Add missing + 'd on unborrows.

This commit is contained in:
Dario Nieuwenhuis
2022-02-10 16:06:42 +01:00
parent 550da471be
commit a8bd3ab952
9 changed files with 45 additions and 32 deletions

View File

@ -1,16 +1,19 @@
use core::marker::PhantomData;
use crate::pac::CRC as PAC_CRC;
use crate::peripherals::CRC;
use crate::rcc::sealed::RccPeripheral;
use embassy::util::Unborrow;
use embassy_hal_common::unborrow;
pub struct Crc {
pub struct Crc<'d> {
_peripheral: CRC,
_phantom: PhantomData<&'d mut CRC>,
}
impl Crc {
impl<'d> Crc<'d> {
/// Instantiates the CRC32 peripheral and initializes it to default values.
pub fn new(peripheral: impl Unborrow<Target = CRC>) -> Self {
pub fn new(peripheral: impl Unborrow<Target = CRC> + 'd) -> Self {
// Note: enable and reset come from RccPeripheral.
// enable CRC clock in RCC.
CRC::enable();
@ -20,6 +23,7 @@ impl Crc {
unborrow!(peripheral);
let mut instance = Self {
_peripheral: peripheral,
_phantom: PhantomData,
};
instance.reset();
instance