Inter-Integrated Circuit (I2C) interface for communication with sensors and peripherals.
More...
|
| MYRIOTA_HARDWARE_API int | I2CInit (void) |
| | Initialise I2C bus.
|
| |
| MYRIOTA_HARDWARE_API int | I2CInitEx (uint32_t Option) |
| | Initialise I2C bus with options.
|
| |
| MYRIOTA_HARDWARE_API void | I2CDeinit (void) |
| | Deinitialise I2C bus.
|
| |
| MYRIOTA_HARDWARE_API int | I2CWrite (uint16_t DeviceAddress, const uint8_t *Command, size_t CommandLength) |
| | Write to an I2C device synchronously.
|
| |
| MYRIOTA_HARDWARE_API int | I2CRead (uint16_t DeviceAddress, const uint8_t *Command, size_t CommandLength, uint8_t *Rx, size_t RxLength) |
| | Read from an I2C device synchronously.
|
| |
Inter-Integrated Circuit (I2C) interface for communication with sensors and peripherals.
◆ I2COption
I2C bit-wise options.
| Enumerator |
|---|
| I2C_DEFAULT_OPTIONS | Up to ~100 kbit/s.
|
| I2C_FAST_MODE | Up to ~400 kbit/s.
|
◆ I2CInit()
| MYRIOTA_HARDWARE_API int I2CInit |
( |
void |
| ) |
|
Initialise I2C bus.
- Returns
- 0 if initialisation succeeds, -1 if initialisation fails.
◆ I2CInitEx()
| MYRIOTA_HARDWARE_API int I2CInitEx |
( |
uint32_t |
Option | ) |
|
Initialise I2C bus with options.
- Parameters
-
| Option | I2C options for bus speed. |
- Returns
- 0 if initialisation succeeds, -1 if initialisation fails.
◆ I2CDeinit()
| MYRIOTA_HARDWARE_API void I2CDeinit |
( |
void |
| ) |
|
Deinitialise I2C bus.
Deinitialises the I2C bus and releases associated hardware resources.
◆ I2CWrite()
| MYRIOTA_HARDWARE_API int I2CWrite |
( |
uint16_t |
DeviceAddress, |
|
|
const uint8_t * |
Command, |
|
|
size_t |
CommandLength |
|
) |
| |
Write to an I2C device synchronously.
- Parameters
-
| DeviceAddress | The I2C device address. |
| Command[in] | Pointer to the command data. |
| CommandLength | Length of the command data. |
- Returns
- 0 if write succeeds, -1 if write fails.
◆ I2CRead()
| MYRIOTA_HARDWARE_API int I2CRead |
( |
uint16_t |
DeviceAddress, |
|
|
const uint8_t * |
Command, |
|
|
size_t |
CommandLength, |
|
|
uint8_t * |
Rx, |
|
|
size_t |
RxLength |
|
) |
| |
Read from an I2C device synchronously.
- Parameters
-
| DeviceAddress | The I2C device address. |
| Command[in] | Pointer to the command data. |
| CommandLength | Length of the command data. |
| Rx[out] | Pointer to the buffer to store the received data. |
| RxLength | Length of the buffer to store the received data. |
- Returns
- 0 if read succeeds, -1 if read fails.