feat: migrate to embassy-executor 0.10
Bump embassy-executor 0.9 -> 0.10 and embassy-rp 0.9 -> 0.10 from crates.io. Patch esp-hal, esp-rtos, esp-backtrace, esp-println from esp-rs/esp-hal main branch (esp-rtos 0.2.0 on crates.io pins embassy-executor ^0.9). API migrations: - embassy-executor: arch-cortex-m -> platform-cortex-m feature rename - embassy-executor: SpawnToken now returned as Result from task functions - esp-hal main: efuse::Efuse::mac_address() -> efuse::base_mac_address() - esp-hal main: esp_rtos::start() now requires SoftwareInterrupt<0> - embassy-rp 0.10: SPI constructor requires DMA interrupt bindings Also fixes UART display stuck on splash (sent Reset instead of On at boot) and switches just check to clippy -D warnings.
This commit is contained in:
14 files changed
+329
-124
No files matched your search
@@ -51,7 +51,7 @@ impl LoRaBoard for Board {
|
||||
fn into_parts(self) -> BoardParts<RadioParts, UsbParts, DisplayParts, LedDriver> {
|
||||
let p = self.p;
|
||||
|
||||
mcu::start_timer(p.TIMG0);
|
||||
mcu::start_timer(p.TIMG0, p.SW_INTERRUPT);
|
||||
|
||||
// Vext power: GPIO36, active LOW to enable peripherals
|
||||
let vext = Output::new(p.GPIO36, Level::Low, OutputConfig::default());
|
||||
|
||||
@@ -50,7 +50,7 @@ impl LoRaBoard for Board {
|
||||
fn into_parts(self) -> BoardParts<RadioParts, UartParts, DisplayParts, LedDriver> {
|
||||
let p = self.p;
|
||||
|
||||
mcu::start_timer(p.TIMG0);
|
||||
mcu::start_timer(p.TIMG0, p.SW_INTERRUPT);
|
||||
|
||||
// Vext power: GPIO36, active LOW to enable peripherals
|
||||
let vext = Output::new(p.GPIO36, Level::Low, OutputConfig::default());
|
||||
|
||||
@@ -44,7 +44,7 @@ impl LoRaBoard for Board {
|
||||
fn into_parts(self) -> BoardParts<RadioParts, UsbParts, DisplayParts, LedDriver> {
|
||||
let p = self.p;
|
||||
|
||||
mcu::start_timer(p.TIMG0);
|
||||
mcu::start_timer(p.TIMG0, p.SW_INTERRUPT);
|
||||
|
||||
// Vext power: GPIO36, active LOW to enable peripherals
|
||||
let vext = Output::new(p.GPIO36, Level::Low, OutputConfig::default());
|
||||
|
||||
@@ -92,7 +92,7 @@ impl LoRaBoard for Board {
|
||||
let mut spi_cfg = spi::Config::default();
|
||||
spi_cfg.frequency = 1_000_000;
|
||||
let spi = spi::Spi::new(
|
||||
p.SPI1, p.PIN_14, p.PIN_15, p.PIN_24, p.DMA_CH0, p.DMA_CH1, spi_cfg,
|
||||
p.SPI1, p.PIN_14, p.PIN_15, p.PIN_24, p.DMA_CH0, p.DMA_CH1, mcu::Irqs, spi_cfg,
|
||||
);
|
||||
let spi_bus = mcu::share_spi_bus(spi);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use crate::protocol::{Command, RadioConfig, Response};
|
||||
pub enum DisplayCommand {
|
||||
On,
|
||||
Off,
|
||||
#[allow(dead_code)] // only used by USB host task, not UART
|
||||
Reset,
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -21,9 +21,13 @@ pub type I2cBus = I2c<'static, esp_hal::Async>;
|
||||
// ── Timer ───────────────────────────────────────────────────────────
|
||||
|
||||
/// Start the ESP-RTOS scheduler and Embassy time driver.
|
||||
pub fn start_timer(timg0: esp_hal::peripherals::TIMG0<'static>) {
|
||||
pub fn start_timer(
|
||||
timg0: esp_hal::peripherals::TIMG0<'static>,
|
||||
sw_int: esp_hal::peripherals::SW_INTERRUPT<'static>,
|
||||
) {
|
||||
let timg0 = TimerGroup::new(timg0);
|
||||
esp_rtos::start(timg0.timer0);
|
||||
let sw_ints = esp_hal::interrupt::software::SoftwareInterruptControl::new(sw_int);
|
||||
esp_rtos::start(timg0.timer0, sw_ints.software_interrupt0);
|
||||
}
|
||||
|
||||
// ── SPI bus ─────────────────────────────────────────────────────────
|
||||
@@ -78,5 +82,8 @@ pub fn init_i2c(
|
||||
|
||||
/// Read the factory-programmed MAC address from eFuse.
|
||||
pub fn mac_address() -> [u8; 6] {
|
||||
esp_hal::efuse::Efuse::mac_address()
|
||||
esp_hal::efuse::base_mac_address()
|
||||
.as_bytes()
|
||||
.try_into()
|
||||
.expect("MAC is 6 bytes")
|
||||
}
|
||||
@@ -11,6 +11,8 @@ use static_cell::StaticCell;
|
||||
|
||||
bind_interrupts!(pub struct Irqs {
|
||||
USBCTRL_IRQ => embassy_rp::usb::InterruptHandler<embassy_rp::peripherals::USB>;
|
||||
DMA_IRQ_0 => embassy_rp::dma::InterruptHandler<embassy_rp::peripherals::DMA_CH0>,
|
||||
embassy_rp::dma::InterruptHandler<embassy_rp::peripherals::DMA_CH1>;
|
||||
});
|
||||
|
||||
// ── MCU-level types ────────────────────────────────────────────────
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ pub async fn host_task(
|
||||
) {
|
||||
let (mut rx, mut tx) = parts.driver.split();
|
||||
|
||||
// UART has no DTR — signal the display that a host is present at boot.
|
||||
// UART has no DTR — assume a host is always present.
|
||||
if has_display {
|
||||
display_commands.send(DisplayCommand::Reset).await;
|
||||
display_commands.send(DisplayCommand::On).await;
|
||||
}
|
||||
|
||||
let mut read_buf = [0u8; 64];
|
||||
|
||||
+14
-10
@@ -79,24 +79,28 @@ async fn run(spawner: Spawner) {
|
||||
let board = <board::Board as LoRaBoard>::init();
|
||||
let parts = board.into_parts();
|
||||
|
||||
spawner
|
||||
.spawn(radio::radio_task(parts.radio, &COMMANDS, &RESPONSES, &STATUS))
|
||||
.expect("spawn radio_task");
|
||||
spawner.spawn(
|
||||
radio::radio_task(parts.radio, &COMMANDS, &RESPONSES, &STATUS)
|
||||
.expect("spawn radio_task"),
|
||||
);
|
||||
|
||||
spawner
|
||||
.spawn(host::host_task(
|
||||
spawner.spawn(
|
||||
host::host_task(
|
||||
parts.host,
|
||||
&COMMANDS,
|
||||
&RESPONSES,
|
||||
&DISPLAY_COMMANDS,
|
||||
parts.display.is_some(),
|
||||
parts.mac,
|
||||
))
|
||||
.expect("spawn host_task");
|
||||
)
|
||||
.expect("spawn host_task"),
|
||||
);
|
||||
|
||||
if let Some(dp) = parts.display {
|
||||
spawner
|
||||
.spawn(display::display_task(dp, parts.led, &STATUS, &DISPLAY_COMMANDS))
|
||||
.expect("spawn display_task");
|
||||
#[allow(clippy::unit_arg)] // LedDriver is () for boards without LEDs
|
||||
spawner.spawn(
|
||||
display::display_task(dp, parts.led, &STATUS, &DISPLAY_COMMANDS)
|
||||
.expect("spawn display_task"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user