![]() |
Contiki-NG
|
Files | |
file | i2c-arch.c |
Implementation of the I2C HAL driver for CC13xx/CC26xx. | |
file | i2c-arch.h |
Implementation of the I2C HAL driver for CC13xx/CC26xx. | |
Functions | |
bool | i2c_arch_write_read (I2C_Handle i2c_handle, uint_least8_t slave_addr, void *wbuf, size_t wcount, void *rbuf, size_t rcount) |
Setup and peform an I2C transaction. More... | |
void | i2c_arch_release (I2C_Handle i2c_handle) |
Release the I2C Peripheral for other modules to use. More... | |
I2C_Handle | i2c_arch_acquire (uint_least8_t index) |
Open and lock the I2C Peripheral for use. More... | |
static void | i2c_arch_init (void) |
One-time initialisation of the I2C Driver. More... | |
static bool | i2c_arch_write (I2C_Handle i2c_handle, uint_least8_t slave_addr, void *wbuf, size_t wcount) |
Perform a write-only I2C transaction. More... | |
static bool | i2c_arch_read (I2C_Handle i2c_handle, uint_least8_t slave_addr, void *rbuf, size_t rcount) |
Perform a read-only I2C transaction. More... | |
I2C_Handle i2c_arch_acquire | ( | uint_least8_t | index | ) |
Open and lock the I2C Peripheral for use.
index | The index of the I2C controller |
Must be called before each I2C transaction.
When the function returns successfully, i2c_handle will be non-NULL and can be used in subsequent calls to perform an I2C transaction, for example with i2c_arch_write_read().
index can take values among Board_I2Cx e.g. Board_I2C0
At the end of the transaction, the caller should call i2c_arch_release() in order to allow other code files to use the I2C module
Definition at line 84 of file i2c-arch.c.
|
inlinestatic |
One-time initialisation of the I2C Driver.
This function must be called before any other I2C driver calls.
Definition at line 71 of file i2c-arch.h.
|
inlinestatic |
Perform a read-only I2C transaction.
i2c_handle | The I2C handle to use for this transaction |
slave_addr | The address of the slave device on the I2C bus |
rbuf | Input buffer during the I2C transaction. |
rcount | How many bytes to read into rbuf. |
true | The I2C operation was successful |
false | The I2C operation failed |
Definition at line 144 of file i2c-arch.h.
void i2c_arch_release | ( | I2C_Handle | i2c_handle | ) |
Release the I2C Peripheral for other modules to use.
i2c_handle | A pointer to an I2C handle |
Must be called after the end of each I2C transaction in order to allow other modules to use the I2C controller. The i2c_handle is obtained by an earlier call to i2c_arch_acquire()
Definition at line 74 of file i2c-arch.c.
|
inlinestatic |
Perform a write-only I2C transaction.
i2c_handle | The I2C handle to use for this transaction |
slave_addr | The address of the slave device on the I2C bus |
wbuf | Write buffer during the I2C transaction. |
wcount | How many bytes in the write buffer |
true | The I2C operation was successful |
false | The I2C operation failed |
Definition at line 128 of file i2c-arch.h.
bool i2c_arch_write_read | ( | I2C_Handle | i2c_handle, |
uint_least8_t | slave_addr, | ||
void * | wbuf, | ||
size_t | wcount, | ||
void * | rbuf, | ||
size_t | rcount | ||
) |
Setup and peform an I2C transaction.
i2c_handle | The I2C handle to use for this transaction |
slave_addr | The address of the slave device on the I2C bus |
wbuf | Write buffer during the I2C transation. |
wcount | How many bytes in the write buffer |
rbuf | Input buffer during the I2C transation. |
rcount | How many bytes to read into rbuf. |
true | The I2C operation was successful |
false | The I2C operation failed |
Definition at line 53 of file i2c-arch.c.