I did not get an error. I just wanna learn the explaination i2c with hal lib. So what is the code processing? How does it work?
It's still not really clear what you're after...
It's not at all clear what your competence level is in C and embedded code.
This makes it next to impossible to answer.
If you are looking for an explanation of how to
use the I2C HAL, I would suggest studying:
- The long "How to use this driver" comment at the beginning of the HAL I2C C file, e.g., for an F4 in stm32f4xx_hal_i2c.c - it's terse, but a good guide.
- The various project examples, also contained in the Cube package
If you want to understand how the HAL code
works, you can start by reading the reference manual for your specific STM32 family, matching the descriptions and usage suggestions there with the actual HAL code.
If there are parts that you cannot understand, show that you have made an effort, ask specific questions and many here will be happy to help.
In any case, it's not fun code to read.