2021-05-11 03:04:59 +02:00
|
|
|
pub use nrf52840_pac as pac;
|
|
|
|
|
2021-08-22 01:23:03 +02:00
|
|
|
/// The maximum buffer size that the EasyDMA can send/recv in one operation.
|
2021-05-11 03:04:59 +02:00
|
|
|
pub const EASY_DMA_SIZE: usize = (1 << 16) - 1;
|
|
|
|
pub const FORCE_COPY_BUFFER_SIZE: usize = 512;
|
|
|
|
|
2021-10-22 02:09:55 +02:00
|
|
|
pub const FLASH_SIZE: usize = 1024 * 1024;
|
|
|
|
|
2023-01-23 01:48:35 +01:00
|
|
|
pub const RESET_PIN: u32 = 18;
|
|
|
|
|
2023-07-28 13:23:22 +02:00
|
|
|
embassy_hal_internal::peripherals! {
|
2021-12-15 18:11:00 +01:00
|
|
|
// USB
|
|
|
|
USBD,
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
// RTC
|
|
|
|
RTC0,
|
|
|
|
RTC1,
|
|
|
|
RTC2,
|
|
|
|
|
2021-08-07 14:26:28 +02:00
|
|
|
// WDT
|
|
|
|
WDT,
|
|
|
|
|
2021-10-22 02:09:55 +02:00
|
|
|
// NVMC
|
|
|
|
NVMC,
|
|
|
|
|
2021-06-29 09:26:16 +02:00
|
|
|
// RNG
|
|
|
|
RNG,
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
// QSPI
|
|
|
|
QSPI,
|
|
|
|
|
2022-05-07 00:46:36 +02:00
|
|
|
// QDEC
|
|
|
|
QDEC,
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
// UARTE
|
|
|
|
UARTE0,
|
|
|
|
UARTE1,
|
|
|
|
|
|
|
|
// SPI/TWI
|
|
|
|
TWISPI0,
|
|
|
|
TWISPI1,
|
|
|
|
SPI2,
|
|
|
|
SPI3,
|
|
|
|
|
|
|
|
// SAADC
|
|
|
|
SAADC,
|
|
|
|
|
2021-05-12 04:56:11 +02:00
|
|
|
// PWM
|
|
|
|
PWM0,
|
|
|
|
PWM1,
|
|
|
|
PWM2,
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
|
|
|
|
P0_00,
|
|
|
|
P0_01,
|
|
|
|
P0_02,
|
|
|
|
P0_03,
|
|
|
|
P0_04,
|
|
|
|
P0_05,
|
|
|
|
P0_06,
|
|
|
|
P0_07,
|
|
|
|
P0_08,
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature = "nfc-pins-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
P0_09,
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature = "nfc-pins-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
P0_10,
|
|
|
|
P0_11,
|
|
|
|
P0_12,
|
|
|
|
P0_13,
|
|
|
|
P0_14,
|
|
|
|
P0_15,
|
|
|
|
P0_16,
|
|
|
|
P0_17,
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature="reset-pin-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
P0_18,
|
|
|
|
P0_19,
|
|
|
|
P0_20,
|
|
|
|
P0_21,
|
|
|
|
P0_22,
|
|
|
|
P0_23,
|
|
|
|
P0_24,
|
|
|
|
P0_25,
|
|
|
|
P0_26,
|
|
|
|
P0_27,
|
|
|
|
P0_28,
|
|
|
|
P0_29,
|
|
|
|
P0_30,
|
|
|
|
P0_31,
|
|
|
|
|
|
|
|
// GPIO port 1
|
|
|
|
P1_00,
|
|
|
|
P1_01,
|
|
|
|
P1_02,
|
|
|
|
P1_03,
|
|
|
|
P1_04,
|
|
|
|
P1_05,
|
|
|
|
P1_06,
|
|
|
|
P1_07,
|
|
|
|
P1_08,
|
|
|
|
P1_09,
|
|
|
|
P1_10,
|
|
|
|
P1_11,
|
|
|
|
P1_12,
|
|
|
|
P1_13,
|
|
|
|
P1_14,
|
|
|
|
P1_15,
|
2021-10-18 15:24:31 +02:00
|
|
|
|
|
|
|
// TEMP
|
|
|
|
TEMP,
|
2022-07-10 20:12:25 +02:00
|
|
|
|
|
|
|
// PDM
|
|
|
|
PDM,
|
2022-11-09 19:14:43 +01:00
|
|
|
|
|
|
|
// I2S
|
|
|
|
I2S,
|
2021-05-11 03:04:59 +02:00
|
|
|
}
|
|
|
|
|
2022-03-30 01:18:37 +02:00
|
|
|
#[cfg(feature = "nightly")]
|
2021-12-15 18:11:00 +01:00
|
|
|
impl_usb!(USBD, USBD, USBD);
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
impl_uarte!(UARTE0, UARTE0, UARTE0_UART0);
|
|
|
|
impl_uarte!(UARTE1, UARTE1, UARTE1);
|
|
|
|
|
|
|
|
impl_spim!(TWISPI0, SPIM0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
|
|
|
impl_spim!(TWISPI1, SPIM1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
|
|
|
impl_spim!(SPI2, SPIM2, SPIM2_SPIS2_SPI2);
|
|
|
|
impl_spim!(SPI3, SPIM3, SPIM3);
|
|
|
|
|
2022-11-05 00:15:43 +01:00
|
|
|
impl_spis!(TWISPI0, SPIS0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
|
|
|
impl_spis!(TWISPI1, SPIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
|
|
|
impl_spis!(SPI2, SPIS2, SPIM2_SPIS2_SPI2);
|
|
|
|
|
2021-05-11 03:07:37 +02:00
|
|
|
impl_twim!(TWISPI0, TWIM0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
|
|
|
impl_twim!(TWISPI1, TWIM1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
|
|
|
|
2022-11-13 22:15:19 +01:00
|
|
|
impl_twis!(TWISPI0, TWIS0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
|
|
|
impl_twis!(TWISPI1, TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1);
|
|
|
|
|
2021-05-12 04:56:11 +02:00
|
|
|
impl_pwm!(PWM0, PWM0, PWM0);
|
|
|
|
impl_pwm!(PWM1, PWM1, PWM1);
|
|
|
|
impl_pwm!(PWM2, PWM2, PWM2);
|
|
|
|
impl_pwm!(PWM3, PWM3, PWM3);
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
impl_timer!(TIMER0, TIMER0, TIMER0);
|
|
|
|
impl_timer!(TIMER1, TIMER1, TIMER1);
|
|
|
|
impl_timer!(TIMER2, TIMER2, TIMER2);
|
|
|
|
impl_timer!(TIMER3, TIMER3, TIMER3, extended);
|
|
|
|
impl_timer!(TIMER4, TIMER4, TIMER4, extended);
|
|
|
|
|
|
|
|
impl_qspi!(QSPI, QSPI, QSPI);
|
|
|
|
|
2023-03-05 20:50:45 +01:00
|
|
|
impl_pdm!(PDM, PDM, PDM);
|
|
|
|
|
2023-03-05 21:28:13 +01:00
|
|
|
impl_qdec!(QDEC, QDEC, QDEC);
|
|
|
|
|
2023-03-05 21:50:15 +01:00
|
|
|
impl_rng!(RNG, RNG, RNG);
|
|
|
|
|
2021-05-11 03:04:59 +02:00
|
|
|
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);
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature = "nfc-pins-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
impl_pin!(P0_09, 0, 9);
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature = "nfc-pins-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
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);
|
2023-01-23 01:48:35 +01:00
|
|
|
#[cfg(feature = "reset-pin-as-gpio")]
|
2021-05-11 03:04:59 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2021-10-26 09:45:29 +02:00
|
|
|
impl_ppi_channel!(PPI_CH0, 0 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH1, 1 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH2, 2 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH3, 3 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH4, 4 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH5, 5 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH6, 6 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH7, 7 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH8, 8 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH9, 9 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH10, 10 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH11, 11 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH12, 12 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH13, 13 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH14, 14 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH15, 15 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH16, 16 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH17, 17 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH18, 18 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH19, 19 => configurable);
|
|
|
|
impl_ppi_channel!(PPI_CH20, 20 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH21, 21 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH22, 22 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH23, 23 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH24, 24 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH25, 25 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH26, 26 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH27, 27 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH28, 28 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH29, 29 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH30, 30 => static);
|
|
|
|
impl_ppi_channel!(PPI_CH31, 31 => static);
|
2021-10-11 01:19:06 +02:00
|
|
|
|
2022-10-26 09:13:26 +02:00
|
|
|
impl_saadc_input!(P0_02, ANALOG_INPUT0);
|
|
|
|
impl_saadc_input!(P0_03, ANALOG_INPUT1);
|
|
|
|
impl_saadc_input!(P0_04, ANALOG_INPUT2);
|
|
|
|
impl_saadc_input!(P0_05, ANALOG_INPUT3);
|
|
|
|
impl_saadc_input!(P0_28, ANALOG_INPUT4);
|
|
|
|
impl_saadc_input!(P0_29, ANALOG_INPUT5);
|
|
|
|
impl_saadc_input!(P0_30, ANALOG_INPUT6);
|
|
|
|
impl_saadc_input!(P0_31, ANALOG_INPUT7);
|
2021-10-11 01:22:01 +02:00
|
|
|
|
2022-11-09 19:14:43 +01:00
|
|
|
impl_i2s!(I2S, I2S, I2S);
|
|
|
|
|
2023-07-28 13:23:22 +02:00
|
|
|
embassy_hal_internal::interrupt_mod!(
|
2023-06-08 16:08:40 +02:00
|
|
|
POWER_CLOCK,
|
|
|
|
RADIO,
|
|
|
|
UARTE0_UART0,
|
|
|
|
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0,
|
|
|
|
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1,
|
|
|
|
NFCT,
|
|
|
|
GPIOTE,
|
|
|
|
SAADC,
|
|
|
|
TIMER0,
|
|
|
|
TIMER1,
|
|
|
|
TIMER2,
|
|
|
|
RTC0,
|
|
|
|
TEMP,
|
|
|
|
RNG,
|
|
|
|
ECB,
|
|
|
|
CCM_AAR,
|
|
|
|
WDT,
|
|
|
|
RTC1,
|
|
|
|
QDEC,
|
|
|
|
COMP_LPCOMP,
|
|
|
|
SWI0_EGU0,
|
|
|
|
SWI1_EGU1,
|
|
|
|
SWI2_EGU2,
|
|
|
|
SWI3_EGU3,
|
|
|
|
SWI4_EGU4,
|
|
|
|
SWI5_EGU5,
|
|
|
|
TIMER3,
|
|
|
|
TIMER4,
|
|
|
|
PWM0,
|
|
|
|
PDM,
|
|
|
|
MWU,
|
|
|
|
PWM1,
|
|
|
|
PWM2,
|
|
|
|
SPIM2_SPIS2_SPI2,
|
|
|
|
RTC2,
|
|
|
|
FPU,
|
|
|
|
USBD,
|
|
|
|
UARTE1,
|
|
|
|
QSPI,
|
|
|
|
CRYPTOCELL,
|
|
|
|
PWM3,
|
|
|
|
SPIM3,
|
|
|
|
I2S,
|
|
|
|
);
|