Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly gate events of nested APIs #358

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/scheduler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

### Patch

- Correctly gate events of nested APIs
- Rename `debug` internal feature to `internal-debug`
- Fix double-lock issue for native callbacks
- Fix parsing of `WASEFIRE_MEMORY_PAGE_COUNT`
Expand Down
4 changes: 4 additions & 0 deletions crates/scheduler/src/event/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
use wasefire_board_api::radio::Event;
use wasefire_board_api::Api as Board;

#[cfg(all(feature = "board-api-radio-ble", feature = "applet-api-radio-ble"))]
pub mod ble;

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum Key {
#[cfg(all(feature = "board-api-radio-ble", feature = "applet-api-radio-ble"))]
Ble(ble::Key),
}

Expand All @@ -31,13 +33,15 @@ impl<B: Board> From<Key> for crate::event::Key<B> {
impl<'a> From<&'a Event> for Key {
fn from(event: &'a Event) -> Self {
match event {
#[cfg(all(feature = "board-api-radio-ble", feature = "applet-api-radio-ble"))]
Event::Ble(event) => Key::Ble(event.into()),
}
}
}

pub fn process(event: Event) {
match event {
#[cfg(all(feature = "board-api-radio-ble", feature = "applet-api-radio-ble"))]
Event::Ble(_) => ble::process(),
}
}
4 changes: 4 additions & 0 deletions crates/scheduler/src/event/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
use wasefire_board_api::usb::Event;
use wasefire_board_api::Api as Board;

#[cfg(all(feature = "board-api-usb-serial", feature = "applet-api-usb-serial"))]
pub mod serial;

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum Key {
#[cfg(all(feature = "board-api-usb-serial", feature = "applet-api-usb-serial"))]
Serial(serial::Key),
}

Expand All @@ -31,13 +33,15 @@ impl<B: Board> From<Key> for crate::event::Key<B> {
impl<'a> From<&'a Event> for Key {
fn from(event: &'a Event) -> Self {
match event {
#[cfg(all(feature = "board-api-usb-serial", feature = "applet-api-usb-serial"))]
Event::Serial(event) => Key::Serial(event.into()),
}
}
}

pub fn process(event: Event) {
match event {
#[cfg(all(feature = "board-api-usb-serial", feature = "applet-api-usb-serial"))]
Event::Serial(_) => serial::process(),
}
}