lhr-solar / Embedded-Sharepoint

This repository contains files that can be shared among us, the embedded design teams.
MIT License
3 stars 0 forks source link

Include correct stm32 header based on Makefile #57

Open Lakshay983 opened 3 weeks ago

Lakshay983 commented 3 weeks ago

In current files, we only include the "stm32l4xx_hal.h" or "stm32f4xx_hal.h" not both. Meaning tests like https://github.com/lhr-solar/Embedded-Sharepoint/blob/STM32L4/HwTests/Heartbeat.c won't work on the F4 chip.

You could solve this with conditional compilations like

Ifdef STM32L4

include stm32l4xx_hal.h

elif STM32F4

include stm32f4xx_hal.h

but that can be somewhat bloated if we need to do that for every file. An ideal situation would be to include only one header file and then on the backend it handles which header is used at compile time.