Remove pender-callback

This commit is contained in:
Dániel Buga 2023-08-14 08:32:26 +02:00
parent ec6bd27df6
commit 454a7cbf4c
2 changed files with 2 additions and 24 deletions

View File

@ -14,7 +14,7 @@ categories = [
[package.metadata.embassy_docs] [package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
features = ["nightly", "defmt", "pender-callback"] features = ["nightly", "defmt"]
flavors = [ flavors = [
{ name = "std", target = "x86_64-unknown-linux-gnu", features = ["arch-std", "executor-thread"] }, { name = "std", target = "x86_64-unknown-linux-gnu", features = ["arch-std", "executor-thread"] },
{ name = "wasm", target = "wasm32-unknown-unknown", features = ["arch-wasm", "executor-thread"] }, { name = "wasm", target = "wasm32-unknown-unknown", features = ["arch-wasm", "executor-thread"] },
@ -25,7 +25,7 @@ flavors = [
[package.metadata.docs.rs] [package.metadata.docs.rs]
default-target = "thumbv7em-none-eabi" default-target = "thumbv7em-none-eabi"
targets = ["thumbv7em-none-eabi"] targets = ["thumbv7em-none-eabi"]
features = ["nightly", "defmt", "pender-callback", "arch-cortex-m", "executor-thread", "executor-interrupt"] features = ["nightly", "defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"]
[features] [features]
@ -37,9 +37,6 @@ arch-xtensa = ["_arch"]
arch-riscv32 = ["_arch"] arch-riscv32 = ["_arch"]
arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"]
# Enable creating a `Pender` from an arbitrary function pointer callback.
pender-callback = []
# Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs) # Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs)
executor-thread = [] executor-thread = []
# Enable the interrupt-mode executor (available in Cortex-M only) # Enable the interrupt-mode executor (available in Cortex-M only)

View File

@ -317,28 +317,11 @@ pub enum Pender {
/// Pender for an interrupt-mode executor. /// Pender for an interrupt-mode executor.
#[cfg(feature = "executor-interrupt")] #[cfg(feature = "executor-interrupt")]
Interrupt(OpaqueInterruptContext), Interrupt(OpaqueInterruptContext),
/// Arbitrary, dynamically dispatched pender.
#[cfg(feature = "pender-callback")]
Callback { func: fn(*mut ()), context: *mut () },
} }
unsafe impl Send for Pender {} unsafe impl Send for Pender {}
unsafe impl Sync for Pender {} unsafe impl Sync for Pender {}
impl Pender {
/// Create a `Pender` that will call an arbitrary function pointer.
///
/// # Arguments
///
/// - `func`: The function pointer to call.
/// - `context`: Opaque context pointer, that will be passed to the function pointer.
#[cfg(feature = "pender-callback")]
pub fn new_from_callback(func: fn(*mut ()), context: *mut ()) -> Self {
Self::Callback { func, context }
}
}
impl Pender { impl Pender {
pub(crate) fn pend(self) { pub(crate) fn pend(self) {
match self { match self {
@ -356,8 +339,6 @@ impl Pender {
} }
unsafe { __interrupt_mode_pender(interrupt) }; unsafe { __interrupt_mode_pender(interrupt) };
} }
#[cfg(feature = "pender-callback")]
Pender::Callback { func, context } => func(context),
} }
} }
} }