adamgreig / stm32ral

Register access layer in Rust for all STM32 microcontrollers
Apache License 2.0
34 stars 7 forks source link

Reset flag has no counterpart like Enabled/Disabled #7

Closed pftbest closed 5 years ago

pftbest commented 5 years ago

For example to reset SPI I need to do two operations: First set Reset flag:

let rcc2 = stm32ral::rcc::RCC::take().unwrap();
modify_reg!(stm32ral::rcc, rcc2, APB1RSTR, SPI2RST: Reset);

Then I need to clear it:

modify_reg!(stm32ral::rcc, rcc2, APB1RSTR, SPI2RST: 0);

But there is no constant defined for this, so I have to use literal 0 instead. It would be great to have a flag like ResetClear for example.

adamgreig commented 5 years ago

Good point, probably just Clear would work even. This would need to be fixed in stm32-rs upstream, i.e. by adding some Clear values to this field, and then stm32ral could be updated.