aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-executor/Cargo.toml7
-rw-r--r--embassy-executor/src/raw/mod.rs19
2 files changed, 2 insertions, 24 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index ce5e2741f..d190c95a3 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -14,7 +14,7 @@ categories = [
14[package.metadata.embassy_docs] 14[package.metadata.embassy_docs]
15src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" 15src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
16src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" 16src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
17features = ["nightly", "defmt", "pender-callback"] 17features = ["nightly", "defmt"]
18flavors = [ 18flavors = [
19 { name = "std", target = "x86_64-unknown-linux-gnu", features = ["arch-std", "executor-thread"] }, 19 { name = "std", target = "x86_64-unknown-linux-gnu", features = ["arch-std", "executor-thread"] },
20 { name = "wasm", target = "wasm32-unknown-unknown", features = ["arch-wasm", "executor-thread"] }, 20 { name = "wasm", target = "wasm32-unknown-unknown", features = ["arch-wasm", "executor-thread"] },
@@ -25,7 +25,7 @@ flavors = [
25[package.metadata.docs.rs] 25[package.metadata.docs.rs]
26default-target = "thumbv7em-none-eabi" 26default-target = "thumbv7em-none-eabi"
27targets = ["thumbv7em-none-eabi"] 27targets = ["thumbv7em-none-eabi"]
28features = ["nightly", "defmt", "pender-callback", "arch-cortex-m", "executor-thread", "executor-interrupt"] 28features = ["nightly", "defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"]
29 29
30[features] 30[features]
31 31
@@ -37,9 +37,6 @@ arch-xtensa = ["_arch"]
37arch-riscv32 = ["_arch"] 37arch-riscv32 = ["_arch"]
38arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] 38arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"]
39 39
40# Enable creating a `Pender` from an arbitrary function pointer callback.
41pender-callback = []
42
43# Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs) 40# Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs)
44executor-thread = [] 41executor-thread = []
45# Enable the interrupt-mode executor (available in Cortex-M only) 42# Enable the interrupt-mode executor (available in Cortex-M only)
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index 7795f1e4a..81ad1e53d 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -317,29 +317,12 @@ pub enum Pender {
317 /// Pender for an interrupt-mode executor. 317 /// Pender for an interrupt-mode executor.
318 #[cfg(feature = "executor-interrupt")] 318 #[cfg(feature = "executor-interrupt")]
319 Interrupt(OpaqueInterruptContext), 319 Interrupt(OpaqueInterruptContext),
320
321 /// Arbitrary, dynamically dispatched pender.
322 #[cfg(feature = "pender-callback")]
323 Callback { func: fn(*mut ()), context: *mut () },
324} 320}
325 321
326unsafe impl Send for Pender {} 322unsafe impl Send for Pender {}
327unsafe impl Sync for Pender {} 323unsafe impl Sync for Pender {}
328 324
329impl Pender { 325impl Pender {
330 /// Create a `Pender` that will call an arbitrary function pointer.
331 ///
332 /// # Arguments
333 ///
334 /// - `func`: The function pointer to call.
335 /// - `context`: Opaque context pointer, that will be passed to the function pointer.
336 #[cfg(feature = "pender-callback")]
337 pub fn new_from_callback(func: fn(*mut ()), context: *mut ()) -> Self {
338 Self::Callback { func, context }
339 }
340}
341
342impl Pender {
343 pub(crate) fn pend(self) { 326 pub(crate) fn pend(self) {
344 match self { 327 match self {
345 #[cfg(feature = "executor-thread")] 328 #[cfg(feature = "executor-thread")]
@@ -356,8 +339,6 @@ impl Pender {
356 } 339 }
357 unsafe { __interrupt_mode_pender(interrupt) }; 340 unsafe { __interrupt_mode_pender(interrupt) };
358 } 341 }
359 #[cfg(feature = "pender-callback")]
360 Pender::Callback { func, context } => func(context),
361 } 342 }
362 } 343 }
363} 344}