docs: module-level documentation, channel capacity rationale, architecture in main.rs
This commit is contained in:
5 files changed
+32
-4
No files matched your search
+12
-4
@@ -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::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||||
use embassy_sync::channel::Channel;
|
use embassy_sync::channel::Channel;
|
||||||
use embassy_sync::watch::Watch;
|
use embassy_sync::watch::Watch;
|
||||||
@@ -13,16 +21,16 @@ pub enum DisplayCommand {
|
|||||||
Reset,
|
Reset,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// USB-to-display command channel.
|
/// USB-to-display command channel (depth 4: display commands are rare events).
|
||||||
pub type DisplayCommandChannel = Channel<CriticalSectionRawMutex, DisplayCommand, 4>;
|
pub type DisplayCommandChannel = Channel<CriticalSectionRawMutex, DisplayCommand, 4>;
|
||||||
|
|
||||||
/// Host-to-radio command channel.
|
/// Host-to-radio command channel (depth 16: buffer bursty host command sequences).
|
||||||
pub type CommandChannel = Channel<CriticalSectionRawMutex, Command, 16>;
|
pub type CommandChannel = Channel<CriticalSectionRawMutex, Command, 16>;
|
||||||
|
|
||||||
/// Radio-to-host response channel.
|
/// Radio-to-host response channel (depth 32: buffer RX packets while USB writes).
|
||||||
pub type ResponseChannel = Channel<CriticalSectionRawMutex, Response, 32>;
|
pub type ResponseChannel = Channel<CriticalSectionRawMutex, Response, 32>;
|
||||||
|
|
||||||
/// Observable radio status for the display task.
|
/// Observable radio status for the display task (2 slots: latest + previous).
|
||||||
pub type StatusWatch = Watch<CriticalSectionRawMutex, RadioStatus, 2>;
|
pub type StatusWatch = Watch<CriticalSectionRawMutex, RadioStatus, 2>;
|
||||||
|
|
||||||
/// Current radio state exposed to observers (e.g. display).
|
/// Current radio state exposed to observers (e.g. display).
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! OLED display driver with radio status dashboard.
|
||||||
|
|
||||||
mod render;
|
mod render;
|
||||||
mod task;
|
mod task;
|
||||||
pub use task::display_task;
|
pub use task::display_task;
|
||||||
+14
@@ -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_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
//! LoRa radio control via SX1262.
|
||||||
|
|
||||||
mod task;
|
mod task;
|
||||||
pub use task::radio_task;
|
pub use task::radio_task;
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
|
//! USB CDC-ACM interface with COBS-framed command/response protocol.
|
||||||
|
|
||||||
mod task;
|
mod task;
|
||||||
pub use task::usb_task;
|
pub use task::usb_task;
|
||||||
Reference in new issue
Block a user