pub struct Status {
pub byte: u8,
pub mode: Option<Mode>,
pub command: Option<CommandStatus>,
}Expand description
What the radio answered when asked how it was.
Fields§
§byte: u8The byte as it arrived, with the bits the radio does not answer cleared.
mode: Option<Mode>What the radio is doing.
command: Option<CommandStatus>How the last command went.
Implementations§
Source§impl Status
impl Status
Sourcepub const fn read(byte: u8) -> Status
pub const fn read(byte: u8) -> Status
Reads a status byte.
§Arguments
byte- what the radio answered.
§Returns
The byte and the fields inside it.
§Examples
use pamoja_radios::sx1302::sx1261::{Mode, Status, STANDBY_READY};
let status = Status::read(STANDBY_READY);
assert_eq!(status.mode, Some(Mode::StandbyRc));
assert!(status.parked(), "this is the answer a parked radio gives");Sourcepub const fn parked(&self) -> bool
pub const fn parked(&self) -> bool
Whether the radio is parked and ready for the patch.
§Returns
Whether the answer is STANDBY_READY, which is the whole byte a parked radio gives
rather than a test of either field.
§Examples
use pamoja_radios::sx1302::sx1261::{Status, STANDBY_READY};
assert!(Status::read(STANDBY_READY).parked());
assert!(!Status::read(0x50).parked(), "receiving is not parked");Trait Implementations§
impl Copy for Status
impl Eq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnsafeUnpin for Status
impl UnwindSafe for Status
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