stm32f1/stm32f101/usb/
daddr.rs1pub type R = crate::R<DADDRrs>;
3pub type W = crate::W<DADDRrs>;
5pub type ADD_R = crate::FieldReader;
7pub type ADD_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14pub enum EF {
15 Disabled = 0,
17 Enabled = 1,
19}
20impl From<EF> for bool {
21 #[inline(always)]
22 fn from(variant: EF) -> Self {
23 variant as u8 != 0
24 }
25}
26pub type EF_R = crate::BitReader<EF>;
28impl EF_R {
29 #[inline(always)]
31 pub const fn variant(&self) -> EF {
32 match self.bits {
33 false => EF::Disabled,
34 true => EF::Enabled,
35 }
36 }
37 #[inline(always)]
39 pub fn is_disabled(&self) -> bool {
40 *self == EF::Disabled
41 }
42 #[inline(always)]
44 pub fn is_enabled(&self) -> bool {
45 *self == EF::Enabled
46 }
47}
48pub type EF_W<'a, REG> = crate::BitWriter<'a, REG, EF>;
50impl<'a, REG> EF_W<'a, REG>
51where
52 REG: crate::Writable + crate::RegisterSpec,
53{
54 #[inline(always)]
56 pub fn disabled(self) -> &'a mut crate::W<REG> {
57 self.variant(EF::Disabled)
58 }
59 #[inline(always)]
61 pub fn enabled(self) -> &'a mut crate::W<REG> {
62 self.variant(EF::Enabled)
63 }
64}
65impl R {
66 #[inline(always)]
68 pub fn add(&self) -> ADD_R {
69 ADD_R::new((self.bits & 0x7f) as u8)
70 }
71 #[inline(always)]
73 pub fn ef(&self) -> EF_R {
74 EF_R::new(((self.bits >> 7) & 1) != 0)
75 }
76}
77impl core::fmt::Debug for R {
78 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
79 f.debug_struct("DADDR")
80 .field("add", &self.add())
81 .field("ef", &self.ef())
82 .finish()
83 }
84}
85impl W {
86 #[inline(always)]
88 pub fn add(&mut self) -> ADD_W<DADDRrs> {
89 ADD_W::new(self, 0)
90 }
91 #[inline(always)]
93 pub fn ef(&mut self) -> EF_W<DADDRrs> {
94 EF_W::new(self, 7)
95 }
96}
97pub struct DADDRrs;
103impl crate::RegisterSpec for DADDRrs {
104 type Ux = u32;
105}
106impl crate::Readable for DADDRrs {}
108impl crate::Writable for DADDRrs {
110 type Safety = crate::Unsafe;
111}
112impl crate::Resettable for DADDRrs {}