Flesh out v2 config writes

This commit is contained in:
Joshua Salzedo 2021-09-26 18:39:55 -07:00
parent afef19d813
commit 8fac444c4e
No known key found for this signature in database
GPG key ID: C3D0EB484493B731

View file

@ -55,9 +55,11 @@ impl Crc {
CRC::reset();
let mut instance = Self {
_peripheral: peripheral,
_config: config
};
instance.init();
instance
unimplemented!();
// instance.init();
// instance
}
// Configure device settings
@ -84,4 +86,28 @@ impl Crc {
)})
}
}
fn configure_polysize(&mut self) {
unsafe {
PAC_CRC.cr().modify(|w| {w.set_polysize(
match self._config.poly_size {
PolySize::Width7 => {vals::Polysize::POLYSIZE7}
PolySize::Width8 => {vals::Polysize::POLYSIZE8}
PolySize::Width16 => {vals::Polysize::POLYSIZE16}
PolySize::Width32 => {vals::Polysize::POLYSIZE32}
}
)})
}
}
pub fn reset(&mut self) {
unsafe { PAC_CRC.cr().modify(|w| w.set_reset(true)); }
}
fn set_crc_init(&mut self, value: u32) {
unsafe {
PAC_CRC.init().write_value(value)
}
}
}