2024-04-03 05:56 AM
Hi,
I am trying to add HAL_I2C_Mem_Read into my application. However, when I write the API in the region below, it is not auto filled, I can not use the API. On the other hand, when I add the API inside the above function it works.
How can I fix this ?
I have already added #include "stm32f4xx_hal_i2c.h" as header file.
Thanks.
Solved! Go to Solution.
2024-04-03 06:42 AM - edited 2024-04-03 06:43 AM
@demir wrote:I have already added #include "stm32f4xx_hal_i2c.h" as header file.
You shouldn't need to do that manually.
Once you enable & configure I2C in the CubeIDE Device Configuration Tool (or CubeMX), and re-generate the code, it should do all this for you.
These are for L4 rather than F4, but should give the idea:
STM32L4 training: 05.5 Communication peripherals - Inter-integrated circuit interface (I2C) theory:
https://www.youtube.com/watch?v=e4F_7WcYkdU&list=PLnMKNibPkDnEEvQWrDqVuu1w_iQ214GXi&index=31
STM32L4 training: 05.6 Communication peripherals - Hands-on I2C:
https://www.youtube.com/watch?v=_SuRDVcDaMo&list=PLnMKNibPkDnEEvQWrDqVuu1w_iQ214GXi&index=32
2024-04-03 06:33 AM - edited 2024-04-03 06:33 AM
Hello,
What is this?
2024-04-03 06:42 AM - edited 2024-04-03 06:42 AM
I have deliberately pointed out that to show there is no auto fill when I start to type HAL_I2C_M in that region, on the contrary when I start to type in the function body as HAL_I2C_M and press space, then I see the API in the suggestion list that is HAL_I2C_Mem_Read()
In brief, my question is that, why HAL_I2C_Mem_Read is not useable outside of the function body ?
2024-04-03 06:42 AM - edited 2024-04-03 06:43 AM
@demir wrote:I have already added #include "stm32f4xx_hal_i2c.h" as header file.
You shouldn't need to do that manually.
Once you enable & configure I2C in the CubeIDE Device Configuration Tool (or CubeMX), and re-generate the code, it should do all this for you.
These are for L4 rather than F4, but should give the idea:
STM32L4 training: 05.5 Communication peripherals - Inter-integrated circuit interface (I2C) theory:
https://www.youtube.com/watch?v=e4F_7WcYkdU&list=PLnMKNibPkDnEEvQWrDqVuu1w_iQ214GXi&index=31
STM32L4 training: 05.6 Communication peripherals - Hands-on I2C:
https://www.youtube.com/watch?v=_SuRDVcDaMo&list=PLnMKNibPkDnEEvQWrDqVuu1w_iQ214GXi&index=32