Rahix / avr-hal

embedded-hal abstractions for AVR microcontrollers
Apache License 2.0
1.23k stars 216 forks source link

peripherals type alias #555

Closed djdisodo closed 3 weeks ago

djdisodo commented 1 month ago

i think peripherals type names are hard to write and remember currently,

it makes some problem because rust requires you to put type on generic parameters, function arguments or static/const values

for example how can tell what's type of pin d9 on UNO is? atmega_hal::port::PB1

however names should be different depending on the board

first, maybe we can introduce some macro that parses given value and return the type

iirc this is used in syn with token! macro

or we can just create type alias

Rahix commented 3 weeks ago

for example how can tell what's type of pin d9 on UNO is? atmega_hal::port::PB1

This is a good point. I think the avr_hal_generic::renamed_pins! {} macro should generate type aliases for the pins at least. This also shouldn't be too difficult to achieve.

Rahix commented 3 weeks ago

(Created #558 to track this)