Skip to main content

Chip

Struct Chip 

Source
pub struct Chip { /* private fields */ }
Expand description

A simulated SX126x or SX127x, shared between its driver and the program watching it.

Cloning a chip gives another handle on the same part.

Implementations§

Source§

impl Chip

Source

pub fn sx126x(board: Board) -> Chip

A simulated SX1261, SX1262, SX1268, or LLCC68, out of reset.

§Arguments
  • board - how the module wires the chip, which the driver radio returns is given.
§Returns

The chip.

Source

pub fn sx127x(board: Board) -> Chip

A simulated SX1276, SX1277, SX1278, or SX1279, out of reset.

§Arguments
  • board - how the module wires the chip, which the driver radio returns is given.
§Returns

The chip.

Source

pub fn family(&self) -> Family

Returns which family the chip belongs to.

§Returns

The family.

Source

pub fn radio(&self) -> SimRadio

Returns a driver wired to the chip, as a board wires a real one.

§Returns

The driver, which has sent nothing yet; init resets the chip.

Source

pub fn hear(&self, payload: &[u8], rssi_dbm: Decibels, snr_db: Decibels)

Puts a frame on the air for the chip to receive the next time it listens.

§Arguments
  • payload - the frame’s payload, at most 255 bytes; any more is cut off, as no LoRa frame carries it.
  • rssi_dbm - the strength the chip hears the frame at.
  • snr_db - the signal-to-noise ratio it hears it with, negative below the noise.
Source

pub fn hear_corrupt(&self, rssi_dbm: Decibels, snr_db: Decibels)

Puts a frame on the air whose CRC fails, which the chip reports and drops.

§Arguments
  • rssi_dbm - the strength the chip hears the frame at.
  • snr_db - the signal-to-noise ratio it hears it with.
Source

pub fn waiting(&self) -> usize

Returns how many frames wait on the air for the chip to receive.

§Returns

The number of frames given to hear and not yet received.

Source

pub fn sent(&self) -> Vec<Sent>

Returns every frame the chip has put on the air, oldest first.

§Returns

The frames, each with what the chip was tuned to when it went out.

Source

pub fn tuning(&self) -> Tuning

Returns what the chip is tuned to now.

Before its driver configures it, these are the chip’s own values out of reset. The SX126x has no carrier until it is given one, and reports 0 Hz.

§Returns

The tuning.

Trait Implementations§

Source§

impl Clone for Chip

Source§

fn clone(&self) -> Chip

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Chip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Chip

§

impl RefUnwindSafe for Chip

§

impl Send for Chip

§

impl Sync for Chip

§

impl Unpin for Chip

§

impl UnsafeUnpin for Chip

§

impl UnwindSafe for Chip

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.