Mock of the board i2c.
More...
|
| void | lampda::platform::i2c::i2c_setup (uint8_t i2cIndex, uint32_t baudrate, uint32_t timeout) |
| | Setup the i2c interface, needs to be called at program start.
|
| |
| void | lampda::platform::i2c::i2c_turn_off (uint8_t i2cIndex) |
| | Turn of the i2c interface, all i2c functions will return an error after that, until i2c_setup is called again.
|
| |
|
int | lampda::platform::i2c::i2c_check_existence (uint8_t i2cIndex, uint8_t deviceAddr) |
| | Return 0 if the address exists on the I2C line.
|
| |
|
int | lampda::platform::i2c::lock_i2c () |
| |
|
int | lampda::platform::i2c::unlock_i2c () |
| |
| int | lampda::platform::i2c::i2c_writeData (uint8_t i2cIndex, uint8_t deviceAddr, uint8_t registerAdd, uint8_t size, const uint8_t *buf, int stopBit) |
| | Write data to the two wire interface.
|
| |
| int | lampda::platform::i2c::i2c_readData (uint8_t i2cIndex, uint8_t deviceAddr, uint8_t registerAdd, uint8_t size, uint8_t *buf, int stopBit) |
| | Read data from the two wire interface.
|
| |
| int | lampda::platform::i2c::i2c_xfer_unlocked (uint8_t i2cIndex, uint8_t deviceAddr, int out_size, const uint8_t *out, int in_size, uint8_t *in, uint8_t flags) |
| | Does a range read/write.
|
| |
|
|
static constexpr size_t | simulator::numberOfMocks = 1 |
| |
| const std::array< std::unique_ptr< IntegratedCircuitMock_I >, numberOfMocks > | simulator::icMocks |
| |
|
bool | simulator::isI2cAvailable = false |
| |
|
std::atomic< bool > | simulator::canRunComponentUpdateThread = false |
| |
|
std::thread | simulator::componentUpdateThread |
| |
◆ i2c_readData()
| int lampda::platform::i2c::i2c_readData |
( |
uint8_t |
i2cIndex, |
|
|
uint8_t |
deviceAddr, |
|
|
uint8_t |
registerAdd, |
|
|
uint8_t |
size, |
|
|
uint8_t * |
buf, |
|
|
int |
stopBit |
|
) |
| |
Read data from the two wire interface.
- Parameters
-
| [in] | i2cIndex | The index of the i2c interface (from 0 to WIRE_INTERFACES_COUNT - 1) |
| [in] | deviceAddr | the address of the target device |
| [in] | registerAdd | The address of the register to read |
| [in] | size | the size of the data to read (in bytes) |
| [in,out] | buf | the data to read, in an array of size size |
| [in] | stopBit | if > 0, will add a stopBit after message |
◆ i2c_setup()
| void lampda::platform::i2c::i2c_setup |
( |
uint8_t |
i2cIndex, |
|
|
uint32_t |
baudrate, |
|
|
uint32_t |
timeout |
|
) |
| |
Setup the i2c interface, needs to be called at program start.
Define the general i2c interface (in c style for compatibility) ALL FUNCTION RETURN 0 IN CASE OF SUCCESS !! THEY RETURN 1 IN FAILURE This is C style, not C++
- Parameters
-
| [in] | i2cIndex | The index of the i2c interface (from 0 to WIRE_INTERFACES_COUNT - 1) |
| [in] | baudrate | The baud rate of this interface (100000, 250000, 400000) in hertz |
| [in] | timeout | The tiemout in milliseconds after which a read or write fails |
◆ i2c_turn_off()
| void lampda::platform::i2c::i2c_turn_off |
( |
uint8_t |
i2cIndex | ) |
|
Turn of the i2c interface, all i2c functions will return an error after that, until i2c_setup is called again.
- Parameters
-
| [in] | i2cIndex | The index of the i2c interface (from 0 to WIRE_INTERFACES_COUNT - 1) |
◆ i2c_writeData()
| int lampda::platform::i2c::i2c_writeData |
( |
uint8_t |
i2cIndex, |
|
|
uint8_t |
deviceAddr, |
|
|
uint8_t |
registerAdd, |
|
|
uint8_t |
size, |
|
|
const uint8_t * |
buf, |
|
|
int |
stopBit |
|
) |
| |
Write data to the two wire interface.
- Parameters
-
| [in] | i2cIndex | The index of the i2c interface (from 0 to WIRE_INTERFACES_COUNT - 1) |
| [in] | deviceAddr | the address of the target device |
| [in] | registerAdd | The address of the register to write |
| [in] | size | the size of the data to write (in bytes) |
| [in,out] | buf | the data to write, in an array of size size |
| [in] | stopBit | if > 0, will add a stopBit after message |
◆ i2c_xfer_unlocked()
| int lampda::platform::i2c::i2c_xfer_unlocked |
( |
uint8_t |
i2cIndex, |
|
|
uint8_t |
deviceAddr, |
|
|
int |
out_size, |
|
|
const uint8_t * |
out, |
|
|
int |
in_size, |
|
|
uint8_t * |
in, |
|
|
uint8_t |
flags |
|
) |
| |
Does a range read/write.
- Parameters
-
| [in] | i2cIndex | The index of the i2c interface (from 0 to WIRE_INTERFACES_COUNT - 1) |
| [in] | deviceAddr | the address of the target device |
| [in] | out_size | Size of the out buffer to read |
| [out] | out | The buffer that will contain the read data |
| [in] | in_size | Size of the in buffer to write |
| [in] | in | The buffer that contains the write data |
| [in] | flags | Flags to set the stop bit, start/stop info, etc |