pub enum ScanTime {
Short,
Long,
}Expand description
How long the radio listens for before it answers.
The radio counts samples rather than time, and only these two durations have a count, so they are the only ones it takes.
Variants§
Short
A short check, long enough for the channel to be plainly busy or plainly clear.
Long
A long check, for a band whose rules ask for one.
Implementations§
Source§impl ScanTime
impl ScanTime
Sourcepub const fn samples(&self) -> u16
pub const fn samples(&self) -> u16
How many samples the radio takes to fill that duration.
§Returns
The count the radio is programmed with. It is not the duration divided by anything a caller can work out, so it is carried rather than computed.
§Examples
use pamoja_radios::sx1302::lbt::ScanTime;
assert_eq!(ScanTime::Short.samples(), 24);
assert_eq!(ScanTime::Long.samples(), 715);Sourcepub const fn of_micros(micros: u16) -> Option<ScanTime>
pub const fn of_micros(micros: u16) -> Option<ScanTime>
Reads a duration a caller asked for.
§Arguments
micros- the duration in microseconds.
§Returns
The check that takes that long, or None for a duration the radio has no count for.
A near miss is refused rather than rounded, because a check shorter than the rules ask
for is worse than no check at all.
§Examples
use pamoja_radios::sx1302::lbt::ScanTime;
assert_eq!(ScanTime::of_micros(128), Some(ScanTime::Short));
assert_eq!(ScanTime::of_micros(5000), Some(ScanTime::Long));
assert_eq!(ScanTime::of_micros(4999), None, "a near miss is not rounded");Trait Implementations§
impl Copy for ScanTime
impl Eq for ScanTime
impl StructuralPartialEq for ScanTime
Auto Trait Implementations§
impl Freeze for ScanTime
impl RefUnwindSafe for ScanTime
impl Send for ScanTime
impl Sync for ScanTime
impl Unpin for ScanTime
impl UnsafeUnpin for ScanTime
impl UnwindSafe for ScanTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more