diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-10-11 01:42:28 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-11 01:42:28 +0200 |
| commit | 9fec833015579cca5f1b398745cac7ad08245f0c (patch) | |
| tree | 101f0eb13eb69ad1b77eeda221e4de71058d9c03 | |
| parent | 34637bf2d0e7d01003607521cf91c26317f7094c (diff) | |
| parent | 14c3260d88b95a7354dd1d0686d113602e25becb (diff) | |
Merge pull request #419 from embassy-rs/nrf-fixes-2
Nrf fixes 2
| -rw-r--r-- | embassy-nrf/src/chips/nrf52805.rs | 26 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52810.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52811.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52820.rs | 33 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52832.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52833.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/chips/nrf52840.rs | 42 | ||||
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 8 | ||||
| -rw-r--r-- | embassy-nrf/src/ppi.rs | 63 | ||||
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 47 | ||||
| -rw-r--r-- | embassy-nrf/src/util.rs | 2 |
11 files changed, 296 insertions, 93 deletions
diff --git a/embassy-nrf/src/chips/nrf52805.rs b/embassy-nrf/src/chips/nrf52805.rs index f214d927b..db1fac2ff 100644 --- a/embassy-nrf/src/chips/nrf52805.rs +++ b/embassy-nrf/src/chips/nrf52805.rs | |||
| @@ -159,6 +159,32 @@ impl_pin!(P0_29, 0, 29); | |||
| 159 | impl_pin!(P0_30, 0, 30); | 159 | impl_pin!(P0_30, 0, 30); |
| 160 | impl_pin!(P0_31, 0, 31); | 160 | impl_pin!(P0_31, 0, 31); |
| 161 | 161 | ||
| 162 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 163 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 164 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 165 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 166 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 167 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 168 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 169 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 170 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 171 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 172 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 173 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 174 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 175 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 176 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 177 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 178 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 179 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 180 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 181 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 182 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 183 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 184 | |||
| 185 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 186 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 187 | |||
| 162 | pub mod irqs { | 188 | pub mod irqs { |
| 163 | use crate::pac::Interrupt as InterruptEnum; | 189 | use crate::pac::Interrupt as InterruptEnum; |
| 164 | use embassy_macros::interrupt_declare as declare; | 190 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52810.rs b/embassy-nrf/src/chips/nrf52810.rs index caef3e7e7..06b9bfb38 100644 --- a/embassy-nrf/src/chips/nrf52810.rs +++ b/embassy-nrf/src/chips/nrf52810.rs | |||
| @@ -164,6 +164,48 @@ impl_pin!(P0_29, 0, 29); | |||
| 164 | impl_pin!(P0_30, 0, 30); | 164 | impl_pin!(P0_30, 0, 30); |
| 165 | impl_pin!(P0_31, 0, 31); | 165 | impl_pin!(P0_31, 0, 31); |
| 166 | 166 | ||
| 167 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 168 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 169 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 170 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 171 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 172 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 173 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 174 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 175 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 176 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 177 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 178 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 179 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 180 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 181 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 182 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 183 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 184 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 185 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 186 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 187 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 188 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 189 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 190 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 191 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 192 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 193 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 194 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 195 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 196 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 197 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 198 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 199 | |||
| 200 | impl_saadc_input!(P0_02, ANALOGINPUT0); | ||
| 201 | impl_saadc_input!(P0_03, ANALOGINPUT1); | ||
| 202 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 203 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 204 | impl_saadc_input!(P0_28, ANALOGINPUT4); | ||
| 205 | impl_saadc_input!(P0_29, ANALOGINPUT5); | ||
| 206 | impl_saadc_input!(P0_30, ANALOGINPUT6); | ||
| 207 | impl_saadc_input!(P0_31, ANALOGINPUT7); | ||
| 208 | |||
| 167 | pub mod irqs { | 209 | pub mod irqs { |
| 168 | use crate::pac::Interrupt as InterruptEnum; | 210 | use crate::pac::Interrupt as InterruptEnum; |
| 169 | use embassy_macros::interrupt_declare as declare; | 211 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52811.rs b/embassy-nrf/src/chips/nrf52811.rs index cbf14df2a..2f8d98b31 100644 --- a/embassy-nrf/src/chips/nrf52811.rs +++ b/embassy-nrf/src/chips/nrf52811.rs | |||
| @@ -165,6 +165,48 @@ impl_pin!(P0_29, 0, 29); | |||
| 165 | impl_pin!(P0_30, 0, 30); | 165 | impl_pin!(P0_30, 0, 30); |
| 166 | impl_pin!(P0_31, 0, 31); | 166 | impl_pin!(P0_31, 0, 31); |
| 167 | 167 | ||
| 168 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 169 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 170 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 171 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 172 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 173 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 174 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 175 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 176 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 177 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 178 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 179 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 180 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 181 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 182 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 183 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 184 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 185 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 186 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 187 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 188 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 189 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 190 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 191 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 192 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 193 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 194 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 195 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 196 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 197 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 198 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 199 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 200 | |||
| 201 | impl_saadc_input!(P0_02, ANALOGINPUT0); | ||
| 202 | impl_saadc_input!(P0_03, ANALOGINPUT1); | ||
| 203 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 204 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 205 | impl_saadc_input!(P0_28, ANALOGINPUT4); | ||
| 206 | impl_saadc_input!(P0_29, ANALOGINPUT5); | ||
| 207 | impl_saadc_input!(P0_30, ANALOGINPUT6); | ||
| 208 | impl_saadc_input!(P0_31, ANALOGINPUT7); | ||
| 209 | |||
| 168 | pub mod irqs { | 210 | pub mod irqs { |
| 169 | use crate::pac::Interrupt as InterruptEnum; | 211 | use crate::pac::Interrupt as InterruptEnum; |
| 170 | use embassy_macros::interrupt_declare as declare; | 212 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52820.rs b/embassy-nrf/src/chips/nrf52820.rs index e434c0096..fc7a367ef 100644 --- a/embassy-nrf/src/chips/nrf52820.rs +++ b/embassy-nrf/src/chips/nrf52820.rs | |||
| @@ -160,6 +160,39 @@ impl_pin!(P0_29, 0, 29); | |||
| 160 | impl_pin!(P0_30, 0, 30); | 160 | impl_pin!(P0_30, 0, 30); |
| 161 | impl_pin!(P0_31, 0, 31); | 161 | impl_pin!(P0_31, 0, 31); |
| 162 | 162 | ||
| 163 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 164 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 165 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 166 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 167 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 168 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 169 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 170 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 171 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 172 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 173 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 174 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 175 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 176 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 177 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 178 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 179 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 180 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 181 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 182 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 183 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 184 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 185 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 186 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 187 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 188 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 189 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 190 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 191 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 192 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 193 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 194 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 195 | |||
| 163 | pub mod irqs { | 196 | pub mod irqs { |
| 164 | use crate::pac::Interrupt as InterruptEnum; | 197 | use crate::pac::Interrupt as InterruptEnum; |
| 165 | use embassy_macros::interrupt_declare as declare; | 198 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52832.rs b/embassy-nrf/src/chips/nrf52832.rs index b95aa604b..47cf27de4 100644 --- a/embassy-nrf/src/chips/nrf52832.rs +++ b/embassy-nrf/src/chips/nrf52832.rs | |||
| @@ -178,6 +178,48 @@ impl_pin!(P0_29, 0, 29); | |||
| 178 | impl_pin!(P0_30, 0, 30); | 178 | impl_pin!(P0_30, 0, 30); |
| 179 | impl_pin!(P0_31, 0, 31); | 179 | impl_pin!(P0_31, 0, 31); |
| 180 | 180 | ||
| 181 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 182 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 183 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 184 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 185 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 186 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 187 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 188 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 189 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 190 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 191 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 192 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 193 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 194 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 195 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 196 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 197 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 198 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 199 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 200 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 201 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 202 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 203 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 204 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 205 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 206 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 207 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 208 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 209 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 210 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 211 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 212 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 213 | |||
| 214 | impl_saadc_input!(P0_02, ANALOGINPUT0); | ||
| 215 | impl_saadc_input!(P0_03, ANALOGINPUT1); | ||
| 216 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 217 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 218 | impl_saadc_input!(P0_28, ANALOGINPUT4); | ||
| 219 | impl_saadc_input!(P0_29, ANALOGINPUT5); | ||
| 220 | impl_saadc_input!(P0_30, ANALOGINPUT6); | ||
| 221 | impl_saadc_input!(P0_31, ANALOGINPUT7); | ||
| 222 | |||
| 181 | pub mod irqs { | 223 | pub mod irqs { |
| 182 | use crate::pac::Interrupt as InterruptEnum; | 224 | use crate::pac::Interrupt as InterruptEnum; |
| 183 | use embassy_macros::interrupt_declare as declare; | 225 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52833.rs b/embassy-nrf/src/chips/nrf52833.rs index 570e4b103..b3d813e24 100644 --- a/embassy-nrf/src/chips/nrf52833.rs +++ b/embassy-nrf/src/chips/nrf52833.rs | |||
| @@ -218,6 +218,48 @@ impl_pin!(P1_13, 1, 13); | |||
| 218 | impl_pin!(P1_14, 1, 14); | 218 | impl_pin!(P1_14, 1, 14); |
| 219 | impl_pin!(P1_15, 1, 15); | 219 | impl_pin!(P1_15, 1, 15); |
| 220 | 220 | ||
| 221 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 222 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 223 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 224 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 225 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 226 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 227 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 228 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 229 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 230 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 231 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 232 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 233 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 234 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 235 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 236 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 237 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 238 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 239 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 240 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 241 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 242 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 243 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 244 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 245 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 246 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 247 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 248 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 249 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 250 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 251 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 252 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 253 | |||
| 254 | impl_saadc_input!(P0_02, ANALOGINPUT0); | ||
| 255 | impl_saadc_input!(P0_03, ANALOGINPUT1); | ||
| 256 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 257 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 258 | impl_saadc_input!(P0_28, ANALOGINPUT4); | ||
| 259 | impl_saadc_input!(P0_29, ANALOGINPUT5); | ||
| 260 | impl_saadc_input!(P0_30, ANALOGINPUT6); | ||
| 261 | impl_saadc_input!(P0_31, ANALOGINPUT7); | ||
| 262 | |||
| 221 | pub mod irqs { | 263 | pub mod irqs { |
| 222 | use crate::pac::Interrupt as InterruptEnum; | 264 | use crate::pac::Interrupt as InterruptEnum; |
| 223 | use embassy_macros::interrupt_declare as declare; | 265 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/chips/nrf52840.rs b/embassy-nrf/src/chips/nrf52840.rs index 1221f23b3..473036f61 100644 --- a/embassy-nrf/src/chips/nrf52840.rs +++ b/embassy-nrf/src/chips/nrf52840.rs | |||
| @@ -223,6 +223,48 @@ impl_pin!(P1_13, 1, 13); | |||
| 223 | impl_pin!(P1_14, 1, 14); | 223 | impl_pin!(P1_14, 1, 14); |
| 224 | impl_pin!(P1_15, 1, 15); | 224 | impl_pin!(P1_15, 1, 15); |
| 225 | 225 | ||
| 226 | impl_ppi_channel!(PPI_CH0, 0, configurable); | ||
| 227 | impl_ppi_channel!(PPI_CH1, 1, configurable); | ||
| 228 | impl_ppi_channel!(PPI_CH2, 2, configurable); | ||
| 229 | impl_ppi_channel!(PPI_CH3, 3, configurable); | ||
| 230 | impl_ppi_channel!(PPI_CH4, 4, configurable); | ||
| 231 | impl_ppi_channel!(PPI_CH5, 5, configurable); | ||
| 232 | impl_ppi_channel!(PPI_CH6, 6, configurable); | ||
| 233 | impl_ppi_channel!(PPI_CH7, 7, configurable); | ||
| 234 | impl_ppi_channel!(PPI_CH8, 8, configurable); | ||
| 235 | impl_ppi_channel!(PPI_CH9, 9, configurable); | ||
| 236 | impl_ppi_channel!(PPI_CH10, 10, configurable); | ||
| 237 | impl_ppi_channel!(PPI_CH11, 11, configurable); | ||
| 238 | impl_ppi_channel!(PPI_CH12, 12, configurable); | ||
| 239 | impl_ppi_channel!(PPI_CH13, 13, configurable); | ||
| 240 | impl_ppi_channel!(PPI_CH14, 14, configurable); | ||
| 241 | impl_ppi_channel!(PPI_CH15, 15, configurable); | ||
| 242 | impl_ppi_channel!(PPI_CH16, 16, configurable); | ||
| 243 | impl_ppi_channel!(PPI_CH17, 17, configurable); | ||
| 244 | impl_ppi_channel!(PPI_CH18, 18, configurable); | ||
| 245 | impl_ppi_channel!(PPI_CH19, 19, configurable); | ||
| 246 | impl_ppi_channel!(PPI_CH20, 20); | ||
| 247 | impl_ppi_channel!(PPI_CH21, 21); | ||
| 248 | impl_ppi_channel!(PPI_CH22, 22); | ||
| 249 | impl_ppi_channel!(PPI_CH23, 23); | ||
| 250 | impl_ppi_channel!(PPI_CH24, 24); | ||
| 251 | impl_ppi_channel!(PPI_CH25, 25); | ||
| 252 | impl_ppi_channel!(PPI_CH26, 26); | ||
| 253 | impl_ppi_channel!(PPI_CH27, 27); | ||
| 254 | impl_ppi_channel!(PPI_CH28, 28); | ||
| 255 | impl_ppi_channel!(PPI_CH29, 29); | ||
| 256 | impl_ppi_channel!(PPI_CH30, 30); | ||
| 257 | impl_ppi_channel!(PPI_CH31, 31); | ||
| 258 | |||
| 259 | impl_saadc_input!(P0_02, ANALOGINPUT0); | ||
| 260 | impl_saadc_input!(P0_03, ANALOGINPUT1); | ||
| 261 | impl_saadc_input!(P0_04, ANALOGINPUT2); | ||
| 262 | impl_saadc_input!(P0_05, ANALOGINPUT3); | ||
| 263 | impl_saadc_input!(P0_28, ANALOGINPUT4); | ||
| 264 | impl_saadc_input!(P0_29, ANALOGINPUT5); | ||
| 265 | impl_saadc_input!(P0_30, ANALOGINPUT6); | ||
| 266 | impl_saadc_input!(P0_31, ANALOGINPUT7); | ||
| 267 | |||
| 226 | pub mod irqs { | 268 | pub mod irqs { |
| 227 | use crate::pac::Interrupt as InterruptEnum; | 269 | use crate::pac::Interrupt as InterruptEnum; |
| 228 | use embassy_macros::interrupt_declare as declare; | 270 | use embassy_macros::interrupt_declare as declare; |
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 001ee7fb8..25d09db4e 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -239,14 +239,14 @@ impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> { | |||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | /// Triggers `task set` (set associated pin high). | 241 | /// Triggers `task set` (set associated pin high). |
| 242 | #[cfg(not(feature = "51"))] | 242 | #[cfg(not(feature = "nrf51"))] |
| 243 | pub fn set(&self) { | 243 | pub fn set(&self) { |
| 244 | let g = unsafe { &*pac::GPIOTE::ptr() }; | 244 | let g = unsafe { &*pac::GPIOTE::ptr() }; |
| 245 | g.tasks_set[self.ch.number()].write(|w| unsafe { w.bits(1) }); | 245 | g.tasks_set[self.ch.number()].write(|w| unsafe { w.bits(1) }); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | /// Triggers `task clear` (set associated pin low). | 248 | /// Triggers `task clear` (set associated pin low). |
| 249 | #[cfg(not(feature = "51"))] | 249 | #[cfg(not(feature = "nrf51"))] |
| 250 | pub fn clear(&self) { | 250 | pub fn clear(&self) { |
| 251 | let g = unsafe { &*pac::GPIOTE::ptr() }; | 251 | let g = unsafe { &*pac::GPIOTE::ptr() }; |
| 252 | g.tasks_clr[self.ch.number()].write(|w| unsafe { w.bits(1) }); | 252 | g.tasks_clr[self.ch.number()].write(|w| unsafe { w.bits(1) }); |
| @@ -259,14 +259,14 @@ impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> { | |||
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | /// Returns the CLR task, for use with PPI. | 261 | /// Returns the CLR task, for use with PPI. |
| 262 | #[cfg(not(feature = "51"))] | 262 | #[cfg(not(feature = "nrf51"))] |
| 263 | pub fn task_clr(&self) -> Task { | 263 | pub fn task_clr(&self) -> Task { |
| 264 | let g = unsafe { &*pac::GPIOTE::ptr() }; | 264 | let g = unsafe { &*pac::GPIOTE::ptr() }; |
| 265 | Task::from_reg(&g.tasks_clr[self.ch.number()]) | 265 | Task::from_reg(&g.tasks_clr[self.ch.number()]) |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | /// Returns the SET task, for use with PPI. | 268 | /// Returns the SET task, for use with PPI. |
| 269 | #[cfg(not(feature = "51"))] | 269 | #[cfg(not(feature = "nrf51"))] |
| 270 | pub fn task_set(&self) -> Task { | 270 | pub fn task_set(&self) -> Task { |
| 271 | let g = unsafe { &*pac::GPIOTE::ptr() }; | 271 | let g = unsafe { &*pac::GPIOTE::ptr() }; |
| 272 | Task::from_reg(&g.tasks_set[self.ch.number()]) | 272 | Task::from_reg(&g.tasks_set[self.ch.number()]) |
diff --git a/embassy-nrf/src/ppi.rs b/embassy-nrf/src/ppi.rs index 61028c03a..1b12b1e95 100644 --- a/embassy-nrf/src/ppi.rs +++ b/embassy-nrf/src/ppi.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #![macro_use] | ||
| 2 | |||
| 1 | //! HAL interface for the PPI peripheral. | 3 | //! HAL interface for the PPI peripheral. |
| 2 | //! | 4 | //! |
| 3 | //! The Programmable Peripheral Interconnect interface allows for an autonomous interoperability | 5 | //! The Programmable Peripheral Interconnect interface allows for an autonomous interoperability |
| @@ -31,7 +33,7 @@ impl<'d, C: Channel> Ppi<'d, C> { | |||
| 31 | ch, | 33 | ch, |
| 32 | phantom: PhantomData, | 34 | phantom: PhantomData, |
| 33 | }; | 35 | }; |
| 34 | #[cfg(not(feature = "51"))] | 36 | #[cfg(not(feature = "nrf51"))] |
| 35 | this.clear_fork_task(); | 37 | this.clear_fork_task(); |
| 36 | this | 38 | this |
| 37 | } | 39 | } |
| @@ -50,7 +52,7 @@ impl<'d, C: Channel> Ppi<'d, C> { | |||
| 50 | .write(|w| unsafe { w.bits(1 << self.ch.number()) }); | 52 | .write(|w| unsafe { w.bits(1 << self.ch.number()) }); |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | #[cfg(not(feature = "51"))] | 55 | #[cfg(not(feature = "nrf51"))] |
| 54 | /// Sets the fork task that must be triggered when the configured event occurs. The user must | 56 | /// Sets the fork task that must be triggered when the configured event occurs. The user must |
| 55 | /// provide a reference to the task. | 57 | /// provide a reference to the task. |
| 56 | pub fn set_fork_task(&mut self, task: Task) { | 58 | pub fn set_fork_task(&mut self, task: Task) { |
| @@ -60,7 +62,7 @@ impl<'d, C: Channel> Ppi<'d, C> { | |||
| 60 | .write(|w| unsafe { w.bits(task.0.as_ptr() as u32) }) | 62 | .write(|w| unsafe { w.bits(task.0.as_ptr() as u32) }) |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | #[cfg(not(feature = "51"))] | 65 | #[cfg(not(feature = "nrf51"))] |
| 64 | /// Clear the fork task endpoint. Previously set task will no longer be triggered. | 66 | /// Clear the fork task endpoint. Previously set task will no longer be triggered. |
| 65 | pub fn clear_fork_task(&mut self) { | 67 | pub fn clear_fork_task(&mut self) { |
| 66 | let r = unsafe { &*pac::PPI::ptr() }; | 68 | let r = unsafe { &*pac::PPI::ptr() }; |
| @@ -109,7 +111,7 @@ impl Event { | |||
| 109 | } | 111 | } |
| 110 | } | 112 | } |
| 111 | 113 | ||
| 112 | mod sealed { | 114 | pub(crate) mod sealed { |
| 113 | pub trait ConfigurableChannel {} | 115 | pub trait ConfigurableChannel {} |
| 114 | pub trait Channel {} | 116 | pub trait Channel {} |
| 115 | pub trait Group {} | 117 | pub trait Group {} |
| @@ -167,15 +169,15 @@ impl Channel for AnyConfigurableChannel { | |||
| 167 | } | 169 | } |
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | macro_rules! impl_channel { | 172 | macro_rules! impl_ppi_channel { |
| 171 | ($type:ident, $number:expr, configurable) => { | 173 | ($type:ident, $number:expr, configurable) => { |
| 172 | impl_channel!($type, $number); | 174 | impl_ppi_channel!($type, $number); |
| 173 | impl sealed::ConfigurableChannel for peripherals::$type {} | 175 | impl crate::ppi::sealed::ConfigurableChannel for peripherals::$type {} |
| 174 | impl ConfigurableChannel for peripherals::$type {} | 176 | impl crate::ppi::ConfigurableChannel for peripherals::$type {} |
| 175 | }; | 177 | }; |
| 176 | ($type:ident, $number:expr) => { | 178 | ($type:ident, $number:expr) => { |
| 177 | impl sealed::Channel for peripherals::$type {} | 179 | impl crate::ppi::sealed::Channel for peripherals::$type {} |
| 178 | impl Channel for peripherals::$type { | 180 | impl crate::ppi::Channel for peripherals::$type { |
| 179 | fn number(&self) -> usize { | 181 | fn number(&self) -> usize { |
| 180 | $number | 182 | $number |
| 181 | } | 183 | } |
| @@ -183,43 +185,6 @@ macro_rules! impl_channel { | |||
| 183 | }; | 185 | }; |
| 184 | } | 186 | } |
| 185 | 187 | ||
| 186 | impl_channel!(PPI_CH0, 0, configurable); | ||
| 187 | impl_channel!(PPI_CH1, 1, configurable); | ||
| 188 | impl_channel!(PPI_CH2, 2, configurable); | ||
| 189 | impl_channel!(PPI_CH3, 3, configurable); | ||
| 190 | impl_channel!(PPI_CH4, 4, configurable); | ||
| 191 | impl_channel!(PPI_CH5, 5, configurable); | ||
| 192 | impl_channel!(PPI_CH6, 6, configurable); | ||
| 193 | impl_channel!(PPI_CH7, 7, configurable); | ||
| 194 | impl_channel!(PPI_CH8, 8, configurable); | ||
| 195 | impl_channel!(PPI_CH9, 9, configurable); | ||
| 196 | impl_channel!(PPI_CH10, 10, configurable); | ||
| 197 | impl_channel!(PPI_CH11, 11, configurable); | ||
| 198 | impl_channel!(PPI_CH12, 12, configurable); | ||
| 199 | impl_channel!(PPI_CH13, 13, configurable); | ||
| 200 | impl_channel!(PPI_CH14, 14, configurable); | ||
| 201 | impl_channel!(PPI_CH15, 15, configurable); | ||
| 202 | #[cfg(not(feature = "51"))] | ||
| 203 | impl_channel!(PPI_CH16, 16, configurable); | ||
| 204 | #[cfg(not(feature = "51"))] | ||
| 205 | impl_channel!(PPI_CH17, 17, configurable); | ||
| 206 | #[cfg(not(feature = "51"))] | ||
| 207 | impl_channel!(PPI_CH18, 18, configurable); | ||
| 208 | #[cfg(not(feature = "51"))] | ||
| 209 | impl_channel!(PPI_CH19, 19, configurable); | ||
| 210 | impl_channel!(PPI_CH20, 20); | ||
| 211 | impl_channel!(PPI_CH21, 21); | ||
| 212 | impl_channel!(PPI_CH22, 22); | ||
| 213 | impl_channel!(PPI_CH23, 23); | ||
| 214 | impl_channel!(PPI_CH24, 24); | ||
| 215 | impl_channel!(PPI_CH25, 25); | ||
| 216 | impl_channel!(PPI_CH26, 26); | ||
| 217 | impl_channel!(PPI_CH27, 27); | ||
| 218 | impl_channel!(PPI_CH28, 28); | ||
| 219 | impl_channel!(PPI_CH29, 29); | ||
| 220 | impl_channel!(PPI_CH30, 30); | ||
| 221 | impl_channel!(PPI_CH31, 31); | ||
| 222 | |||
| 223 | // ====================== | 188 | // ====================== |
| 224 | // groups | 189 | // groups |
| 225 | 190 | ||
| @@ -249,7 +214,7 @@ impl_group!(PPI_GROUP0, 0); | |||
| 249 | impl_group!(PPI_GROUP1, 1); | 214 | impl_group!(PPI_GROUP1, 1); |
| 250 | impl_group!(PPI_GROUP2, 2); | 215 | impl_group!(PPI_GROUP2, 2); |
| 251 | impl_group!(PPI_GROUP3, 3); | 216 | impl_group!(PPI_GROUP3, 3); |
| 252 | #[cfg(not(feature = "51"))] | 217 | #[cfg(not(feature = "nrf51"))] |
| 253 | impl_group!(PPI_GROUP4, 4); | 218 | impl_group!(PPI_GROUP4, 4); |
| 254 | #[cfg(not(feature = "51"))] | 219 | #[cfg(not(feature = "nrf51"))] |
| 255 | impl_group!(PPI_GROUP5, 5); | 220 | impl_group!(PPI_GROUP5, 5); |
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 2f2baefae..2ce7ef16d 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #![macro_use] | ||
| 2 | |||
| 1 | use core::marker::PhantomData; | 3 | use core::marker::PhantomData; |
| 2 | use core::sync::atomic::{compiler_fence, Ordering}; | 4 | use core::sync::atomic::{compiler_fence, Ordering}; |
| 3 | use core::task::Poll; | 5 | use core::task::Poll; |
| @@ -231,45 +233,12 @@ pub trait Input { | |||
| 231 | fn channel(&self) -> InputChannel; | 233 | fn channel(&self) -> InputChannel; |
| 232 | } | 234 | } |
| 233 | 235 | ||
| 234 | macro_rules! input_mappings { | 236 | macro_rules! impl_saadc_input { |
| 235 | ( $($ch:ident => $input:ident,)*) => { | 237 | ($pin:ident, $ch:ident) => { |
| 236 | $( | 238 | impl crate::saadc::Input for crate::peripherals::$pin { |
| 237 | impl Input for crate::peripherals::$input { | 239 | fn channel(&self) -> crate::saadc::InputChannel { |
| 238 | fn channel(&self) -> InputChannel { | 240 | crate::saadc::InputChannel::$ch |
| 239 | InputChannel::$ch | ||
| 240 | } | ||
| 241 | } | 241 | } |
| 242 | )* | 242 | } |
| 243 | }; | 243 | }; |
| 244 | } | 244 | } |
| 245 | |||
| 246 | // TODO the variant names are unchecked | ||
| 247 | // the inputs are copied from nrf hal | ||
| 248 | #[cfg(feature = "nrf9160")] | ||
| 249 | input_mappings! { | ||
| 250 | ANALOGINPUT0 => P0_13, | ||
| 251 | ANALOGINPUT1 => P0_14, | ||
| 252 | ANALOGINPUT2 => P0_15, | ||
| 253 | ANALOGINPUT3 => P0_16, | ||
| 254 | ANALOGINPUT4 => P0_17, | ||
| 255 | ANALOGINPUT5 => P0_18, | ||
| 256 | ANALOGINPUT6 => P0_19, | ||
| 257 | ANALOGINPUT7 => P0_20, | ||
| 258 | } | ||
| 259 | #[cfg(feature = "nrf52805")] | ||
| 260 | input_mappings! { | ||
| 261 | ANALOGINPUT2 => P0_04, | ||
| 262 | ANALOGINPUT3 => P0_05, | ||
| 263 | } | ||
| 264 | |||
| 265 | #[cfg(not(any(feature = "nrf52805", feature = "nrf9160")))] | ||
| 266 | input_mappings! { | ||
| 267 | ANALOGINPUT0 => P0_02, | ||
| 268 | ANALOGINPUT1 => P0_03, | ||
| 269 | ANALOGINPUT2 => P0_04, | ||
| 270 | ANALOGINPUT3 => P0_05, | ||
| 271 | ANALOGINPUT4 => P0_28, | ||
| 272 | ANALOGINPUT5 => P0_29, | ||
| 273 | ANALOGINPUT6 => P0_30, | ||
| 274 | ANALOGINPUT7 => P0_31, | ||
| 275 | } | ||
diff --git a/embassy-nrf/src/util.rs b/embassy-nrf/src/util.rs index 7c3974eeb..344fb01f9 100644 --- a/embassy-nrf/src/util.rs +++ b/embassy-nrf/src/util.rs | |||
| @@ -8,7 +8,7 @@ pub(crate) fn slice_in_ram(slice: &[u8]) -> bool { | |||
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | /// Return an error if slice is not in RAM. | 10 | /// Return an error if slice is not in RAM. |
| 11 | #[cfg(not(feature = "51"))] | 11 | #[cfg(not(feature = "nrf51"))] |
| 12 | pub(crate) fn slice_in_ram_or<T>(slice: &[u8], err: T) -> Result<(), T> { | 12 | pub(crate) fn slice_in_ram_or<T>(slice: &[u8], err: T) -> Result<(), T> { |
| 13 | if slice.len() == 0 || slice_in_ram(slice) { | 13 | if slice.len() == 0 || slice_in_ram(slice) { |
| 14 | Ok(()) | 14 | Ok(()) |
