Myriota Flex SDK 2.5.0
Loading...
Searching...
No Matches
External I2C

Interact with FlexSense external i2c peripheral. More...

Functions

int FLEX_ExtI2CWrite (int Address, const uint8_t *const TxData, uint16_t TxLength)
 
int FLEX_ExtI2CRead (int Address, const uint8_t *const TxData, uint16_t TxLength, uint8_t *const RxData, uint16_t RxLength)
 

Detailed Description

Interact with FlexSense external i2c peripheral.

The FlexSense device supports i2c communication with external sensors through the cable interface.

Warning
The i2c communication should only be implemented with a cable length of 1m or less between the FlexSense and a sensor.

Function Documentation

◆ FLEX_ExtI2CWrite()

int FLEX_ExtI2CWrite ( int Address,
const uint8_t *const TxData,
uint16_t TxLength )

Write to an i2c device at a given address.

Note
i2c Addresses 0x20 and 0x42 are reserved, and a sensor with this address should not be interfaced with FlexSense.
Parameters
[in]Addressthe peripheral device address.
[in]TxDatapointer to the TX buffer containing registers address and command.
[in]TxLengthlength of data to be sent.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_EINVALinvalid i2c address (address in use by internal device)
-FLEX_ERROR_IO_EXPANDERfailed to initialise or configure expander device
-FLEX_ERROR_POWER_OUTfailed to power on external i2c bus
-FLEX_ERROR_I2Cerror initialising i2c bus

◆ FLEX_ExtI2CRead()

int FLEX_ExtI2CRead ( int Address,
const uint8_t *const TxData,
uint16_t TxLength,
uint8_t *const RxData,
uint16_t RxLength )

Write to an i2c device at a given address and then read the response.

Note
i2c Addresses 0x20 and 0x42 are reserved, and a sensor with this address should not be interfaced with FlexSense.
Parameters
[in]Addressthe peripheral device address.
[in]TxDatapointer to TX buffer containing registers address and command.
[in]TxLengthlength of data to be sent.
[out]RxDatapointer to the RX buffer.
[in]RxLengthlength of data to be received.
Returns
FLEX_SUCCESS (0) if succeeded and < 0 if failed.
Return values
-FLEX_ERROR_EINVALinvalid i2c address (address in use by internal device)
-FLEX_ERROR_IO_EXPANDERfailed to initialise or configure expander device
-FLEX_ERROR_POWER_OUTfailed to power on external i2c bus
-FLEX_ERROR_I2Cerror initialising i2c bus