refractor into proper driver with abstractions and Radio struct, LoRa TX and RX working

This commit is contained in:
2026-02-26 00:14:05 +01:00
parent bac6567fe3
commit 15d13bdad7
9 changed files with 1472 additions and 136 deletions

20
src/traits.rs Normal file
View File

@@ -0,0 +1,20 @@
use crate::error::RadioError;
/// Can configure the radio
pub trait Configure {
/// Each modulation has its own `Config` struct
type Config;
async fn configure(&mut self, config: &Self::Config) -> Result<(), RadioError>;
}
/// Can send data
pub trait Transmit {
async fn tx(&mut self, data: &[u8]) -> Result<(), RadioError>;
}
/// Can receive data
pub trait Receive {
/// Returns the number of bytes received
async fn rx(&mut self, buf: &mut [u8], timeout_ms: u32) -> Result<usize, RadioError>;
}