![]() |
MAX32665 SDK Documentation
0.2
Software Development Kit Overview and API Documentation
|
Modules | |
I2C_Registers | |
Registers, Bit Masks and Bit Positions for the I2C Peripheral Module. | |
Data Structures | |
struct | i2c_req_t |
Enumerations | |
enum | i2c_speed_t { I2C_STD_MODE = 100000, I2C_FAST_MODE = 400000, I2C_FASTPLUS_MODE = 1000000, I2C_HS_MODE = 3400000 } |
I2C Speed Modes. More... | |
enum | i2c_state_t { I2C_STATE_READING = 0, I2C_STATE_WRITING = 1 } |
enum | i2c_autoflush_disable_t { I2C_AUTOFLUSH_ENABLE = 0, I2C_AUTOFLUSH_DISABLE = 1 } |
Functions | |
int | I2C_Init (mxc_i2c_regs_t *i2c, i2c_speed_t i2cspeed, const sys_cfg_i2c_t *sys_cfg) |
Initialize and enable I2C. More... | |
int | I2C_Shutdown (mxc_i2c_regs_t *i2c) |
Shutdown I2C module. More... | |
int | I2C_MasterWrite (mxc_i2c_regs_t *i2c, uint8_t addr, const uint8_t *data, int len, int restart) |
Master write data. More... | |
int | I2C_MasterRead (mxc_i2c_regs_t *i2c, uint8_t addr, uint8_t *data, int len, int restart) |
Master read data. More... | |
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. More... | |
int | I2C_MasterAsync (mxc_i2c_regs_t *i2c, i2c_req_t *req) |
Master Read and Write Asynchronous. More... | |
int | I2C_SlaveAsync (mxc_i2c_regs_t *i2c, i2c_req_t *req) |
Slave Read and Write Asynchronous. More... | |
void | I2C_Handler (mxc_i2c_regs_t *i2c) |
I2C interrupt handler. More... | |
void | I2C_DrainRX (mxc_i2c_regs_t *i2c) |
Drain all of the data in the RXFIFO. More... | |
void | I2C_DrainTX (mxc_i2c_regs_t *i2c) |
Drain all of the data in the TXFIFO. More... | |
int | I2C_AbortAsync (i2c_req_t *req) |
Abort Async request based on the request you want to abort. More... | |
int | I2C_SetTimeout (mxc_i2c_regs_t *i2c, int us) |
Enable and Set Timeout. More... | |
void | I2C_ClearTimeout (mxc_i2c_regs_t *i2c) |
clear and disable timeout More... | |
enum i2c_speed_t |
int I2C_Init | ( | mxc_i2c_regs_t * | i2c, |
i2c_speed_t | i2cspeed, | ||
const sys_cfg_i2c_t * | sys_cfg | ||
) |
i2c | Pointer to I2C peripheral registers. |
i2cspeed | desired speed (I2C mode) |
sys_cfg | System configuration object |
int I2C_Shutdown | ( | mxc_i2c_regs_t * | i2c | ) |
i2c | Pointer to the I2C registers. |
int I2C_MasterWrite | ( | mxc_i2c_regs_t * | i2c, |
uint8_t | addr, | ||
const uint8_t * | data, | ||
int | len, | ||
int | restart | ||
) |
Will block until transaction is complete.
i2c | Pointer to I2C regs. |
addr | I2C 7-bit Address left aligned, bit 7 to bit 1. Only supports 7-bit addressing. LSb of the given address will be used as the read/write bit, the addr will not be shifted. Used for both master and slave transactions. |
data | Data to be written. |
len | Number of bytes to Write. |
restart | 0 to send a stop bit at the end of the transaction, otherwise send a restart. |
int I2C_MasterRead | ( | mxc_i2c_regs_t * | i2c, |
uint8_t | addr, | ||
uint8_t * | data, | ||
int | len, | ||
int | restart | ||
) |
Will block until transaction is complete.
i2c | Pointer to I2C regs. |
addr | I2C 7-bit Address left aligned, bit 7 to bit 1. Only supports 7-bit addressing. LSb of the given address will be used as the read/write bit, the addr will not be shifted. Used for both master and slave transactions. |
data | Data to be written. |
len | Number of bytes to Write. |
restart | 0 to send a stop bit at the end of the transaction, otherwise send a restart. |
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 | ||
) |
Will block until transaction is complete.
i2c | Pointer to I2C regs. |
addr | I2C 7-bit Address left aligned, bit 7 to bit 1. Only supports 7-bit addressing. LSb of the given address will be used as the read/write bit, the addr will not be shifted. Used for both master and slave transactions. |
read_data | Buffer that the master will read from. |
read_len | Number of bytes the master can read. |
write_data | Buffer that the master will write to. |
write_len | Number of bytes the master can write. |
tx_num | Number of bytes transmitted by the slave. |
rx_num | Number of bytes received by the slave. |
sw_autoflush_disable | TX Autoflush enabled by default.Set this bit to disable autoflush manually. |
int I2C_MasterAsync | ( | mxc_i2c_regs_t * | i2c, |
i2c_req_t * | req | ||
) |
i2c | Pointer to I2C regs. |
req | Request for an I2C transaction. |
int I2C_SlaveAsync | ( | mxc_i2c_regs_t * | i2c, |
i2c_req_t * | req | ||
) |
i2c | Pointer to I2C regs. |
req | Request for an I2C transaction. |
void I2C_Handler | ( | mxc_i2c_regs_t * | i2c | ) |
This function should be called by the application from the interrupt handler if I2C interrupts are enabled. Alternately, this function can be periodically called by the application if I2C interrupts are disabled.
i2c | Base address of the I2C module. |
void I2C_DrainRX | ( | mxc_i2c_regs_t * | i2c | ) |
i2c | Pointer to I2C regs. |
void I2C_DrainTX | ( | mxc_i2c_regs_t * | i2c | ) |
i2c | Pointer to I2C regs. |
int I2C_AbortAsync | ( | i2c_req_t * | req | ) |
req | Pointer to I2C Transaction. |
int I2C_SetTimeout | ( | mxc_i2c_regs_t * | i2c, |
int | us | ||
) |
i2c | pointer to I2C regs | |
[in] | us | micro seconds to delay |
void I2C_ClearTimeout | ( | mxc_i2c_regs_t * | i2c | ) |
i2c | pointer to I2C regs |