pub struct Power<'a> { /* private fields */ }
Expand description
The USB state machine needs to be notified of power events (USB detected, USB removed, USB power ready) in order to be initialized and shut down properly. These events come from the power management registers of this module; that’s this has a USB client to notify.
Implementations§
source§impl<'a> Power<'a>
impl<'a> Power<'a>
pub const fn new() -> Power<'a>
pub fn set_usb_client(&self, client: &'a dyn PowerClient)
pub fn handle_interrupt(&self)
pub fn enable_interrupts(&self)
pub fn enable_interrupt(&self, intr: u32)
pub fn clear_interrupt(&self, intr: u32)
pub fn disable_all_interrupts(&self)
pub fn get_main_supply_status(&self) -> MainVoltage
pub fn is_vbus_present(&self) -> bool
pub fn is_usb_power_ready(&self) -> bool
sourcepub fn get_gpregret(&self) -> u8
pub fn get_gpregret(&self) -> u8
Return the contents of the GPREGRET (general purpose retention register) register.
This register is a “retention” register because it preserves eight bits of its state across a soft reset.
This is used to set a flag before a reset to instruct the bootloader to stay in the bootloader mode.
sourcepub fn set_gpregret(&self, val: u8)
pub fn set_gpregret(&self, val: u8)
Set the value of the GPREGRET (general purpose retention register) register.
This is used to set a flag before a reset to instruct the bootloader to stay in the bootloader mode.
Auto Trait Implementations§
impl<'a> !Freeze for Power<'a>
impl<'a> !RefUnwindSafe for Power<'a>
impl<'a> !Send for Power<'a>
impl<'a> !Sync for Power<'a>
impl<'a> Unpin for Power<'a>
impl<'a> !UnwindSafe for Power<'a>
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