1#[doc = "Reader of register USBCTRL"]
2pub type R = crate::R<u8, super::USBCTRL>;
3#[doc = "Writer for register USBCTRL"]
4pub type W = crate::W<u8, super::USBCTRL>;
5#[doc = "Register USBCTRL `reset()`'s with value 0xc0"]
6impl crate::ResetValue for super::USBCTRL {
7 type Type = u8;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0xc0
11 }
12}
13#[doc = "Enables the weak pulldowns on the USB transceiver.\n\nValue on reset: 1"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum PDE_A {
16 #[doc = "0: Weak pulldowns are disabled on D+ and D-."]
17 _0,
18 #[doc = "1: Weak pulldowns are enabled on D+ and D-."]
19 _1,
20}
21impl From<PDE_A> for bool {
22 #[inline(always)]
23 fn from(variant: PDE_A) -> Self {
24 match variant {
25 PDE_A::_0 => false,
26 PDE_A::_1 => true,
27 }
28 }
29}
30#[doc = "Reader of field `PDE`"]
31pub type PDE_R = crate::R<bool, PDE_A>;
32impl PDE_R {
33 #[doc = r"Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> PDE_A {
36 match self.bits {
37 false => PDE_A::_0,
38 true => PDE_A::_1,
39 }
40 }
41 #[doc = "Checks if the value of the field is `_0`"]
42 #[inline(always)]
43 pub fn is_0(&self) -> bool {
44 *self == PDE_A::_0
45 }
46 #[doc = "Checks if the value of the field is `_1`"]
47 #[inline(always)]
48 pub fn is_1(&self) -> bool {
49 *self == PDE_A::_1
50 }
51}
52#[doc = "Write proxy for field `PDE`"]
53pub struct PDE_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> PDE_W<'a> {
57 #[doc = r"Writes `variant` to the field"]
58 #[inline(always)]
59 pub fn variant(self, variant: PDE_A) -> &'a mut W {
60 {
61 self.bit(variant.into())
62 }
63 }
64 #[doc = "Weak pulldowns are disabled on D+ and D-."]
65 #[inline(always)]
66 pub fn _0(self) -> &'a mut W {
67 self.variant(PDE_A::_0)
68 }
69 #[doc = "Weak pulldowns are enabled on D+ and D-."]
70 #[inline(always)]
71 pub fn _1(self) -> &'a mut W {
72 self.variant(PDE_A::_1)
73 }
74 #[doc = r"Sets the field bit"]
75 #[inline(always)]
76 pub fn set_bit(self) -> &'a mut W {
77 self.bit(true)
78 }
79 #[doc = r"Clears the field bit"]
80 #[inline(always)]
81 pub fn clear_bit(self) -> &'a mut W {
82 self.bit(false)
83 }
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub fn bit(self, value: bool) -> &'a mut W {
87 self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
88 self.w
89 }
90}
91#[doc = "Places the USB transceiver into the suspend state.\n\nValue on reset: 1"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum SUSP_A {
94 #[doc = "0: USB transceiver is not in suspend state."]
95 _0,
96 #[doc = "1: USB transceiver is in suspend state."]
97 _1,
98}
99impl From<SUSP_A> for bool {
100 #[inline(always)]
101 fn from(variant: SUSP_A) -> Self {
102 match variant {
103 SUSP_A::_0 => false,
104 SUSP_A::_1 => true,
105 }
106 }
107}
108#[doc = "Reader of field `SUSP`"]
109pub type SUSP_R = crate::R<bool, SUSP_A>;
110impl SUSP_R {
111 #[doc = r"Get enumerated values variant"]
112 #[inline(always)]
113 pub fn variant(&self) -> SUSP_A {
114 match self.bits {
115 false => SUSP_A::_0,
116 true => SUSP_A::_1,
117 }
118 }
119 #[doc = "Checks if the value of the field is `_0`"]
120 #[inline(always)]
121 pub fn is_0(&self) -> bool {
122 *self == SUSP_A::_0
123 }
124 #[doc = "Checks if the value of the field is `_1`"]
125 #[inline(always)]
126 pub fn is_1(&self) -> bool {
127 *self == SUSP_A::_1
128 }
129}
130#[doc = "Write proxy for field `SUSP`"]
131pub struct SUSP_W<'a> {
132 w: &'a mut W,
133}
134impl<'a> SUSP_W<'a> {
135 #[doc = r"Writes `variant` to the field"]
136 #[inline(always)]
137 pub fn variant(self, variant: SUSP_A) -> &'a mut W {
138 {
139 self.bit(variant.into())
140 }
141 }
142 #[doc = "USB transceiver is not in suspend state."]
143 #[inline(always)]
144 pub fn _0(self) -> &'a mut W {
145 self.variant(SUSP_A::_0)
146 }
147 #[doc = "USB transceiver is in suspend state."]
148 #[inline(always)]
149 pub fn _1(self) -> &'a mut W {
150 self.variant(SUSP_A::_1)
151 }
152 #[doc = r"Sets the field bit"]
153 #[inline(always)]
154 pub fn set_bit(self) -> &'a mut W {
155 self.bit(true)
156 }
157 #[doc = r"Clears the field bit"]
158 #[inline(always)]
159 pub fn clear_bit(self) -> &'a mut W {
160 self.bit(false)
161 }
162 #[doc = r"Writes raw bits to the field"]
163 #[inline(always)]
164 pub fn bit(self, value: bool) -> &'a mut W {
165 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
166 self.w
167 }
168}
169impl R {
170 #[doc = "Bit 6 - Enables the weak pulldowns on the USB transceiver."]
171 #[inline(always)]
172 pub fn pde(&self) -> PDE_R {
173 PDE_R::new(((self.bits >> 6) & 0x01) != 0)
174 }
175 #[doc = "Bit 7 - Places the USB transceiver into the suspend state."]
176 #[inline(always)]
177 pub fn susp(&self) -> SUSP_R {
178 SUSP_R::new(((self.bits >> 7) & 0x01) != 0)
179 }
180}
181impl W {
182 #[doc = "Bit 6 - Enables the weak pulldowns on the USB transceiver."]
183 #[inline(always)]
184 pub fn pde(&mut self) -> PDE_W {
185 PDE_W { w: self }
186 }
187 #[doc = "Bit 7 - Places the USB transceiver into the suspend state."]
188 #[inline(always)]
189 pub fn susp(&mut self) -> SUSP_W {
190 SUSP_W { w: self }
191 }
192}