STM32G4 HAL SPI HandleTypedef
Hello ST MCU Community,
I'm a beginner to C and coding on a MCU and have run into what I hope is a simple problem. I have a small project where I'm trying to have a STM32G474 Nucleo board interface to a SPI display (http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807). At first I wanted to check my setup so I wrote a few functions that initialized the display based off the example psuedo-code provide. I then verified that I could change the color of the display to verify that I was actually writing to the display. I didn't have a problem but I had created all my functions in main.c.
Now I want to be able to add text to my display and have seen that there are multiple drivers located on Github. One driver that I would like to use can be found at: https://github.com/martnak/STM32-ILI9341
The code from Github looks to be dated from 2017 and I think there may have been some updates to CUBEMX since then. From what I can gather at that time, the SPI handler was not automatically initiated and the end user had to do it manually. The driver I found creates a spi_handletypedef in the driver l while my current implementation creates a spi_handetypedef in main.c.
Is there a way to use the hspi that was created in main.c in another file? The only way I could think of is to pass the hspi to each function in that file or to create the hspi at the driver file.
I'm hoping there may be a simpler solution before I edit the drivers from github to accept hspi from main.c.
Any guidance or help would be very much appreciated.
Thank you,
