71 I2C_STATE_READING = 0,
77 I2C_AUTOFLUSH_ENABLE = 0,
78 I2C_AUTOFLUSH_DISABLE = 1
79 } i2c_autoflush_disable_t;
82 typedef struct i2c_req i2c_req_t;
190 int read_len, uint8_t* write_data,
int write_len,
int*
tx_num,
void I2C_DrainTX(mxc_i2c_regs_t *i2c)
Drain all of the data in the TXFIFO.
uint8_t addr
Definition: i2c.h:85
uint8_t * rx_data
Data for master read/slave write.
Definition: i2c.h:92
int I2C_SlaveAsync(mxc_i2c_regs_t *i2c, i2c_req_t *req)
Slave Read and Write Asynchronous.
int I2C_Init(mxc_i2c_regs_t *i2c, i2c_speed_t i2cspeed, const sys_cfg_i2c_t *sys_cfg)
Initialize and enable I2C.
void I2C_DrainRX(mxc_i2c_regs_t *i2c)
Drain all of the data in the RXFIFO.
int I2C_Shutdown(mxc_i2c_regs_t *i2c)
Shutdown I2C module.
const uint8_t * tx_data
Data for mater write/slave read.
Definition: i2c.h:91
i2c_state_t state
Read or Write.
Definition: i2c.h:97
void I2C_ClearTimeout(mxc_i2c_regs_t *i2c)
clear and disable timeout
int I2C_MasterAsync(mxc_i2c_regs_t *i2c, i2c_req_t *req)
Master Read and Write Asynchronous.
unsigned rx_num
Number of rx bytes sent.
Definition: i2c.h:96
int I2C_Slave(mxc_i2c_regs_t *i2c, uint8_t addr, const uint8_t *read_data, int read_len, uint8_t *write_data, int write_len, int *tx_num, int *rx_num, i2c_autoflush_disable_t sw_autoflush_disable)
Slave read data.
int I2C_MasterRead(mxc_i2c_regs_t *i2c, uint8_t addr, uint8_t *data, int len, int restart)
Master read data.
i2c_speed_t
I2C Speed Modes.
Definition: i2c.h:62
Structure type to access the I2C Registers.
Definition: i2c_regs.h:88
400KHz Bus Speed
Definition: i2c.h:64
int restart
Definition: i2c.h:103
void I2C_Handler(mxc_i2c_regs_t *i2c)
I2C interrupt handler.
1MHz Bus Speed
Definition: i2c.h:65
i2c_autoflush_disable_t sw_autoflush_disable
Enable/Disable autoflush.
Definition: i2c.h:109
unsigned tx_num
Number of tx bytes sent.
Definition: i2c.h:95
unsigned tx_len
Length of tx data.
Definition: i2c.h:93
int I2C_AbortAsync(i2c_req_t *req)
Abort Async request based on the request you want to abort.
unsigned rx_len
Length of rx.
Definition: i2c.h:94
void(* callback)(i2c_req_t *, int)
Callback for asynchronous request.
Definition: i2c.h:116
int I2C_MasterWrite(mxc_i2c_regs_t *i2c, uint8_t addr, const uint8_t *data, int len, int restart)
Master write data.
3.4MHz Bus Speed
Definition: i2c.h:66
int I2C_SetTimeout(mxc_i2c_regs_t *i2c, int us)
Enable and Set Timeout.
100KHz Bus Speed
Definition: i2c.h:63