Start work on CRC_v1
This commit is contained in:
parent
f8d833e0c5
commit
e527892d89
5 changed files with 27 additions and 0 deletions
4
embassy-stm32/src/crc/mod.rs
Normal file
4
embassy-stm32/src/crc/mod.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
#[cfg_attr(crc_v1, path = "v1.rs")]
|
||||
#[cfg_attr(crc_v2, path = "v2.rs")]
|
||||
#[cfg_attr(crc_v3, path = "v3.rs")]
|
||||
mod _version;
|
21
embassy-stm32/src/crc/v1.rs
Normal file
21
embassy-stm32/src/crc/v1.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
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)) };
|
||||
}
|
||||
}
|
0
embassy-stm32/src/crc/v2.rs
Normal file
0
embassy-stm32/src/crc/v2.rs
Normal file
0
embassy-stm32/src/crc/v3.rs
Normal file
0
embassy-stm32/src/crc/v3.rs
Normal file
|
@ -49,6 +49,8 @@ pub mod sdmmc;
|
|||
pub mod spi;
|
||||
#[cfg(usart)]
|
||||
pub mod usart;
|
||||
#[cfg(crc)]
|
||||
pub mod crc;
|
||||
|
||||
#[cfg(feature = "subghz")]
|
||||
pub mod subghz;
|
||||
|
|
Loading…
Reference in a new issue