diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-17 22:52:27 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-17 22:52:57 +0100 |
| commit | 278ce028247160328f22f3d52c25299280ec5d8c (patch) | |
| tree | f0eba26129f966f68767088e25f530b69ab56065 | |
| parent | a9076636ac5e5396aea0e450b8af591b709640a2 (diff) | |
Rename IrqExecutor to InterruptExecutor
| -rw-r--r-- | embassy-nrf-examples/src/bin/multiprio.rs | 10 | ||||
| -rw-r--r-- | embassy/src/executor/mod.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/embassy-nrf-examples/src/bin/multiprio.rs b/embassy-nrf-examples/src/bin/multiprio.rs index f5ebf67ff..65c646217 100644 --- a/embassy-nrf-examples/src/bin/multiprio.rs +++ b/embassy-nrf-examples/src/bin/multiprio.rs | |||
| @@ -67,7 +67,7 @@ use cortex_m_rt::entry; | |||
| 67 | use defmt::panic; | 67 | use defmt::panic; |
| 68 | use nrf52840_hal::clocks; | 68 | use nrf52840_hal::clocks; |
| 69 | 69 | ||
| 70 | use embassy::executor::{task, Executor, IrqExecutor}; | 70 | use embassy::executor::{task, Executor, InterruptExecutor}; |
| 71 | use embassy::interrupt::InterruptExt; | 71 | use embassy::interrupt::InterruptExt; |
| 72 | use embassy::time::{Duration, Instant, Timer}; | 72 | use embassy::time::{Duration, Instant, Timer}; |
| 73 | use embassy::util::Forever; | 73 | use embassy::util::Forever; |
| @@ -117,9 +117,9 @@ async fn run_low() { | |||
| 117 | 117 | ||
| 118 | static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new(); | 118 | static RTC: Forever<rtc::RTC<pac::RTC1>> = Forever::new(); |
| 119 | static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); | 119 | static ALARM_HIGH: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); |
| 120 | static EXECUTOR_HIGH: Forever<IrqExecutor<interrupt::SWI1_EGU1>> = Forever::new(); | 120 | static EXECUTOR_HIGH: Forever<InterruptExecutor<interrupt::SWI1_EGU1>> = Forever::new(); |
| 121 | static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); | 121 | static ALARM_MED: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); |
| 122 | static EXECUTOR_MED: Forever<IrqExecutor<interrupt::SWI0_EGU0>> = Forever::new(); | 122 | static EXECUTOR_MED: Forever<InterruptExecutor<interrupt::SWI0_EGU0>> = Forever::new(); |
| 123 | static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); | 123 | static ALARM_LOW: Forever<rtc::Alarm<pac::RTC1>> = Forever::new(); |
| 124 | static EXECUTOR_LOW: Forever<Executor> = Forever::new(); | 124 | static EXECUTOR_LOW: Forever<Executor> = Forever::new(); |
| 125 | 125 | ||
| @@ -142,7 +142,7 @@ fn main() -> ! { | |||
| 142 | let irq = interrupt::take!(SWI1_EGU1); | 142 | let irq = interrupt::take!(SWI1_EGU1); |
| 143 | irq.set_priority(interrupt::Priority::Level6); | 143 | irq.set_priority(interrupt::Priority::Level6); |
| 144 | let alarm = ALARM_HIGH.put(rtc.alarm2()); | 144 | let alarm = ALARM_HIGH.put(rtc.alarm2()); |
| 145 | let executor = EXECUTOR_HIGH.put(IrqExecutor::new(irq)); | 145 | let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq)); |
| 146 | executor.set_alarm(alarm); | 146 | executor.set_alarm(alarm); |
| 147 | executor.start(|spawner| { | 147 | executor.start(|spawner| { |
| 148 | unwrap!(spawner.spawn(run_high())); | 148 | unwrap!(spawner.spawn(run_high())); |
| @@ -152,7 +152,7 @@ fn main() -> ! { | |||
| 152 | let irq = interrupt::take!(SWI0_EGU0); | 152 | let irq = interrupt::take!(SWI0_EGU0); |
| 153 | irq.set_priority(interrupt::Priority::Level7); | 153 | irq.set_priority(interrupt::Priority::Level7); |
| 154 | let alarm = ALARM_MED.put(rtc.alarm1()); | 154 | let alarm = ALARM_MED.put(rtc.alarm1()); |
| 155 | let executor = EXECUTOR_MED.put(IrqExecutor::new(irq)); | 155 | let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq)); |
| 156 | executor.set_alarm(alarm); | 156 | executor.set_alarm(alarm); |
| 157 | executor.start(|spawner| { | 157 | executor.start(|spawner| { |
| 158 | unwrap!(spawner.spawn(run_med())); | 158 | unwrap!(spawner.spawn(run_med())); |
diff --git a/embassy/src/executor/mod.rs b/embassy/src/executor/mod.rs index 787230c0b..10e543307 100644 --- a/embassy/src/executor/mod.rs +++ b/embassy/src/executor/mod.rs | |||
| @@ -215,13 +215,13 @@ fn pend_by_number(n: u16) { | |||
| 215 | cortex_m::peripheral::NVIC::pend(N(n)) | 215 | cortex_m::peripheral::NVIC::pend(N(n)) |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | pub struct IrqExecutor<I: Interrupt> { | 218 | pub struct InterruptExecutor<I: Interrupt> { |
| 219 | irq: I, | 219 | irq: I, |
| 220 | inner: raw::Executor, | 220 | inner: raw::Executor, |
| 221 | not_send: PhantomData<*mut ()>, | 221 | not_send: PhantomData<*mut ()>, |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | impl<I: Interrupt> IrqExecutor<I> { | 224 | impl<I: Interrupt> InterruptExecutor<I> { |
| 225 | pub fn new(irq: I) -> Self { | 225 | pub fn new(irq: I) -> Self { |
| 226 | let ctx = irq.number() as *mut (); | 226 | let ctx = irq.number() as *mut (); |
| 227 | Self { | 227 | Self { |
