Struct stm32wlxx_hal::subghz::PwrCtrl
source · pub struct PwrCtrl { /* private fields */ }
Expand description
Power control.
Argument of set_bit_sync
.
Implementations§
source§impl PwrCtrl
impl PwrCtrl
sourcepub const fn from_raw(raw: u8) -> Self
pub const fn from_raw(raw: u8) -> Self
Create a new PwrCtrl
structure from a raw value.
Reserved bits will be masked.
sourcepub const fn set_current_lim_en(self, en: bool) -> PwrCtrl
pub const fn set_current_lim_en(self, en: bool) -> PwrCtrl
Set the current limiter enable.
Example
use stm32wlxx_hal::subghz::PwrCtrl;
const PWR_CTRL: PwrCtrl = PwrCtrl::RESET.set_current_lim_en(true);
sourcepub const fn current_limit_en(&self) -> bool
pub const fn current_limit_en(&self) -> bool
Returns true
if current limiting is enabled
Example
use stm32wlxx_hal::subghz::PwrCtrl;
let pc: PwrCtrl = PwrCtrl::RESET;
assert_eq!(pc.current_limit_en(), true);
let pc: PwrCtrl = pc.set_current_lim_en(false);
assert_eq!(pc.current_limit_en(), false);
let pc: PwrCtrl = pc.set_current_lim_en(true);
assert_eq!(pc.current_limit_en(), true);
sourcepub const fn set_current_lim(self, lim: CurrentLim) -> PwrCtrl
pub const fn set_current_lim(self, lim: CurrentLim) -> PwrCtrl
Set the current limit.
sourcepub const fn current_lim(&self) -> CurrentLim
pub const fn current_lim(&self) -> CurrentLim
Get the current limit.
Example
use stm32wlxx_hal::subghz::{CurrentLim, PwrCtrl};
let pc: PwrCtrl = PwrCtrl::RESET;
assert_eq!(pc.current_lim(), CurrentLim::Milli50);
let pc: PwrCtrl = pc.set_current_lim(CurrentLim::Milli25);
assert_eq!(pc.current_lim(), CurrentLim::Milli25);
let pc: PwrCtrl = pc.set_current_lim(CurrentLim::Milli50);
assert_eq!(pc.current_lim(), CurrentLim::Milli50);
let pc: PwrCtrl = pc.set_current_lim(CurrentLim::Milli100);
assert_eq!(pc.current_lim(), CurrentLim::Milli100);
let pc: PwrCtrl = pc.set_current_lim(CurrentLim::Milli200);
assert_eq!(pc.current_lim(), CurrentLim::Milli200);
Trait Implementations§
source§impl PartialEq for PwrCtrl
impl PartialEq for PwrCtrl
impl Copy for PwrCtrl
impl Eq for PwrCtrl
impl StructuralEq for PwrCtrl
impl StructuralPartialEq for PwrCtrl
Auto Trait Implementations§
impl RefUnwindSafe for PwrCtrl
impl Send for PwrCtrl
impl Sync for PwrCtrl
impl Unpin for PwrCtrl
impl UnwindSafe for PwrCtrl
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