Skip to main content

TxPower

Struct TxPower 

Source
pub struct TxPower {
    pub pa_config: u8,
    pub pa_dac: u8,
    pub ocp: u8,
    pub output_dbm: i8,
}
Expand description

The amplifier settings that produce an output power: RegPaConfig, RegPaDac, and RegOcp.

§Examples

use pamoja_radios::sx127x::config::{PaOutput, TxPower, PA_DAC_HIGH_POWER};

// +20 dBm on the PA_BOOST pin of an RFM95W.
let power = TxPower::for_output(PaOutput::PaBoost, 20);
assert_eq!(power.pa_config, 0xFF);
assert_eq!(power.pa_dac, PA_DAC_HIGH_POWER);
assert_eq!(power.output_dbm, 20);

Fields§

§pa_config: u8

RegPaConfig: PaSelect in bit 7, MaxPower in bits 6 to 4, OutputPower in bits 3 to 0.

§pa_dac: u8

RegPaDac: PA_DAC_HIGH_POWER above +17 dBm on PA_BOOST, else PA_DAC_DEFAULT.

§ocp: u8

RegOcp: a 140 mA limit with the high power setting, whose amplifier draws 120 mA at +20 dBm, and the 100 mA reset limit otherwise.

§output_dbm: i8

The output power these settings produce, in dBm.

Implementations§

Source§

impl TxPower

Source

pub const fn for_output(output: PaOutput, output_dbm: i8) -> TxPower

Chooses the settings for an output power.

The steps follow Semtech’s LoRaMac-node. On RFO, MaxPower 7 gives a +15 dBm maximum and OutputPower the power itself, and at 0 dBm and below MaxPower 0 and OutputPower the power plus 4, which lands 0.2 dB under. On PA_BOOST, OutputPower is the power less 2 up to +17 dBm, and with the high power setting the power less 5 above it.

§Arguments
  • output - the amplifier output the module uses.
  • output_dbm - the output power wanted, clamped to what the output delivers.
§Returns

The settings.

Source

pub fn under_ceiling( output: PaOutput, budget: &LinkBudget, eirp_ceiling_dbm: Decibels, ) -> TxPower

Chooses the settings that keep a link’s EIRP at or under a ceiling.

§Arguments
  • output - the amplifier output the module uses.
  • budget - the link budget, whose transmitting antenna and cable apply.
  • eirp_ceiling_dbm - the EIRP limit, such as a channel plan’s ceiling for the frequency in use.
§Returns

The settings, rounded down to whole decibels so the EIRP stays under the ceiling.

Source

pub const fn output(&self) -> PaOutput

Returns the amplifier output these settings select.

§Returns

PaOutput::PaBoost when PaSelect is set, else PaOutput::Rfo.

Trait Implementations§

Source§

impl Clone for TxPower

Source§

fn clone(&self) -> TxPower

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 TxPower

Source§

impl Debug for TxPower

Source§

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

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

impl Eq for TxPower

Source§

impl Hash for TxPower

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 TxPower

Source§

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

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.