cancel
Showing results for 
Search instead for 
Did you mean: 

How to use HAL_I2C_Master_Transmit() from outside main.c

gerhard
Associate II
Posted on March 29, 2016 at 21:14

How to use HAL_I2C_Master_Transmit() from outside main.c

This HAL_I2C works when I call it from within main.c.

I created some external i2c_routines.c, but have a hard time defining how/where to get and use HAL_I2C_Master_Transmit() from outside main.c.

The routines work inside of main.c but I want place them in a separate file.

Any help appreciated

#hal_i2c_master_transmit()
2 REPLIES 2
sincoon
Associate II
Posted on March 29, 2016 at 22:40

So, what problems/errors stumped you when you'd used HAL_I2C_Master_Transmit() in other files? Just don't forget to put

#include ''stm32f4xx_hal.h'' where you want to use it.

Walid FTITI_O
Senior II
Posted on March 30, 2016 at 12:20

Hi Gerhard,

The header of the common HAL driver file (stm32f4xx_hal.h) includes the common configurations for the whole HAL library. It is the only header file that is included in the user sources and the HAL C sources files to be able to use the HAL resources.

So always with Hal library, if you develop your project application , make sure that you have include the stm32f4xx_hal.h.

-Hannibal-

How to use HAL_I2C_Master_Transmit() from outside main.c

This HAL_I2C works when I call it from within main.c.

I created some external i2c_routines.c, but have a hard time defining how/where to get and use HAL_I2C_Master_Transmit() from outside main.c.

The routines work inside of main.c but I want place them in a separate file.

Any help appreciated