Rahix / avr-device

Register access crate for AVR microcontrollers
Apache License 2.0
173 stars 66 forks source link

design question #142

Closed djdisodo closed 10 months ago

djdisodo commented 10 months ago

i'm not sure but modules with same name (for example TC8_ASYNC) seems to have same features even across different boards

however, to get these generalized(i think it's done on atmega-hal tho) i'd imagine it's easier to use struct to store register address or etc and define constant value for each mcus and boards ( also use generic consts for minor differences in modules)

this will prevent complex macro works and feature bounding (if you impl for one struct type it will work on all boards?)

Rahix commented 10 months ago

I agree it would be nice to unify these but unfortunately doing this properly is really really hard. In the ARM world, this works a lot better because standardization of peripherals has been thought out a lot more. On AVR, there are slight incompatibilities everywhere so unifying the register interfaces becomes impossible in most instances.

We chose to go with the approach of leaving registers as is and then using the avr-hal-generic macros as the point where unification into a single interface is done.