nrf/gpiote: Allow choosing IRQ priority.
This commit is contained in:
parent
9206d4b33d
commit
32fc17f0fd
@ -40,7 +40,7 @@ pub enum OutputChannelPolarity {
|
|||||||
Toggle,
|
Toggle,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn init() {
|
pub(crate) fn init(irq_prio: crate::interrupt::Priority) {
|
||||||
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
||||||
let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
|
let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] };
|
||||||
#[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))]
|
#[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))]
|
||||||
@ -57,6 +57,7 @@ pub(crate) fn init() {
|
|||||||
|
|
||||||
let irq = unsafe { interrupt::GPIOTE::steal() };
|
let irq = unsafe { interrupt::GPIOTE::steal() };
|
||||||
irq.unpend();
|
irq.unpend();
|
||||||
|
irq.set_priority(irq_prio);
|
||||||
irq.enable();
|
irq.enable();
|
||||||
|
|
||||||
let g = unsafe { &*pac::GPIOTE::ptr() };
|
let g = unsafe { &*pac::GPIOTE::ptr() };
|
||||||
|
@ -93,6 +93,7 @@ pub mod config {
|
|||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub hfclk_source: HfclkSource,
|
pub hfclk_source: HfclkSource,
|
||||||
pub lfclk_source: LfclkSource,
|
pub lfclk_source: LfclkSource,
|
||||||
|
pub gpiote_interrupt_priority: crate::interrupt::Priority,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@ -103,6 +104,7 @@ pub mod config {
|
|||||||
// xtals if they know they have them.
|
// xtals if they know they have them.
|
||||||
hfclk_source: HfclkSource::Internal,
|
hfclk_source: HfclkSource::Internal,
|
||||||
lfclk_source: LfclkSource::InternalRC,
|
lfclk_source: LfclkSource::InternalRC,
|
||||||
|
gpiote_interrupt_priority: crate::interrupt::Priority::P0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +157,7 @@ pub fn init(config: config::Config) -> Peripherals {
|
|||||||
while r.events_lfclkstarted.read().bits() == 0 {}
|
while r.events_lfclkstarted.read().bits() == 0 {}
|
||||||
|
|
||||||
// Init GPIOTE
|
// Init GPIOTE
|
||||||
crate::gpiote::init();
|
crate::gpiote::init(config.gpiote_interrupt_priority);
|
||||||
|
|
||||||
peripherals
|
peripherals
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user