mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
Rename unsafe_impl_unborrow to impl_unborrow
This commit is contained in:
parent
f9f2de3dfb
commit
be6408e202
@ -21,7 +21,7 @@ macro_rules! peripherals {
|
||||
}
|
||||
|
||||
$(#[$cfg])?
|
||||
$crate::unsafe_impl_unborrow!($name);
|
||||
$crate::impl_unborrow!($name);
|
||||
)*
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ macro_rules! unborrow {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! unsafe_impl_unborrow {
|
||||
macro_rules! impl_unborrow {
|
||||
($type:ident) => {
|
||||
impl $crate::Unborrow for $type {
|
||||
type Target = $type;
|
||||
|
@ -25,7 +25,7 @@ pub fn run(name: syn::Ident) -> Result<TokenStream, TokenStream> {
|
||||
}
|
||||
}
|
||||
|
||||
::embassy_hal_common::unsafe_impl_unborrow!(#name_interrupt);
|
||||
::embassy_hal_common::impl_unborrow!(#name_interrupt);
|
||||
};
|
||||
Ok(result)
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use core::convert::Infallible;
|
||||
use core::hint::unreachable_unchecked;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use embassy_hal_common::{unborrow, unsafe_impl_unborrow, Unborrowed};
|
||||
use embassy_hal_common::{impl_unborrow, unborrow, Unborrowed};
|
||||
|
||||
use self::sealed::Pin as _;
|
||||
use crate::pac::p0 as gpio;
|
||||
@ -432,7 +432,7 @@ macro_rules! unborrow_and_degrade {
|
||||
};
|
||||
}
|
||||
|
||||
unsafe_impl_unborrow!(AnyPin);
|
||||
impl_unborrow!(AnyPin);
|
||||
impl Pin for AnyPin {}
|
||||
impl sealed::Pin for AnyPin {
|
||||
#[inline]
|
||||
|
@ -4,7 +4,7 @@ use core::marker::PhantomData;
|
||||
use core::task::{Context, Poll};
|
||||
|
||||
use embassy::waitqueue::AtomicWaker;
|
||||
use embassy_hal_common::unsafe_impl_unborrow;
|
||||
use embassy_hal_common::impl_unborrow;
|
||||
use futures::future::poll_fn;
|
||||
|
||||
use crate::gpio::sealed::Pin as _;
|
||||
@ -414,7 +414,7 @@ pub trait Channel: sealed::Channel + Sized {
|
||||
pub struct AnyChannel {
|
||||
number: u8,
|
||||
}
|
||||
unsafe_impl_unborrow!(AnyChannel);
|
||||
impl_unborrow!(AnyChannel);
|
||||
impl sealed::Channel for AnyChannel {}
|
||||
impl Channel for AnyChannel {
|
||||
fn number(&self) -> usize {
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
use core::ptr::NonNull;
|
||||
|
||||
use embassy_hal_common::{unsafe_impl_unborrow, Unborrowed};
|
||||
use embassy_hal_common::{impl_unborrow, Unborrowed};
|
||||
|
||||
use crate::{peripherals, Unborrow};
|
||||
|
||||
@ -117,7 +117,7 @@ pub trait Group: sealed::Group + Sized {
|
||||
pub struct AnyStaticChannel {
|
||||
pub(crate) number: u8,
|
||||
}
|
||||
unsafe_impl_unborrow!(AnyStaticChannel);
|
||||
impl_unborrow!(AnyStaticChannel);
|
||||
impl sealed::Channel for AnyStaticChannel {}
|
||||
impl Channel for AnyStaticChannel {
|
||||
fn number(&self) -> usize {
|
||||
@ -135,7 +135,7 @@ impl StaticChannel for AnyStaticChannel {
|
||||
pub struct AnyConfigurableChannel {
|
||||
pub(crate) number: u8,
|
||||
}
|
||||
unsafe_impl_unborrow!(AnyConfigurableChannel);
|
||||
impl_unborrow!(AnyConfigurableChannel);
|
||||
impl sealed::Channel for AnyConfigurableChannel {}
|
||||
impl Channel for AnyConfigurableChannel {
|
||||
fn number(&self) -> usize {
|
||||
@ -187,7 +187,7 @@ macro_rules! impl_ppi_channel {
|
||||
pub struct AnyGroup {
|
||||
number: u8,
|
||||
}
|
||||
unsafe_impl_unborrow!(AnyGroup);
|
||||
impl_unborrow!(AnyGroup);
|
||||
impl sealed::Group for AnyGroup {}
|
||||
impl Group for AnyGroup {
|
||||
fn number(&self) -> usize {
|
||||
|
@ -5,7 +5,7 @@ use core::sync::atomic::{compiler_fence, Ordering};
|
||||
use core::task::Poll;
|
||||
|
||||
use embassy::waitqueue::AtomicWaker;
|
||||
use embassy_hal_common::{unborrow, unsafe_impl_unborrow};
|
||||
use embassy_hal_common::{impl_unborrow, unborrow};
|
||||
use futures::future::poll_fn;
|
||||
use pac::{saadc, SAADC};
|
||||
use saadc::ch::config::{GAIN_A, REFSEL_A, RESP_A, TACQ_A};
|
||||
@ -77,7 +77,7 @@ pub struct ChannelConfig<'d> {
|
||||
/// internal voltage.
|
||||
pub struct VddInput;
|
||||
|
||||
unsafe_impl_unborrow!(VddInput);
|
||||
impl_unborrow!(VddInput);
|
||||
|
||||
impl sealed::Input for VddInput {
|
||||
#[cfg(not(feature = "_nrf9160"))]
|
||||
@ -97,7 +97,7 @@ impl Input for VddInput {}
|
||||
pub struct VddhDiv5Input;
|
||||
|
||||
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
|
||||
unsafe_impl_unborrow!(VddhDiv5Input);
|
||||
impl_unborrow!(VddhDiv5Input);
|
||||
|
||||
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
|
||||
impl sealed::Input for VddhDiv5Input {
|
||||
@ -113,12 +113,7 @@ pub struct AnyInput {
|
||||
channel: InputChannel,
|
||||
}
|
||||
|
||||
unsafe impl Unborrow for AnyInput {
|
||||
type Target = AnyInput;
|
||||
unsafe fn unborrow(self) -> Self::Target {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl_unborrow!(AnyInput);
|
||||
|
||||
impl sealed::Input for AnyInput {
|
||||
fn channel(&self) -> InputChannel {
|
||||
|
@ -5,7 +5,7 @@ use core::task::{Context, Poll};
|
||||
|
||||
use embassy::waitqueue::AtomicWaker;
|
||||
use embassy_cortex_m::interrupt::{Interrupt, InterruptExt};
|
||||
use embassy_hal_common::{unborrow, unsafe_impl_unborrow, Unborrowed};
|
||||
use embassy_hal_common::{impl_unborrow, unborrow, Unborrowed};
|
||||
|
||||
use crate::pac::common::{Reg, RW};
|
||||
use crate::pac::SIO;
|
||||
@ -676,7 +676,7 @@ macro_rules! unborrow_and_degrade {
|
||||
};
|
||||
}
|
||||
|
||||
unsafe_impl_unborrow!(AnyPin);
|
||||
impl_unborrow!(AnyPin);
|
||||
|
||||
impl Pin for AnyPin {}
|
||||
impl sealed::Pin for AnyPin {
|
||||
|
@ -13,10 +13,10 @@ use core::mem;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll, Waker};
|
||||
|
||||
#[cfg(dmamux)]
|
||||
pub use dmamux::*;
|
||||
use embassy_hal_common::unborrow;
|
||||
use embassy_hal_common::{impl_unborrow, unborrow};
|
||||
|
||||
#[cfg(dmamux)]
|
||||
pub use self::dmamux::*;
|
||||
use crate::Unborrow;
|
||||
|
||||
#[cfg(feature = "unstable-pac")]
|
||||
@ -294,13 +294,7 @@ pub trait Channel: sealed::Channel + Unborrow<Target = Self> + 'static {}
|
||||
|
||||
pub struct NoDma;
|
||||
|
||||
unsafe impl Unborrow for NoDma {
|
||||
type Target = NoDma;
|
||||
|
||||
unsafe fn unborrow(self) -> Self::Target {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl_unborrow!(NoDma);
|
||||
|
||||
// safety: must be called only once at startup
|
||||
pub(crate) unsafe fn init() {
|
||||
|
@ -4,7 +4,7 @@ use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
|
||||
use embassy::waitqueue::AtomicWaker;
|
||||
use embassy_hal_common::unsafe_impl_unborrow;
|
||||
use embassy_hal_common::impl_unborrow;
|
||||
|
||||
use crate::gpio::{AnyPin, Input, Pin as GpioPin};
|
||||
use crate::pac::exti::regs::Lines;
|
||||
@ -320,7 +320,7 @@ pub trait Channel: sealed::Channel + Sized {
|
||||
pub struct AnyChannel {
|
||||
number: u8,
|
||||
}
|
||||
unsafe_impl_unborrow!(AnyChannel);
|
||||
impl_unborrow!(AnyChannel);
|
||||
impl sealed::Channel for AnyChannel {}
|
||||
impl Channel for AnyChannel {
|
||||
fn number(&self) -> usize {
|
||||
|
@ -2,7 +2,7 @@
|
||||
use core::convert::Infallible;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use embassy_hal_common::{unborrow, unsafe_impl_unborrow};
|
||||
use embassy_hal_common::{impl_unborrow, unborrow};
|
||||
|
||||
use crate::pac::gpio::{self, vals};
|
||||
use crate::{pac, peripherals, Unborrow};
|
||||
@ -673,7 +673,7 @@ impl AnyPin {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe_impl_unborrow!(AnyPin);
|
||||
impl_unborrow!(AnyPin);
|
||||
impl Pin for AnyPin {
|
||||
#[cfg(feature = "exti")]
|
||||
type ExtiChannel = crate::exti::AnyChannel;
|
||||
|
Loading…
Reference in New Issue
Block a user