Open benedekkupper opened 3 years ago
You can derive this from parsing the CMSIS-SVD files. modm parses the CMSIS header files for STM32 (since the SVD files are less accurate) and uses that to provide such an API. However, some manual fixing is still required as the mapping is a little fuzzy.
We've integrated bit fields before for the STM32F1 AFIO remap groups, so moving the RCC bit fields into here would probably be useful.
Yes, so basically what I'm asking is the same as what's already suggested in the modm parser/generator.
Just FYI: I'm currently writing my master's thesis so I don't have the head space to refactor this. I'm happy to review pull requests though, if you want to give it a shot.
There is an effort by me to add a much better, proper Python API to this repo, but it hasn't been a big enough priority for me to finish it: https://github.com/modm-io/modm-devices/pull/35
One of the most important thing for any peripheral driver is to be able to enable the root clock for the peripheral. On STM32's this is done via RCC A[H/P]nBENR registers. It would be nice if the database contained an enum like in https://github.com/IntergatedCircuits/STM32_XPD/blob/master/STM32F0_XPD/inc/xpd_rcc.h#L78, where the position consists of a register offset from the lowest A[H/P]nBENR register, and a bit offset within the register. Then the appropriate enum values should be bound to the peripheral instances, allowing a peripheral driver to call a uniform RCC driver API to enable/reset/enable in sleep mode a peripheral.