![]() |
EVE 1.0
|
|
Data Structures | |
| struct | i2c_state_t |
| struct | i2c_t |
Typedefs | |
| typedef void(* | i2c_completion_callback_t) (const struct i2c_t *I2c, uint8_t ErrorMask, void *Data) |
Functions called from application programs | |
| void | I2cMasterInit (const struct i2c_t *I2cMaster) |
| Name: I2cMasterInit Initialize the driver. Function must be called before driver use. More... | |
| void | I2cBusReset (const struct i2c_t *I2cMaster) |
| Name: I2cBusReset Reset the bus (clock through a bus hung) More... | |
| bool | I2cMasterAsync (const struct i2c_t *I2cMaster, uint8_t SlaveAddress, const void *SrcBuffer, uint8_t SrcCount, void *DstBuffer, uint8_t DstCount, i2c_completion_callback_t Callback, void *CallbackData) |
| Name: I2cMasterAsync Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does: More... | |
| void | I2cMasterSchedule (const struct i2c_t *I2cMaster, struct work_t *Work) |
| Name: I2cMasterSchedule Schedule work when I2C bus becomes available. In case the bus is already free, the work is scheduled immediately. More... | |
| bool | I2cMasterAsyncWait (const struct i2c_t *I2cMaster, uint8_t SlaveAddress, const void *SrcBuffer, uint8_t SrcCount, void *DstBuffer, uint8_t DstCount, i2c_completion_callback_t Callback, void *CallbackData, struct work_t *Work) |
| Name: I2cMasterAsyncWait Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does: More... | |
| bool | I2cMaster (const struct i2c_t *I2cMaster, uint8_t SlaveAddress, const void *SrcBuffer, uint16_t SrcCount, void *DstBuffer, uint16_t DstCount) |
| Name: I2cMaster Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does: More... | |
| void | I2cMasterInterruptHandler (const struct i2c_t *I2cMaster) |
| Name: I2cInterruptHandler I2C master interrupt handler Called from board.c at hardware interrupt context. More... | |
This I2C driver can be used for I2C0 and I2C1.
First the driver setup the microcontroller to I2C master based on the i2c_t structure. Then the driver does:
The driver returns true if communication OK, else false.
While the I2C communication is in progress, the clock is locked and energy mode EM1 is minimum required.
| typedef void(* i2c_completion_callback_t) (const struct i2c_t *I2c, uint8_t ErrorMask, void *Data) |
Asynchronous callback type
| I2c | Pointer to the I2C master instance object |
| ErrorMask | Bitmap of the possible bus error types, see enum i2c_error_t |
| Data | User data passed as I2cMasterAsync function parameter |
Definition at line 82 of file i2c-master.h.
| void I2cMasterInit | ( | const struct i2c_t * | I2cMaster | ) |
Name: I2cMasterInit
Initialize the driver. Function must be called before driver use.
| I2cMaster | Pointer to I2C module |
| void I2cBusReset | ( | const struct i2c_t * | I2cMaster | ) |
Name: I2cBusReset
Reset the bus (clock through a bus hung)
| I2cMaster | Pointer to I2C module |
| bool I2cMasterAsync | ( | const struct i2c_t * | I2cMaster, |
| uint8_t | SlaveAddress, | ||
| const void * | SrcBuffer, | ||
| uint8_t | SrcCount, | ||
| void * | DstBuffer, | ||
| uint8_t | DstCount, | ||
| i2c_completion_callback_t | Callback, | ||
| void * | CallbackData | ||
| ) |
Name: I2cMasterAsync
Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does:
| I2cMaster | Pointer to I2C module |
| SlaveAddress | IIC slave address |
| SrcBuffer | Pointer to data to be written |
| SrcCount | Number of bytes to write |
| DstBuffer | Pointer to buffer to place read data |
| DstCount | Number of bytes to read |
| Callback | Completion callback |
| CallbackData | Completion callback data |
Referenced by I2cMasterAsyncWait().
Name: I2cMasterSchedule
Schedule work when I2C bus becomes available.
In case the bus is already free, the work is scheduled immediately.
| I2cMaster | Pointer to I2C module |
| Work | Work to be scheduled immediately if I2C is free, otherwise after I2C becomes free. |
Referenced by I2cMasterAsyncWait().
|
inline |
Name: I2cMasterAsyncWait
Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does:
| I2cMaster | Pointer to I2C module |
| SlaveAddress | IIC slave address |
| SrcBuffer | Pointer to data to be written |
| SrcCount | Number of bytes to write |
| DstBuffer | Pointer to buffer to place read data |
| DstCount | Number of bytes to read |
| Callback | Completion callback |
| CallbackData | Completion callback data |
| Work | If I2C is busy, the Work to be scheduled after I2C is free again. |
Definition at line 218 of file i2c-master.h.
References I2cMaster(), I2cMasterAsync(), I2cMasterInterruptHandler(), and I2cMasterSchedule().
| bool I2cMaster | ( | const struct i2c_t * | I2cMaster, |
| uint8_t | SlaveAddress, | ||
| const void * | SrcBuffer, | ||
| uint16_t | SrcCount, | ||
| void * | DstBuffer, | ||
| uint16_t | DstCount | ||
| ) |
Name: I2cMaster
Setup the microcontroller to I2C master based on the i2c_t structure (slave not supported). Then the driver does:
| I2cMaster | Pointer to I2C module |
| SlaveAddress | IIC slave address |
| SrcBuffer | Pointer to data to be written |
| SrcCount | Number of bytes to write |
| DstBuffer | Pointer to buffer to place read data |
| DstCount | Number of bytes to read |
Referenced by I2cMasterAsyncWait().
| void I2cMasterInterruptHandler | ( | const struct i2c_t * | I2cMaster | ) |
Name: I2cInterruptHandler
I2C master interrupt handler Called from board.c at hardware interrupt context.
| I2cMaster | I2C parameters to be used |
Referenced by I2cMasterAsyncWait().