65 #define I2C_NULL ((void *)0) 100 #define I2C_ERROR_NO_ERROR (0) 101 #define I2C_ERROR_NO_SLAVE (-1) 102 #define I2C_ERROR_BUS_BUSY (-2) 103 #define I2C_ERROR_PARAM (-3) 104 #define I2C_ERROR_OTHERS (-4) 105 #define I2C_ERROR_ARBITRATION (-5) 116 #define I2C_EVENT_ERROR (1 << 1) 117 #define I2C_EVENT_ERROR_NO_SLAVE (1 << 2) 118 #define I2C_EVENT_TRANSFER_COMPLETE (1 << 3) 119 #define I2C_EVENT_TRANSFER_EARLY_NACK (1 << 4) 120 #define I2C_EVENT_ALL (I2C_EVENT_ERROR | I2C_EVENT_TRANSFER_COMPLETE | I2C_EVENT_ERROR_NO_SLAVE | I2C_EVENT_TRANSFER_EARLY_NACK) 130 #define I2C_NO_DATA (0) 131 #define I2C_READ_ADDRESSED (1) 132 #define I2C_WRITE_GENERAL (2) 133 #define I2C_WRITE_ADDRESSED (3) 177 #if defined(I2C_CHANNEL0) 178 #define I2Cx_TEXT "I2C0" 179 #define I2C_CFG_PORT_SCL (I2C_PORT_PG3) 180 #define I2C_CFG_PORT_SDA (I2C_PORT_PG2) 181 #elif defined(I2C_CHANNEL1) 182 #define I2Cx_TEXT "I2C1" 183 #define I2C_CFG_PORT_SCL (I2C_PORT_PF3) 184 #define I2C_CFG_PORT_SDA (I2C_PORT_PF2) 185 #elif defined(I2C_CHANNEL2) 186 #define I2Cx_TEXT "I2C2" 187 #define I2C_CFG_PORT_SCL (I2C_PORT_PG5) 188 #define I2C_CFG_PORT_SDA (I2C_PORT_PG4) 189 #elif defined(I2C_CHANNEL3) 190 #define I2Cx_TEXT "I2C3" 191 #define I2C_CFG_PORT_SCL (I2C_PORT_PJ7) 192 #define I2C_CFG_PORT_SDA (I2C_PORT_PJ6) 193 #elif defined(I2C_CHANNEL4) 194 #define I2Cx_TEXT "I2C4" 195 #define I2C_CFG_PORT_SCL (I2C_PORT_PJ3) 196 #define I2C_CFG_PORT_SDA (I2C_PORT_PJ2) 198 #error "target channel is non-select." 274 int32_t
i2c_read(
i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop);
275 int32_t
i2c_write(
i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop);
TXZ_Result i2c_slave_transfer_asynch(i2c_t *p_obj, uint8_t *p_tx, int32_t tx_length, uint8_t *p_rx, int32_t rx_length)
Start I2C asynchronous transfer.
Definition: bsp_i2c.c:1789
int32_t i2c_write(i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop)
Blocking sending data.
Definition: bsp_i2c.c:1266
I2C_t i2c
Definition: bsp_i2c.h:250
Definition: bsp_i2c.h:158
Definition: bsp_i2c.h:165
uint32_t i2c_slave_irq_handler_asynch(i2c_t *p_obj)
The asynchronous IRQ handler.
Definition: bsp_i2c.c:1835
Definition: bsp_i2c.h:159
Definition: bsp_i2c.h:160
uint8_t bus_free
Definition: bsp_i2c.h:219
TXZ_Result i2c_transfer_asynch(i2c_t *p_obj, uint8_t *p_tx, int32_t tx_length, uint8_t *p_rx, int32_t rx_length, int32_t address, int32_t stop)
Start I2C asynchronous transfer.
Definition: bsp_i2c.c:1486
TXZ_Result
Definition: txz_driver_def.h:43
Definition: bsp_i2c.h:164
int32_t i2c_slave_read(i2c_t *p_obj, uint8_t *p_data, int32_t length)
Blocking reading data.
Definition: bsp_i2c.c:1673
Definition: bsp_i2c.h:163
Definition: bsp_i2c.h:166
void i2c_slave_address(i2c_t *p_obj, uint32_t address)
Configure I2C slave address.
Definition: bsp_i2c.c:1760
void i2c_reset(i2c_t *p_obj)
Reset I2C peripheral.
Definition: bsp_i2c.c:1023
TXZ_Result i2c_init(i2c_t *p_obj, i2c_port_t sda, i2c_port_t scl)
Initialize the I2C Driver.
Definition: bsp_i2c.c:945
i2c_buffer_t tx_buff
Definition: bsp_i2c.h:252
I2C handle structure definenition.
Definition: bsp_i2c.h:248
I2C buffer structure definenition.
Definition: bsp_i2c.h:236
Definition: bsp_i2c.h:157
TXZ_Result i2c_start(i2c_t *p_obj)
Creates a start condition on the I2C bus.
Definition: bsp_i2c.c:1126
int32_t i2c_slave_receive(i2c_t *p_obj)
Check to see if the I2C slave has been addressed.
Definition: bsp_i2c.c:1635
This file provides all the functions prototypes for I2C Class.
void i2c_slave_abort_asynch(i2c_t *p_obj)
Abort asynchronous transfer.
Definition: bsp_i2c.c:1860
Definition: bsp_i2c.h:161
uint32_t irqn
Definition: bsp_i2c.h:221
uint32_t state
Definition: bsp_i2c.h:227
uint32_t i2c_irq_handler_asynch(i2c_t *p_obj)
The asynchronous IRQ handler.
Definition: bsp_i2c.c:1543
uint8_t i2c_active(i2c_t *p_obj)
Attempts to determine if the I2C bus is already in use.
Definition: bsp_i2c.c:1447
i2c_buffer_t rx_buff
Definition: bsp_i2c.h:253
This file provides all the functions prototypes for CG driver.
uint32_t length
Definition: bsp_i2c.h:239
uint8_t * p_buffer
Definition: bsp_i2c.h:238
i2c_port_t
i2c Port Enumerated Type Definition.
Definition: bsp_i2c.h:156
int32_t i2c_byte_read(i2c_t *p_obj, int32_t last)
Read one byte.
Definition: bsp_i2c.c:1334
int32_t i2c_slave_write(i2c_t *p_obj, uint8_t *p_data, int32_t length)
Blocking sending data.
Definition: bsp_i2c.c:1716
uint8_t start
Definition: bsp_i2c.h:220
Definition: bsp_i2c.h:162
i2c_internal_info_t info
Definition: bsp_i2c.h:251
TXZ_Result i2c_stop(i2c_t *p_obj)
Creates a stop condition on the I2C bus.
Definition: bsp_i2c.c:1152
int32_t i2c_read(i2c_t *p_obj, int32_t address, uint8_t *p_data, int32_t length, int32_t stop)
Blocking reading data.
Definition: bsp_i2c.c:1193
void i2c_slave_mode(i2c_t *p_obj, int32_t enable_slave)
Configure I2C as slave or master.
Definition: bsp_i2c.c:1597
TXZ_Result i2c_frequency(i2c_t *p_obj, int32_t hz)
Configure the I2C frequency.
Definition: bsp_i2c.c:1047
uint32_t event
Definition: bsp_i2c.h:226
I2C handle structure definition.
Definition: txz_i2c.h:342
int32_t i2c_byte_write(i2c_t *p_obj, int32_t data)
Write one byte.
Definition: bsp_i2c.c:1372
void i2c_abort_asynch(i2c_t *p_obj)
Abort asynchronous transfer.
Definition: bsp_i2c.c:1567
uint32_t pos
Definition: bsp_i2c.h:240
uint32_t address
Definition: bsp_i2c.h:224
TXZ_Result i2c_check_bus_free(i2c_t *p_obj)
Check bus free on the I2C bus.
Definition: bsp_i2c.c:1100
uint32_t stop
Definition: bsp_i2c.h:225
I2C internal information structure definenition.
Definition: bsp_i2c.h:217