embassy/embassy-stm32/src/crc/v1.rs

21 lines
459 B
Rust
Raw Normal View History

2021-09-27 01:29:22 +02:00
use crate::pac::{CRC as PAC_CRC, RCC};
use crate::peripherals::CRC;
use crate::rcc::sealed::RccPeripheral;
pub struct Crc {
_peripheral: CRC
}
impl Crc{
pub fn new(peripheral: CRC) -> Self{
// enable CRC clock in RCC.
CRC::enable();
// Reset CRC to default values.
CRC::reset();
Self { _peripheral: peripheral}
}
pub fn reset() {
unsafe { PAC_CRC.cr().modify(|w| w.set_reset(true)) };
}
}