InPlay API
|
HAL_I2C. More...
Functions | |
void * | hal_i2c_open (int id, i2c_init_t *init) |
Open the I2c driver. More... | |
void | hal_i2c_close (void *hdl) |
Close the I2c driver. More... | |
int | hal_mi2c_read (void *hdl, uint8_t tar, uint8_t *buffer, uint16_t buffer_len) |
I2c master read function. More... | |
int | hal_mi2c_write (void *hdl, uint8_t tar, uint8_t *buffer, uint16_t buffer_len) |
I2c master write function. More... | |
int | hal_mi2c_mix_tran_start_poll (void *hdl, int speed, uint8_t tar, int dir_write, uint8_t *buffer, uint16_t buffer_len) |
Start of I2c master read/write mixed function. More... | |
int | hal_mi2c_mix_tran_continue_poll (void *hdl, uint8_t tar, int dir_write, int restart, uint8_t *buffer, uint16_t buffer_len) |
Continue of I2c master read/write mixed function. More... | |
int | hal_mi2c_mix_tran_end_poll (void *hdl, uint8_t tar, int dir_write, int restart, uint8_t *buffer, uint16_t buffer_len) |
End of I2c master read/write mixed function. More... | |
int | hal_si2c_read (void *hdl, uint8_t sar, uint8_t *buffer, uint16_t buffer_len) |
I2c slave read function. More... | |
int | hal_si2c_write (void *hdl, uint8_t sar, uint8_t *buffer, uint16_t buffer_len) |
I2c slave write function. More... | |
int | hal_mi2c_write_read (void *hdl, uint8_t tar, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len) |
I2c master write and read function. More... | |
int | hal_i2c_set_tmo (void *hdl, uint32_t tmo) |
Set the I2c timeout. More... | |
HAL_I2C.
void hal_i2c_close | ( | void * | hdl | ) |
Close the I2c driver.
[in] | hdl | The handle from the previous "open" function. |
void* hal_i2c_open | ( | int | id, |
i2c_init_t * | init | ||
) |
Open the I2c driver.
[in] | id | The I2c controller ID, |
[in] | init | The I2c initialization structure, |
int hal_i2c_set_tmo | ( | void * | hdl, |
uint32_t | tmo | ||
) |
Set the I2c timeout.
[in] | hdl | The handle from the previous "open" function. |
[in] | tmo | Timeout in ms. |
int hal_mi2c_mix_tran_continue_poll | ( | void * | hdl, |
uint8_t | tar, | ||
int | dir_write, | ||
int | restart, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
Continue of I2c master read/write mixed function.
[in] | hdl | The handle from the previous "open" function. |
[in] | tar | The slave address. |
[in] | dir_write | Direction of the transaction on the I2C bus, 1: Write, 0: Read |
[in] | restart | Issue a new start condition on the I2C bus, 1: Generate Re-Start bit, 0: informs the master function to continue to the next operation. This must done after writing transmit data or reading received data. |
[in] | buffer | The pointer to the transaction buffer. |
[in] | buffer_len | The transaction buffer length. |
int hal_mi2c_mix_tran_end_poll | ( | void * | hdl, |
uint8_t | tar, | ||
int | dir_write, | ||
int | restart, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
End of I2c master read/write mixed function.
[in] | hdl | The handle from the previous "open" function. |
[in] | tar | The slave address. |
[in] | dir_write | Direction of the last transaction on the I2C bus, 1: Write, 0: Read |
[in] | restart | Issue a new start condition on the I2C bus, 1: Generate a re-start bit, 0: informs the master function to continue to the next operation. This must done after writing transmit data or reading received data. |
[in] | buffer | The pointer to the transaction buffer. |
[in] | buffer_len | The transaction buffer length. |
int hal_mi2c_mix_tran_start_poll | ( | void * | hdl, |
int | speed, | ||
uint8_t | tar, | ||
int | dir_write, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
Start of I2c master read/write mixed function.
[in] | hdl | The handle from the previous "open" function. |
[in] | speed | The I2c serial clock rate, |
[in] | tar | The slave address. |
[in] | dir_write | Direction of the first transaction on the I2C bus, 1: Write, 0: Read |
[in] | buffer | The pointer to the transaction buffer. |
[in] | buffer_len | The transaction buffer length. |
int hal_mi2c_read | ( | void * | hdl, |
uint8_t | tar, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
I2c master read function.
[in] | hdl | The handle from the previous "open" function. |
[in] | tar | The slave address. |
[in] | buffer | The pointer to the received buffer. |
[in] | buffer_len | The receive buffer length. |
int hal_mi2c_write | ( | void * | hdl, |
uint8_t | tar, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
I2c master write function.
[in] | hdl | The handle from the previous "open" function. |
[in] | tar | The slave address. |
[in] | buffer | The pointer to the transmit buffer. |
[in] | buffer_len | The transmit buffer length. |
int hal_mi2c_write_read | ( | void * | hdl, |
uint8_t | tar, | ||
uint8_t * | wr_buf, | ||
uint16_t | wr_len, | ||
uint8_t * | rd_buf, | ||
uint16_t | rd_len | ||
) |
I2c master write and read function.
[in] | hdl | The handle from the previous "open" function. |
[in] | tar | The slave address. |
[in] | wr_buf | The pointer to the write buffer. |
[in] | wr_len | The write buffer length. |
[out] | rd_buf | The pointer to the read buffer. |
[in] | rd_len | The read buffer length. |
int hal_si2c_read | ( | void * | hdl, |
uint8_t | sar, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
I2c slave read function.
[in] | hdl | The handle from the previous "open" function. |
[in] | sar | The slave address. |
[in] | buffer | The pointer to the receive buffer. |
[in] | buffer_len | The receive buffer length. |
int hal_si2c_write | ( | void * | hdl, |
uint8_t | sar, | ||
uint8_t * | buffer, | ||
uint16_t | buffer_len | ||
) |
I2c slave write function.
[in] | hdl | The handle from the previous "open" function. |
[in] | sar | The slave address. |
[in] | buffer | The pointer to the transmit buffer. |
[in] | buffer_len | The transmit buffer length. |