cancel
Showing results for 
Search instead for 
Did you mean: 

API is not coming up outside of the function body

demir
Senior II

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.

 

demir_0-1712148947715.png

 

demir_1-1712148996290.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Evangelist III

@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

 

View solution in original post

3 REPLIES 3
SofLit
ST Employee

Hello,

What is this?

SofLit_0-1712151173054.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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 ?

Andrew Neil
Evangelist III

@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