chore: Use embassy runtime
This commit is contained in:
parent
480ba97ee7
commit
ae71fb51ef
4 changed files with 348 additions and 5 deletions
|
|
@ -7,9 +7,10 @@
|
|||
)]
|
||||
#![deny(clippy::large_stack_frames)]
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use esp_backtrace as _;
|
||||
use esp_hal::clock::CpuClock;
|
||||
use esp_hal::main;
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use log::{debug, error, info, warn};
|
||||
|
||||
|
|
@ -78,10 +79,10 @@ esp_bootloader_esp_idf::esp_app_desc!();
|
|||
clippy::large_stack_frames,
|
||||
reason = "it's not unusual to allocate larger buffers etc. in main"
|
||||
)]
|
||||
#[main]
|
||||
fn main() -> ! {
|
||||
#[esp_rtos::main]
|
||||
async fn main(spawner: Spawner) -> ! {
|
||||
// generator version: 1.3.0
|
||||
// generator parameters: --chip esp32c5 -o esp32c5-wroom-1 -o alloc -o vscode -o log -o unstable-hal -o wifi -o esp-backtrace
|
||||
// generator parameters: --chip esp32c5 -o esp32c5-wroom-1-psram -o alloc -o log -o unstable-hal -o wifi -o esp-backtrace -o embassy
|
||||
|
||||
esp_println::logger::init_logger_from_env();
|
||||
|
||||
|
|
@ -105,6 +106,8 @@ fn main() -> ! {
|
|||
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
||||
esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0);
|
||||
|
||||
info!("Embassy initialized!");
|
||||
|
||||
let (_wifi_controller, interfaces) = esp_radio::wifi::new(
|
||||
peripherals.WIFI,
|
||||
esp_radio::wifi::ControllerConfig::default(),
|
||||
|
|
@ -142,7 +145,12 @@ fn main() -> ! {
|
|||
}
|
||||
info!("WiFi promiscuous mode on channel {WIFI_CHANNEL} running");
|
||||
|
||||
// TODO: Spawn some tasks
|
||||
let _ = spawner;
|
||||
|
||||
loop {
|
||||
// nothing to do here, all data is handled in RX callback for now
|
||||
// but use a timer so that this is yields to other tasks
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue