Mark Unborrow as unsafe to implement
This commit is contained in:
@ -5,7 +5,7 @@ use core::hint::unreachable_unchecked;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use embassy::util::Unborrow;
|
||||
use embassy_extras::{impl_unborrow, unborrow};
|
||||
use embassy_extras::{unborrow, unsafe_impl_unborrow};
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin, StatefulOutputPin};
|
||||
use gpio::pin_cnf::DRIVE_A;
|
||||
|
||||
@ -330,7 +330,7 @@ pub(crate) mod sealed {
|
||||
pub trait OptionalPin {}
|
||||
}
|
||||
|
||||
pub trait Pin: Unborrow<Target = Self> + sealed::Pin + Sized {
|
||||
pub trait Pin: Unborrow<Target = Self> + sealed::Pin + Sized + 'static {
|
||||
/// Number of the pin within the port (0..31)
|
||||
#[inline]
|
||||
fn pin(&self) -> u8 {
|
||||
@ -374,7 +374,7 @@ impl AnyPin {
|
||||
}
|
||||
}
|
||||
|
||||
impl_unborrow!(AnyPin);
|
||||
unsafe_impl_unborrow!(AnyPin);
|
||||
impl Pin for AnyPin {}
|
||||
impl sealed::Pin for AnyPin {
|
||||
#[inline]
|
||||
@ -469,7 +469,7 @@ impl<T: Pin> OptionalPin for T {
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct NoPin;
|
||||
impl_unborrow!(NoPin);
|
||||
unsafe_impl_unborrow!(NoPin);
|
||||
impl sealed::OptionalPin for NoPin {}
|
||||
impl OptionalPin for NoPin {
|
||||
type Pin = AnyPin;
|
||||
|
@ -5,7 +5,7 @@ use core::task::{Context, Poll};
|
||||
use embassy::interrupt::{Interrupt, InterruptExt};
|
||||
use embassy::traits::gpio::{WaitForAnyEdge, WaitForHigh, WaitForLow};
|
||||
use embassy::util::AtomicWaker;
|
||||
use embassy_extras::impl_unborrow;
|
||||
use embassy_extras::unsafe_impl_unborrow;
|
||||
use embedded_hal::digital::v2::{InputPin, StatefulOutputPin};
|
||||
use futures::future::poll_fn;
|
||||
|
||||
@ -382,7 +382,7 @@ pub trait Channel: sealed::Channel + Sized {
|
||||
pub struct AnyChannel {
|
||||
number: u8,
|
||||
}
|
||||
impl_unborrow!(AnyChannel);
|
||||
unsafe_impl_unborrow!(AnyChannel);
|
||||
impl sealed::Channel for AnyChannel {}
|
||||
impl Channel for AnyChannel {
|
||||
fn number(&self) -> usize {
|
||||
|
@ -12,7 +12,7 @@
|
||||
use core::marker::PhantomData;
|
||||
use core::ptr::NonNull;
|
||||
use embassy::util::Unborrow;
|
||||
use embassy_extras::{impl_unborrow, unborrow};
|
||||
use embassy_extras::{unborrow, unsafe_impl_unborrow};
|
||||
|
||||
use crate::{pac, peripherals};
|
||||
|
||||
@ -146,7 +146,7 @@ pub trait Group: sealed::Group + Sized {
|
||||
pub struct AnyChannel {
|
||||
number: u8,
|
||||
}
|
||||
impl_unborrow!(AnyChannel);
|
||||
unsafe_impl_unborrow!(AnyChannel);
|
||||
impl sealed::Channel for AnyChannel {}
|
||||
impl Channel for AnyChannel {
|
||||
fn number(&self) -> usize {
|
||||
@ -157,7 +157,7 @@ impl Channel for AnyChannel {
|
||||
pub struct AnyConfigurableChannel {
|
||||
number: u8,
|
||||
}
|
||||
impl_unborrow!(AnyConfigurableChannel);
|
||||
unsafe_impl_unborrow!(AnyConfigurableChannel);
|
||||
impl sealed::Channel for AnyConfigurableChannel {}
|
||||
impl sealed::ConfigurableChannel for AnyConfigurableChannel {}
|
||||
impl ConfigurableChannel for AnyConfigurableChannel {}
|
||||
@ -226,7 +226,7 @@ impl_channel!(PPI_CH31, 31);
|
||||
pub struct AnyGroup {
|
||||
number: u8,
|
||||
}
|
||||
impl_unborrow!(AnyGroup);
|
||||
unsafe_impl_unborrow!(AnyGroup);
|
||||
impl sealed::Group for AnyGroup {}
|
||||
impl Group for AnyGroup {
|
||||
fn number(&self) -> usize {
|
||||
|
@ -190,7 +190,7 @@ impl<'d, T: PositivePin> Sample for OneShot<'d, T> {
|
||||
/// A pin that can be used as the positive end of a ADC differential in the SAADC periperhal.
|
||||
///
|
||||
/// Currently negative is always shorted to ground (0V).
|
||||
pub trait PositivePin {
|
||||
pub trait PositivePin: Unborrow<Target = Self> {
|
||||
fn channel(&self) -> PositiveChannel;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user