HAL I2C Overview ¶
Introducing I2C ¶
- group I2C_Introduction
-
The I2C hardware abstraction layer provides a set of APIs to interface with the STM32 I2C (Inter-integrated circuit interface) peripheral.
It simplifies the configuration, initialization and management of I2C communication, by supporting various modes such as polling, interrupt, and DMA for efficient data transfer.
This abstraction layer ensures portability and ease of use across different STM32 series.
Module and files ¶
The following diagram illustrates the I2C module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the I2C module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL I2C module, specifying their locations, default values, and descriptions:
- group I2C_Configuration_Table
-
Configuration inside the I2C driver
Software configuration defined in stm32c5xx_hal_conf.h:
Preprocessor flags
Default value
Comment
USE_HAL_I2C_MODULE
1
Enable HAL I2C driver module
USE_HAL_I2C_REGISTER_CALLBACKS
0
Allow the user to define their own callback
USE_HAL_I2C_DMA
1
Enable DMA code inside I2C
USE_HAL_CHECK_PARAM
0
Enable runtime parameter check
USE_HAL_I2C_CLK_ENABLE_MODEL
HAL_CLK_ENABLE_NO
Enable the gating of the peripheral clock
USE_HAL_CHECK_PROCESS_STATE
0
Enable atomicity of process state check
USE_HAL_MUTEX
0
Enable semaphore creation for OS
USE_HAL_I2C_USER_DATA
0
Add a user data inside HAL I2C handle
USE_HAL_I2C_GET_LAST_ERRORS
0
Enable retrieval of last processes error codes
Software configuration defined in preprocessor environment:
Preprocessor flags
Default value
Comment
USE_ASSERT_DBG_PARAM
Not defined
Enable check param for HAL and LL
USE_ASSERT_DBG_STATE
Not defined
Enable check state for HAL