i2c.h File Reference

Go to the source code of this file.

Data Structures

struct  KI2CConf
 i2c configuration structure More...
 
struct  KI2C
 i2c bus data structure More...
 

Enumerations

enum  KI2CNum { K_I2C1 = 0, K_I2C2, K_I2C3 }
 Available i2c buses. More...
 
enum  I2CAddressingMode { K_ADDRESSINGMODE_7BIT = 0, K_ADDRESSINGMODE_10BIT }
 Expected addressing mode of i2c bus. More...
 
enum  I2CRole { K_MASTER = 0, K_SLAVE }
 Expected role of i2c bus. More...
 
enum  KI2CStatus {
  I2C_OK = 0, I2C_ERROR, I2C_ERROR_AF, I2C_ERROR_ADDR_TIMEOUT,
  I2C_ERROR_TIMEOUT, I2C_ERROR_NACK, I2C_ERROR_TXE_TIMEOUT, I2C_ERROR_BTF_TIMEOUT,
  I2C_ERROR_NULL_HANDLE
}
 i2c function status More...
 

Functions

void k_i2c_init (KI2CNum i2c, KI2CConf *conf)
 Setup and enable i2c bus. More...
 
void k_i2c_terminate (KI2CNum i2c)
 Terminate i2c bus. More...
 
KI2CConf k_i2c_conf_defaults (void)
 Generate KI2CConf with default I2C values. More...
 
void k_i2c_default_init ()
 Init DEFAULT_I2C bus with default config values. More...
 
void k_i2c_default_dev_init (KI2CNum i2c)
 Initialize i2c device with default config values. More...
 
KI2CStatus k_i2c_write (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Transmit data over i2c bus to specified address. More...
 
KI2CStatus k_i2c_read (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Read data over i2c bus from specified address. More...
 
KI2Ckprv_i2c_get (KI2CNum i2c)
 Fetches i2c bus data structure. More...
 
void kprv_i2c_dev_init (KI2CNum i2c)
 Low level hal device initialization This is implemented by the device specific hal. More...
 
void kprv_i2c_dev_terminate (KI2CNum i2c)
 Low level hal i2c termination This is implemented by the device specific hal. More...
 
KI2CStatus kprv_i2c_master_write (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Low level hal i2c write (as master) This is implemented by the device specific hal. More...
 
KI2CStatus kprv_i2c_master_read (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Low level hal i2c read (as master) This is implemented by the device specific hal. More...
 
KI2CStatus kprv_i2c_slave_write (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Low level hal i2c write (as slave) This is implemented by the device specific hal. More...
 
KI2CStatus kprv_i2c_slave_read (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Low level hal i2c read (as slave) This is implemented by the device specific hal. More...