SpaIot Library
|
#include <twowireslave.h>
Public Member Functions | |
TwoWireSlave (uint8_t slaveAddress, TwoWire &bus=Wire) | |
Constructor. More... | |
int | write (uint8_t value) |
Write a byte in the integrated circuit. More... | |
int | read () |
Reading a byte in the integrated circuit. More... | |
int | write (const uint8_t *values, uint16_t len) |
Write several bytes in the integrated circuit. More... | |
int | read (uint8_t *values, uint16_t len) |
Reading several bytes in the integrated circuit. More... | |
int | write (uint8_t dataAddress, uint8_t value) |
Write a byte in an integrated circuit register. More... | |
int | read (uint8_t dataAddress) |
Reading a byte in an integrated circuit register. More... | |
int | write (uint8_t dataAddress, const uint8_t *values, uint16_t len) |
Write bytes in integrated circuit registers. More... | |
int | read (uint8_t dataAddress, uint8_t *values, uint16_t len) |
Reading several bytes in the integrated circuit. More... | |
uint8_t | address () const |
Reading of the slave m_address of the integrated circuit. More... | |
void | setAddress (uint8_t slaveAddress) |
Change of the slave m_address of the integrated circuit. More... | |
TwoWire & | bus () const |
Returns the I²C bus used to access the integrated circuit. More... | |
Allows write-read access to an I²C slave circuit
TwoWireSlave::TwoWireSlave | ( | uint8_t | slaveAddress, |
TwoWire & | bus = Wire |
||
) |
Constructor.
slaveAddress | 7-bit I²C slave m_address, right-aligned |
bus | reference on the I²C bus to use |
|
inline |
Reading of the slave m_address of the integrated circuit.
|
inline |
Returns the I²C bus used to access the integrated circuit.
int TwoWireSlave::read | ( | ) |
Reading a byte in the integrated circuit.
The frame is made up of a start condition, the slave m_address with an RW bit high, the byte read and a stop condition.
int TwoWireSlave::read | ( | uint8_t * | values, |
uint16_t | len | ||
) |
Reading several bytes in the integrated circuit.
The frame is made up of a start condition, the slave m_address with an RW bit high, the bytes read and a stop condition.
values | pointer where to store bytes, must be able to store at least n bytes |
len | number of bytes to read |
int TwoWireSlave::read | ( | uint8_t | dataAddress | ) |
Reading a byte in an integrated circuit register.
The frame is made up of a start condition, the slave m_address with an RW bit high, the dataAddress
, the byte read and a stop condition.
dataAddress | register m_address or control byte |
int TwoWireSlave::read | ( | uint8_t | dataAddress, |
uint8_t * | values, | ||
uint16_t | len | ||
) |
Reading several bytes in the integrated circuit.
The frame is made up of a start condition, the slave m_address with an RW bit high, the dataAddress
, the bytes read and a stop condition.
dataAddress | register m_address or control byte |
values | pointer where to store bytes, must be able to store at least n bytes |
len | number of bytes to read |
|
inline |
Change of the slave m_address of the integrated circuit.
slaveAddress | 7-bit I²C slave m_address, right-aligned |
int TwoWireSlave::write | ( | const uint8_t * | values, |
uint16_t | len | ||
) |
Write several bytes in the integrated circuit.
The frame is made up of a start condition, the slave m_address with an RW bit low, the bytes to write and a stop condition.
values | pointer to the bytes to write |
len | number of bytes to write |
int TwoWireSlave::write | ( | uint8_t | dataAddress, |
const uint8_t * | values, | ||
uint16_t | len | ||
) |
Write bytes in integrated circuit registers.
The frame is made up of a start condition, the slave m_address with an RW bit low, the dataAddress
, the bytes to write and a stop condition.
dataAddress | register m_address or control byte |
values | pointer to the bytes to write |
len | number of bytes to write |
int TwoWireSlave::write | ( | uint8_t | dataAddress, |
uint8_t | value | ||
) |
Write a byte in an integrated circuit register.
The frame is made up of a start condition, the slave m_address with an RW bit low, the dataAddress
, the value
byte and a stop condition.
dataAddress | register m_address or control byte |
value | byte to write |
int TwoWireSlave::write | ( | uint8_t | value | ) |
Write a byte in the integrated circuit.
The frame is made up of a start condition, the slave m_address with an RW bit low, the value
byte and a stop condition.
value | byte to write |