Functions | |
static hal_i2c_handle * | hal_i2c_get_handle (KI2CNum num) |
Fetches i2c bus data structure. More... | |
static hal_i2c_handle * | hal_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... | |
Function Documentation
|
static |
Checks for the addr flag to be set, with builtin timeout.
- Note
- Derived from STM32CubeF4's I2C_WaitOnMasterAddressFlagUntilTimeout
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data flag I2C flag to check
- Returns
- KI2CStatus I2C_OK if success, otherwise a specific error flag
|
static |
Checks for btf flag to reset, with builtin timeout.
- Note
- Derived from STM32CubeF4's I2C_WaitOnBTFFlagUntilTimeout
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data
- Returns
- KI2CStatus I2C_OK if btf is reset within timeout, otherwise specific error
|
static |
Checks for special conditions based on the flag.
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data flag I2C Flag that should be checked
- Returns
- KI2CStatus I2C_OK if no special conditions found, specific error otherwise
|
static |
Checks specified flag for desired state, with builtin timeout.
- Note
- Derived from STM32CubeF4's I2C_WaitOnFlagUntilTimeout
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data flag I2C Flag that should be checked status Indicates whether to check for flag state of SET or RESET
- Returns
- KI2CStatus I2C_OK if flag is set to desired value within timout, otherwise I2C_TIMEOUT
|
static |
Checks for txe flag to reset, with builtin timeout.
- Note
- Derived from STM32CubeF4's I2C_WaitOnBTFFlagUntilTimeout
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data
- Returns
- KI2CStatus I2C_OK if txe is reset within timeout, otherwise specific error
|
static |
Initializes i2c bus structure with data needed to setup hardware.
- Parameters
-
i2c higher level hal i2c data
- Returns
- hal_i2c_handle* NULL if bad bus num, otherwise data ready for dev setup
|
static |
Fetches i2c bus data structure.
- Parameters
-
num i2c bus num to fetch
- Returns
- hal_i2c_handle* pointer to data structure
|
static |
Initializes the I2C according to the specified parameters in the I2C_InitTypeDef and create the associated handle.
- Note
- Derived from STM32CubeF4's HAL_I2C_INIT
- Parameters
-
handle pointer to hal_i2c_handle containing config information
- Returns
- KI2CStatus I2C_OK if success, otherwise a specific error flag
|
static |
Master sends slave address for read request.
- Note
- Derived from STM32CubeF4's I2C_MasterRequestRead
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data addr target slave address
- Returns
- KI2CStatus I2C_OK if success, otherwise specific error
|
static |
Master sends slave address for write request.
- Note
- Derived from STM32CubeF4's I2C_MasterRequestWrite
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data addr target slave address
- Returns
- KI2CStatus I2C_OK if success, otherwise specific error
|
static |
Sends initial receive sequence based on length of data expected.
- Note
- Partly derived from STM32CubeF4's HAL_I2C_Master_Receive
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data addr target slave address len length of data expected to be received
- Returns
- KI2CStatus I2C_OK if success, otherwise specific error
|
static |
Sends initial transmit sequence.
- Note
- Derived from STM32CubeF4's HAL_I2C_Master_Transmit
- Parameters
-
handle Pointer to STM32CubeF4 HAL defined structure for I2C data addr target slave address
- Returns
- KI2CStatus I2C_OK if success, otherwise specific error
|
static |
Low level I2C hardware setup.
- Note
- Derived from STM32CubeF4's HAL_I2C_MspInit
- Parameters
-
handle pointer to hal_i2c_handle containing config information
|
static |
I2C hardware cleanup and disabling.
- Parameters
-
handle pointer to hal_i2c_handle containing config information
KI2CStatus kprv_i2c_dev_init | ( | KI2CNum | i2c_num | ) |
Setup and enable i2c bus.
- Parameters
-
i2c i2c bus to initialize
- Returns
- KI2CStatus I2C_OK if success, otherwise a specific error flag
KI2CStatus kprv_i2c_dev_terminate | ( | KI2CNum | i2c | ) |
i2c hardware cleanup and disabling
- Parameters
-
i2c bus num to terminate
- Returns
- KI2CStatus I2C_OK if success, otherwise a specific error flag
KI2CStatus kprv_i2c_master_read | ( | KI2CNum | i2c, |
uint16_t | addr, | ||
uint8_t * | ptr, | ||
int | len | ||
) |
Read data over i2c bus as master.
- Parameters
-
i2c i2c bus to read from addr i2c address to write to ptr pointer to data buffer len length of data to read
- Returns
- KI2CStatus I2C_OK on success, otherwise failure
KI2CStatus kprv_i2c_master_write | ( | KI2CNum | i2c, |
uint16_t | addr, | ||
uint8_t * | ptr, | ||
int | len | ||
) |
Write data over i2c bus as master.
- Parameters
-
i2c i2c bus to write to addr i2c address to write to ptr pointer to data buffer len length of data to write
- Returns
- KI2CStatus I2C_OK on success, otherwise failure
Variable Documentation
|
static |
Static array of i2c bus handles.