diff --git a/src/channel.rs b/src/channel.rs index c3c8e371..f2d93306 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -1,3 +1,11 @@ +//! Inter-task communication channels. +//! +//! Each channel connects exactly two tasks: +//! - [`CommandChannel`]: USB → Radio (host commands) +//! - [`ResponseChannel`]: Radio → USB (firmware responses) +//! - [`DisplayCommandChannel`]: USB → Display (on/off/reset) +//! - [`StatusWatch`]: Radio → Display (observable radio state) + use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::channel::Channel; use embassy_sync::watch::Watch; @@ -13,16 +21,16 @@ pub enum DisplayCommand { Reset, } -/// USB-to-display command channel. +/// USB-to-display command channel (depth 4: display commands are rare events). pub type DisplayCommandChannel = Channel; -/// Host-to-radio command channel. +/// Host-to-radio command channel (depth 16: buffer bursty host command sequences). pub type CommandChannel = Channel; -/// Radio-to-host response channel. +/// Radio-to-host response channel (depth 32: buffer RX packets while USB writes). pub type ResponseChannel = Channel; -/// Observable radio status for the display task. +/// Observable radio status for the display task (2 slots: latest + previous). pub type StatusWatch = Watch; /// Current radio state exposed to observers (e.g. display). diff --git a/src/display/mod.rs b/src/display/mod.rs index ff2dc929..50b4bdf1 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -1,3 +1,5 @@ +//! OLED display driver with radio status dashboard. + mod render; mod task; pub use task::display_task; diff --git a/src/main.rs b/src/main.rs index eed77bd5..8bfa90a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,17 @@ +//! DongLoRa firmware — transparent LoRa radio over USB. +//! +//! Three async tasks communicate via static channels: +//! +//! ```text +//! usb_task ──Command──► radio_task ──► SX1262 +//! ◄──Response── │ +//! StatusWatch +//! ▼ +//! display_task (optional) +//! ``` +//! +//! The host drives everything. The radio idles until commanded. + #![no_std] #![no_main] diff --git a/src/radio/mod.rs b/src/radio/mod.rs index 85bb11e3..6e5a859b 100644 --- a/src/radio/mod.rs +++ b/src/radio/mod.rs @@ -1,2 +1,4 @@ +//! LoRa radio control via SX1262. + mod task; pub use task::radio_task; diff --git a/src/usb/mod.rs b/src/usb/mod.rs index 22b2a9b2..60d99c5e 100644 --- a/src/usb/mod.rs +++ b/src/usb/mod.rs @@ -1,2 +1,4 @@ +//! USB CDC-ACM interface with COBS-framed command/response protocol. + mod task; pub use task::usb_task;