DeviceControl

Struct DeviceControl 

Source
pub struct DeviceControl<M: RawMutex> { /* private fields */ }
Expand description

Control handle for device_runner: latest-wins settings updates and on-demand instantaneous-RSSI sampling. Place in a static next to the Channels.

Implementations§

Source§

impl<M: RawMutex> DeviceControl<M>

Source

pub const fn new() -> Self

Source

pub fn shutdown(&self)

Put the radio into chip sleep and stop the runner.

Terminal, and meant for the board’s own power-off path: the runner parks forever once it observes this, so nothing after it can transmit or receive. The SX1262 keeps its own supply while the host MCU is in deep sleep, so skipping this would leave the chip receiving and dominate the sleeping board’s current draw.

The flag is what the runner acts on; the settings signal only exists to break it out of RX so it can look.

Source

pub fn apply(&self, settings: DeviceSettings)

Apply new settings. The runner picks them up at its next await point and rebuilds modulation/packet params.

Source

pub fn request_rssi(&self)

Request an instantaneous-RSSI sample from the runner. Pair with wait_rssi. Only meaningful while the radio is in RX (i.e. enabled); the caller is responsible for that gating.

Source

pub async fn wait_rssi(&self) -> Result<i16, ()>

Await the RSSI sample requested via request_rssi, in dBm. Err(()) means the read failed at the radio.

Trait Implementations§

Source§

impl<M: RawMutex> Default for DeviceControl<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<M> !Freeze for DeviceControl<M>

§

impl<M> !RefUnwindSafe for DeviceControl<M>

§

impl<M> Send for DeviceControl<M>
where M: Send,

§

impl<M> Sync for DeviceControl<M>
where M: Sync,

§

impl<M> Unpin for DeviceControl<M>
where M: Unpin,

§

impl<M> UnwindSafe for DeviceControl<M>
where M: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.