aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-nrf/src/gpiote.rs3
-rw-r--r--embassy-nrf/src/lib.rs4
2 files changed, 5 insertions, 2 deletions
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs
index f322c1694..7e0220e79 100644
--- a/embassy-nrf/src/gpiote.rs
+++ b/embassy-nrf/src/gpiote.rs
@@ -40,7 +40,7 @@ pub enum OutputChannelPolarity {
40 Toggle, 40 Toggle,
41} 41}
42 42
43pub(crate) fn init() { 43pub(crate) fn init(irq_prio: crate::interrupt::Priority) {
44 #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] 44 #[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
45 let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] }; 45 let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
46 #[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))] 46 #[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))]
@@ -57,6 +57,7 @@ pub(crate) fn init() {
57 57
58 let irq = unsafe { interrupt::GPIOTE::steal() }; 58 let irq = unsafe { interrupt::GPIOTE::steal() };
59 irq.unpend(); 59 irq.unpend();
60 irq.set_priority(irq_prio);
60 irq.enable(); 61 irq.enable();
61 62
62 let g = unsafe { &*pac::GPIOTE::ptr() }; 63 let g = unsafe { &*pac::GPIOTE::ptr() };
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 1c496be19..f39521594 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -93,6 +93,7 @@ pub mod config {
93 pub struct Config { 93 pub struct Config {
94 pub hfclk_source: HfclkSource, 94 pub hfclk_source: HfclkSource,
95 pub lfclk_source: LfclkSource, 95 pub lfclk_source: LfclkSource,
96 pub gpiote_interrupt_priority: crate::interrupt::Priority,
96 } 97 }
97 98
98 impl Default for Config { 99 impl Default for Config {
@@ -103,6 +104,7 @@ pub mod config {
103 // xtals if they know they have them. 104 // xtals if they know they have them.
104 hfclk_source: HfclkSource::Internal, 105 hfclk_source: HfclkSource::Internal,
105 lfclk_source: LfclkSource::InternalRC, 106 lfclk_source: LfclkSource::InternalRC,
107 gpiote_interrupt_priority: crate::interrupt::Priority::P0,
106 } 108 }
107 } 109 }
108 } 110 }
@@ -155,7 +157,7 @@ pub fn init(config: config::Config) -> Peripherals {
155 while r.events_lfclkstarted.read().bits() == 0 {} 157 while r.events_lfclkstarted.read().bits() == 0 {}
156 158
157 // Init GPIOTE 159 // Init GPIOTE
158 crate::gpiote::init(); 160 crate::gpiote::init(config.gpiote_interrupt_priority);
159 161
160 peripherals 162 peripherals
161} 163}