pub struct RfFreq { /* private fields */ }
Expand description

RF frequency structure.

Argument of set_rf_frequency.

Implementations§

source§

impl RfFreq

source

pub const F915: RfFreq = _

915MHz, often used in Australia and North America.

Example
use stm32wlxx_hal::subghz::RfFreq;

assert_eq!(RfFreq::F915.freq(), 915_000_000);
source

pub const F868: RfFreq = _

868MHz, often used in Europe.

Example
use stm32wlxx_hal::subghz::RfFreq;

assert_eq!(RfFreq::F868.freq(), 868_000_000);
source

pub const F433: RfFreq = _

433MHz, often used in Europe.

Example
use stm32wlxx_hal::subghz::RfFreq;

assert_eq!(RfFreq::F433.freq(), 433_000_000);
source

pub const fn from_raw(bits: u32) -> RfFreq

Create a new RfFreq from a raw bit value.

The equation used to get the PLL frequency from the raw bits is:

RFPLL = 32e6 × bits / 225

Example
use stm32wlxx_hal::subghz::RfFreq;

const FREQ: RfFreq = RfFreq::from_raw(0x39300000);
assert_eq!(FREQ, RfFreq::F915);
source

pub const fn from_frequency(freq: u32) -> RfFreq

Create a new RfFreq from a PLL frequency.

The equation used to get the raw bits from the PLL frequency is:

bits = RFPLL * 225 / 32e6

Example
use stm32wlxx_hal::subghz::RfFreq;

const FREQ: RfFreq = RfFreq::from_frequency(915_000_000);
assert_eq!(FREQ, RfFreq::F915);
source

pub fn freq(&self) -> u32

Get the actual frequency.

Example
use stm32wlxx_hal::subghz::RfFreq;

assert_eq!(RfFreq::from_raw(0x39300000).freq(), 915_000_000);
source

pub const fn as_slice(&self) -> &[u8]

Extracts a slice containing the packet.

Example
use stm32wlxx_hal::subghz::RfFreq;

assert_eq!(RfFreq::F915.as_slice(), &[0x86, 0x39, 0x30, 0x00, 0x00]);

Trait Implementations§

source§

impl Clone for RfFreq

source§

fn clone(&self) -> RfFreq

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for RfFreq

source§

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

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

impl Ord for RfFreq

source§

fn cmp(&self, other: &RfFreq) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for RfFreq

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for RfFreq

source§

fn partial_cmp(&self, other: &RfFreq) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for RfFreq

source§

impl Eq for RfFreq

source§

impl StructuralEq for RfFreq

source§

impl StructuralPartialEq for RfFreq

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.