Skip to content

Commit

Permalink
fix(threads): xtensa: re-enable scheduling interrupt after `esp_hal::…
Browse files Browse the repository at this point in the history
…init()`
  • Loading branch information
kaspar030 committed Oct 22, 2024
1 parent b8e3aa2 commit 899281d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/riot-rs-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ wifi = []
wifi-cyw43 = ["riot-rs-rp/wifi-cyw43", "net", "wifi"]
wifi-esp = ["riot-rs-esp/wifi-esp", "net", "wifi"]

threading = ["dep:riot-rs-threads"]
threading = ["dep:riot-rs-threads", "riot-rs-esp/threading"]
override-network-config = []
override-usb-config = []

Expand Down
3 changes: 3 additions & 0 deletions src/riot-rs-esp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ i2c = [
## Enables defmt support.
defmt = ["dep:defmt", "esp-wifi?/defmt", "fugit?/defmt"]

## Enables threading support.
threading = []

## Enables Wi-Fi support.
wifi = []

Expand Down
13 changes: 13 additions & 0 deletions src/riot-rs-esp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ pub use esp_hal_embassy::Executor;
pub fn init() -> OptionalPeripherals {
let mut peripherals = OptionalPeripherals::from(esp_hal::init(esp_hal::Config::default()));

#[cfg(feature = "threading")]
{
use esp_hal::{interrupt, peripherals::Interrupt};
// Since https://github.com/esp-rs/esp-hal/pull/2091,
// `esp_hal::init()` resets all interrupts.
// This re-enables our previously in `riot_rs_threads::arch::xtensa` enabled
// scheduler interrupt.

// Panics if `FROM_CPU_INTR1` is among `esp_hal::interrupt::RESERVED_INTERRUPTS`,
// which isn't the case.
interrupt::enable(Interrupt::FROM_CPU_INTR1, interrupt::Priority::min()).unwrap();
}

#[cfg(feature = "wifi-esp")]
{
use esp_hal::timer::timg::TimerGroup;
Expand Down

0 comments on commit 899281d

Please sign in to comment.