Skip to main content

LoraBandwidth

Enum LoraBandwidth 

Source
pub enum LoraBandwidth {
    Khz7_8,
    Khz10_4,
    Khz15_6,
    Khz20_8,
    Khz31_25,
    Khz41_7,
    Khz62_5,
    Khz125,
    Khz250,
    Khz500,
}
Expand description

A LoRa signal bandwidth, the Bw bits of RegModemConfig1.

Variants§

§

Khz7_8

7.8 kHz (0000).

§

Khz10_4

10.4 kHz (0001).

§

Khz15_6

15.6 kHz (0010).

§

Khz20_8

20.8 kHz (0011).

§

Khz31_25

31.25 kHz (0100).

§

Khz41_7

41.7 kHz (0101).

§

Khz62_5

62.5 kHz (0110).

§

Khz125

125 kHz (0111).

§

Khz250

250 kHz (1000).

§

Khz500

500 kHz (1001).

Implementations§

Source§

impl LoraBandwidth

Source

pub const fn code(self) -> u8

Returns the Bw bits.

§Returns

The four bit code, 0 to 9.

Source

pub const fn hz(self) -> u32

Returns the bandwidth in hertz, rounded to the nearest hertz.

§Returns

The bandwidth: 500 kHz halved, or 125 kHz divided by 3 and halved, as many times as the setting takes.

Source

pub fn from_hz(hz: u32) -> Option<LoraBandwidth>

Finds the setting for a bandwidth in hertz.

§Arguments
  • hz - the bandwidth in hertz, within 1% of one the chip supports.
§Returns

The setting, or None for a bandwidth the SX127x does not offer.

Source

pub const fn in_band(self, frequency_hz: u32) -> bool

Reports whether the bandwidth is available at a carrier frequency.

§Arguments
  • frequency_hz - the carrier frequency in hertz.
§Returns

false for 250 and 500 kHz at or below LOW_BAND_TOP_HZ, which the datasheet excludes in the lowest band, and true otherwise.

Trait Implementations§

Source§

impl Clone for LoraBandwidth

Source§

fn clone(&self) -> LoraBandwidth

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 Copy for LoraBandwidth

Source§

impl Debug for LoraBandwidth

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for LoraBandwidth

Source§

impl Hash for LoraBandwidth

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LoraBandwidth

Source§

fn eq(&self, other: &LoraBandwidth) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LoraBandwidth

Auto Trait Implementations§

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.