Embassy
stm32-metapac

Crates

git

Versions

stm32g0c1ke

Flavors

Struct stm32_metapac::usb::regs::Bcdr

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

Battery charging detector

Tuple Fields§

§0: u32

Implementations§

§

impl Bcdr

pub const fn bcden(&self) -> bool

Battery charging detector (BCD) enable Device mode This bit is set by the software to enable the BCD support within the USB device. When enabled, the USB PHY is fully controlled by BCD and cannot be used for normal communication. Once the BCD discovery is finished, the BCD should be placed in OFF mode by clearing this bit to ’0 in order to allow the normal USB operation.

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

Battery charging detector (BCD) enable Device mode This bit is set by the software to enable the BCD support within the USB device. When enabled, the USB PHY is fully controlled by BCD and cannot be used for normal communication. Once the BCD discovery is finished, the BCD should be placed in OFF mode by clearing this bit to ’0 in order to allow the normal USB operation.

pub const fn dcden(&self) -> bool

Data contact detection (DCD) mode enable Device mode This bit is set by the software to put the BCD into DCD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

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

Data contact detection (DCD) mode enable Device mode This bit is set by the software to put the BCD into DCD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

pub const fn pden(&self) -> bool

Primary detection (PD) mode enable Device mode This bit is set by the software to put the BCD into PD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

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

Primary detection (PD) mode enable Device mode This bit is set by the software to put the BCD into PD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

pub const fn sden(&self) -> bool

Secondary detection (SD) mode enable Device mode This bit is set by the software to put the BCD into SD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

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

Secondary detection (SD) mode enable Device mode This bit is set by the software to put the BCD into SD mode. Only one detection mode (DCD, PD, SD or OFF) should be selected to work correctly.

pub const fn dcdet(&self) -> bool

Data contact detection (DCD) status Device mode This bit gives the result of DCD.

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

Data contact detection (DCD) status Device mode This bit gives the result of DCD.

pub const fn pdet(&self) -> bool

Primary detection (PD) status Device mode This bit gives the result of PD.

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

Primary detection (PD) status Device mode This bit gives the result of PD.

pub const fn sdet(&self) -> Sdet

Secondary detection (SD) status Device mode This bit gives the result of SD.

pub fn set_sdet(&mut self, val: Sdet)

Secondary detection (SD) status Device mode This bit gives the result of SD.

pub const fn ps2det(&self) -> bool

DM pull-up detection status Device mode This bit is active only during PD and gives the result of comparison between DM voltage level and VLGC threshold. In normal situation, the DM level should be below this threshold. If it is above, it means that the DM is externally pulled high. This can be caused by connection to a PS2 port (which pulls-up both DP and DM lines) or to some proprietary charger not following the BCD specification.

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

DM pull-up detection status Device mode This bit is active only during PD and gives the result of comparison between DM voltage level and VLGC threshold. In normal situation, the DM level should be below this threshold. If it is above, it means that the DM is externally pulled high. This can be caused by connection to a PS2 port (which pulls-up both DP and DM lines) or to some proprietary charger not following the BCD specification.

pub const fn dppu(&self) -> bool

DP pull-up / DPDM pull-down Device mode This bit is set by software to enable the embedded pull-up on DP line. Clearing it to ’0 can be used to signal disconnect to the host when needed by the user software. Host mode This bit is set by software to enable the embedded pull-down on DP and DM lines.

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

DP pull-up / DPDM pull-down Device mode This bit is set by software to enable the embedded pull-up on DP line. Clearing it to ’0 can be used to signal disconnect to the host when needed by the user software. Host mode This bit is set by software to enable the embedded pull-down on DP and DM lines.

Trait Implementations§

§

impl Clone for Bcdr

§

fn clone(&self) -> Bcdr

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 Bcdr

§

fn default() -> Bcdr

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

impl PartialEq for Bcdr

§

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

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

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

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

impl Copy for Bcdr

§

impl Eq for Bcdr

§

impl StructuralEq for Bcdr

§

impl StructuralPartialEq for Bcdr

Auto Trait Implementations§

§

impl RefUnwindSafe for Bcdr

§

impl Send for Bcdr

§

impl Sync for Bcdr

§

impl Unpin for Bcdr

§

impl UnwindSafe for Bcdr

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> 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>,

§

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>,

§

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.