Functions to use the Inter-Integrated Circuit (IIC).
High-level functions to read/write to clients connected to the two integrated IIC modules.
◆ iic_index_t
Enum of IICs. Functions use a switch numbered from 0..NUM_IICS-1.
Enumerator |
---|
IIC0 | |
IIC1 | |
NUM_IICS | |
Definition at line 42 of file iic.h.
◆ iic_destroy()
Close the shared memory handle for the specified IIC index.
- Parameters
-
uart | The IIC index to remove from the shared memory space. |
- Warning
- Fails with program exit if the IIC channel is outside valid range.
Definition at line 50 of file iic.c.
◆ iic_init()
Initialize the IIC specified by the index with a shared memory handle and a buffer size of 4096 bytes.
- Parameters
-
uart | The IIC index to initialize. |
- Warning
- Fails with program exit if the IIC channel is outside valid range or when the shared memory system has not been instantiated.
Definition at line 37 of file iic.c.
◆ iic_read_register()
bool iic_read_register |
( |
const iic_index_t |
iic, |
|
|
const uint8_t |
addr, |
|
|
const uint8_t |
reg, |
|
|
uint8_t * |
data, |
|
|
uint16_t |
length |
|
) |
| |
- Parameters
-
iic | The IIC index to initialize. |
addr | The IIC address of the client to access. |
reg | The clients register address. |
data | Buffer where the register content is stored. [out] |
length | The amount of data to read. |
Reads the content of the register into data.
- Returns
- 0 if successful, 1 on error
Definition at line 58 of file iic.c.
◆ iic_write_register()
bool iic_write_register |
( |
const iic_index_t |
iic, |
|
|
const uint8_t |
addr, |
|
|
const uint8_t |
reg, |
|
|
uint8_t * |
data, |
|
|
uint16_t |
length |
|
) |
| |
- Parameters
-
iic | The IIC index to initialize. |
addr | The IIC address of the client to access. |
reg | The clients register address. |
data | Buffer where new the register content is stored. |
length | The amount of data to write. |
Writes data to register.
- Returns
- 0 if successful, 1 on error
Definition at line 69 of file iic.c.