AM263x MCU+ SDK  08.02.00
i2c/v0/i2c.h File Reference

Go to the source code of this file.

Data Structures

struct  I2C_HwAttrs
 I2C Hardware attributes. More...
 
struct  I2C_Transaction
 I2C transaction. More...
 
struct  I2C_Params
 I2C Parameters. More...
 
struct  I2C_Object
 I2C Object. More...
 
struct  I2C_Config
 I2C Global configuration. More...
 

Macros

#define I2C_MAX_NUM_OWN_SLAVE_ADDR   (4U)
 
MACROS used to select the transfer mode

I2C_MODE_BLOCKING block task execution while a I2C transfer is in progress I2C_MODE_CALLBACK does not block task execution; but calls a callback function when the I2C transfer has completed

#define I2C_MODE_BLOCKING   ((uint8_t) 0U)
 
#define I2C_MODE_CALLBACK   ((uint8_t) 1U)
 
MACROS used to select one of the standardized bus bit rates for

I2C communication. Deafults to I2C_100KHZ

#define I2C_100KHZ   ((uint8_t) 0U)
 
#define I2C_400KHZ   ((uint8_t) 1U)
 
#define I2C_1P0MHZ   ((uint8_t) 2U)
 
#define I2C_3P4MHZ   ((uint8_t) 3U)
 
MACROS for the return values of I2C_transfer()

#define I2C_STS_SUCCESS   ( 0)
 
#define I2C_STS_ERR   (-1)
 
#define I2C_STS_ERR_TIMEOUT   (-2)
 
#define I2C_STS_ERR_BUS_BUSY   (-3)
 
#define I2C_STS_ERR_NO_ACK   (-4)
 
#define I2C_STS_ERR_ARBITRATION_LOST   (-5)
 
#define I2C_STS_ERR_ACCESS_ERROR   (-6)
 
#define I2C_STS_ERR_COMMAND_FAILURE   (-7)
 
#define I2C_STS_ERR_INVALID_COMMAND   (-8)
 
#define I2C_STS_RESTART   (-9)
 

Typedefs

typedef struct I2C_Config_s * I2C_Handle
 A handle that is returned from a I2C_open() call. More...
 
typedef void(* I2C_CallbackFxn) (I2C_Handle handle, I2C_Transaction *msg, int32_t transferStatus)
 I2C callback function. More...
 

Functions

void I2C_init (void)
 Initialize the I2C module. More...
 
void I2C_deinit (void)
 De-nitialize the I2C module. More...
 
void I2C_Params_init (I2C_Params *params)
 Function to set default values of I2C_Params in params. More...
 
I2C_Handle I2C_open (uint32_t idx, const I2C_Params *params)
 Open the I2C at index idx with parameters params. More...
 
void I2C_Transaction_init (I2C_Transaction *transaction)
 Function to set default values of I2C_Transaction in transaction. More...
 
int32_t I2C_transfer (I2C_Handle handle, I2C_Transaction *transaction)
 Function to initiate a transfer from I2C. More...
 
int32_t I2C_probe (I2C_Handle handle, uint32_t slaveAddr)
 Function to probe I2C. More...
 
int32_t I2C_setBusFrequency (I2C_Handle handle, uint32_t busFrequency)
 Function to set the bus frequency. More...
 
int32_t I2C_recoverBus (I2C_Handle handle, uint32_t i2cDelay)
 Function to recover the bus in case of error. More...
 
void I2C_close (I2C_Handle handle)
 Function to close the I2C. More...
 
I2C_Handle I2C_getHandle (uint32_t index)
 This function returns the handle of an open I2C instance from the instance index. More...