pazi88 / STM32_CAN

CAN bus Library for Arduino STM32
GNU General Public License v3.0
67 stars 28 forks source link

Change the can ports to be defined at compile time rather than runtime #27

Closed abinash18 closed 5 months ago

abinash18 commented 6 months ago

There are some mcus that dont have some of the GPIO ports so it causes errors at compile time. Like the STM32L4 it dose not have GPIOD defined.

pazi88 commented 6 months ago

Which L4 board you are trying to build?

abinash18 commented 6 months ago

Sorry I didnt specify i am using the stm32l432 it only has Port A and B.

abinash18 commented 6 months ago

I think there should be a macro check something like:

#ifdef GPIOD 

...

#endif

These definitions are found in framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32xx/Include/stm32**xe.h

where is your 2 letter mcu family and ** is the 2 letter mcu family and 2 letter varient

like stm32L432 L4 is family 32 is varient

pazi88 commented 5 months ago

This must be something that is already fixed. There is already check for GPIOD. I did try compiling for L432 versions and those worked fine. Not sure if this is something that was fixed "recently", so I did create release of the current state of the library.