mrrwa / LocoNet

An embedded Loconet interface library for Arduino family microcontrollers
Other
65 stars 32 forks source link

Support for STM32 #18

Closed deltaphi closed 3 years ago

deltaphi commented 3 years ago

I have extended the LocoNet library to work on the STM32. To this end, I had to make some minor modifications:

I can also extract these modifications into a separate MR, if so desired.

For the STM32 port, I tried to make as many operations with direct register access as possible. I succeeded mostly with regards to GPIO access.

Unfortunately, for Timer and ISR access this approach was hampered by the fact that for STM32, multiple HALs exist. My work (as my current usecase) is actually based on libopencm3, not STM32duino. Further removing HAL dependencies would require basically hard-coding register address values, thereby creating another HAL. I'm open to suggestions for further improvements. Especially, I don't know how much of the Timer setup would be taken care of by STM32duino and could thus be moved out of the library to my custom project.

Note that this is based on (and thus includes) merge request #17.

kiwi64ajs commented 3 years ago

Sorry for the really long delay, I've just eye-balled your changes and they look good. I'll merge them and hopefully retry some builds of my projects and then tag the repo to make a new release

deltaphi commented 3 years ago

Hi @kiwi64ajs,

good to hear that you are still around! No worries about the delay. However, I had another couple tiny fixes sitting in my repository that I didn't bother to put in a PR so far - I just created #19 for that.

In case you are curious, this work was done for the project https://github.com/deltaphi/c6021light

Greetings Damian