diff options
| author | Dániel Buga <[email protected]> | 2023-08-14 08:32:26 +0200 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2023-08-14 08:32:26 +0200 |
| commit | 454a7cbf4c0eb3a4e651e7da5512ec49ff7d4050 (patch) | |
| tree | e66c4c70dfb8b7e2ad591d2889b91d6c36907c97 | |
| parent | ec6bd27df6101bc5f77fa4eace0e8963970231ad (diff) | |
Remove pender-callback
| -rw-r--r-- | embassy-executor/Cargo.toml | 7 | ||||
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 19 |
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] |
| 15 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" | 15 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" |
| 16 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" | 16 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" |
| 17 | features = ["nightly", "defmt", "pender-callback"] | 17 | features = ["nightly", "defmt"] |
| 18 | flavors = [ | 18 | flavors = [ |
| 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] |
| 26 | default-target = "thumbv7em-none-eabi" | 26 | default-target = "thumbv7em-none-eabi" |
| 27 | targets = ["thumbv7em-none-eabi"] | 27 | targets = ["thumbv7em-none-eabi"] |
| 28 | features = ["nightly", "defmt", "pender-callback", "arch-cortex-m", "executor-thread", "executor-interrupt"] | 28 | features = ["nightly", "defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"] |
| 29 | 29 | ||
| 30 | [features] | 30 | [features] |
| 31 | 31 | ||
| @@ -37,9 +37,6 @@ arch-xtensa = ["_arch"] | |||
| 37 | arch-riscv32 = ["_arch"] | 37 | arch-riscv32 = ["_arch"] |
| 38 | arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] | 38 | arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] |
| 39 | 39 | ||
| 40 | # Enable creating a `Pender` from an arbitrary function pointer callback. | ||
| 41 | pender-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) |
| 44 | executor-thread = [] | 41 | executor-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 | ||
| 326 | unsafe impl Send for Pender {} | 322 | unsafe impl Send for Pender {} |
| 327 | unsafe impl Sync for Pender {} | 323 | unsafe impl Sync for Pender {} |
| 328 | 324 | ||
| 329 | impl Pender { | 325 | impl 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 | |||
| 342 | impl 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 | } |
