nrf: better macro naming.
This commit is contained in:
parent
48cf1f6ebf
commit
b9e709403d
@ -380,7 +380,7 @@ impl OptionalPin for NoPin {
|
||||
|
||||
// ====================
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_pin {
|
||||
($type:ident, $port_num:expr, $pin_num:expr) => {
|
||||
impl Pin for peripherals::$type {}
|
||||
impl sealed::Pin for peripherals::$type {
|
||||
@ -392,56 +392,56 @@ macro_rules! make_impl {
|
||||
};
|
||||
}
|
||||
|
||||
make_impl!(P0_00, 0, 0);
|
||||
make_impl!(P0_01, 0, 1);
|
||||
make_impl!(P0_02, 0, 2);
|
||||
make_impl!(P0_03, 0, 3);
|
||||
make_impl!(P0_04, 0, 4);
|
||||
make_impl!(P0_05, 0, 5);
|
||||
make_impl!(P0_06, 0, 6);
|
||||
make_impl!(P0_07, 0, 7);
|
||||
make_impl!(P0_08, 0, 8);
|
||||
make_impl!(P0_09, 0, 9);
|
||||
make_impl!(P0_10, 0, 10);
|
||||
make_impl!(P0_11, 0, 11);
|
||||
make_impl!(P0_12, 0, 12);
|
||||
make_impl!(P0_13, 0, 13);
|
||||
make_impl!(P0_14, 0, 14);
|
||||
make_impl!(P0_15, 0, 15);
|
||||
make_impl!(P0_16, 0, 16);
|
||||
make_impl!(P0_17, 0, 17);
|
||||
make_impl!(P0_18, 0, 18);
|
||||
make_impl!(P0_19, 0, 19);
|
||||
make_impl!(P0_20, 0, 20);
|
||||
make_impl!(P0_21, 0, 21);
|
||||
make_impl!(P0_22, 0, 22);
|
||||
make_impl!(P0_23, 0, 23);
|
||||
make_impl!(P0_24, 0, 24);
|
||||
make_impl!(P0_25, 0, 25);
|
||||
make_impl!(P0_26, 0, 26);
|
||||
make_impl!(P0_27, 0, 27);
|
||||
make_impl!(P0_28, 0, 28);
|
||||
make_impl!(P0_29, 0, 29);
|
||||
make_impl!(P0_30, 0, 30);
|
||||
make_impl!(P0_31, 0, 31);
|
||||
impl_pin!(P0_00, 0, 0);
|
||||
impl_pin!(P0_01, 0, 1);
|
||||
impl_pin!(P0_02, 0, 2);
|
||||
impl_pin!(P0_03, 0, 3);
|
||||
impl_pin!(P0_04, 0, 4);
|
||||
impl_pin!(P0_05, 0, 5);
|
||||
impl_pin!(P0_06, 0, 6);
|
||||
impl_pin!(P0_07, 0, 7);
|
||||
impl_pin!(P0_08, 0, 8);
|
||||
impl_pin!(P0_09, 0, 9);
|
||||
impl_pin!(P0_10, 0, 10);
|
||||
impl_pin!(P0_11, 0, 11);
|
||||
impl_pin!(P0_12, 0, 12);
|
||||
impl_pin!(P0_13, 0, 13);
|
||||
impl_pin!(P0_14, 0, 14);
|
||||
impl_pin!(P0_15, 0, 15);
|
||||
impl_pin!(P0_16, 0, 16);
|
||||
impl_pin!(P0_17, 0, 17);
|
||||
impl_pin!(P0_18, 0, 18);
|
||||
impl_pin!(P0_19, 0, 19);
|
||||
impl_pin!(P0_20, 0, 20);
|
||||
impl_pin!(P0_21, 0, 21);
|
||||
impl_pin!(P0_22, 0, 22);
|
||||
impl_pin!(P0_23, 0, 23);
|
||||
impl_pin!(P0_24, 0, 24);
|
||||
impl_pin!(P0_25, 0, 25);
|
||||
impl_pin!(P0_26, 0, 26);
|
||||
impl_pin!(P0_27, 0, 27);
|
||||
impl_pin!(P0_28, 0, 28);
|
||||
impl_pin!(P0_29, 0, 29);
|
||||
impl_pin!(P0_30, 0, 30);
|
||||
impl_pin!(P0_31, 0, 31);
|
||||
|
||||
#[cfg(any(feature = "52833", feature = "52840"))]
|
||||
mod _p1 {
|
||||
use super::*;
|
||||
make_impl!(P1_00, 1, 0);
|
||||
make_impl!(P1_01, 1, 1);
|
||||
make_impl!(P1_02, 1, 2);
|
||||
make_impl!(P1_03, 1, 3);
|
||||
make_impl!(P1_04, 1, 4);
|
||||
make_impl!(P1_05, 1, 5);
|
||||
make_impl!(P1_06, 1, 6);
|
||||
make_impl!(P1_07, 1, 7);
|
||||
make_impl!(P1_08, 1, 8);
|
||||
make_impl!(P1_09, 1, 9);
|
||||
make_impl!(P1_10, 1, 10);
|
||||
make_impl!(P1_11, 1, 11);
|
||||
make_impl!(P1_12, 1, 12);
|
||||
make_impl!(P1_13, 1, 13);
|
||||
make_impl!(P1_14, 1, 14);
|
||||
make_impl!(P1_15, 1, 15);
|
||||
impl_pin!(P1_00, 1, 0);
|
||||
impl_pin!(P1_01, 1, 1);
|
||||
impl_pin!(P1_02, 1, 2);
|
||||
impl_pin!(P1_03, 1, 3);
|
||||
impl_pin!(P1_04, 1, 4);
|
||||
impl_pin!(P1_05, 1, 5);
|
||||
impl_pin!(P1_06, 1, 6);
|
||||
impl_pin!(P1_07, 1, 7);
|
||||
impl_pin!(P1_08, 1, 8);
|
||||
impl_pin!(P1_09, 1, 9);
|
||||
impl_pin!(P1_10, 1, 10);
|
||||
impl_pin!(P1_11, 1, 11);
|
||||
impl_pin!(P1_12, 1, 12);
|
||||
impl_pin!(P1_13, 1, 13);
|
||||
impl_pin!(P1_14, 1, 14);
|
||||
impl_pin!(P1_15, 1, 15);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ pub trait Instance: sealed::Instance + 'static {
|
||||
type Interrupt: Interrupt;
|
||||
}
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_instance {
|
||||
($type:ident, $irq:ident) => {
|
||||
impl sealed::Instance for peripherals::$type {
|
||||
fn regs(&self) -> &pac::qspi::RegisterBlock {
|
||||
@ -376,4 +376,4 @@ macro_rules! make_impl {
|
||||
};
|
||||
}
|
||||
|
||||
make_impl!(QSPI, QSPI);
|
||||
impl_instance!(QSPI, QSPI);
|
||||
|
@ -268,7 +268,7 @@ mod sealed {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_instance {
|
||||
($type:ident, $irq:ident) => {
|
||||
impl sealed::Instance for peripherals::$type {
|
||||
fn regs(&self) -> &pac::rtc0::RegisterBlock {
|
||||
@ -287,7 +287,7 @@ pub trait Instance: sealed::Instance + 'static {
|
||||
type Interrupt: Interrupt;
|
||||
}
|
||||
|
||||
make_impl!(RTC0, RTC0);
|
||||
make_impl!(RTC1, RTC1);
|
||||
impl_instance!(RTC0, RTC0);
|
||||
impl_instance!(RTC1, RTC1);
|
||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||
make_impl!(RTC2, RTC2);
|
||||
impl_instance!(RTC2, RTC2);
|
||||
|
@ -224,7 +224,7 @@ pub trait Instance: sealed::Instance + 'static {
|
||||
type Interrupt: Interrupt;
|
||||
}
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_instance {
|
||||
($type:ident, $irq:ident) => {
|
||||
impl sealed::Instance for peripherals::$type {
|
||||
fn regs(&self) -> &pac::spim0::RegisterBlock {
|
||||
@ -238,15 +238,15 @@ macro_rules! make_impl {
|
||||
}
|
||||
|
||||
#[cfg(feature = "52810")]
|
||||
make_impl!(SPIM0, SPIM0_SPIS0_SPI0);
|
||||
impl_instance!(SPIM0, SPIM0_SPIS0_SPI0);
|
||||
#[cfg(not(feature = "52810"))]
|
||||
make_impl!(SPIM0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
||||
impl_instance!(SPIM0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
||||
|
||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||
make_impl!(SPIM1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
||||
impl_instance!(SPIM1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
||||
|
||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||
make_impl!(SPIM2, SPIM2_SPIS2_SPI2);
|
||||
impl_instance!(SPIM2, SPIM2_SPIS2_SPI2);
|
||||
|
||||
#[cfg(any(feature = "52833", feature = "52840"))]
|
||||
make_impl!(SPIM3, SPIM3);
|
||||
impl_instance!(SPIM3, SPIM3);
|
||||
|
@ -16,7 +16,7 @@ pub trait Instance: sealed::Instance + 'static {
|
||||
}
|
||||
pub trait ExtendedInstance: Instance + sealed::ExtendedInstance {}
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_instance {
|
||||
($type:ident, $irq:ident) => {
|
||||
impl sealed::Instance for peripherals::$type {
|
||||
fn regs(&self) -> &pac::timer0::RegisterBlock {
|
||||
@ -28,16 +28,16 @@ macro_rules! make_impl {
|
||||
}
|
||||
};
|
||||
($type:ident, $irq:ident, extended) => {
|
||||
make_impl!($type, $irq);
|
||||
impl_instance!($type, $irq);
|
||||
impl sealed::ExtendedInstance for peripherals::$type {}
|
||||
impl ExtendedInstance for peripherals::$type {}
|
||||
};
|
||||
}
|
||||
|
||||
make_impl!(TIMER0, TIMER0);
|
||||
make_impl!(TIMER1, TIMER1);
|
||||
make_impl!(TIMER2, TIMER2);
|
||||
impl_instance!(TIMER0, TIMER0);
|
||||
impl_instance!(TIMER1, TIMER1);
|
||||
impl_instance!(TIMER2, TIMER2);
|
||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||
make_impl!(TIMER3, TIMER3, extended);
|
||||
impl_instance!(TIMER3, TIMER3, extended);
|
||||
#[cfg(any(feature = "52832", feature = "52833", feature = "52840"))]
|
||||
make_impl!(TIMER4, TIMER4, extended);
|
||||
impl_instance!(TIMER4, TIMER4, extended);
|
||||
|
@ -315,7 +315,7 @@ pub trait Instance: sealed::Instance + 'static {
|
||||
type Interrupt: Interrupt;
|
||||
}
|
||||
|
||||
macro_rules! make_impl {
|
||||
macro_rules! impl_instance {
|
||||
($type:ident, $irq:ident) => {
|
||||
impl sealed::Instance for peripherals::$type {
|
||||
fn regs(&self) -> &pac::uarte0::RegisterBlock {
|
||||
@ -328,6 +328,6 @@ macro_rules! make_impl {
|
||||
};
|
||||
}
|
||||
|
||||
make_impl!(UARTE0, UARTE0_UART0);
|
||||
impl_instance!(UARTE0, UARTE0_UART0);
|
||||
#[cfg(any(feature = "52833", feature = "52840", feature = "9160"))]
|
||||
make_impl!(UARTE1, UARTE1);
|
||||
impl_instance!(UARTE1, UARTE1);
|
||||
|
Loading…
Reference in New Issue
Block a user