Update embassy-stm32
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use embassy_hal_common::unborrow;
|
||||
use embassy_hal_common::{unborrow, Unborrowed};
|
||||
|
||||
use crate::pac::CRC as PAC_CRC;
|
||||
use crate::peripherals::CRC;
|
||||
@ -8,24 +6,21 @@ use crate::rcc::sealed::RccPeripheral;
|
||||
use crate::Unborrow;
|
||||
|
||||
pub struct Crc<'d> {
|
||||
_peripheral: CRC,
|
||||
_phantom: PhantomData<&'d mut CRC>,
|
||||
_peri: Unborrowed<'d, CRC>,
|
||||
}
|
||||
|
||||
impl<'d> Crc<'d> {
|
||||
/// Instantiates the CRC32 peripheral and initializes it to default values.
|
||||
pub fn new(peripheral: impl Unborrow<Target = CRC> + 'd) -> Self {
|
||||
unborrow!(peripheral);
|
||||
|
||||
// Note: enable and reset come from RccPeripheral.
|
||||
// enable CRC clock in RCC.
|
||||
CRC::enable();
|
||||
// Reset CRC to default values.
|
||||
CRC::reset();
|
||||
// Unborrow the peripheral
|
||||
unborrow!(peripheral);
|
||||
let mut instance = Self {
|
||||
_peripheral: peripheral,
|
||||
_phantom: PhantomData,
|
||||
};
|
||||
let mut instance = Self { _peri: peripheral };
|
||||
instance.reset();
|
||||
instance
|
||||
}
|
||||
|
Reference in New Issue
Block a user