Skip to main content

RadioConfig

Struct RadioConfig 

Source
pub struct RadioConfig {
    pub frequency_hz: u32,
    pub link: LinkSettings,
    pub power: TxPower,
    pub sync_word: SyncWord,
    pub invert_iq_transmit: bool,
    pub invert_iq_receive: bool,
}
Expand description

What a radio sends and listens with: the carrier, the LoRa link, the power, and the sync word and IQ polarity that keep one network apart from another.

§Examples

use pamoja_lora::LinkSettings;
use pamoja_radios::sx127x::config::{PaOutput, SyncWord, TxPower};
use pamoja_radios::sx127x::RadioConfig;

// A LoRaWAN device on 868.1 MHz at SF9 with 14 dBm on PA_BOOST.
let config = RadioConfig::new(
    868_100_000,
    LinkSettings::new(9, 125_000),
    TxPower::for_output(PaOutput::PaBoost, 14),
)
.lorawan_device();
assert_eq!(config.sync_word, SyncWord::Public);
assert!(config.invert_iq_receive && !config.invert_iq_transmit);

Fields§

§frequency_hz: u32

The carrier frequency in hertz.

§link: LinkSettings

The LoRa link settings frames are sent and received with.

§power: TxPower

The amplifier settings.

§sync_word: SyncWord

The sync word.

§invert_iq_transmit: bool

Whether transmitted frames have inverted IQ.

§invert_iq_receive: bool

Whether received frames are expected with inverted IQ.

Implementations§

Source§

impl RadioConfig

Source

pub const fn new( frequency_hz: u32, link: LinkSettings, power: TxPower, ) -> RadioConfig

A configuration with the private sync word and standard IQ both ways.

§Arguments
  • frequency_hz - the carrier frequency in hertz.
  • link - the LoRa link settings.
  • power - the amplifier settings.
§Returns

The configuration.

Source

pub const fn with_sync_word(self, sync_word: SyncWord) -> RadioConfig

Returns the configuration with another sync word.

§Arguments
  • sync_word - the sync word.
§Returns

The configuration.

Source

pub const fn with_inverted_iq( self, transmit: bool, receive: bool, ) -> RadioConfig

Returns the configuration with the IQ polarity of each direction set.

§Arguments
  • transmit - whether transmitted frames have inverted IQ.
  • receive - whether received frames have inverted IQ.
§Returns

The configuration.

Source

pub const fn lorawan_device(self) -> RadioConfig

Returns the configuration for a LoRaWAN end device: the public sync word, standard IQ on uplinks, and inverted IQ on downlinks.

§Returns

The configuration.

Trait Implementations§

Source§

impl Clone for RadioConfig

Source§

fn clone(&self) -> RadioConfig

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 RadioConfig

Source§

impl Debug for RadioConfig

Source§

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

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

impl Eq for RadioConfig

Source§

impl PartialEq for RadioConfig

Source§

fn eq(&self, other: &RadioConfig) -> 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 RadioConfig

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.