Skip to main content
Matthieu Tanguay
Associate II
July 2, 2017
Question

How to properly use HandleTypeDef in librairies

  • July 2, 2017
  • 1 reply
  • 1070 views
Posted on July 02, 2017 at 17:09

Hello,

I have a temperature sensor connected to the I2C1 bus of my board. To help me with basic configuration I use STM32 Cube to generate the base of my code. I usually then go on to write my own libraires to use at later time. It is probably not the most optimal, but helps my understanding quite a bit. Somewhere close to the top of the code there is multiple (I2C,TIM,USAT)_HandleTypeDef. How to I go around using these in other files? Do I need to redefine them in all the file I write them in or simply pass them around as arguments to functions?

Thank you in advance

MT

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    July 2, 2017
    Posted on July 02, 2017 at 17:59

    Decide which ones actually need global scope, instead of GPIO or TIM initializations which occur once.

    Use 'extern' in secondary use cases.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..