stm32-rs / bxcan

bxCAN peripheral driver for STM32 chips
Apache License 2.0
32 stars 22 forks source link

`Can::builder` #38

Closed jonas-schievink closed 3 years ago

jonas-schievink commented 3 years ago

Currently (after https://github.com/stm32-rs/bxcan/pull/37), users have to perform 2 steps to use bxCAN: Call Can::new, then call Can::modify_config. The rest is very hard to forget because of #[must_use] on CanConfig.

We could reduce this to 1 step by replacing Can::new by Can::builder, and have that return a CanBuilder that functions similar to CanConfig, but gives you a Can instance when finished.

romixlab commented 3 years ago

Would be really nice to implement timing configuration without involving raw numbers. CAN controller frequency can probably be provided by HALs and time quantas by user.