0
0
Fork 0

main: Add feature flag for GNSS module

This commit is contained in:
Jannik Beyerstedt 2026-06-15 21:36:34 +02:00
commit 57a6b7983d
4 changed files with 19 additions and 4 deletions

View file

@ -13,6 +13,7 @@ use core::cell::RefCell;
use critical_section::Mutex;
use crossbeam_queue::ArrayQueue;
use embassy_executor::Spawner;
#[cfg(feature = "gnss")]
use embassy_gps::gps::l76k;
use esp_backtrace as _;
use esp_hal::clock::CpuClock;
@ -34,6 +35,7 @@ const WIFI_CHANNEL: radio::Channel = 180;
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
esp_bootloader_esp_idf::esp_app_desc!();
#[cfg(feature = "gnss")]
static GNSS_UPDATE: Mutex<RefCell<Option<embassy_gps::types::GpsFix>>> =
Mutex::new(RefCell::new(None));
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
@ -93,6 +95,7 @@ async fn main(spawner: Spawner) -> ! {
// 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,
@ -109,6 +112,7 @@ async fn main(spawner: Spawner) -> ! {
loop {
embassy_time::Timer::after(embassy_time::Duration::from_millis(5)).await;
#[cfg(feature = "gnss")]
critical_section::with(|cs| {
let gnss_update_ref = GNSS_UPDATE.borrow(cs);
@ -236,6 +240,7 @@ fn handle_frame(frame: wifi::sniffer::PromiscuousPkt<'_>) {
});
}
#[cfg(feature = "gnss")]
#[allow(clippy::large_stack_frames, reason = "GNSS driver needs some space")]
#[embassy_executor::task]
async fn gnss_task(