screen: Initialize before GNSS and WiFI
This commit is contained in:
parent
b2ec98da2e
commit
f732585989
1 changed files with 36 additions and 35 deletions
71
src/main.rs
71
src/main.rs
|
|
@ -80,41 +80,6 @@ async fn main(spawner: Spawner) -> ! {
|
|||
|
||||
info!("Embassy initialized!");
|
||||
|
||||
let (_wifi_controller, interfaces) = esp_radio::wifi::new(
|
||||
peripherals.WIFI,
|
||||
esp_radio::wifi::ControllerConfig::default(),
|
||||
)
|
||||
.expect("Failed to initialize Wi-Fi controller");
|
||||
|
||||
critical_section::with(|cs| {
|
||||
WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2)));
|
||||
});
|
||||
|
||||
let mut sniffer = interfaces.sniffer;
|
||||
radio::setup_wifi_sniffer(WIFI_CHANNEL, &mut sniffer, handle_frame)
|
||||
.expect("Fatal error initializing 802.11p sniffer");
|
||||
|
||||
info!("WiFi promiscuous mode on channel {WIFI_CHANNEL} running");
|
||||
|
||||
// Seeed XIAO L67K:
|
||||
// RX: D7/ GPIO12
|
||||
// TX: D6/ GPIO11
|
||||
// WAKEUP: D0/ GPIO1 -> HIGH for active, LOW for Sleep
|
||||
// RESET: D2/ GPIO25 -> HIGH for normal, LOW for Reset
|
||||
#[cfg(feature = "gnss")]
|
||||
spawner.spawn(
|
||||
gnss_task(
|
||||
peripherals.GPIO1,
|
||||
peripherals.GPIO25,
|
||||
peripherals.UART0,
|
||||
peripherals.GPIO12,
|
||||
peripherals.GPIO11,
|
||||
)
|
||||
.expect("Failed to spawn GNSS task"),
|
||||
);
|
||||
#[cfg(feature = "gnss")]
|
||||
info!("GNSS task started, waiting for GNSS fix...");
|
||||
|
||||
// ST7789 172*320px screen
|
||||
// SCL: D8/ GPIO8 (SPI_SCK)
|
||||
// SDA: D10/ GPIO10 (SPI_MOSI)
|
||||
|
|
@ -159,6 +124,42 @@ async fn main(spawner: Spawner) -> ! {
|
|||
#[cfg(feature = "screen")]
|
||||
let _ = screen::draw_slash_screen(&mut display).inspect_err(log_screen_error);
|
||||
|
||||
// Setup WiFi
|
||||
let (_wifi_controller, interfaces) = esp_radio::wifi::new(
|
||||
peripherals.WIFI,
|
||||
esp_radio::wifi::ControllerConfig::default(),
|
||||
)
|
||||
.expect("Failed to initialize Wi-Fi controller");
|
||||
|
||||
critical_section::with(|cs| {
|
||||
WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2)));
|
||||
});
|
||||
|
||||
let mut sniffer = interfaces.sniffer;
|
||||
radio::setup_wifi_sniffer(WIFI_CHANNEL, &mut sniffer, handle_frame)
|
||||
.expect("Fatal error initializing 802.11p sniffer");
|
||||
|
||||
info!("WiFi promiscuous mode on channel {WIFI_CHANNEL} running");
|
||||
|
||||
// Seeed XIAO L67K:
|
||||
// RX: D7/ GPIO12
|
||||
// TX: D6/ GPIO11
|
||||
// WAKEUP: D0/ GPIO1 -> HIGH for active, LOW for Sleep
|
||||
// RESET: D2/ GPIO25 -> HIGH for normal, LOW for Reset
|
||||
#[cfg(feature = "gnss")]
|
||||
spawner.spawn(
|
||||
gnss_task(
|
||||
peripherals.GPIO1,
|
||||
peripherals.GPIO25,
|
||||
peripherals.UART0,
|
||||
peripherals.GPIO12,
|
||||
peripherals.GPIO11,
|
||||
)
|
||||
.expect("Failed to spawn GNSS task"),
|
||||
);
|
||||
#[cfg(feature = "gnss")]
|
||||
info!("GNSS task started, waiting for GNSS fix...");
|
||||
|
||||
let mut state = applogic::State::new();
|
||||
loop {
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_millis(5)).await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue