i2c.c File Reference

Functions

static hal_i2c_handlehal_i2c_get_handle (KI2CNum num)
 Fetches i2c bus data structure. More...
 
static hal_i2c_handlehal_i2c_device_init (KI2C *i2c)
 Initializes i2c bus structure with data needed to setup hardware. More...
 
static KI2CStatus hal_i2c_hw_init (hal_i2c_handle *handle)
 Initializes the I2C according to the specified parameters in the I2C_InitTypeDef and create the associated handle. More...
 
static void hal_i2c_msp_init (hal_i2c_handle *handle)
 Low level I2C hardware setup. More...
 
static void hal_i2c_terminate (hal_i2c_handle *handle)
 I2C hardware cleanup and disabling. More...
 
static KI2CStatus hal_i2c_check_addr_timeout (I2C_HandleTypeDef *handle, uint32_t flag)
 Checks for the addr flag to be set, with builtin timeout. More...
 
static KI2CStatus hal_i2c_check_flag_special (I2C_HandleTypeDef *handle, uint32_t flag)
 Checks for special conditions based on the flag. More...
 
static KI2CStatus hal_i2c_check_flag_timeout (I2C_HandleTypeDef *handle, uint32_t flag, uint16_t status)
 Checks specified flag for desired state, with builtin timeout. More...
 
static KI2CStatus hal_i2c_check_btf_timeout (I2C_HandleTypeDef *handle)
 Checks for btf flag to reset, with builtin timeout. More...
 
static KI2CStatus hal_i2c_check_txe_timeout (I2C_HandleTypeDef *handle)
 Checks for txe flag to reset, with builtin timeout. More...
 
static KI2CStatus hal_i2c_master_request_read (I2C_HandleTypeDef *hal_handle, uint16_t addr)
 Master sends slave address for read request. More...
 
static KI2CStatus hal_i2c_master_setup_read (I2C_HandleTypeDef *hal_handle, uint16_t addr, int len)
 Sends initial receive sequence based on length of data expected. More...
 
static KI2CStatus hal_i2c_master_request_write (I2C_HandleTypeDef *hal_handle, uint16_t addr)
 Master sends slave address for write request. More...
 
static KI2CStatus hal_i2c_master_setup_write (I2C_HandleTypeDef *hal_handle, uint16_t addr)
 Sends initial transmit sequence. More...
 
KI2CStatus kprv_i2c_dev_init (KI2CNum i2c_num)
 Setup and enable i2c bus. More...
 
KI2CStatus kprv_i2c_dev_terminate (KI2CNum i2c)
 i2c hardware cleanup and disabling More...
 
KI2CStatus kprv_i2c_master_write (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Write data over i2c bus as master. More...
 
KI2CStatus kprv_i2c_master_read (KI2CNum i2c, uint16_t addr, uint8_t *ptr, int len)
 Read data over i2c bus as master. More...
 

Variables

static hal_i2c_handle hal_i2c_bus [K_NUM_I2CS]
 Static array of i2c bus handles. More...