Open dsvensson opened 6 years ago
The following code:
self.modify_register(config::Register::MDMCFG2, |r| { MDMCFG2(r).modify().sync_mode(mode.value()).bits() })?;
... should ideally not mention MDMCFG2 in the body, nor modify():
self.modify_register(config::Register::MDMCFG2, |r| { r.sync_mode(mode.value()).bits() })?;
And similarily, calling self.read_register(config::Register.:MDMCFG2) should return a MDMCFG2 rather than an u8.
self.read_register(config::Register.:MDMCFG2)
MDMCFG2
u8
Can probably be fixed by introducing some good traits. Figure out how.
This probably requires some broader macro that replaces the per-register-type enum with macro expansion as there's not really a good link between the register value wrappers and the register address enums.
The following code:
... should ideally not mention MDMCFG2 in the body, nor modify():
And similarily, calling
self.read_register(config::Register.:MDMCFG2)
should return aMDMCFG2
rather than anu8
.Can probably be fixed by introducing some good traits. Figure out how.