CARME-M4 I2C high level functions.
More...
|
| file | i2c.h |
| | I2C board support package for the CARME module.
|
| |
| file | i2c.c |
| | I2C board support package for the CARME module.
|
| |
|
| void | CARME_I2C_Init (I2C_TypeDef *I2Cx) |
| | I2C initialization. More...
|
| |
| ERROR_CODES | CARME_I2C_Write (I2C_TypeDef *I2Cx, uint8_t addr, uint16_t reg, uint8_t twoByte, uint8_t *pdata, uint16_t count) |
| | Write data to an I2C slave device on a specific register address. More...
|
| |
| ERROR_CODES | CARME_I2C_Read (I2C_TypeDef *I2Cx, uint8_t addr, uint16_t reg, uint8_t twoByte, uint8_t *pdata, uint16_t count) |
| | Read data from an I2C slave device on a specific register address. More...
|
| |
| static void | CARME_I2C_Settings (I2C_TypeDef *I2Cx) |
| | I2C interface initialization. More...
|
| |
| static ERROR_CODES | CARME_I2C_Timeout (I2C_TypeDef *I2Cx) |
| | Restart the I2C periph if a timeout has occurred. More...
|
| |
CARME-M4 I2C high level functions.
I2C timeout
Definition at line 92 of file i2c.h.
| #define CARME_I2C_ADDR_AUDIO 0x33 |
I2C Address of master on the I2C audio bus
Definition at line 88 of file i2c.h.
| #define CARME_I2C_ADDR_BOARD 0xA0 |
I2C Address of master on the I2C board bus
Definition at line 85 of file i2c.h.
| #define CARME_I2C_AUDIO I2C3 |
I2C to audio codec
Definition at line 82 of file i2c.h.
| #define CARME_I2C_BOARD I2C2 |
I2C on board and external
- Examples:
- i2c.c.
Definition at line 81 of file i2c.h.
| #define CARME_I2C_SPEED 100000 |
I2C speed in Hz
Definition at line 84 of file i2c.h.
| #define TIMEOUT_MAX 0x3000 |
I2C timeout in systicks
Definition at line 87 of file i2c.c.
| void CARME_I2C_Init |
( |
I2C_TypeDef * |
I2Cx | ) |
|
I2C initialization.
- Parameters
-
- Returns
- None
- Examples:
- i2c.c.
Definition at line 124 of file i2c.c.
| ERROR_CODES CARME_I2C_Read |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint8_t |
addr, |
|
|
uint16_t |
reg, |
|
|
uint8_t |
twoByte, |
|
|
uint8_t * |
pdata, |
|
|
uint16_t |
count |
|
) |
| |
Read data from an I2C slave device on a specific register address.
- Parameters
-
| [in] | I2Cx | The I2C port which will be used. Possible values are CARME_I2C_BOARD and CARME_I2C_AUDIO. |
| [in] | addr | Address of the slave device. |
| [in] | reg | Register address of the slave device. |
| [in] | twoByte | If the register address is two Byte long (ex. 0x01F3) set this parameter to 1. |
| [out] | pdata | Pointer to the data array. |
| [in] | count | Number of bytes in the array. |
- Returns
- ERROR_CODES
Definition at line 312 of file i2c.c.
| static void CARME_I2C_Settings |
( |
I2C_TypeDef * |
I2Cx | ) |
|
|
static |
I2C interface initialization.
- Parameters
-
- Returns
- None
Definition at line 165 of file i2c.c.
| static ERROR_CODES CARME_I2C_Timeout |
( |
I2C_TypeDef * |
I2Cx | ) |
|
|
static |
Restart the I2C periph if a timeout has occurred.
- Parameters
-
- Returns
- ERROR_CODES
Definition at line 198 of file i2c.c.
| ERROR_CODES CARME_I2C_Write |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint8_t |
addr, |
|
|
uint16_t |
reg, |
|
|
uint8_t |
twoByte, |
|
|
uint8_t * |
pdata, |
|
|
uint16_t |
count |
|
) |
| |
Write data to an I2C slave device on a specific register address.
- Parameters
-
| [in] | I2Cx | The I2C port which will be used. Possible values are CARME_I2C_BOARD and CARME_I2C_AUDIO. |
| [in] | addr | Address of the slave device. |
| [in] | reg | Register address of the slave device. |
| [in] | twoByte | If the register address is two Byte long (ex. 0x01F3) set this parameter to 1. |
| [in] | pdata | Pointer to the data array. |
| [in] | count | Number of bytes in the array. |
- Returns
- ERROR_CODES
- Examples:
- i2c.c.
Definition at line 226 of file i2c.c.
Initial value:
I2C Port and Pin association.
Definition at line 99 of file i2c.c.