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

Power amplifier configuration parameters.

Argument of set_pa_config.

Implementations§

source§

impl PaConfig

source

pub const LP_15: PaConfig = _

Optimal settings for +15dBm output power with the low-power PA.

This must be used with TxParams::LP_15.

source

pub const LP_14: PaConfig = _

Optimal settings for +14dBm output power with the low-power PA.

This must be used with TxParams::LP_14.

source

pub const LP_10: PaConfig = _

Optimal settings for +10dBm output power with the low-power PA.

This must be used with TxParams::LP_10.

source

pub const HP_22: PaConfig = _

Optimal settings for +22dBm output power with the high-power PA.

This must be used with TxParams::HP.

source

pub const HP_20: PaConfig = _

Optimal settings for +20dBm output power with the high-power PA.

This must be used with TxParams::HP.

source

pub const HP_17: PaConfig = _

Optimal settings for +17dBm output power with the high-power PA.

This must be used with TxParams::HP.

source

pub const HP_14: PaConfig = _

Optimal settings for +14dBm output power with the high-power PA.

This must be used with TxParams::HP.

source

pub const fn new() -> PaConfig

Create a new PaConfig struct.

This is the same as default, but in a const function.

Example
use stm32wlxx_hal::subghz::PaConfig;

const PA_CONFIG: PaConfig = PaConfig::new();
source

pub const fn set_pa_duty_cycle(self, pa_duty_cycle: u8) -> PaConfig

Set the power amplifier duty cycle (conduit angle) control.

Note: Only the first 3 bits of the pa_duty_cycle argument are used.

Duty cycle = 0.2 + 0.04 × bits

Caution

The following restrictions must be observed to avoid over-stress on the PA:

  • LP PA mode with synthesis frequency > 400 MHz, pa_duty_cycle must be < 0x7.
  • LP PA mode with synthesis frequency < 400 MHz, pa_duty_cycle must be < 0x4.
  • HP PA mode, pa_duty_cycle must be < 0x4
Example
use stm32wlxx_hal::subghz::{PaConfig, PaSel};

const PA_CONFIG: PaConfig = PaConfig::new().set_pa(PaSel::Lp).set_pa_duty_cycle(0x4);
source

pub const fn set_hp_max(self, hp_max: u8) -> PaConfig

Set the high power amplifier output power.

Note: Only the first 3 bits of the hp_max argument are used.

Example
use stm32wlxx_hal::subghz::{PaConfig, PaSel};

const PA_CONFIG: PaConfig = PaConfig::new().set_pa(PaSel::Hp).set_hp_max(0x2);
source

pub const fn set_pa(self, pa: PaSel) -> PaConfig

Set the power amplifier to use, low or high power.

Example
use stm32wlxx_hal::subghz::{PaConfig, PaSel};

const PA_CONFIG_HP: PaConfig = PaConfig::new().set_pa(PaSel::Hp);
const PA_CONFIG_LP: PaConfig = PaConfig::new().set_pa(PaSel::Lp);
source

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

Extracts a slice containing the packet.

Example
use stm32wlxx_hal::subghz::{PaConfig, PaSel};

const PA_CONFIG: PaConfig = PaConfig::new()
    .set_pa(PaSel::Hp)
    .set_pa_duty_cycle(0x2)
    .set_hp_max(0x3);

assert_eq!(PA_CONFIG.as_slice(), &[0x95, 0x2, 0x03, 0x00, 0x01]);

Trait Implementations§

source§

impl Clone for PaConfig

source§

fn clone(&self) -> PaConfig

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 PaConfig

source§

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

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

impl Default for PaConfig

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq for PaConfig

source§

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

source§

impl Eq for PaConfig

source§

impl StructuralEq for PaConfig

source§

impl StructuralPartialEq for PaConfig

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.