Struct stm32wlxx_hal::lptim::Cr
source · pub struct Cr { /* private fields */ }
Expand description
Control register.
Implementations§
source§impl Cr
impl Cr
sourcepub const DISABLE: Cr = _
pub const DISABLE: Cr = _
Reset value + timer disabled.
This is equivalent to the reset value, it is provided to make the code more expressive.
Example
use stm32wlxx_hal::lptim::Cr;
assert_eq!(Cr::DISABLE.enabled(), false);
assert_eq!(Cr::DISABLE, Cr::RESET);
sourcepub const fn new(val: u32) -> Cr
pub const fn new(val: u32) -> Cr
Create a new Cr register from a raw value.
Example
use stm32wlxx_hal::lptim::Cr;
const CR: Cr = Cr::new(0b1);
sourcepub const fn raw(self) -> u32
pub const fn raw(self) -> u32
Get the raw value of the register.
Example
use stm32wlxx_hal::lptim::Cr;
const CR: Cr = Cr::new(0x1234_5678);
assert_eq!(CR.raw(), 0x1234_5678);
sourcepub const fn set_cnt_rst(self) -> Cr
pub const fn set_cnt_rst(self) -> Cr
Set the counter reset.
This bit is cleared by hardware.
sourcepub const fn set_continuous(self) -> Cr
pub const fn set_continuous(self) -> Cr
Start the timer in continuous mode.
sourcepub const fn set_single(self) -> Cr
pub const fn set_single(self) -> Cr
Start the timer in single-shot mode.
sourcepub const fn set_enable(self, en: bool) -> Cr
pub const fn set_enable(self, en: bool) -> Cr
Set the enable bit for the timer.
Example
use stm32wlxx_hal::lptim::Cr;
let cr = Cr::RESET;
assert_eq!(cr.enabled(), false);
let cr = cr.set_enable(true);
assert_eq!(cr.enabled(), true);
let cr = cr.set_enable(false);
assert_eq!(cr.enabled(), false);
sourcepub const fn enable(self) -> Cr
pub const fn enable(self) -> Cr
Enable the LPTIM peripheral.
Example
use stm32wlxx_hal::lptim::Cr;
let cr = Cr::RESET;
assert_eq!(cr.enabled(), false);
let cr = cr.enable();
assert_eq!(cr.enabled(), true);
let cr = cr.disable();
assert_eq!(cr.enabled(), false);
Trait Implementations§
impl Copy for Cr
impl Eq for Cr
impl StructuralEq for Cr
impl StructuralPartialEq for Cr
Auto Trait Implementations§
impl RefUnwindSafe for Cr
impl Send for Cr
impl Sync for Cr
impl Unpin for Cr
impl UnwindSafe for Cr
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