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

Generic packet control.

Argument of set_pkt_ctrl.

Implementations§

source§

impl PktCtrl

source

pub const RESET: PktCtrl = _

Reset value of the packet control register.

source

pub const fn from_raw(raw: u8) -> Self

Create a new PktCtrl structure from a raw value.

Reserved bits will be masked.

source

pub const fn as_bits(&self) -> u8

Get the raw value of the PktCtrl register.

source

pub const fn set_sync_det_en(self, en: bool) -> PktCtrl

Generic packet synchronization word detection enable.

Example
use stm32wlxx_hal::subghz::PktCtrl;

const PKT_CTRL: PktCtrl = PktCtrl::RESET.set_sync_det_en(true);
source

pub const fn sync_det_en(&self) -> bool

Returns true if generic packet synchronization word detection is enabled.

Example
use stm32wlxx_hal::subghz::PktCtrl;

let pc: PktCtrl = PktCtrl::RESET;
assert_eq!(pc.sync_det_en(), true);
let pc: PktCtrl = pc.set_sync_det_en(false);
assert_eq!(pc.sync_det_en(), false);
let pc: PktCtrl = pc.set_sync_det_en(true);
assert_eq!(pc.sync_det_en(), true);
source

pub const fn set_cont_tx_en(self, en: bool) -> PktCtrl

Generic packet continuous transmit enable.

Example
use stm32wlxx_hal::subghz::PktCtrl;

const PKT_CTRL: PktCtrl = PktCtrl::RESET.set_cont_tx_en(true);
source

pub const fn cont_tx_en(&self) -> bool

Returns true if generic packet continuous transmit is enabled.

Example
use stm32wlxx_hal::subghz::PktCtrl;

let pc: PktCtrl = PktCtrl::RESET;
assert_eq!(pc.cont_tx_en(), false);
let pc: PktCtrl = pc.set_cont_tx_en(true);
assert_eq!(pc.cont_tx_en(), true);
let pc: PktCtrl = pc.set_cont_tx_en(false);
assert_eq!(pc.cont_tx_en(), false);
source

pub const fn set_inf_seq_sel(self, sel: InfSeqSel) -> PktCtrl

Set the continuous sequence type.

source

pub const fn inf_seq_sel(&self) -> InfSeqSel

Get the continuous sequence type.

Example
use stm32wlxx_hal::subghz::{InfSeqSel, PktCtrl};

let pc: PktCtrl = PktCtrl::RESET;
assert_eq!(pc.inf_seq_sel(), InfSeqSel::Five);

let pc: PktCtrl = pc.set_inf_seq_sel(InfSeqSel::Zero);
assert_eq!(pc.inf_seq_sel(), InfSeqSel::Zero);

let pc: PktCtrl = pc.set_inf_seq_sel(InfSeqSel::One);
assert_eq!(pc.inf_seq_sel(), InfSeqSel::One);

let pc: PktCtrl = pc.set_inf_seq_sel(InfSeqSel::Prbs9);
assert_eq!(pc.inf_seq_sel(), InfSeqSel::Prbs9);

let pc: PktCtrl = pc.set_inf_seq_sel(InfSeqSel::Five);
assert_eq!(pc.inf_seq_sel(), InfSeqSel::Five);
source

pub const fn set_inf_seq_en(self, en: bool) -> PktCtrl

Enable infinite sequence generation.

Example
use stm32wlxx_hal::subghz::PktCtrl;

const PKT_CTRL: PktCtrl = PktCtrl::RESET.set_inf_seq_en(true);
source

pub const fn inf_seq_en(&self) -> bool

Returns true if infinite sequence generation is enabled.

Example
use stm32wlxx_hal::subghz::PktCtrl;

let pc: PktCtrl = PktCtrl::RESET;
assert_eq!(pc.inf_seq_en(), false);
let pc: PktCtrl = pc.set_inf_seq_en(true);
assert_eq!(pc.inf_seq_en(), true);
let pc: PktCtrl = pc.set_inf_seq_en(false);
assert_eq!(pc.inf_seq_en(), false);
source

pub const fn set_whitening_init(self, val: bool) -> PktCtrl

Set the value of bit-8 (9th bit) for generic packet whitening.

Example
use stm32wlxx_hal::subghz::PktCtrl;

const PKT_CTRL: PktCtrl = PktCtrl::RESET.set_whitening_init(true);
source

pub const fn whitening_init(&self) -> bool

Returns true if bit-8 of the generic packet whitening is set.

Example
use stm32wlxx_hal::subghz::PktCtrl;

let pc: PktCtrl = PktCtrl::RESET;
assert_eq!(pc.whitening_init(), true);
let pc: PktCtrl = pc.set_whitening_init(false);
assert_eq!(pc.whitening_init(), false);
let pc: PktCtrl = pc.set_whitening_init(true);
assert_eq!(pc.whitening_init(), true);

Trait Implementations§

source§

impl Clone for PktCtrl

source§

fn clone(&self) -> PktCtrl

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 PktCtrl

source§

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

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

impl Default for PktCtrl

source§

fn default() -> Self

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

impl From<PktCtrl> for u8

source§

fn from(pc: PktCtrl) -> Self

Converts to this type from the input type.
source§

impl PartialEq for PktCtrl

source§

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

source§

impl Eq for PktCtrl

source§

impl StructuralEq for PktCtrl

source§

impl StructuralPartialEq for PktCtrl

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.