Skip to main content
MSole.1
Visitor II
December 1, 2020
Solved

hi2c2 in an external .c

  • December 1, 2020
  • 1 reply
  • 1423 views

Hello to all.

I'm coding an I2C comunication and the IDE (1.4.0) create the Private variable I2C_HandleTypeDef hi2c2; and then the function MX_I2C2_Init. Everithing ok.

I'm using an external .c file to handle the I2C communication and how can I access to the hi2c2 from my read/write functions in my .c module?

Thanks in advance, Manu.

This topic has been closed for replies.
Best answer by TDK

Add "extern I2C_HandleTypeDef hi2c2;" either in your .c file, or in an included header.

1 reply

TDK
TDKBest answer
Super User
December 1, 2020

Add "extern I2C_HandleTypeDef hi2c2;" either in your .c file, or in an included header.

"If you feel a post has answered your question, please click ""Accept as Solution""."