diff options
Diffstat (limited to 'embassy-nrf/src/lib.rs')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 05bdd1904..5a73b87e0 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -12,7 +12,8 @@ | |||
| 12 | feature = "nrf52832", | 12 | feature = "nrf52832", |
| 13 | feature = "nrf52833", | 13 | feature = "nrf52833", |
| 14 | feature = "nrf52840", | 14 | feature = "nrf52840", |
| 15 | feature = "nrf5340-app", | 15 | feature = "nrf5340-app-s", |
| 16 | feature = "nrf5340-app-ns", | ||
| 16 | feature = "nrf5340-net", | 17 | feature = "nrf5340-net", |
| 17 | feature = "nrf9160-s", | 18 | feature = "nrf9160-s", |
| 18 | feature = "nrf9160-ns", | 19 | feature = "nrf9160-ns", |
| @@ -30,23 +31,24 @@ pub mod buffered_uarte; | |||
| 30 | pub mod gpio; | 31 | pub mod gpio; |
| 31 | #[cfg(feature = "gpiote")] | 32 | #[cfg(feature = "gpiote")] |
| 32 | pub mod gpiote; | 33 | pub mod gpiote; |
| 33 | #[cfg(not(feature = "_nrf9160"))] | 34 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 34 | pub mod nvmc; | 35 | pub mod nvmc; |
| 35 | pub mod ppi; | 36 | pub mod ppi; |
| 36 | #[cfg(not(any(feature = "nrf52805", feature = "nrf52820")))] | 37 | #[cfg(not(any(feature = "nrf52805", feature = "nrf52820", feature = "_nrf5340-net")))] |
| 37 | pub mod pwm; | 38 | pub mod pwm; |
| 38 | #[cfg(feature = "nrf52840")] | 39 | #[cfg(feature = "nrf52840")] |
| 39 | pub mod qspi; | 40 | pub mod qspi; |
| 40 | #[cfg(not(feature = "_nrf9160"))] | 41 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 41 | pub mod rng; | 42 | pub mod rng; |
| 42 | #[cfg(not(feature = "nrf52820"))] | 43 | #[cfg(not(any(feature = "nrf52820", feature = "_nrf5340-net")))] |
| 43 | pub mod saadc; | 44 | pub mod saadc; |
| 44 | pub mod spim; | 45 | pub mod spim; |
| 45 | #[cfg(not(feature = "_nrf9160"))] | 46 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 46 | pub mod temp; | 47 | pub mod temp; |
| 47 | pub mod timer; | 48 | pub mod timer; |
| 48 | pub mod twim; | 49 | pub mod twim; |
| 49 | pub mod uarte; | 50 | pub mod uarte; |
| 51 | #[cfg(not(feature = "_nrf5340"))] | ||
| 50 | pub mod wdt; | 52 | pub mod wdt; |
| 51 | 53 | ||
| 52 | // This mod MUST go last, so that it sees all the `impl_foo!` macros | 54 | // This mod MUST go last, so that it sees all the `impl_foo!` macros |
| @@ -57,6 +59,8 @@ pub mod wdt; | |||
| 57 | #[cfg_attr(feature = "nrf52832", path = "chips/nrf52832.rs")] | 59 | #[cfg_attr(feature = "nrf52832", path = "chips/nrf52832.rs")] |
| 58 | #[cfg_attr(feature = "nrf52833", path = "chips/nrf52833.rs")] | 60 | #[cfg_attr(feature = "nrf52833", path = "chips/nrf52833.rs")] |
| 59 | #[cfg_attr(feature = "nrf52840", path = "chips/nrf52840.rs")] | 61 | #[cfg_attr(feature = "nrf52840", path = "chips/nrf52840.rs")] |
| 62 | #[cfg_attr(feature = "_nrf5340-app", path = "chips/nrf5340_app.rs")] | ||
| 63 | #[cfg_attr(feature = "_nrf5340-net", path = "chips/nrf5340_net.rs")] | ||
| 60 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] | 64 | #[cfg_attr(feature = "_nrf9160", path = "chips/nrf9160.rs")] |
| 61 | mod chip; | 65 | mod chip; |
| 62 | 66 | ||
| @@ -67,7 +71,6 @@ pub use chip::pac; | |||
| 67 | #[cfg(not(feature = "unstable-pac"))] | 71 | #[cfg(not(feature = "unstable-pac"))] |
| 68 | pub(crate) use chip::pac; | 72 | pub(crate) use chip::pac; |
| 69 | 73 | ||
| 70 | use crate::pac::CLOCK; | ||
| 71 | pub use chip::{peripherals, Peripherals}; | 74 | pub use chip::{peripherals, Peripherals}; |
| 72 | 75 | ||
| 73 | pub mod interrupt { | 76 | pub mod interrupt { |
| @@ -86,12 +89,12 @@ pub mod config { | |||
| 86 | 89 | ||
| 87 | pub enum LfclkSource { | 90 | pub enum LfclkSource { |
| 88 | InternalRC, | 91 | InternalRC, |
| 89 | #[cfg(not(feature = "_nrf9160"))] | 92 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 90 | Synthesized, | 93 | Synthesized, |
| 91 | ExternalXtal, | 94 | ExternalXtal, |
| 92 | #[cfg(not(feature = "_nrf9160"))] | 95 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 93 | ExternalLowSwing, | 96 | ExternalLowSwing, |
| 94 | #[cfg(not(feature = "_nrf9160"))] | 97 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 95 | ExternalFullSwing, | 98 | ExternalFullSwing, |
| 96 | } | 99 | } |
| 97 | 100 | ||
| @@ -127,7 +130,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 127 | // before doing anything important. | 130 | // before doing anything important. |
| 128 | let peripherals = Peripherals::take(); | 131 | let peripherals = Peripherals::take(); |
| 129 | 132 | ||
| 130 | let r = unsafe { &*CLOCK::ptr() }; | 133 | let r = unsafe { &*pac::CLOCK::ptr() }; |
| 131 | 134 | ||
| 132 | // Start HFCLK. | 135 | // Start HFCLK. |
| 133 | match config.hfclk_source { | 136 | match config.hfclk_source { |
| @@ -141,7 +144,7 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 141 | } | 144 | } |
| 142 | 145 | ||
| 143 | // Configure LFCLK. | 146 | // Configure LFCLK. |
| 144 | #[cfg(not(feature = "_nrf9160"))] | 147 | #[cfg(not(any(feature = "_nrf5340", feature = "_nrf9160")))] |
| 145 | match config.lfclk_source { | 148 | match config.lfclk_source { |
| 146 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), | 149 | config::LfclkSource::InternalRC => r.lfclksrc.write(|w| w.src().rc()), |
| 147 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), | 150 | config::LfclkSource::Synthesized => r.lfclksrc.write(|w| w.src().synth()), |
