Struct stm32wlxx_hal::lptim::Cfgr

source ·
pub struct Cfgr { /* private fields */ }
Expand description

Configuration register.

Implementations§

source§

impl Cfgr

source

pub const RESET: Cfgr = _

Reset value of the register.

Example
use stm32wlxx_hal::lptim::Cfgr;
assert_eq!(Cfgr::RESET.raw(), 0);
source

pub const fn new(val: u32) -> Cfgr

Create a new Cfgr register from a raw value.

Example
use stm32wlxx_hal::lptim::Cfgr;
const CFGR: Cfgr = Cfgr::new(0);
source

pub const fn raw(self) -> u32

Get the raw value of the register.

Example
use stm32wlxx_hal::lptim::Cfgr;
const CFGR: Cfgr = Cfgr::new(0x1234_5678);
assert_eq!(CFGR.raw(), 0x1234_5678);
source

pub const fn set_wavepol(self, wavepol: bool) -> Self

Set the waveform polarity.

Example
use stm32wlxx_hal::lptim::Cfgr;

let cfgr: Cfgr = Cfgr::RESET;
assert_eq!(cfgr.wavepol(), false);

let cfgr: Cfgr = cfgr.set_wavepol(true);
assert_eq!(cfgr.wavepol(), true);

let cfgr: Cfgr = cfgr.set_wavepol(false);
assert_eq!(cfgr.wavepol(), false);
source

pub const fn wavepol(&self) -> bool

Get the waveform polarity.

source

pub const fn set_trg_pol(self, trg_pol: TrgPol) -> Self

Set the trigger polarity.

source

pub const fn set_trg_sel(self, trigger: u32) -> Self

Set the trigger source.

source

pub const fn set_trg_filter(self, filter: Filter) -> Self

Set the trigger filter.

source

pub const fn prescaler(&self) -> Prescaler

Get the prescaler value.

Example
use stm32wlxx_hal::lptim::{Cfgr, Prescaler};

assert_eq!(Cfgr::default().prescaler(), Prescaler::default());
source

pub const fn set_prescaler(self, pres: Prescaler) -> Self

Set the prescaler value.

Example
use stm32wlxx_hal::lptim::{Cfgr, Prescaler};

let cfgr: Cfgr = Cfgr::RESET;

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div1);
assert_eq!(cfgr.prescaler(), Prescaler::Div1);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div2);
assert_eq!(cfgr.prescaler(), Prescaler::Div2);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div4);
assert_eq!(cfgr.prescaler(), Prescaler::Div4);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div8);
assert_eq!(cfgr.prescaler(), Prescaler::Div8);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div16);
assert_eq!(cfgr.prescaler(), Prescaler::Div16);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div32);
assert_eq!(cfgr.prescaler(), Prescaler::Div32);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div64);
assert_eq!(cfgr.prescaler(), Prescaler::Div64);

let cfgr: Cfgr = cfgr.set_prescaler(Prescaler::Div128);
assert_eq!(cfgr.prescaler(), Prescaler::Div128);

Trait Implementations§

source§

impl Clone for Cfgr

source§

fn clone(&self) -> Cfgr

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 Cfgr

source§

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

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

impl Default for Cfgr

source§

fn default() -> Self

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

impl From<Cfgr> for u32

source§

fn from(cr: Cfgr) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Cfgr

source§

fn from(val: u32) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Cfgr

source§

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

source§

impl Eq for Cfgr

source§

impl StructuralEq for Cfgr

source§

impl StructuralPartialEq for Cfgr

Auto Trait Implementations§

§

impl RefUnwindSafe for Cfgr

§

impl Send for Cfgr

§

impl Sync for Cfgr

§

impl Unpin for Cfgr

§

impl UnwindSafe for Cfgr

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.