A RPi Pico powered Lightning Detector
1use core::cell::Cell;
2
3use embassy_strike_driver::DetectorConfig;
4use embassy_sync::{blocking_mutex::Mutex, signal::Signal};
5
6use crate::{
7 constants::{BLIP_SIZE, BLIP_THRESHOLD},
8 locks::{ConfigUpdateLock, ConnectionStatusLock},
9};
10
11pub static DEVICE_STATE: Mutex<ConnectionStatusLock, Cell<DeviceState>> =
12 Mutex::new(Cell::new(DeviceState::Disconnected));
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub enum DeviceState {
16 Disconnected,
17 Connected,
18}
19
20pub static DETECTOR_CONFIG_UPDATES: Signal<ConfigUpdateLock, DetectorConfig> = Signal::new();
21
22pub static DETECTOR_CONFIG: Mutex<ConfigUpdateLock, DetectorConfig> =
23 Mutex::new(DetectorConfig::new(BLIP_THRESHOLD, BLIP_SIZE));