diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-10-26 17:11:51 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-10-26 17:40:07 +0200 |
| commit | c995a97f2032d329c2955c79054b7e466b0b423b (patch) | |
| tree | 9b59d0517706370e79291ea6a6720eeacb489d76 | |
| parent | 7cb34760c4bd4d98f38437c36769c54c56047a10 (diff) | |
nrf91: support running in both S and NS mode.
| -rw-r--r-- | .github/workflows/rust.yml | 5 | ||||
| -rw-r--r-- | embassy-nrf/Cargo.toml | 5 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf9160.rs | 168 | ||||
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/lib.rs | 50 | ||||
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 4 | ||||
| -rw-r--r-- | embassy-nrf/src/uarte.rs | 4 | ||||
| -rw-r--r-- | embassy-nrf/src/wdt.rs | 4 |
8 files changed, 175 insertions, 73 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ff30a09a7..4415fd987 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml | |||
| @@ -56,7 +56,10 @@ jobs: | |||
| 56 | features: nrf52833 | 56 | features: nrf52833 |
| 57 | - package: embassy-nrf | 57 | - package: embassy-nrf |
| 58 | target: thumbv8m.main-none-eabihf | 58 | target: thumbv8m.main-none-eabihf |
| 59 | features: nrf9160 | 59 | features: nrf9160-s |
| 60 | - package: embassy-nrf | ||
| 61 | target: thumbv8m.main-none-eabihf | ||
| 62 | features: nrf9160-ns | ||
| 60 | - package: embassy-nrf | 63 | - package: embassy-nrf |
| 61 | target: thumbv7em-none-eabi | 64 | target: thumbv7em-none-eabi |
| 62 | features: nrf52840 | 65 | features: nrf52840 |
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index c083978c3..479e2f912 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml | |||
| @@ -25,10 +25,13 @@ nrf52820 = ["nrf52820-pac", "_ppi"] | |||
| 25 | nrf52832 = ["nrf52832-pac", "_ppi"] | 25 | nrf52832 = ["nrf52832-pac", "_ppi"] |
| 26 | nrf52833 = ["nrf52833-pac", "_ppi"] | 26 | nrf52833 = ["nrf52833-pac", "_ppi"] |
| 27 | nrf52840 = ["nrf52840-pac", "_ppi"] | 27 | nrf52840 = ["nrf52840-pac", "_ppi"] |
| 28 | nrf9160 = ["nrf9160-pac", "_dppi"] | 28 | nrf9160-s = ["_nrf9160"] |
| 29 | nrf9160-ns = ["_nrf9160"] | ||
| 29 | 30 | ||
| 30 | # Features starting with `_` are for internal use only. They're not intended | 31 | # Features starting with `_` are for internal use only. They're not intended |
| 31 | # to be enabled by other crates, and are not covered by semver guarantees. | 32 | # to be enabled by other crates, and are not covered by semver guarantees. |
| 33 | |||
| 34 | _nrf9160 = ["nrf9160-pac", "_dppi"] | ||
| 32 | _time-driver = ["embassy/time-tick-32768hz"] | 35 | _time-driver = ["embassy/time-tick-32768hz"] |
| 33 | _ppi = [] | 36 | _ppi = [] |
| 34 | _dppi = [] | 37 | _dppi = [] |
diff --git a/embassy-nrf/src/chips/nrf9160.rs b/embassy-nrf/src/chips/nrf9160.rs index 6ca918104..3db1e77f2 100644 --- a/embassy-nrf/src/chips/nrf9160.rs +++ b/embassy-nrf/src/chips/nrf9160.rs | |||
| @@ -1,10 +1,14 @@ | |||
| 1 | #[allow(unused_imports)] | 1 | #[allow(unused_imports)] |
| 2 | #[rustfmt::skip] | ||
| 2 | pub mod pac { | 3 | pub mod pac { |
| 3 | // The nRF9160 has a secure and non-secure (NS) mode. | 4 | // The nRF9160 has a secure and non-secure (NS) mode. |
| 4 | // For now we only support the NS mode, but those peripherals have `_ns` appended to them. | 5 | // For now we only support the NS mode, but those peripherals have `_ns` appended to them. |
| 5 | // To avoid cfg spam, weŕe going to rename the ones we use here. | 6 | // To avoid cfg spam, weŕe going to rename the ones we use here. |
| 6 | #[rustfmt::skip] | 7 | |
| 7 | pub(crate) use nrf9160_pac::{ | 8 | pub use nrf9160_pac::{ |
| 9 | interrupt, | ||
| 10 | Interrupt, | ||
| 11 | |||
| 8 | p0_ns as p0, | 12 | p0_ns as p0, |
| 9 | pwm0_ns as pwm0, | 13 | pwm0_ns as pwm0, |
| 10 | rtc0_ns as rtc0, | 14 | rtc0_ns as rtc0, |
| @@ -12,17 +16,123 @@ pub mod pac { | |||
| 12 | timer0_ns as timer0, | 16 | timer0_ns as timer0, |
| 13 | twim0_ns as twim0, | 17 | twim0_ns as twim0, |
| 14 | uarte0_ns as uarte0, | 18 | uarte0_ns as uarte0, |
| 19 | saadc_ns as saadc, | ||
| 20 | }; | ||
| 21 | |||
| 22 | #[cfg(feature = "nrf9160-ns")] | ||
| 23 | pub use nrf9160_pac::{ | ||
| 24 | CLOCK_NS as CLOCK, | ||
| 15 | DPPIC_NS as PPI, | 25 | DPPIC_NS as PPI, |
| 26 | EGU0_NS as EGU0, | ||
| 27 | EGU1_NS as EGU1, | ||
| 28 | EGU2_NS as EGU2, | ||
| 29 | EGU3_NS as EGU3, | ||
| 30 | EGU4_NS as EGU4, | ||
| 31 | EGU5_NS as EGU5, | ||
| 32 | FPU_NS as FPU, | ||
| 16 | GPIOTE1_NS as GPIOTE, | 33 | GPIOTE1_NS as GPIOTE, |
| 34 | I2S_NS as I2S, | ||
| 35 | IPC_NS as IPC, | ||
| 36 | KMU_NS as KMU, | ||
| 37 | NVMC_NS as NVMC, | ||
| 17 | P0_NS as P0, | 38 | P0_NS as P0, |
| 39 | PDM_NS as PDM, | ||
| 40 | POWER_NS as POWER, | ||
| 41 | PWM0_NS as PWM0, | ||
| 42 | PWM1_NS as PWM1, | ||
| 43 | PWM2_NS as PWM2, | ||
| 44 | PWM3_NS as PWM3, | ||
| 45 | REGULATORS_NS as REGULATORS, | ||
| 46 | RTC0_NS as RTC0, | ||
| 18 | RTC1_NS as RTC1, | 47 | RTC1_NS as RTC1, |
| 19 | WDT_NS as WDT, | ||
| 20 | saadc_ns as saadc, | ||
| 21 | SAADC_NS as SAADC, | 48 | SAADC_NS as SAADC, |
| 22 | CLOCK_NS as CLOCK, | 49 | SPIM0_NS as SPIM0, |
| 50 | SPIM1_NS as SPIM1, | ||
| 51 | SPIM2_NS as SPIM2, | ||
| 52 | SPIM3_NS as SPIM3, | ||
| 53 | SPIS0_NS as SPIS0, | ||
| 54 | SPIS1_NS as SPIS1, | ||
| 55 | SPIS2_NS as SPIS2, | ||
| 56 | SPIS3_NS as SPIS3, | ||
| 57 | TIMER0_NS as TIMER0, | ||
| 58 | TIMER1_NS as TIMER1, | ||
| 59 | TIMER2_NS as TIMER2, | ||
| 60 | TWIM0_NS as TWIM0, | ||
| 61 | TWIM1_NS as TWIM1, | ||
| 62 | TWIM2_NS as TWIM2, | ||
| 63 | TWIM3_NS as TWIM3, | ||
| 64 | TWIS0_NS as TWIS0, | ||
| 65 | TWIS1_NS as TWIS1, | ||
| 66 | TWIS2_NS as TWIS2, | ||
| 67 | TWIS3_NS as TWIS3, | ||
| 68 | UARTE0_NS as UARTE0, | ||
| 69 | UARTE1_NS as UARTE1, | ||
| 70 | UARTE2_NS as UARTE2, | ||
| 71 | UARTE3_NS as UARTE3, | ||
| 72 | VMC_NS as VMC, | ||
| 73 | WDT_NS as WDT, | ||
| 23 | }; | 74 | }; |
| 24 | 75 | ||
| 25 | pub use nrf9160_pac::*; | 76 | #[cfg(feature = "nrf9160-s")] |
| 77 | pub use nrf9160_pac::{ | ||
| 78 | CC_HOST_RGF_S as CC_HOST_RGF, | ||
| 79 | CLOCK_S as CLOCK, | ||
| 80 | CRYPTOCELL_S as CRYPTOCELL, | ||
| 81 | CTRL_AP_PERI_S as CTRL_AP_PERI, | ||
| 82 | DPPIC_S as PPI, | ||
| 83 | EGU0_S as EGU0, | ||
| 84 | EGU1_S as EGU1, | ||
| 85 | EGU2_S as EGU2, | ||
| 86 | EGU3_S as EGU3, | ||
| 87 | EGU4_S as EGU4, | ||
| 88 | EGU5_S as EGU5, | ||
| 89 | FICR_S as FICR, | ||
| 90 | FPU_S as FPU, | ||
| 91 | GPIOTE0_S as GPIOTE, | ||
| 92 | I2S_S as I2S, | ||
| 93 | IPC_S as IPC, | ||
| 94 | KMU_S as KMU, | ||
| 95 | NVMC_S as NVMC, | ||
| 96 | P0_S as P0, | ||
| 97 | PDM_S as PDM, | ||
| 98 | POWER_S as POWER, | ||
| 99 | PWM0_S as PWM0, | ||
| 100 | PWM1_S as PWM1, | ||
| 101 | PWM2_S as PWM2, | ||
| 102 | PWM3_S as PWM3, | ||
| 103 | REGULATORS_S as REGULATORS, | ||
| 104 | RTC0_S as RTC0, | ||
| 105 | RTC1_S as RTC1, | ||
| 106 | SAADC_S as SAADC, | ||
| 107 | SPIM0_S as SPIM0, | ||
| 108 | SPIM1_S as SPIM1, | ||
| 109 | SPIM2_S as SPIM2, | ||
| 110 | SPIM3_S as SPIM3, | ||
| 111 | SPIS0_S as SPIS0, | ||
| 112 | SPIS1_S as SPIS1, | ||
| 113 | SPIS2_S as SPIS2, | ||
| 114 | SPIS3_S as SPIS3, | ||
| 115 | SPU_S as SPU, | ||
| 116 | TAD_S as TAD, | ||
| 117 | TIMER0_S as TIMER0, | ||
| 118 | TIMER1_S as TIMER1, | ||
| 119 | TIMER2_S as TIMER2, | ||
| 120 | TWIM0_S as TWIM0, | ||
| 121 | TWIM1_S as TWIM1, | ||
| 122 | TWIM2_S as TWIM2, | ||
| 123 | TWIM3_S as TWIM3, | ||
| 124 | TWIS0_S as TWIS0, | ||
| 125 | TWIS1_S as TWIS1, | ||
| 126 | TWIS2_S as TWIS2, | ||
| 127 | TWIS3_S as TWIS3, | ||
| 128 | UARTE0_S as UARTE0, | ||
| 129 | UARTE1_S as UARTE1, | ||
| 130 | UARTE2_S as UARTE2, | ||
| 131 | UARTE3_S as UARTE3, | ||
| 132 | UICR_S as UICR, | ||
| 133 | VMC_S as VMC, | ||
| 134 | WDT_S as WDT, | ||
| 135 | }; | ||
| 26 | } | 136 | } |
| 27 | 137 | ||
| 28 | /// The maximum buffer size that the EasyDMA can send/recv in one operation. | 138 | /// The maximum buffer size that the EasyDMA can send/recv in one operation. |
| @@ -127,29 +237,29 @@ embassy_hal_common::peripherals! { | |||
| 127 | P0_31, | 237 | P0_31, |
| 128 | } | 238 | } |
| 129 | 239 | ||
| 130 | impl_uarte!(UARTETWISPI0, UARTE0_NS, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); | 240 | impl_uarte!(UARTETWISPI0, UARTE0, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); |
| 131 | impl_uarte!(UARTETWISPI1, UARTE1_NS, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); | 241 | impl_uarte!(UARTETWISPI1, UARTE1, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); |
| 132 | impl_uarte!(UARTETWISPI2, UARTE2_NS, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); | 242 | impl_uarte!(UARTETWISPI2, UARTE2, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); |
| 133 | impl_uarte!(UARTETWISPI3, UARTE3_NS, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); | 243 | impl_uarte!(UARTETWISPI3, UARTE3, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); |
| 134 | 244 | ||
| 135 | impl_spim!(UARTETWISPI0, SPIM0_NS, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); | 245 | impl_spim!(UARTETWISPI0, SPIM0, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); |
| 136 | impl_spim!(UARTETWISPI1, SPIM1_NS, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); | 246 | impl_spim!(UARTETWISPI1, SPIM1, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); |
| 137 | impl_spim!(UARTETWISPI2, SPIM2_NS, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); | 247 | impl_spim!(UARTETWISPI2, SPIM2, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); |
| 138 | impl_spim!(UARTETWISPI3, SPIM3_NS, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); | 248 | impl_spim!(UARTETWISPI3, SPIM3, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); |
| 139 | 249 | ||
| 140 | impl_twim!(UARTETWISPI0, TWIM0_NS, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); | 250 | impl_twim!(UARTETWISPI0, TWIM0, UARTE0_SPIM0_SPIS0_TWIM0_TWIS0); |
| 141 | impl_twim!(UARTETWISPI1, TWIM1_NS, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); | 251 | impl_twim!(UARTETWISPI1, TWIM1, UARTE1_SPIM1_SPIS1_TWIM1_TWIS1); |
| 142 | impl_twim!(UARTETWISPI2, TWIM2_NS, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); | 252 | impl_twim!(UARTETWISPI2, TWIM2, UARTE2_SPIM2_SPIS2_TWIM2_TWIS2); |
| 143 | impl_twim!(UARTETWISPI3, TWIM3_NS, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); | 253 | impl_twim!(UARTETWISPI3, TWIM3, UARTE3_SPIM3_SPIS3_TWIM3_TWIS3); |
| 144 | 254 | ||
| 145 | impl_pwm!(PWM0, PWM0_NS, PWM0); | 255 | impl_pwm!(PWM0, PWM0, PWM0); |
| 146 | impl_pwm!(PWM1, PWM1_NS, PWM1); | 256 | impl_pwm!(PWM1, PWM1, PWM1); |
| 147 | impl_pwm!(PWM2, PWM2_NS, PWM2); | 257 | impl_pwm!(PWM2, PWM2, PWM2); |
| 148 | impl_pwm!(PWM3, PWM3_NS, PWM3); | 258 | impl_pwm!(PWM3, PWM3, PWM3); |
| 149 | 259 | ||
| 150 | impl_timer!(TIMER0, TIMER0_NS, TIMER0); | 260 | impl_timer!(TIMER0, TIMER0, TIMER0); |
| 151 | impl_timer!(TIMER1, TIMER1_NS, TIMER1); | 261 | impl_timer!(TIMER1, TIMER1, TIMER1); |
| 152 | impl_timer!(TIMER2, TIMER2_NS, TIMER2); | 262 | impl_timer!(TIMER2, TIMER2, TIMER2); |
| 153 | 263 | ||
| 154 | impl_pin!(P0_00, 0, 0); | 264 | impl_pin!(P0_00, 0, 0); |
| 155 | impl_pin!(P0_01, 0, 1); | 265 | impl_pin!(P0_01, 0, 1); |
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 7ec072ac8..03688859f 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -56,9 +56,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) { | |||
| 56 | 56 | ||
| 57 | // Enable interrupts | 57 | // Enable interrupts |
| 58 | 58 | ||
| 59 | #[cfg(not(feature = "nrf9160"))] | 59 | #[cfg(not(feature = "_nrf9160"))] |
| 60 | let irq = unsafe { interrupt::GPIOTE::steal() }; | 60 | let irq = unsafe { interrupt::GPIOTE::steal() }; |
| 61 | #[cfg(feature = "nrf9160")] | 61 | #[cfg(feature = "_nrf9160")] |
| 62 | let irq = unsafe { interrupt::GPIOTE1::steal() }; | 62 | let irq = unsafe { interrupt::GPIOTE1::steal() }; |
| 63 | 63 | ||
| 64 | irq.unpend(); | 64 | irq.unpend(); |
| @@ -70,13 +70,13 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) { | |||
| 70 | g.intenset.write(|w| w.port().set()); | 70 | g.intenset.write(|w| w.port().set()); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | #[cfg(not(feature = "nrf9160"))] | 73 | #[cfg(not(feature = "_nrf9160"))] |
| 74 | #[interrupt] | 74 | #[interrupt] |
| 75 | fn GPIOTE() { | 75 | fn GPIOTE() { |
| 76 | unsafe { handle_gpiote_interrupt() }; | 76 | unsafe { handle_gpiote_interrupt() }; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #[cfg(feature = "nrf9160")] | 79 | #[cfg(feature = "_nrf9160")] |
| 80 | #[interrupt] | 80 | #[interrupt] |
| 81 | fn GPIOTE1() { | 81 | fn GPIOTE1() { |
| 82 | unsafe { handle_gpiote_interrupt() }; | 82 | unsafe { handle_gpiote_interrupt() }; |
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index c21c4d398..05bdd1904 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | feature = "nrf52840", | 14 | feature = "nrf52840", |
| 15 | feature = "nrf5340-app", | 15 | feature = "nrf5340-app", |
| 16 | feature = "nrf5340-net", | 16 | feature = "nrf5340-net", |
| 17 | feature = "nrf9160", | 17 | feature = "nrf9160-s", |
| 18 | feature = "nrf9160-ns", | ||
| 18 | )))] | 19 | )))] |
| 19 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840"); | 20 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840"); |
| 20 | 21 | ||
| @@ -29,19 +30,19 @@ pub mod buffered_uarte; | |||
| 29 | pub mod gpio; | 30 | pub mod gpio; |
| 30 | #[cfg(feature = "gpiote")] | 31 | #[cfg(feature = "gpiote")] |
| 31 | pub mod gpiote; | 32 | pub mod gpiote; |
| 32 | #[cfg(not(feature = "nrf9160"))] | 33 | #[cfg(not(feature = "_nrf9160"))] |
| 33 | pub mod nvmc; | 34 | pub mod nvmc; |
| 34 | pub mod ppi; | 35 | pub mod ppi; |
| 35 | #[cfg(not(any(feature = "nrf52805", feature = "nrf52820")))] | 36 | #[cfg(not(any(feature = "nrf52805", feature = "nrf52820")))] |
| 36 | pub mod pwm; | 37 | pub mod pwm; |
| 37 | #[cfg(feature = "nrf52840")] | 38 | #[cfg(feature = "nrf52840")] |
| 38 | pub mod qspi; | 39 | pub mod qspi; |
| 39 | #[cfg(not(feature = "nrf9160"))] | 40 | #[cfg(not(feature = "_nrf9160"))] |
| 40 | pub mod rng; | 41 | pub mod rng; |
| 41 | #[cfg(not(feature = "nrf52820"))] | 42 | #[cfg(not(feature = "nrf52820"))] |
| 42 | pub mod saadc; | 43 | pub mod saadc; |
| 43 | pub mod spim; | 44 | pub mod spim; |
| 44 | #[cfg(not(feature = "nrf9160"))] | 45 | #[cfg(not(feature = "_nrf9160"))] |
| 45 | pub mod temp; | 46 | pub mod temp; |
| 46 | pub mod timer; | 47 | pub mod timer; |
| 47 | pub mod twim; | 48 | pub mod twim; |
| @@ -49,29 +50,14 @@ pub mod uarte; | |||
| 49 | pub mod wdt; | 50 | pub mod wdt; |
| 50 | 51 | ||
| 51 | // This mod MUST go last, so that it sees all the `impl_foo!` macros | 52 | // This mod MUST go last, so that it sees all the `impl_foo!` macros |
| 52 | #[cfg(feature = "nrf52805")] | 53 | #[cfg_attr(feature = "nrf52805", path = "chips/nrf52805.rs")] |
| 53 | #[path = "chips/nrf52805.rs"] | 54 | #[cfg_attr(feature = "nrf52810", path = "chips/nrf52810.rs")] |
| 54 | mod chip; | 55 | #[cfg_attr(feature = "nrf52811", path = "chips/nrf52811.rs")] |
| 55 | #[cfg(feature = "nrf52810")] | 56 | #[cfg_attr(feature = "nrf52820", path = "chips/nrf52820.rs")] |
| 56 | #[path = "chips/nrf52810.rs"] | 57 | #[cfg_attr(feature = "nrf52832", path = "chips/nrf52832.rs")] |
| 57 | mod chip; | 58 | #[cfg_attr(feature = "nrf52833", path = "chips/nrf52833.rs")] |
| 58 | #[cfg(feature = "nrf52811")] | 59 | #[cfg_attr(feature = "nrf52840", path = "chips/nrf52840.rs")] |
| 59 | #[path = "chips/nrf52811.rs"] | 60 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] |
| 60 | mod chip; | ||
| 61 | #[cfg(feature = "nrf52820")] | ||
| 62 | #[path = "chips/nrf52820.rs"] | ||
| 63 | mod chip; | ||
| 64 | #[cfg(feature = "nrf52832")] | ||
| 65 | #[path = "chips/nrf52832.rs"] | ||
| 66 | mod chip; | ||
| 67 | #[cfg(feature = "nrf52833")] | ||
| 68 | #[path = "chips/nrf52833.rs"] | ||
| 69 | mod chip; | ||
| 70 | #[cfg(feature = "nrf52840")] | ||
| 71 | #[path = "chips/nrf52840.rs"] | ||
| 72 | mod chip; | ||
| 73 | #[cfg(feature = "nrf9160")] | ||
| 74 | #[path = "chips/nrf9160.rs"] | ||
| 75 | mod chip; | 61 | mod chip; |
| 76 | 62 | ||
| 77 | pub use chip::EASY_DMA_SIZE; | 63 | pub use chip::EASY_DMA_SIZE; |
| @@ -100,12 +86,12 @@ pub mod config { | |||
| 100 | 86 | ||
| 101 | pub enum LfclkSource { | 87 | pub enum LfclkSource { |
| 102 | InternalRC, | 88 | InternalRC, |
| 103 | #[cfg(not(feature = "nrf9160"))] | 89 | #[cfg(not(feature = "_nrf9160"))] |
| 104 | Synthesized, | 90 | Synthesized, |
| 105 | ExternalXtal, | 91 | ExternalXtal, |
| 106 | #[cfg(not(feature = "nrf9160"))] | 92 | #[cfg(not(feature = "_nrf9160"))] |
| 107 | ExternalLowSwing, | 93 | ExternalLowSwing, |
| 108 | #[cfg(not(feature = "nrf9160"))] | 94 | #[cfg(not(feature = "_nrf9160"))] |
| 109 | ExternalFullSwing, | 95 | ExternalFullSwing, |
| 110 | } | 96 | } |
| 111 | 97 | ||
| @@ -155,7 +141,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 155 | } | 141 | } |
| 156 | 142 | ||
| 157 | // Configure LFCLK. | 143 | // Configure LFCLK. |
| 158 | #[cfg(not(feature = "nrf9160"))] | 144 | #[cfg(not(feature = "_nrf9160"))] |
| 159 | match config.lfclk_source { | 145 | match config.lfclk_source { |
| 160 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), | 146 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), |
| 161 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), | 147 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), |
| @@ -175,7 +161,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 175 | w | 161 | w |
| 176 | }), | 162 | }), |
| 177 | } | 163 | } |
| 178 | #[cfg(feature = "nrf9160")] | 164 | #[cfg(feature = "_nrf9160")] |
| 179 | match config.lfclk_source { | 165 | match config.lfclk_source { |
| 180 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()), | 166 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()), |
| 181 | config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()), | 167 | config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()), |
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index efcdfb2b1..7fffea1b6 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs | |||
| @@ -90,11 +90,11 @@ unsafe impl Unborrow for VddInput { | |||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | impl sealed::Input for VddInput { | 92 | impl sealed::Input for VddInput { |
| 93 | #[cfg(not(feature = "nrf9160"))] | 93 | #[cfg(not(feature = "_nrf9160"))] |
| 94 | fn channel(&self) -> InputChannel { | 94 | fn channel(&self) -> InputChannel { |
| 95 | InputChannel::VDD | 95 | InputChannel::VDD |
| 96 | } | 96 | } |
| 97 | #[cfg(feature = "nrf9160")] | 97 | #[cfg(feature = "_nrf9160")] |
| 98 | fn channel(&self) -> InputChannel { | 98 | fn channel(&self) -> InputChannel { |
| 99 | InputChannel::VDDGPIO | 99 | InputChannel::VDDGPIO |
| 100 | } | 100 | } |
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 4bbdec63f..459bc8436 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs | |||
| @@ -120,12 +120,12 @@ impl<'d, T: Instance> Uarte<'d, T> { | |||
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | #[cfg(not(any(feature = "nrf9160", feature = "nrf5340")))] | 123 | #[cfg(not(any(feature = "_nrf9160", feature = "nrf5340")))] |
| 124 | fn apply_workaround_for_enable_anomaly() { | 124 | fn apply_workaround_for_enable_anomaly() { |
| 125 | // Do nothing | 125 | // Do nothing |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | #[cfg(any(feature = "nrf9160", feature = "nrf5340"))] | 128 | #[cfg(any(feature = "_nrf9160", feature = "nrf5340"))] |
| 129 | fn apply_workaround_for_enable_anomaly() { | 129 | fn apply_workaround_for_enable_anomaly() { |
| 130 | use core::ops::Deref; | 130 | use core::ops::Deref; |
| 131 | 131 | ||
diff --git a/embassy-nrf/src/wdt.rs b/embassy-nrf/src/wdt.rs index eddfa7582..8760aa301 100644 --- a/embassy-nrf/src/wdt.rs +++ b/embassy-nrf/src/wdt.rs | |||
| @@ -58,9 +58,9 @@ impl Watchdog { | |||
| 58 | let crv = config.timeout_ticks.max(MIN_TICKS); | 58 | let crv = config.timeout_ticks.max(MIN_TICKS); |
| 59 | let rren = (1u32 << N) - 1; | 59 | let rren = (1u32 << N) - 1; |
| 60 | 60 | ||
| 61 | #[cfg(not(feature = "nrf9160"))] | 61 | #[cfg(not(feature = "_nrf9160"))] |
| 62 | let runstatus = r.runstatus.read().runstatus().bit(); | 62 | let runstatus = r.runstatus.read().runstatus().bit(); |
| 63 | #[cfg(feature = "nrf9160")] | 63 | #[cfg(feature = "_nrf9160")] |
| 64 | let runstatus = r.runstatus.read().runstatuswdt().bit(); | 64 | let runstatus = r.runstatus.read().runstatuswdt().bit(); |
| 65 | 65 | ||
| 66 | if runstatus { | 66 | if runstatus { |
