stm32-metapac

Crates

git

Versions

stm32g0b0re

Flavors

Struct stm32_metapac::usb::regs::Cntr

#[repr(transparent)]
pub struct Cntr(pub u32);
Expand description

control register

Tuple Fields§

§0: u32

Implementations§

§

impl Cntr

pub const fn fres(&self) -> bool

Force a reset of the USB peripheral, exactly like a RESET signaling on the USB

pub fn set_fres(&mut self, val: bool)

Force a reset of the USB peripheral, exactly like a RESET signaling on the USB

pub const fn pdwn(&self) -> bool

Power down This bit is used to completely switch off all USB-related analog parts if it is required to completely disable the USB peripheral for any reason. When this bit is set, the USB peripheral is disconnected from the transceivers and it cannot be used.

pub fn set_pdwn(&mut self, val: bool)

Power down This bit is used to completely switch off all USB-related analog parts if it is required to completely disable the USB peripheral for any reason. When this bit is set, the USB peripheral is disconnected from the transceivers and it cannot be used.

pub const fn lpmode(&self) -> bool

Suspend state effective This bit is set by hardware as soon as the suspend state entered through the SUSPEN control gets internally effective. In this state USB activity is suspended, USB clock is gated, transceiver is set in low power mode by disabling the differential receiver. Only asynchronous wakeup logic and single ended receiver is kept alive to detect remote wakeup or resume events. Software must poll this bit to confirm it to be set before any STOP mode entry. This bit is cleared by hardware simultaneously to the WAKEUP flag being set.

pub fn set_lpmode(&mut self, val: bool)

Suspend state effective This bit is set by hardware as soon as the suspend state entered through the SUSPEN control gets internally effective. In this state USB activity is suspended, USB clock is gated, transceiver is set in low power mode by disabling the differential receiver. Only asynchronous wakeup logic and single ended receiver is kept alive to detect remote wakeup or resume events. Software must poll this bit to confirm it to be set before any STOP mode entry. This bit is cleared by hardware simultaneously to the WAKEUP flag being set.

pub const fn fsusp(&self) -> bool

Suspend state enable Device mode Software can set this bit when the SUSP interrupt is received, which is issued when no traffic is received by the USB peripheral for 3 ms. Software can also set this bit when the L1REQ interrupt is received with positive acknowledge sent. As soon as the suspend state is propagated internally all device activity is stopped, USB clock is gated, USB transceiver is set into low power mode and the SUSPRDY bit is set by hardware. In the case that device application wants to purse more aggressive power saving by stopping the USB clock source and by moving the microcontroller to stop mode, as in the case of bus powered device application, it must first wait few cycles to see the SUSPRDY=1 acknowledge the suspend request. This bit is cleared by hardware simultaneous with the WAKEUP flag set. Host mode Software can set this bit when Host application has nothing scheduled for the next frames and wants to enter long term power saving. When set, it stops immediately SOF generation and any other host activity, gates the USB clock and sets the transceiver in low power mode. If any USB transaction is on-going at the time SUSPEN is set, suspend is entered at the end of the current transaction. As soon as suspend state is propagated internally and gets effective the SUSPRDY bit is set. In the case that host application wants to purse more aggressive power saving by stopping the USB clock source and by moving the micro-controller to STOP mode, it must first wait few cycles to see SUSPRDY=1 acknowledge to the suspend request. This bit is cleared by hardware simultaneous with the WAKEUP flag set.

pub fn set_fsusp(&mut self, val: bool)

Suspend state enable Device mode Software can set this bit when the SUSP interrupt is received, which is issued when no traffic is received by the USB peripheral for 3 ms. Software can also set this bit when the L1REQ interrupt is received with positive acknowledge sent. As soon as the suspend state is propagated internally all device activity is stopped, USB clock is gated, USB transceiver is set into low power mode and the SUSPRDY bit is set by hardware. In the case that device application wants to purse more aggressive power saving by stopping the USB clock source and by moving the microcontroller to stop mode, as in the case of bus powered device application, it must first wait few cycles to see the SUSPRDY=1 acknowledge the suspend request. This bit is cleared by hardware simultaneous with the WAKEUP flag set. Host mode Software can set this bit when Host application has nothing scheduled for the next frames and wants to enter long term power saving. When set, it stops immediately SOF generation and any other host activity, gates the USB clock and sets the transceiver in low power mode. If any USB transaction is on-going at the time SUSPEN is set, suspend is entered at the end of the current transaction. As soon as suspend state is propagated internally and gets effective the SUSPRDY bit is set. In the case that host application wants to purse more aggressive power saving by stopping the USB clock source and by moving the micro-controller to STOP mode, it must first wait few cycles to see SUSPRDY=1 acknowledge to the suspend request. This bit is cleared by hardware simultaneous with the WAKEUP flag set.

pub const fn resume(&self) -> bool

L2 Remote Wakeup / Resume driver Device mode The microcontroller can set this bit to send remote wake-up signaling to the Host. It must be activated, according to USB specifications, for no less than 1ms and no more than 15ms after which the Host PC is ready to drive the resume sequence up to its end. Host mode Software sets this bit to send resume signaling to the device. Software clears this bit to send end of resume to device and restart SOF generation. In the context of remote wake up, this bit is to be set following the WAKEUP interrupt.

pub fn set_resume(&mut self, val: bool)

L2 Remote Wakeup / Resume driver Device mode The microcontroller can set this bit to send remote wake-up signaling to the Host. It must be activated, according to USB specifications, for no less than 1ms and no more than 15ms after which the Host PC is ready to drive the resume sequence up to its end. Host mode Software sets this bit to send resume signaling to the device. Software clears this bit to send end of resume to device and restart SOF generation. In the context of remote wake up, this bit is to be set following the WAKEUP interrupt.

pub const fn l1resume(&self) -> bool

L1 Remote Wakeup / Resume driver Device mode Software sets this bit to send a LPM L1 50us remote wakeup signaling to the host. After the signaling ends, this bit is cleared by hardware. Host mode Software sets this bit to send L1 resume signaling to device. Resume duration and next SOF generation is automatically driven to set the restart of USB activity timely aligned with the programmed BESL value. In the context of remote wake up, this bit is to be set following the WAKEUP interrupt. This bit is cleared by hardware at the end of resume.

pub fn set_l1resume(&mut self, val: bool)

L1 Remote Wakeup / Resume driver Device mode Software sets this bit to send a LPM L1 50us remote wakeup signaling to the host. After the signaling ends, this bit is cleared by hardware. Host mode Software sets this bit to send L1 resume signaling to device. Resume duration and next SOF generation is automatically driven to set the restart of USB activity timely aligned with the programmed BESL value. In the context of remote wake up, this bit is to be set following the WAKEUP interrupt. This bit is cleared by hardware at the end of resume.

pub const fn l1reqm(&self) -> bool

LPM L1 state request interrupt mask

pub fn set_l1reqm(&mut self, val: bool)

LPM L1 state request interrupt mask

pub const fn esofm(&self) -> bool

Expected start of frame interrupt mask

pub fn set_esofm(&mut self, val: bool)

Expected start of frame interrupt mask

pub const fn sofm(&self) -> bool

Start of frame interrupt mask

pub fn set_sofm(&mut self, val: bool)

Start of frame interrupt mask

pub const fn resetm(&self) -> bool

reset interrupt mask

pub fn set_resetm(&mut self, val: bool)

reset interrupt mask

pub const fn suspm(&self) -> bool

Suspend mode interrupt mask

pub fn set_suspm(&mut self, val: bool)

Suspend mode interrupt mask

pub const fn wkupm(&self) -> bool

Wakeup interrupt mask

pub fn set_wkupm(&mut self, val: bool)

Wakeup interrupt mask

pub const fn errm(&self) -> bool

Error interrupt mask

pub fn set_errm(&mut self, val: bool)

Error interrupt mask

pub const fn pmaovrm(&self) -> bool

Packet memory area over / underrun interrupt mask

pub fn set_pmaovrm(&mut self, val: bool)

Packet memory area over / underrun interrupt mask

pub const fn ctrm(&self) -> bool

CTR Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set

pub fn set_ctrm(&mut self, val: bool)

CTR Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set

pub const fn thr512m(&self) -> bool

512 byte threshold interrupt mask

pub fn set_thr512m(&mut self, val: bool)

512 byte threshold interrupt mask

pub const fn host(&self) -> bool

HOST mode HOST bit selects betweens Host or Device USB mode of operation. It must be set before enabling the USB peripheral by the function enable bit.

pub fn set_host(&mut self, val: bool)

HOST mode HOST bit selects betweens Host or Device USB mode of operation. It must be set before enabling the USB peripheral by the function enable bit.

Trait Implementations§

§

impl Clone for Cntr

§

fn clone(&self) -> Cntr

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
§

impl Default for Cntr

§

fn default() -> Cntr

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

impl PartialEq for Cntr

§

fn eq(&self, other: &Cntr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for Cntr

§

impl Eq for Cntr

§

impl StructuralPartialEq for Cntr

Auto Trait Implementations§

§

impl Freeze for Cntr

§

impl RefUnwindSafe for Cntr

§

impl Send for Cntr

§

impl Sync for Cntr

§

impl Unpin for Cntr

§

impl UnwindSafe for Cntr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.