Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 14:00:19 +02:00
parent 8a9d2f59af
commit 4901c34d9c
62 changed files with 970 additions and 918 deletions

View File

@ -4,12 +4,12 @@ use core::task::Poll;
use embassy::waitqueue::AtomicWaker;
use embassy_hal_common::drop::OnDrop;
use embassy_hal_common::{unborrow, Unborrowed};
use embassy_hal_common::{into_ref, PeripheralRef};
use futures::future::poll_fn;
use crate::interrupt::InterruptExt;
use crate::peripherals::RNG;
use crate::{interrupt, pac, Unborrow};
use crate::{interrupt, pac, Peripheral};
impl RNG {
fn regs() -> &'static pac::rng::RegisterBlock {
@ -33,7 +33,7 @@ struct State {
///
/// It has a non-blocking API, and a blocking api through `rand`.
pub struct Rng<'d> {
irq: Unborrowed<'d, interrupt::RNG>,
irq: PeripheralRef<'d, interrupt::RNG>,
}
impl<'d> Rng<'d> {
@ -43,8 +43,8 @@ impl<'d> Rng<'d> {
/// e.g. using `mem::forget`.
///
/// The synchronous API is safe.
pub fn new(_rng: impl Unborrow<Target = RNG> + 'd, irq: impl Unborrow<Target = interrupt::RNG> + 'd) -> Self {
unborrow!(irq);
pub fn new(_rng: impl Peripheral<P = RNG> + 'd, irq: impl Peripheral<P = interrupt::RNG> + 'd) -> Self {
into_ref!(irq);
let this = Self { irq };