![]() |
MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
|
Adafruit I2CDevice Class for OLED. More...
#include <MiniR4_I2CDevice.h>
Public Member Functions | |
Adafruit_I2CDevice (uint8_t addr, TwoWire *theWire=&Wire) | |
Create an I2C device at a given address. | |
uint8_t | address (void) |
Returns the 7-bit address of this device. | |
bool | begin (bool addr_detect=true) |
Initializes and does basic address detection. | |
void | end (void) |
De-initialize device, turn off the Wire interface. | |
bool | detected (void) |
Scans I2C for the address - note will give a false-positive if there's no pullups on I2C. | |
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. | |
bool | write (const uint8_t *buffer, size_t len, bool stop=true, const uint8_t *prefix_buffer=nullptr, size_t prefix_len=0) |
Write a buffer or two to the I2C device. Cannot be more than maxBufferSize() bytes. | |
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() bytes. The buffers can point to same/overlapping locations. | |
bool | setSpeed (uint32_t desiredclk) |
Change the I2C clock speed to desired (relies on underlying Wire support! | |
size_t | maxBufferSize () |
How many bytes we can read in a transaction. | |
Adafruit I2CDevice Class for OLED.
The class which defines how we will talk to this device over I2C
Definition at line 43 of file MiniR4_I2CDevice.h.
Adafruit_I2CDevice::Adafruit_I2CDevice | ( | uint8_t | addr, |
TwoWire * | theWire = &Wire ) |
Create an I2C device at a given address.
addr | The 7-bit I2C address for the device |
theWire | The I2C bus to use, defaults to &Wire |
Definition at line 39 of file MiniR4_I2CDevice.cpp.
uint8_t Adafruit_I2CDevice::address | ( | void | ) |
Returns the 7-bit address of this device.
Definition at line 287 of file MiniR4_I2CDevice.cpp.
bool Adafruit_I2CDevice::begin | ( | bool | addr_detect = true | ) |
Initializes and does basic address detection.
addr_detect | Whether we should attempt to detect the I2C address with a scan. 99% of sensors/devices don't mind, but once in a while they don't respond well to a scan! |
Definition at line 59 of file MiniR4_I2CDevice.cpp.
bool Adafruit_I2CDevice::detected | ( | void | ) |
Scans I2C for the address - note will give a false-positive if there's no pullups on I2C.
Definition at line 91 of file MiniR4_I2CDevice.cpp.
void Adafruit_I2CDevice::end | ( | void | ) |
De-initialize device, turn off the Wire interface.
Definition at line 72 of file MiniR4_I2CDevice.cpp.
|
inline |
How many bytes we can read in a transaction.
Definition at line 61 of file MiniR4_I2CDevice.h.
bool Adafruit_I2CDevice::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.
buffer | Pointer to buffer of data to read into |
len | Number of bytes from buffer to read. |
stop | Whether to send an I2C STOP signal on read |
Definition at line 209 of file MiniR4_I2CDevice.cpp.
bool Adafruit_I2CDevice::setSpeed | ( | uint32_t | desiredclk | ) |
Change the I2C clock speed to desired (relies on underlying Wire support!
desiredclk | The desired I2C SCL frequency |
Definition at line 296 of file MiniR4_I2CDevice.cpp.
bool Adafruit_I2CDevice::write | ( | const uint8_t * | buffer, |
size_t | len, | ||
bool | stop = true, | ||
const uint8_t * | prefix_buffer = nullptr, | ||
size_t | prefix_len = 0 ) |
Write a buffer or two to the I2C device. Cannot be more than maxBufferSize() bytes.
buffer | Pointer to buffer of data to write. This is const to ensure the content of this buffer doesn't change. |
len | Number of bytes from buffer to write |
prefix_buffer | Pointer to optional array of data to write before buffer. Cannot be more than maxBufferSize() bytes. This is const to ensure the content of this buffer doesn't change. |
prefix_len | Number of bytes from prefix buffer to write |
stop | Whether to send an I2C STOP signal on write |
Definition at line 128 of file MiniR4_I2CDevice.cpp.
bool Adafruit_I2CDevice::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() bytes. The buffers can point to same/overlapping locations.
write_buffer | Pointer to buffer of data to write from |
write_len | Number of bytes from buffer to write. |
read_buffer | Pointer to buffer of data to read into. |
read_len | Number of bytes from buffer to read. |
stop | Whether to send an I2C STOP signal between the write and read |
Definition at line 273 of file MiniR4_I2CDevice.cpp.