Rename IrqExecutor to InterruptExecutor
This commit is contained in:
parent
a9076636ac
commit
278ce02824
@ -67,7 +67,7 @@ use cortex_m_rt::entry;
|
|||||||
use defmt::panic;
|
use defmt::panic;
|
||||||
use nrf52840_hal::clocks;
|
use nrf52840_hal::clocks;
|
||||||
|
|
||||||
use embassy::executor::{task, Executor, IrqExecutor};
|
use embassy::executor::{task, Executor, InterruptExecutor};
|
||||||
use embassy::interrupt::InterruptExt;
|
use embassy::interrupt::InterruptExt;
|
||||||
use embassy::time::{Duration, Instant, Timer};
|
use embassy::time::{Duration, Instant, Timer};
|
||||||
use embassy::util::Forever;
|
use embassy::util::Forever;
|
||||||
@ -117,9 +117,9 @@ async fn run_low() {
|
|||||||
|
|
||||||
static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new();
|
static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new();
|
||||||
static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1>> = Forever::new();
|
static EXECUTOR_HIGH: Forever<InterruptExecutor<interrupt::SWI1_EGU1>> = Forever::new();
|
||||||
static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0>> = Forever::new();
|
static EXECUTOR_MED: Forever<InterruptExecutor<interrupt::SWI0_EGU0>> = Forever::new();
|
||||||
static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new();
|
||||||
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
|
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ fn main() -> ! {
|
|||||||
let irq = interrupt::take!(SWI1_EGU1);
|
let irq = interrupt::take!(SWI1_EGU1);
|
||||||
irq.set_priority(interrupt::Priority::Level6);
|
irq.set_priority(interrupt::Priority::Level6);
|
||||||
let alarm = ALARM_HIGH.put(rtc.alarm2());
|
let alarm = ALARM_HIGH.put(rtc.alarm2());
|
||||||
let executor = EXECUTOR_HIGH.put(IrqExecutor::new(irq));
|
let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq));
|
||||||
executor.set_alarm(alarm);
|
executor.set_alarm(alarm);
|
||||||
executor.start(|spawner| {
|
executor.start(|spawner| {
|
||||||
unwrap!(spawner.spawn(run_high()));
|
unwrap!(spawner.spawn(run_high()));
|
||||||
@ -152,7 +152,7 @@ fn main() -> ! {
|
|||||||
let irq = interrupt::take!(SWI0_EGU0);
|
let irq = interrupt::take!(SWI0_EGU0);
|
||||||
irq.set_priority(interrupt::Priority::Level7);
|
irq.set_priority(interrupt::Priority::Level7);
|
||||||
let alarm = ALARM_MED.put(rtc.alarm1());
|
let alarm = ALARM_MED.put(rtc.alarm1());
|
||||||
let executor = EXECUTOR_MED.put(IrqExecutor::new(irq));
|
let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq));
|
||||||
executor.set_alarm(alarm);
|
executor.set_alarm(alarm);
|
||||||
executor.start(|spawner| {
|
executor.start(|spawner| {
|
||||||
unwrap!(spawner.spawn(run_med()));
|
unwrap!(spawner.spawn(run_med()));
|
||||||
|
@ -215,13 +215,13 @@ fn pend_by_number(n: u16) {
|
|||||||
cortex_m::peripheral::NVIC::pend(N(n))
|
cortex_m::peripheral::NVIC::pend(N(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IrqExecutor<I: Interrupt> {
|
pub struct InterruptExecutor<I: Interrupt> {
|
||||||
irq: I,
|
irq: I,
|
||||||
inner: raw::Executor,
|
inner: raw::Executor,
|
||||||
not_send: PhantomData<*mut ()>,
|
not_send: PhantomData<*mut ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I: Interrupt> IrqExecutor<I> {
|
impl<I: Interrupt> InterruptExecutor<I> {
|
||||||
pub fn new(irq: I) -> Self {
|
pub fn new(irq: I) -> Self {
|
||||||
let ctx = irq.number() as *mut ();
|
let ctx = irq.number() as *mut ();
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user