diff options
| author | nerwalt <[email protected]> | 2024-06-28 07:11:50 -0600 |
|---|---|---|
| committer | nerwalt <[email protected]> | 2024-06-28 07:11:50 -0600 |
| commit | 5e1a6a97535f86f74495dafc1f75db73689ddad5 (patch) | |
| tree | 01c7765f18fc9f51769d39fbf347a2fe7c603f8f | |
| parent | 8a6b71b0bba450687c48b36c60273f825c3f6d4b (diff) | |
Adding support for 9120
| -rw-r--r-- | embassy-nrf/Cargo.toml | 14 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf9120.rs | 430 | ||||
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/lib.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/nvmc.rs | 4 | ||||
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 4 | ||||
| -rw-r--r-- | embassy-nrf/src/wdt.rs | 8 | ||||
| -rw-r--r-- | examples/nrf9151/ns/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/nrf9151/s/.cargo/config.toml | 1 | ||||
| -rw-r--r-- | examples/nrf9151/s/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/nrf9160/.cargo/config.toml | 1 |
11 files changed, 474 insertions, 42 deletions
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index f21603556..f5a3c4b0f 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml | |||
| @@ -40,6 +40,7 @@ rt = [ | |||
| 40 | "nrf5340-app-pac?/rt", | 40 | "nrf5340-app-pac?/rt", |
| 41 | "nrf5340-net-pac?/rt", | 41 | "nrf5340-net-pac?/rt", |
| 42 | "nrf9160-pac?/rt", | 42 | "nrf9160-pac?/rt", |
| 43 | "nrf9120-pac?/rt", | ||
| 43 | ] | 44 | ] |
| 44 | 45 | ||
| 45 | ## Enable features requiring `embassy-time` | 46 | ## Enable features requiring `embassy-time` |
| @@ -99,13 +100,10 @@ nrf5340-net = ["_nrf5340-net"] | |||
| 99 | nrf9160-s = ["_nrf9160", "_s"] | 100 | nrf9160-s = ["_nrf9160", "_s"] |
| 100 | ## nRF9160 in Non-Secure mode | 101 | ## nRF9160 in Non-Secure mode |
| 101 | nrf9160-ns = ["_nrf9160", "_ns"] | 102 | nrf9160-ns = ["_nrf9160", "_ns"] |
| 102 | 103 | ## nRF9120 in Secure mode | |
| 103 | # TODO - The nrf9151 is close enough to the nrf9160 for a lot of applications. It needs | 104 | nrf9120-s = ["_nrf9120", "_s"] |
| 104 | # more testing though and possilbly proper support | 105 | ## nRF9120 in Non-Secure mode |
| 105 | ## nRF9151 in Secure mode | 106 | nrf9120-ns = ["_nrf9120", "_ns"] |
| 106 | nrf9151-s = ["nrf9160-s"] | ||
| 107 | ## nRF9151 in Non-Secure mode | ||
| 108 | nrf9151-ns = ["nrf9160-ns"] | ||
| 109 | 107 | ||
| 110 | # Features starting with `_` are for internal use only. They're not intended | 108 | # Features starting with `_` are for internal use only. They're not intended |
| 111 | # to be enabled by other crates, and are not covered by semver guarantees. | 109 | # to be enabled by other crates, and are not covered by semver guarantees. |
| @@ -114,6 +112,7 @@ _nrf5340-app = ["_nrf5340", "nrf5340-app-pac"] | |||
| 114 | _nrf5340-net = ["_nrf5340", "nrf5340-net-pac"] | 112 | _nrf5340-net = ["_nrf5340", "nrf5340-net-pac"] |
| 115 | _nrf5340 = ["_gpio-p1", "_dppi"] | 113 | _nrf5340 = ["_gpio-p1", "_dppi"] |
| 116 | _nrf9160 = ["nrf9160-pac", "_dppi"] | 114 | _nrf9160 = ["nrf9160-pac", "_dppi"] |
| 115 | _nrf9120 = ["nrf9120-pac", "_dppi"] | ||
| 117 | _nrf52 = ["_ppi"] | 116 | _nrf52 = ["_ppi"] |
| 118 | _nrf51 = ["_ppi"] | 117 | _nrf51 = ["_ppi"] |
| 119 | 118 | ||
| @@ -168,3 +167,4 @@ nrf52840-pac = { version = "0.12.0", optional = true } | |||
| 168 | nrf5340-app-pac = { version = "0.12.0", optional = true } | 167 | nrf5340-app-pac = { version = "0.12.0", optional = true } |
| 169 | nrf5340-net-pac = { version = "0.12.0", optional = true } | 168 | nrf5340-net-pac = { version = "0.12.0", optional = true } |
| 170 | nrf9160-pac = { version = "0.12.0", optional = true } | 169 | nrf9160-pac = { version = "0.12.0", optional = true } |
| 170 | nrf9120-pac = { path = "../../nrf-pacs/pacs/nrf9120-pac", optional = true } | ||
diff --git a/embassy-nrf/src/chips/nrf9120.rs b/embassy-nrf/src/chips/nrf9120.rs new file mode 100644 index 000000000..b53510118 --- /dev/null +++ b/embassy-nrf/src/chips/nrf9120.rs | |||
| @@ -0,0 +1,430 @@ | |||
| 1 | /// Peripheral Access Crate | ||
| 2 | #[allow(unused_imports)] | ||
| 3 | #[rustfmt::skip] | ||
| 4 | pub mod pac { | ||
| 5 | // The nRF9120 has a secure and non-secure (NS) mode. | ||
| 6 | // To avoid cfg spam, we remove _ns or _s suffixes here. | ||
| 7 | |||
| 8 | pub use nrf9120_pac::NVIC_PRIO_BITS; | ||
| 9 | |||
| 10 | #[cfg(feature="rt")] | ||
| 11 | #[doc(no_inline)] | ||
| 12 | pub use nrf9120_pac::interrupt; | ||
| 13 | |||
| 14 | #[doc(no_inline)] | ||
| 15 | pub use nrf9120_pac::{ | ||
| 16 | Interrupt, | ||
| 17 | |||
| 18 | cc_host_rgf_s as cc_host_rgf, | ||
| 19 | clock_ns as clock, | ||
| 20 | cryptocell_s as cryptocell, | ||
| 21 | ctrl_ap_peri_s as ctrl_ap_peri, | ||
| 22 | dppic_ns as dppic, | ||
| 23 | egu0_ns as egu0, | ||
| 24 | ficr_s as ficr, | ||
| 25 | fpu_ns as fpu, | ||
| 26 | gpiote0_s as gpiote, | ||
| 27 | i2s_ns as i2s, | ||
| 28 | ipc_ns as ipc, | ||
| 29 | kmu_ns as kmu, | ||
| 30 | nvmc_ns as nvmc, | ||
| 31 | p0_ns as p0, | ||
| 32 | pdm_ns as pdm, | ||
| 33 | power_ns as power, | ||
| 34 | pwm0_ns as pwm0, | ||
| 35 | regulators_ns as regulators, | ||
| 36 | rtc0_ns as rtc0, | ||
| 37 | saadc_ns as saadc, | ||
| 38 | spim0_ns as spim0, | ||
| 39 | spis0_ns as spis0, | ||
| 40 | spu_s as spu, | ||
| 41 | tad_s as tad, | ||
| 42 | timer0_ns as timer0, | ||
| 43 | twim0_ns as twim0, | ||
| 44 | twis0_ns as twis0, | ||
| 45 | uarte0_ns as uarte0, | ||
| 46 | uicr_s as uicr, | ||
| 47 | vmc_ns as vmc, | ||
| 48 | wdt_ns as wdt, | ||
| 49 | }; | ||
| 50 | |||
| 51 | /// Non-Secure mode (NS) peripherals | ||
| 52 | pub mod ns { | ||
| 53 | #[doc(no_inline)] | ||
| 54 | pub use nrf9120_pac::{ | ||
| 55 | CLOCK_NS as CLOCK, | ||
| 56 | DPPIC_NS as DPPIC, | ||
| 57 | EGU0_NS as EGU0, | ||
| 58 | EGU1_NS as EGU1, | ||
| 59 | EGU2_NS as EGU2, | ||
| 60 | EGU3_NS as EGU3, | ||
| 61 | EGU4_NS as EGU4, | ||
| 62 | EGU5_NS as EGU5, | ||
| 63 | FPU_NS as FPU, | ||
| 64 | GPIOTE1_NS as GPIOTE1, | ||
| 65 | I2S_NS as I2S, | ||
| 66 | IPC_NS as IPC, | ||
| 67 | KMU_NS as KMU, | ||
| 68 | NVMC_NS as NVMC, | ||
| 69 | P0_NS as P0, | ||
| 70 | PDM_NS as PDM, | ||
| 71 | POWER_NS as POWER, | ||
| 72 | PWM0_NS as PWM0, | ||
| 73 | PWM1_NS as PWM1, | ||
| 74 | PWM2_NS as PWM2, | ||
| 75 | PWM3_NS as PWM3, | ||
| 76 | REGULATORS_NS as REGULATORS, | ||
| 77 | RTC0_NS as RTC0, | ||
| 78 | RTC1_NS as RTC1, | ||
| 79 | SAADC_NS as SAADC, | ||
| 80 | SPIM0_NS as SPIM0, | ||
| 81 | SPIM1_NS as SPIM1, | ||
| 82 | SPIM2_NS as SPIM2, | ||
| 83 | SPIM3_NS as SPIM3, | ||
| 84 | SPIS0_NS as SPIS0, | ||
| 85 | SPIS1_NS as SPIS1, | ||
| 86 | SPIS2_NS as SPIS2, | ||
| 87 | SPIS3_NS as SPIS3, | ||
| 88 | TIMER0_NS as TIMER0, | ||
| 89 | TIMER1_NS as TIMER1, | ||
| 90 | TIMER2_NS as TIMER2, | ||
| 91 | TWIM0_NS as TWIM0, | ||
| 92 | TWIM1_NS as TWIM1, | ||
| 93 | TWIM2_NS as TWIM2, | ||
| 94 | TWIM3_NS as TWIM3, | ||
| 95 | TWIS0_NS as TWIS0, | ||
| 96 | TWIS1_NS as TWIS1, | ||
| 97 | TWIS2_NS as TWIS2, | ||
| 98 | TWIS3_NS as TWIS3, | ||
| 99 | UARTE0_NS as UARTE0, | ||
| 100 | UARTE1_NS as UARTE1, | ||
| 101 | UARTE2_NS as UARTE2, | ||
| 102 | UARTE3_NS as UARTE3, | ||
| 103 | VMC_NS as VMC, | ||
| 104 | WDT_NS as WDT, | ||
| 105 | }; | ||
| 106 | } | ||
| 107 | |||
| 108 | /// Secure mode (S) peripherals | ||
| 109 | pub mod s { | ||
| 110 | #[doc(no_inline)] | ||
| 111 | pub use nrf9120_pac::{ | ||
| 112 | CC_HOST_RGF_S as CC_HOST_RGF, | ||
| 113 | CLOCK_S as CLOCK, | ||
| 114 | CRYPTOCELL_S as CRYPTOCELL, | ||
| 115 | CTRL_AP_PERI_S as CTRL_AP_PERI, | ||
| 116 | DPPIC_S as DPPIC, | ||
| 117 | EGU0_S as EGU0, | ||
| 118 | EGU1_S as EGU1, | ||
| 119 | EGU2_S as EGU2, | ||
| 120 | EGU3_S as EGU3, | ||
| 121 | EGU4_S as EGU4, | ||
| 122 | EGU5_S as EGU5, | ||
| 123 | FICR_S as FICR, | ||
| 124 | FPU as FPU, | ||
| 125 | GPIOTE0_S as GPIOTE0, | ||
| 126 | I2S_S as I2S, | ||
| 127 | IPC_S as IPC, | ||
| 128 | KMU_S as KMU, | ||
| 129 | NVMC_S as NVMC, | ||
| 130 | P0_S as P0, | ||
| 131 | PDM_S as PDM, | ||
| 132 | POWER_S as POWER, | ||
| 133 | PWM0_S as PWM0, | ||
| 134 | PWM1_S as PWM1, | ||
| 135 | PWM2_S as PWM2, | ||
| 136 | PWM3_S as PWM3, | ||
| 137 | REGULATORS_S as REGULATORS, | ||
| 138 | RTC0_S as RTC0, | ||
| 139 | RTC1_S as RTC1, | ||
| 140 | SAADC_S as SAADC, | ||
| 141 | SPIM0_S as SPIM0, | ||
| 142 | SPIM1_S as SPIM1, | ||
| 143 | SPIM2_S as SPIM2, | ||
| 144 | SPIM3_S as SPIM3, | ||
| 145 | SPIS0_S as SPIS0, | ||
| 146 | SPIS1_S as SPIS1, | ||
| 147 | SPIS2_S as SPIS2, | ||
| 148 | SPIS3_S as SPIS3, | ||
| 149 | SPU_S as SPU, | ||
| 150 | TAD_S as TAD, | ||
| 151 | TIMER0_S as TIMER0, | ||
| 152 | TIMER1_S as TIMER1, | ||
| 153 | TIMER2_S as TIMER2, | ||
| 154 | TWIM0_S as TWIM0, | ||
| 155 | TWIM1_S as TWIM1, | ||
| 156 | TWIM2_S as TWIM2, | ||
| 157 | TWIM3_S as TWIM3, | ||
| 158 | TWIS0_S as TWIS0, | ||
| 159 | TWIS1_S as TWIS1, | ||
| 160 | TWIS2_S as TWIS2, | ||
| 161 | TWIS3_S as TWIS3, | ||
| 162 | UARTE0_S as UARTE0, | ||
| 163 | UARTE1_S as UARTE1, | ||
| 164 | UARTE2_S as UARTE2, | ||
| 165 | UARTE3_S as UARTE3, | ||
| 166 | UICR_S as UICR, | ||
| 167 | VMC_S as VMC, | ||
| 168 | WDT_S as WDT, | ||
| 169 | }; | ||
| 170 | } | ||
| 171 | |||
| 172 | #[cfg(feature = "_ns")] | ||
| 173 | pub use ns::*; | ||
| 174 | #[cfg(feature = "_s")] | ||
| 175 | pub use s::*; | ||
| 176 | } | ||
| 177 | |||
| 178 | /// The maximum buffer size that the EasyDMA can send/recv in one operation. | ||
| 179 | pub const EASY_DMA_SIZE: usize = (1 << 13) - 1; | ||
| 180 | pub const FORCE_COPY_BUFFER_SIZE: usize = 1024; | ||
| 181 | |||
| 182 | pub const FLASH_SIZE: usize = 1024 * 1024; | ||
| 183 | |||
| 184 | embassy_hal_internal::peripherals! { | ||
| 185 | // RTC | ||
| 186 | RTC0, | ||
| 187 | RTC1, | ||
| 188 | |||
| 189 | // WDT | ||
| 190 | WDT, | ||
| 191 | |||
| 192 | // NVMC | ||
| 193 | NVMC, | ||
| 194 | |||
| 195 | // UARTE, TWI & SPI | ||
| 196 | SERIAL0, | ||
| 197 | SERIAL1, | ||
| 198 | SERIAL2, | ||
| 199 | SERIAL3, | ||
| 200 | |||
| 201 | // SAADC | ||
| 202 | SAADC, | ||
| 203 | |||
| 204 | // PWM | ||
| 205 | PWM0, | ||
| 206 | PWM1, | ||
| 207 | PWM2, | ||
| 208 | PWM3, | ||
| 209 | |||
| 210 | // TIMER | ||
| 211 | TIMER0, | ||
| 212 | TIMER1, | ||
| 213 | TIMER2, | ||
| 214 | |||
| 215 | // GPIOTE | ||
| 216 | GPIOTE_CH0, | ||
| 217 | GPIOTE_CH1, | ||
| 218 | GPIOTE_CH2, | ||
| 219 | GPIOTE_CH3, | ||
| 220 | GPIOTE_CH4, | ||
| 221 | GPIOTE_CH5, | ||
| 222 | GPIOTE_CH6, | ||
| 223 | GPIOTE_CH7, | ||
| 224 | |||
| 225 | // PPI | ||
| 226 | PPI_CH0, | ||
| 227 | PPI_CH1, | ||
| 228 | PPI_CH2, | ||
| 229 | PPI_CH3, | ||
| 230 | PPI_CH4, | ||
| 231 | PPI_CH5, | ||
| 232 | PPI_CH6, | ||
| 233 | PPI_CH7, | ||
| 234 | PPI_CH8, | ||
| 235 | PPI_CH9, | ||
| 236 | PPI_CH10, | ||
| 237 | PPI_CH11, | ||
| 238 | PPI_CH12, | ||
| 239 | PPI_CH13, | ||
| 240 | PPI_CH14, | ||
| 241 | PPI_CH15, | ||
| 242 | |||
| 243 | PPI_GROUP0, | ||
| 244 | PPI_GROUP1, | ||
| 245 | PPI_GROUP2, | ||
| 246 | PPI_GROUP3, | ||
| 247 | PPI_GROUP4, | ||
| 248 | PPI_GROUP5, | ||
| 249 | |||
| 250 | // GPIO port 0 | ||
| 251 | P0_00, | ||
| 252 | P0_01, | ||
| 253 | P0_02, | ||
| 254 | P0_03, | ||
| 255 | P0_04, | ||
| 256 | P0_05, | ||
| 257 | P0_06, | ||
| 258 | P0_07, | ||
| 259 | P0_08, | ||
| 260 | P0_09, | ||
| 261 | P0_10, | ||
| 262 | P0_11, | ||
| 263 | P0_12, | ||
| 264 | P0_13, | ||
| 265 | P0_14, | ||
| 266 | P0_15, | ||
| 267 | P0_16, | ||
| 268 | P0_17, | ||
| 269 | P0_18, | ||
| 270 | P0_19, | ||
| 271 | P0_20, | ||
| 272 | P0_21, | ||
| 273 | P0_22, | ||
| 274 | P0_23, | ||
| 275 | P0_24, | ||
| 276 | P0_25, | ||
| 277 | P0_26, | ||
| 278 | P0_27, | ||
| 279 | P0_28, | ||
| 280 | P0_29, | ||
| 281 | P0_30, | ||
| 282 | P0_31, | ||
| 283 | |||
| 284 | // PDM | ||
| 285 | PDM, | ||
| 286 | |||
| 287 | // EGU | ||
| 288 | EGU0, | ||
| 289 | EGU1, | ||
| 290 | EGU2, | ||
| 291 | EGU3, | ||
| 292 | EGU4, | ||
| 293 | EGU5, | ||
| 294 | } | ||
| 295 | |||
| 296 | impl_uarte!(SERIAL0, UARTE0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0); | ||
| 297 | impl_uarte!(SERIAL1, UARTE1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1); | ||
| 298 | impl_uarte!(SERIAL2, UARTE2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2); | ||
| 299 | impl_uarte!(SERIAL3, UARTE3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3); | ||
| 300 | |||
| 301 | impl_spim!(SERIAL0, SPIM0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0); | ||
| 302 | impl_spim!(SERIAL1, SPIM1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1); | ||
| 303 | impl_spim!(SERIAL2, SPIM2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2); | ||
| 304 | impl_spim!(SERIAL3, SPIM3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3); | ||
| 305 | |||
| 306 | impl_spis!(SERIAL0, SPIS0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0); | ||
| 307 | impl_spis!(SERIAL1, SPIS1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1); | ||
| 308 | impl_spis!(SERIAL2, SPIS2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2); | ||
| 309 | impl_spis!(SERIAL3, SPIS3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3); | ||
| 310 | |||
| 311 | impl_twim!(SERIAL0, TWIM0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0); | ||
| 312 | impl_twim!(SERIAL1, TWIM1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1); | ||
| 313 | impl_twim!(SERIAL2, TWIM2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2); | ||
| 314 | impl_twim!(SERIAL3, TWIM3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3); | ||
| 315 | |||
| 316 | impl_twis!(SERIAL0, TWIS0, SPIM0_SPIS0_TWIM0_TWIS0_UARTE0); | ||
| 317 | impl_twis!(SERIAL1, TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_UARTE1); | ||
| 318 | impl_twis!(SERIAL2, TWIS2, SPIM2_SPIS2_TWIM2_TWIS2_UARTE2); | ||
| 319 | impl_twis!(SERIAL3, TWIS3, SPIM3_SPIS3_TWIM3_TWIS3_UARTE3); | ||
| 320 | |||
| 321 | impl_pwm!(PWM0, PWM0, PWM0); | ||
| 322 | impl_pwm!(PWM1, PWM1, PWM1); | ||
| 323 | impl_pwm!(PWM2, PWM2, PWM2); | ||
| 324 | impl_pwm!(PWM3, PWM3, PWM3); | ||
| 325 | |||
| 326 | impl_pdm!(PDM, PDM, PDM); | ||
| 327 | |||
| 328 | impl_timer!(TIMER0, TIMER0, TIMER0); | ||
| 329 | impl_timer!(TIMER1, TIMER1, TIMER1); | ||
| 330 | impl_timer!(TIMER2, TIMER2, TIMER2); | ||
| 331 | |||
| 332 | impl_pin!(P0_00, 0, 0); | ||
| 333 | impl_pin!(P0_01, 0, 1); | ||
| 334 | impl_pin!(P0_02, 0, 2); | ||
| 335 | impl_pin!(P0_03, 0, 3); | ||
| 336 | impl_pin!(P0_04, 0, 4); | ||
| 337 | impl_pin!(P0_05, 0, 5); | ||
| 338 | impl_pin!(P0_06, 0, 6); | ||
| 339 | impl_pin!(P0_07, 0, 7); | ||
| 340 | impl_pin!(P0_08, 0, 8); | ||
| 341 | impl_pin!(P0_09, 0, 9); | ||
| 342 | impl_pin!(P0_10, 0, 10); | ||
| 343 | impl_pin!(P0_11, 0, 11); | ||
| 344 | impl_pin!(P0_12, 0, 12); | ||
| 345 | impl_pin!(P0_13, 0, 13); | ||
| 346 | impl_pin!(P0_14, 0, 14); | ||
| 347 | impl_pin!(P0_15, 0, 15); | ||
| 348 | impl_pin!(P0_16, 0, 16); | ||
| 349 | impl_pin!(P0_17, 0, 17); | ||
| 350 | impl_pin!(P0_18, 0, 18); | ||
| 351 | impl_pin!(P0_19, 0, 19); | ||
| 352 | impl_pin!(P0_20, 0, 20); | ||
| 353 | impl_pin!(P0_21, 0, 21); | ||
| 354 | impl_pin!(P0_22, 0, 22); | ||
| 355 | impl_pin!(P0_23, 0, 23); | ||
| 356 | impl_pin!(P0_24, 0, 24); | ||
| 357 | impl_pin!(P0_25, 0, 25); | ||
| 358 | impl_pin!(P0_26, 0, 26); | ||
| 359 | impl_pin!(P0_27, 0, 27); | ||
| 360 | impl_pin!(P0_28, 0, 28); | ||
| 361 | impl_pin!(P0_29, 0, 29); | ||
| 362 | impl_pin!(P0_30, 0, 30); | ||
| 363 | impl_pin!(P0_31, 0, 31); | ||
| 364 | |||
| 365 | impl_ppi_channel!(PPI_CH0, 0 => configurable); | ||
| 366 | impl_ppi_channel!(PPI_CH1, 1 => configurable); | ||
| 367 | impl_ppi_channel!(PPI_CH2, 2 => configurable); | ||
| 368 | impl_ppi_channel!(PPI_CH3, 3 => configurable); | ||
| 369 | impl_ppi_channel!(PPI_CH4, 4 => configurable); | ||
| 370 | impl_ppi_channel!(PPI_CH5, 5 => configurable); | ||
| 371 | impl_ppi_channel!(PPI_CH6, 6 => configurable); | ||
| 372 | impl_ppi_channel!(PPI_CH7, 7 => configurable); | ||
| 373 | impl_ppi_channel!(PPI_CH8, 8 => configurable); | ||
| 374 | impl_ppi_channel!(PPI_CH9, 9 => configurable); | ||
| 375 | impl_ppi_channel!(PPI_CH10, 10 => configurable); | ||
| 376 | impl_ppi_channel!(PPI_CH11, 11 => configurable); | ||
| 377 | impl_ppi_channel!(PPI_CH12, 12 => configurable); | ||
| 378 | impl_ppi_channel!(PPI_CH13, 13 => configurable); | ||
| 379 | impl_ppi_channel!(PPI_CH14, 14 => configurable); | ||
| 380 | impl_ppi_channel!(PPI_CH15, 15 => configurable); | ||
| 381 | |||
| 382 | impl_saadc_input!(P0_13, ANALOG_INPUT0); | ||
| 383 | impl_saadc_input!(P0_14, ANALOG_INPUT1); | ||
| 384 | impl_saadc_input!(P0_15, ANALOG_INPUT2); | ||
| 385 | impl_saadc_input!(P0_16, ANALOG_INPUT3); | ||
| 386 | impl_saadc_input!(P0_17, ANALOG_INPUT4); | ||
| 387 | impl_saadc_input!(P0_18, ANALOG_INPUT5); | ||
| 388 | impl_saadc_input!(P0_19, ANALOG_INPUT6); | ||
| 389 | impl_saadc_input!(P0_20, ANALOG_INPUT7); | ||
| 390 | |||
| 391 | impl_egu!(EGU0, EGU0, EGU0); | ||
| 392 | impl_egu!(EGU1, EGU1, EGU1); | ||
| 393 | impl_egu!(EGU2, EGU2, EGU2); | ||
| 394 | impl_egu!(EGU3, EGU3, EGU3); | ||
| 395 | impl_egu!(EGU4, EGU4, EGU4); | ||
| 396 | impl_egu!(EGU5, EGU5, EGU5); | ||
| 397 | |||
| 398 | embassy_hal_internal::interrupt_mod!( | ||
| 399 | SPU, | ||
| 400 | CLOCK_POWER, | ||
| 401 | SPIM0_SPIS0_TWIM0_TWIS0_UARTE0, | ||
| 402 | SPIM1_SPIS1_TWIM1_TWIS1_UARTE1, | ||
| 403 | SPIM2_SPIS2_TWIM2_TWIS2_UARTE2, | ||
| 404 | SPIM3_SPIS3_TWIM3_TWIS3_UARTE3, | ||
| 405 | GPIOTE0, | ||
| 406 | SAADC, | ||
| 407 | TIMER0, | ||
| 408 | TIMER1, | ||
| 409 | TIMER2, | ||
| 410 | RTC0, | ||
| 411 | RTC1, | ||
| 412 | WDT, | ||
| 413 | EGU0, | ||
| 414 | EGU1, | ||
| 415 | EGU2, | ||
| 416 | EGU3, | ||
| 417 | EGU4, | ||
| 418 | EGU5, | ||
| 419 | PWM0, | ||
| 420 | PWM1, | ||
| 421 | PWM2, | ||
| 422 | PDM, | ||
| 423 | PWM3, | ||
| 424 | I2S, | ||
| 425 | IPC, | ||
| 426 | FPU, | ||
| 427 | GPIOTE1, | ||
| 428 | KMU, | ||
| 429 | CRYPTOCELL, | ||
| 430 | ); | ||
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index a74b3157b..5366de3f0 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -53,9 +53,9 @@ pub enum OutputChannelPolarity { | |||
| 53 | 53 | ||
| 54 | fn regs() -> &'static pac::gpiote::RegisterBlock { | 54 | fn regs() -> &'static pac::gpiote::RegisterBlock { |
| 55 | cfg_if::cfg_if! { | 55 | cfg_if::cfg_if! { |
| 56 | if #[cfg(any(feature="nrf5340-app-s", feature="nrf9160-s"))] { | 56 | if #[cfg(any(feature="nrf5340-app-s", feature="nrf9160-s", feature="nrf9120-s"))] { |
| 57 | unsafe { &*pac::GPIOTE0::ptr() } | 57 | unsafe { &*pac::GPIOTE0::ptr() } |
| 58 | } else if #[cfg(any(feature="nrf5340-app-ns", feature="nrf9160-ns"))] { | 58 | } else if #[cfg(any(feature="nrf5340-app-ns", feature="nrf9160-ns", feature="nrf9120-ns"))] { |
| 59 | unsafe { &*pac::GPIOTE1::ptr() } | 59 | unsafe { &*pac::GPIOTE1::ptr() } |
| 60 | } else { | 60 | } else { |
| 61 | unsafe { &*pac::GPIOTE::ptr() } | 61 | unsafe { &*pac::GPIOTE::ptr() } |
| @@ -81,9 +81,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) { | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | // Enable interrupts | 83 | // Enable interrupts |
| 84 | #[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s"))] | 84 | #[cfg(any(feature = "nrf5340-app-s", feature = "nrf9160-s", feature = "nrf9120-s"))] |
| 85 | let irq = interrupt::GPIOTE0; | 85 | let irq = interrupt::GPIOTE0; |
| 86 | #[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns"))] | 86 | #[cfg(any(feature = "nrf5340-app-ns", feature = "nrf9160-ns", feature = "nrf9120-ns"))] |
| 87 | let irq = interrupt::GPIOTE1; | 87 | let irq = interrupt::GPIOTE1; |
| 88 | #[cfg(any(feature = "_nrf51", feature = "_nrf52", feature = "nrf5340-net"))] | 88 | #[cfg(any(feature = "_nrf51", feature = "_nrf52", feature = "nrf5340-net"))] |
| 89 | let irq = interrupt::GPIOTE; | 89 | let irq = interrupt::GPIOTE; |
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 05b52f687..15d2e65b2 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | feature = "nrf5340-net", | 24 | feature = "nrf5340-net", |
| 25 | feature = "nrf9160-s", | 25 | feature = "nrf9160-s", |
| 26 | feature = "nrf9160-ns", | 26 | feature = "nrf9160-ns", |
| 27 | feature = "nrf9120-s", | ||
| 28 | feature = "nrf9120-ns", | ||
| 27 | )))] | 29 | )))] |
| 28 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840"); | 30 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840"); |
| 29 | 31 | ||
| @@ -47,7 +49,7 @@ pub mod gpio; | |||
| 47 | pub mod gpiote; | 49 | pub mod gpiote; |
| 48 | 50 | ||
| 49 | // TODO: tested on other chips | 51 | // TODO: tested on other chips |
| 50 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf5340-app")))] | 52 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120", feature = "_nrf5340-app")))] |
| 51 | pub mod radio; | 53 | pub mod radio; |
| 52 | 54 | ||
| 53 | #[cfg(not(feature = "nrf51"))] | 55 | #[cfg(not(feature = "nrf51"))] |
| @@ -62,7 +64,8 @@ pub mod nvmc; | |||
| 62 | feature = "nrf52833", | 64 | feature = "nrf52833", |
| 63 | feature = "nrf52840", | 65 | feature = "nrf52840", |
| 64 | feature = "_nrf5340-app", | 66 | feature = "_nrf5340-app", |
| 65 | feature = "_nrf9160" | 67 | feature = "_nrf9160", |
| 68 | feature = "_nrf9120" | ||
| 66 | ))] | 69 | ))] |
| 67 | pub mod pdm; | 70 | pub mod pdm; |
| 68 | pub mod ppi; | 71 | pub mod ppi; |
| @@ -73,11 +76,11 @@ pub mod ppi; | |||
| 73 | feature = "_nrf5340-net" | 76 | feature = "_nrf5340-net" |
| 74 | )))] | 77 | )))] |
| 75 | pub mod pwm; | 78 | pub mod pwm; |
| 76 | #[cfg(not(any(feature = "nrf51", feature = "_nrf9160", feature = "_nrf5340-net")))] | 79 | #[cfg(not(any(feature = "nrf51", feature = "_nrf9160", feature = "_nrf9120", feature = "_nrf5340-net")))] |
| 77 | pub mod qdec; | 80 | pub mod qdec; |
| 78 | #[cfg(any(feature = "nrf52840", feature = "_nrf5340-app"))] | 81 | #[cfg(any(feature = "nrf52840", feature = "_nrf5340-app"))] |
| 79 | pub mod qspi; | 82 | pub mod qspi; |
| 80 | #[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf9160")))] | 83 | #[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf9160", feature = "_nrf9120")))] |
| 81 | pub mod rng; | 84 | pub mod rng; |
| 82 | #[cfg(not(any(feature = "nrf51", feature = "nrf52820", feature = "_nrf5340-net")))] | 85 | #[cfg(not(any(feature = "nrf51", feature = "nrf52820", feature = "_nrf5340-net")))] |
| 83 | pub mod saadc; | 86 | pub mod saadc; |
| @@ -85,7 +88,7 @@ pub mod saadc; | |||
| 85 | pub mod spim; | 88 | pub mod spim; |
| 86 | #[cfg(not(feature = "nrf51"))] | 89 | #[cfg(not(feature = "nrf51"))] |
| 87 | pub mod spis; | 90 | pub mod spis; |
| 88 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 91 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 89 | pub mod temp; | 92 | pub mod temp; |
| 90 | pub mod timer; | 93 | pub mod timer; |
| 91 | #[cfg(not(feature = "nrf51"))] | 94 | #[cfg(not(feature = "nrf51"))] |
| @@ -116,6 +119,7 @@ pub mod wdt; | |||
| 116 | #[cfg_attr(feature = "_nrf5340-app", path = "chips/nrf5340_app.rs")] | 119 | #[cfg_attr(feature = "_nrf5340-app", path = "chips/nrf5340_app.rs")] |
| 117 | #[cfg_attr(feature = "_nrf5340-net", path = "chips/nrf5340_net.rs")] | 120 | #[cfg_attr(feature = "_nrf5340-net", path = "chips/nrf5340_net.rs")] |
| 118 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] | 121 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] |
| 122 | #[cfg_attr(feature = "_nrf9120", path = "chips/nrf9120.rs")] | ||
| 119 | mod chip; | 123 | mod chip; |
| 120 | 124 | ||
| 121 | /// Macro to bind interrupts to handlers. | 125 | /// Macro to bind interrupts to handlers. |
| @@ -196,15 +200,15 @@ pub mod config { | |||
| 196 | /// Internal RC oscillator | 200 | /// Internal RC oscillator |
| 197 | InternalRC, | 201 | InternalRC, |
| 198 | /// Synthesized from the high frequency clock source. | 202 | /// Synthesized from the high frequency clock source. |
| 199 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 203 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 200 | Synthesized, | 204 | Synthesized, |
| 201 | /// External source from xtal. | 205 | /// External source from xtal. |
| 202 | ExternalXtal, | 206 | ExternalXtal, |
| 203 | /// External source from xtal with low swing applied. | 207 | /// External source from xtal with low swing applied. |
| 204 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 208 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 205 | ExternalLowSwing, | 209 | ExternalLowSwing, |
| 206 | /// External source from xtal with full swing applied. | 210 | /// External source from xtal with full swing applied. |
| 207 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 211 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 208 | ExternalFullSwing, | 212 | ExternalFullSwing, |
| 209 | } | 213 | } |
| 210 | 214 | ||
| @@ -222,7 +226,7 @@ pub mod config { | |||
| 222 | } | 226 | } |
| 223 | 227 | ||
| 224 | /// Settings for enabling the built in DCDC converters. | 228 | /// Settings for enabling the built in DCDC converters. |
| 225 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 229 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 226 | pub struct DcdcConfig { | 230 | pub struct DcdcConfig { |
| 227 | /// Config for the first stage DCDC (VDDH -> VDD), if disabled LDO will be used. | 231 | /// Config for the first stage DCDC (VDDH -> VDD), if disabled LDO will be used. |
| 228 | #[cfg(feature = "nrf52840")] | 232 | #[cfg(feature = "nrf52840")] |
| @@ -264,7 +268,7 @@ pub mod config { | |||
| 264 | } | 268 | } |
| 265 | 269 | ||
| 266 | /// Settings for enabling the built in DCDC converter. | 270 | /// Settings for enabling the built in DCDC converter. |
| 267 | #[cfg(feature = "_nrf9160")] | 271 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 268 | pub struct DcdcConfig { | 272 | pub struct DcdcConfig { |
| 269 | /// Config for the main rail, if disabled LDO will be used. | 273 | /// Config for the main rail, if disabled LDO will be used. |
| 270 | pub regmain: bool, | 274 | pub regmain: bool, |
| @@ -298,7 +302,7 @@ pub mod config { | |||
| 298 | // xtals if they know they have them. | 302 | // xtals if they know they have them. |
| 299 | hfclk_source: HfclkSource::Internal, | 303 | hfclk_source: HfclkSource::Internal, |
| 300 | lfclk_source: LfclkSource::InternalRC, | 304 | lfclk_source: LfclkSource::InternalRC, |
| 301 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 305 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 302 | dcdc: DcdcConfig { | 306 | dcdc: DcdcConfig { |
| 303 | #[cfg(feature = "nrf52840")] | 307 | #[cfg(feature = "nrf52840")] |
| 304 | reg0: false, | 308 | reg0: false, |
| @@ -312,7 +316,7 @@ pub mod config { | |||
| 312 | regmain: false, | 316 | regmain: false, |
| 313 | regradio: false, | 317 | regradio: false, |
| 314 | }, | 318 | }, |
| 315 | #[cfg(feature = "_nrf9160")] | 319 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 316 | dcdc: DcdcConfig { regmain: false }, | 320 | dcdc: DcdcConfig { regmain: false }, |
| 317 | #[cfg(feature = "gpiote")] | 321 | #[cfg(feature = "gpiote")] |
| 318 | gpiote_interrupt_priority: crate::interrupt::Priority::P0, | 322 | gpiote_interrupt_priority: crate::interrupt::Priority::P0, |
| @@ -329,7 +333,7 @@ pub mod config { | |||
| 329 | } | 333 | } |
| 330 | } | 334 | } |
| 331 | 335 | ||
| 332 | #[cfg(feature = "_nrf9160")] | 336 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 333 | #[allow(unused)] | 337 | #[allow(unused)] |
| 334 | mod consts { | 338 | mod consts { |
| 335 | pub const UICR_APPROTECT: *mut u32 = 0x00FF8000 as *mut u32; | 339 | pub const UICR_APPROTECT: *mut u32 = 0x00FF8000 as *mut u32; |
| @@ -468,7 +472,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 468 | // UICR.APPROTECT = Enabled | 472 | // UICR.APPROTECT = Enabled |
| 469 | let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED); | 473 | let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED); |
| 470 | needs_reset |= res == WriteResult::Written; | 474 | needs_reset |= res == WriteResult::Written; |
| 471 | #[cfg(any(feature = "_nrf5340-app", feature = "_nrf9160"))] | 475 | #[cfg(any(feature = "_nrf5340-app", feature = "_nrf9160", feature = "_nrf9120"))] |
| 472 | { | 476 | { |
| 473 | let res = uicr_write(consts::UICR_SECUREAPPROTECT, consts::APPROTECT_ENABLED); | 477 | let res = uicr_write(consts::UICR_SECUREAPPROTECT, consts::APPROTECT_ENABLED); |
| 474 | needs_reset |= res == WriteResult::Written; | 478 | needs_reset |= res == WriteResult::Written; |
| @@ -552,7 +556,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 552 | } | 556 | } |
| 553 | 557 | ||
| 554 | // Configure LFCLK. | 558 | // Configure LFCLK. |
| 555 | #[cfg(not(any(feature = "nrf51", feature = "_nrf5340", feature = "_nrf9160")))] | 559 | #[cfg(not(any(feature = "nrf51", feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 556 | match config.lfclk_source { | 560 | match config.lfclk_source { |
| 557 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), | 561 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), |
| 558 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), | 562 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), |
| @@ -572,7 +576,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 572 | w | 576 | w |
| 573 | }), | 577 | }), |
| 574 | } | 578 | } |
| 575 | #[cfg(feature = "_nrf9160")] | 579 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 576 | match config.lfclk_source { | 580 | match config.lfclk_source { |
| 577 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()), | 581 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().lfrc()), |
| 578 | config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()), | 582 | config::LfclkSource::ExternalXtal => r.lfclksrc.write(|w| w.src().lfxo()), |
| @@ -585,7 +589,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 585 | r.tasks_lfclkstart.write(|w| unsafe { w.bits(1) }); | 589 | r.tasks_lfclkstart.write(|w| unsafe { w.bits(1) }); |
| 586 | while r.events_lfclkstarted.read().bits() == 0 {} | 590 | while r.events_lfclkstarted.read().bits() == 0 {} |
| 587 | 591 | ||
| 588 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] | 592 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160", feature = "_nrf9120")))] |
| 589 | { | 593 | { |
| 590 | // Setup DCDCs. | 594 | // Setup DCDCs. |
| 591 | let pwr = unsafe { &*pac::POWER::ptr() }; | 595 | let pwr = unsafe { &*pac::POWER::ptr() }; |
| @@ -597,7 +601,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 597 | pwr.dcdcen.write(|w| w.dcdcen().set_bit()); | 601 | pwr.dcdcen.write(|w| w.dcdcen().set_bit()); |
| 598 | } | 602 | } |
| 599 | } | 603 | } |
| 600 | #[cfg(feature = "_nrf9160")] | 604 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 601 | { | 605 | { |
| 602 | // Setup DCDC. | 606 | // Setup DCDC. |
| 603 | let reg = unsafe { &*pac::REGULATORS::ptr() }; | 607 | let reg = unsafe { &*pac::REGULATORS::ptr() }; |
| @@ -629,7 +633,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 629 | time_driver::init(config.time_interrupt_priority); | 633 | time_driver::init(config.time_interrupt_priority); |
| 630 | 634 | ||
| 631 | // Disable UARTE (enabled by default for some reason) | 635 | // Disable UARTE (enabled by default for some reason) |
| 632 | #[cfg(feature = "_nrf9160")] | 636 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 633 | unsafe { | 637 | unsafe { |
| 634 | (*pac::UARTE0::ptr()).enable.write(|w| w.enable().disabled()); | 638 | (*pac::UARTE0::ptr()).enable.write(|w| w.enable().disabled()); |
| 635 | (*pac::UARTE1::ptr()).enable.write(|w| w.enable().disabled()); | 639 | (*pac::UARTE1::ptr()).enable.write(|w| w.enable().disabled()); |
diff --git a/embassy-nrf/src/nvmc.rs b/embassy-nrf/src/nvmc.rs index 4f9eda167..df027636c 100644 --- a/embassy-nrf/src/nvmc.rs +++ b/embassy-nrf/src/nvmc.rs | |||
| @@ -71,12 +71,12 @@ impl<'d> Nvmc<'d> { | |||
| 71 | while p.readynext.read().readynext().is_busy() {} | 71 | while p.readynext.read().readynext().is_busy() {} |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf5340")))] | 74 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120", feature = "_nrf5340")))] |
| 75 | fn erase_page(&mut self, page_addr: u32) { | 75 | fn erase_page(&mut self, page_addr: u32) { |
| 76 | Self::regs().erasepage().write(|w| unsafe { w.bits(page_addr) }); | 76 | Self::regs().erasepage().write(|w| unsafe { w.bits(page_addr) }); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #[cfg(any(feature = "_nrf9160", feature = "_nrf5340"))] | 79 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120", feature = "_nrf5340"))] |
| 80 | fn erase_page(&mut self, page_addr: u32) { | 80 | fn erase_page(&mut self, page_addr: u32) { |
| 81 | let first_page_word = page_addr as *mut u32; | 81 | let first_page_word = page_addr as *mut u32; |
| 82 | unsafe { | 82 | unsafe { |
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 17c65fa3e..e139b15da 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs | |||
| @@ -722,9 +722,9 @@ macro_rules! impl_saadc_input { | |||
| 722 | pub struct VddInput; | 722 | pub struct VddInput; |
| 723 | 723 | ||
| 724 | impl_peripheral!(VddInput); | 724 | impl_peripheral!(VddInput); |
| 725 | #[cfg(not(feature = "_nrf9160"))] | 725 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120")))] |
| 726 | impl_saadc_input!(@local, VddInput, VDD); | 726 | impl_saadc_input!(@local, VddInput, VDD); |
| 727 | #[cfg(feature = "_nrf9160")] | 727 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120")))] |
| 728 | impl_saadc_input!(@local, VddInput, VDDGPIO); | 728 | impl_saadc_input!(@local, VddInput, VDDGPIO); |
| 729 | 729 | ||
| 730 | /// A dummy `Input` pin implementation for SAADC peripheral sampling from the | 730 | /// A dummy `Input` pin implementation for SAADC peripheral sampling from the |
diff --git a/embassy-nrf/src/wdt.rs b/embassy-nrf/src/wdt.rs index 40a674424..5b3e1e930 100644 --- a/embassy-nrf/src/wdt.rs +++ b/embassy-nrf/src/wdt.rs | |||
| @@ -30,9 +30,9 @@ impl Config { | |||
| 30 | pub fn try_new(_wdt: &peripherals::WDT) -> Option<Self> { | 30 | pub fn try_new(_wdt: &peripherals::WDT) -> Option<Self> { |
| 31 | let r = unsafe { &*WDT::ptr() }; | 31 | let r = unsafe { &*WDT::ptr() }; |
| 32 | 32 | ||
| 33 | #[cfg(not(feature = "_nrf9160"))] | 33 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120")))] |
| 34 | let runstatus = r.runstatus.read().runstatus().bit(); | 34 | let runstatus = r.runstatus.read().runstatus().bit(); |
| 35 | #[cfg(feature = "_nrf9160")] | 35 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 36 | let runstatus = r.runstatus.read().runstatuswdt().bit(); | 36 | let runstatus = r.runstatus.read().runstatuswdt().bit(); |
| 37 | 37 | ||
| 38 | if runstatus { | 38 | if runstatus { |
| @@ -83,9 +83,9 @@ impl Watchdog { | |||
| 83 | let crv = config.timeout_ticks.max(MIN_TICKS); | 83 | let crv = config.timeout_ticks.max(MIN_TICKS); |
| 84 | let rren = (1u32 << N) - 1; | 84 | let rren = (1u32 << N) - 1; |
| 85 | 85 | ||
| 86 | #[cfg(not(feature = "_nrf9160"))] | 86 | #[cfg(not(any(feature = "_nrf9160", feature = "_nrf9120")))] |
| 87 | let runstatus = r.runstatus.read().runstatus().bit(); | 87 | let runstatus = r.runstatus.read().runstatus().bit(); |
| 88 | #[cfg(feature = "_nrf9160")] | 88 | #[cfg(any(feature = "_nrf9160", feature = "_nrf9120"))] |
| 89 | let runstatus = r.runstatus.read().runstatuswdt().bit(); | 89 | let runstatus = r.runstatus.read().runstatuswdt().bit(); |
| 90 | 90 | ||
| 91 | if runstatus { | 91 | if runstatus { |
diff --git a/examples/nrf9151/ns/Cargo.toml b/examples/nrf9151/ns/Cargo.toml index 0765d52d1..d73f17e87 100644 --- a/examples/nrf9151/ns/Cargo.toml +++ b/examples/nrf9151/ns/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } | 8 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } |
| 9 | embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9151-ns", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-ns", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | 11 | ||
| 12 | defmt = "0.3" | 12 | defmt = "0.3" |
| 13 | defmt-rtt = "0.4" | 13 | defmt-rtt = "0.4" |
diff --git a/examples/nrf9151/s/.cargo/config.toml b/examples/nrf9151/s/.cargo/config.toml index 1444b0cd1..f64c63966 100644 --- a/examples/nrf9151/s/.cargo/config.toml +++ b/examples/nrf9151/s/.cargo/config.toml | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 2 | # replace nRF82840_xxAA with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --chip nRF9160_xxAA" | 2 | runner = "probe-rs run --chip nRF9160_xxAA" |
| 4 | 3 | ||
| 5 | [build] | 4 | [build] |
diff --git a/examples/nrf9151/s/Cargo.toml b/examples/nrf9151/s/Cargo.toml index 0299002a0..164f9c94e 100644 --- a/examples/nrf9151/s/Cargo.toml +++ b/examples/nrf9151/s/Cargo.toml | |||
| @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" | |||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } | 8 | embassy-executor = { version = "0.5.0", path = "../../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } |
| 9 | embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 9 | embassy-time = { version = "0.3.1", path = "../../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 10 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9151-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } | 10 | embassy-nrf = { version = "0.1.0", path = "../../../embassy-nrf", features = ["defmt", "nrf9120-s", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } |
| 11 | 11 | ||
| 12 | defmt = "0.3" | 12 | defmt = "0.3" |
| 13 | defmt-rtt = "0.4" | 13 | defmt-rtt = "0.4" |
diff --git a/examples/nrf9160/.cargo/config.toml b/examples/nrf9160/.cargo/config.toml index 1444b0cd1..f64c63966 100644 --- a/examples/nrf9160/.cargo/config.toml +++ b/examples/nrf9160/.cargo/config.toml | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 2 | # replace nRF82840_xxAA with your chip as listed in `probe-rs chip list` | ||
| 3 | runner = "probe-rs run --chip nRF9160_xxAA" | 2 | runner = "probe-rs run --chip nRF9160_xxAA" |
| 4 | 3 | ||
| 5 | [build] | 4 | [build] |
