Struct stm32wlxx_hal::lptim::Cfgr
source · pub struct Cfgr { /* private fields */ }
Expand description
Configuration register.
Implementations§
source§impl Cfgr
impl Cfgr
sourcepub const RESET: Cfgr = _
pub const RESET: Cfgr = _
Reset value of the register.
Example
use stm32wlxx_hal::lptim::Cfgr;
assert_eq!(Cfgr::RESET.raw(), 0);
sourcepub const fn new(val: u32) -> Cfgr
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);
sourcepub const fn raw(self) -> u32
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);
sourcepub const fn set_wavepol(self, wavepol: bool) -> Self
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);
sourcepub const fn set_trg_pol(self, trg_pol: TrgPol) -> Self
pub const fn set_trg_pol(self, trg_pol: TrgPol) -> Self
Set the trigger polarity.
sourcepub const fn set_trg_sel(self, trigger: u32) -> Self
pub const fn set_trg_sel(self, trigger: u32) -> Self
Set the trigger source.
sourcepub const fn set_trg_filter(self, filter: Filter) -> Self
pub const fn set_trg_filter(self, filter: Filter) -> Self
Set the trigger filter.
sourcepub const fn prescaler(&self) -> Prescaler
pub const fn prescaler(&self) -> Prescaler
Get the prescaler value.
Example
use stm32wlxx_hal::lptim::{Cfgr, Prescaler};
assert_eq!(Cfgr::default().prescaler(), Prescaler::default());
sourcepub const fn set_prescaler(self, pres: Prescaler) -> Self
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 PartialEq for Cfgr
impl PartialEq for Cfgr
impl Copy for Cfgr
impl Eq for Cfgr
impl StructuralEq for Cfgr
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more