pub struct RadioConfig {
pub freq_hz: u32,
pub bw: Bandwidth,
pub sf: u8,
pub cr: u8,
pub sync_word: u16,
pub tx_power_dbm: i8,
pub preamble_len: u16,
pub cad: u8,
}Expand description
Complete LoRa radio configuration.
Wire layout (13 bytes, all little-endian):
[freq_hz:4] [bw:1] [sf:1] [cr:1] [sync_word:2] [tx_power_dbm:1] [preamble_len:2] [cad:1]Fields§
§freq_hz: u32Frequency in Hz (150_000_000 - 960_000_000 for SX1262).
bw: Bandwidth§sf: u8Spreading factor (5-12).
cr: u8Coding rate denominator (5-8). E.g. 5 = CR 4/5, 8 = CR 4/8.
sync_word: u16§tx_power_dbm: i8Transmit power in dBm. Set to TX_POWER_MAX (-128) for the
board’s maximum.
preamble_len: u16Preamble length in symbols. Set to PREAMBLE_DEFAULT (0) for
the firmware default (16 symbols). Valid range: 6–65535.
cad: u8Channel Activity Detection (listen-before-talk) before TX. 0 = disabled, non-zero = enabled. Default: 1 (enabled).
Implementations§
Source§impl RadioConfig
impl RadioConfig
Sourcepub fn validate(&self, power_range: (i8, i8)) -> Result<(), &'static str>
pub fn validate(&self, power_range: (i8, i8)) -> Result<(), &'static str>
Validate fields against hardware limits.
Sourcepub fn resolve(self, power_range: (i8, i8)) -> Self
pub fn resolve(self, power_range: (i8, i8)) -> Self
Resolve sentinel values to concrete defaults.
Sourcepub fn cad_enabled(&self) -> bool
pub fn cad_enabled(&self) -> bool
Whether CAD (listen-before-talk) is enabled.
Sourcepub fn write_to(self, buf: &mut [u8]) -> usize
pub fn write_to(self, buf: &mut [u8]) -> usize
Serialize to fixed-size LE bytes. Returns number of bytes written (always 13).
Sourcepub fn from_bytes(buf: &[u8]) -> Option<Self>
pub fn from_bytes(buf: &[u8]) -> Option<Self>
Deserialize from fixed-size LE bytes.
Trait Implementations§
Source§impl Clone for RadioConfig
impl Clone for RadioConfig
Source§fn clone(&self) -> RadioConfig
fn clone(&self) -> RadioConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more