PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
i2c.h File Reference

Data Structures

struct  pi_i2c_conf_t
 I2C master configuration structure. More...
 

Enumerations

enum  pi_i2c_xfer_flags_e
 Properties for I2C transfers. More...
 
enum  pi_i2c_ioctl_e
 Commands for pi_i2c_control. More...
 

Functions

void pi_i2c_conf_init (pi_i2c_conf_t *conf)
 Initialize an I2C configuration with default values. More...
 
void pi_i2c_conf_set_slave_addr (struct pi_i2c_conf *conf, uint16_t slave_addr, int8_t is_10_bits)
 set slave addr in conf. More...
 
void pi_i2c_conf_set_wait_cycles (struct pi_i2c_conf *conf, uint16_t wait_cycles)
 set wait_cycles in conf. More...
 
int pi_i2c_open (struct pi_device *device)
 Open an I2C device. More...
 
void pi_i2c_close (struct pi_device *device)
 Close an opened I2C device. More...
 
void pi_i2c_ioctl (struct pi_device *device, uint32_t cmd, void *arg)
 Dynamically change the device configuration. More...
 
int pi_i2c_read (struct pi_device *device, uint8_t *rx_buff, int length, pi_i2c_xfer_flags_e flags)
 Enqueue a burst read copy from the I2C (from I2C device to chip). More...
 
int pi_i2c_write (struct pi_device *device, uint8_t *tx_data, int length, pi_i2c_xfer_flags_e flags)
 Enqueue a burst write copy to the I2C (from chip to I2C device). More...
 
void pi_i2c_write_read (struct pi_device *device, void *tx_buffer, void *rx_buffer, uint32_t tx_size, uint32_t rx_size)
 
void pi_i2c_write_dual (struct pi_device *device, void *tx_buffer0, void *tx_buffer1, uint32_t tx_size0, uint32_t tx_size1)
 
void pi_i2c_read_async (struct pi_device *device, uint8_t *rx_buff, int length, pi_i2c_xfer_flags_e flags, pi_task_t *task)
 Enqueue an asynchronous burst read copy from the I2C (from I2C device to chip). More...
 
void pi_i2c_write_async (struct pi_device *device, uint8_t *tx_data, int length, pi_i2c_xfer_flags_e flags, pi_task_t *task)
 Enqueue a burst write copy to the I2C (from chip to I2C device). More...
 
void pi_i2c_write_read_async (struct pi_device *device, void *tx_buffer, void *rx_buffer, uint32_t tx_size, uint32_t rx_size, pi_task_t *callback)
 
void pi_i2c_write_dual_async (struct pi_device *device, void *tx_buffer0, void *tx_buffer1, uint32_t tx_size0, uint32_t tx_size1, pi_task_t *callback)
 
int pi_i2c_read_timeout (struct pi_device *device, uint8_t *rx_buff, int length, pi_i2c_xfer_flags_e flags, uint32_t timeout_us)
 Enqueue an asynchronous burst read copy from the I2C (from I2C device to chip), with timeout. More...
 
int pi_i2c_write_timeout (struct pi_device *device, uint8_t *tx_data, int length, pi_i2c_xfer_flags_e flags, uint32_t timeout_us)
 Enqueue a burst write copy to the I2C (from chip to I2C device), with timeout. More...
 
int pi_i2c_get_request_status (pi_task_t *task)
 get the request status from a task More...
 
int pi_i2c_detect (struct pi_device *device, struct pi_i2c_conf *conf, uint8_t *rx_data)
 Scan i2c bus to detect a dev. More...