128x64 EasyC OLED Display 1.0.0
This is a library for Soldered OLED Display
Loading...
Searching...
No Matches
Adafruit_I2CDevice.h
Go to the documentation of this file.
1#include <Wire.h>
2
3#ifndef Adafruit_I2CDevice_h
4#define Adafruit_I2CDevice_h
5
8public:
9 Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
10 uint8_t address(void);
11 bool begin(bool addr_detect = true);
12 bool detected(void);
13
14 bool read(uint8_t *buffer, size_t len, bool stop = true);
15 bool write(const uint8_t *buffer, size_t len, bool stop = true,
16 const uint8_t *prefix_buffer = NULL, size_t prefix_len = 0);
17 bool write_then_read(const uint8_t *write_buffer, size_t write_len,
18 uint8_t *read_buffer, size_t read_len,
19 bool stop = false);
20 bool setSpeed(uint32_t desiredclk);
21
24 size_t maxBufferSize() { return _maxBufferSize; }
25
26private:
27 uint8_t _addr;
28 TwoWire *_wire;
29 bool _begun;
31};
32
33#endif // Adafruit_I2CDevice_h
Definition Adafruit_I2CDevice.h:7
size_t maxBufferSize()
How many bytes we can read in a transaction.
Definition Adafruit_I2CDevice.h:24
size_t _maxBufferSize
Definition Adafruit_I2CDevice.h:30
bool setSpeed(uint32_t desiredclk)
Change the I2C clock speed to desired (relies on underlying Wire support!
Definition Adafruit_I2CDevice.cpp:268
bool _begun
Definition Adafruit_I2CDevice.h:29
TwoWire * _wire
Definition Adafruit_I2CDevice.h:28
bool write(const uint8_t *buffer, size_t len, bool stop=true, const uint8_t *prefix_buffer=NULL, size_t prefix_len=0)
Write a buffer or two to the I2C device. Cannot be more than maxBufferSize() bytes.
Definition Adafruit_I2CDevice.cpp:83
uint8_t _addr
Definition Adafruit_I2CDevice.h:27
bool detected(void)
Scans I2C for the address - note will give a false-positive if there's no pullups on I2C.
Definition Adafruit_I2CDevice.cpp:47
bool begin(bool addr_detect=true)
Initializes and does basic address detection.
Definition Adafruit_I2CDevice.cpp:30
uint8_t address(void)
Returns the 7-bit address of this device.
Definition Adafruit_I2CDevice.cpp:256
bool write_then_read(const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len, bool stop=false)
Write some data, then read some data from I2C into another buffer. Cannot be more than maxBufferSize(...
Definition Adafruit_I2CDevice.cpp:241
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire=&Wire)
Create an I2C device at a given address.
Definition Adafruit_I2CDevice.cpp:11
bool read(uint8_t *buffer, size_t len, bool stop=true)
Read from I2C into a buffer from the I2C device. Cannot be more than maxBufferSize() bytes.
Definition Adafruit_I2CDevice.cpp:176