Skip to main content

Fsk

Struct Fsk 

Source
pub struct Fsk {
    pub offset_hz: i32,
    pub chain: Chain,
    pub bitrate: u32,
    pub sync_word: u64,
    pub sync_word_len: u8,
}
Expand description

The receiver that hears frequency shift keying rather than LoRa.

A LoRaWAN network carries one such channel, faster than any of its LoRa rates and with none of their reach. It is the tenth receiver, beside the eight and the fixed-rate one, and like them it is switched on whatever a plan says.

Fields§

§offset_hz: i32

How far from the carrier it listens, in hertz, which is signed.

§chain: Chain

Which radio it takes its samples from.

§bitrate: u32

The bit rate, in bits per second.

§sync_word: u64

The sync word it matches, in its low bytes.

§sync_word_len: u8

How many bytes of that sync word there are.

Implementations§

Source§

impl Fsk

Source

pub const fn at(offset_hz: i32) -> Fsk

A channel on the first radio, at the rate and sync word a LoRaWAN network uses.

§Arguments
  • offset_hz - how far from the carrier it listens, which is signed.
§Returns

The channel.

§Examples
use pamoja_radios::sx1302::channel::{Fsk, FSK_DEFAULT_BITRATE};

let channel = Fsk::at(600_000);
assert_eq!(channel.bitrate, FSK_DEFAULT_BITRATE);
assert_eq!(channel.sync_word_len, 3);
Source

pub const fn on(self, chain: Chain) -> Fsk

The same channel, on the other radio.

A European network puts this channel at 868.8 MHz, which is further from the carrier than one radio hears, so it usually belongs on the second one.

§Arguments
  • chain - the radio it takes its samples from.
§Returns

The channel.

Source

pub const fn bitrate(self, bitrate: u32) -> Fsk

The same channel, at another bit rate.

§Arguments
  • bitrate - the rate, in bits per second.
§Returns

The channel.

Source

pub const fn matching(self, sync_word: u64, len: u8) -> Fsk

The same channel, matching another sync word.

§Arguments
  • sync_word - the word, in the low bytes.
  • len - how many bytes of it, up to eight.
§Returns

The channel.

Source

pub const fn pattern(&self) -> u64

The pattern the receiver is programmed with.

§Returns

The sync word moved into the top of the pattern, which is where the receiver reads it from however few bytes it has.

§Examples
use pamoja_radios::sx1302::channel::Fsk;

// Three bytes sit at the top, not the bottom.
assert_eq!(Fsk::at(0).pattern(), 0xc194_c100_0000_0000);
Source

pub const fn supported(&self) -> bool

Whether the concentrator can be set to this channel at all.

§Returns

Whether the offset is one the radio hears, the sync word is between one and eight bytes, and the bit rate is one the counter can hold.

§Examples
use pamoja_radios::sx1302::channel::Fsk;

assert!(Fsk::at(600_000).supported());
assert!(!Fsk::at(900_000).supported(), "past what the radio hears");
assert!(!Fsk::at(0).bitrate(100).supported(), "too slow to count");
assert!(!Fsk::at(0).matching(0, 9).supported(), "longer than the pattern");

Trait Implementations§

Source§

impl Clone for Fsk

Source§

fn clone(&self) -> Fsk

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 Fsk

Source§

impl Debug for Fsk

Source§

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

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

impl Eq for Fsk

Source§

impl PartialEq for Fsk

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Fsk

Auto Trait Implementations§

§

impl Freeze for Fsk

§

impl RefUnwindSafe for Fsk

§

impl Send for Fsk

§

impl Sync for Fsk

§

impl Unpin for Fsk

§

impl UnsafeUnpin for Fsk

§

impl UnwindSafe for Fsk

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.