lpc43xx/ccu1/clk_usb1_cfg/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CLK_USB1_CFG {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = "Possible values of the field `RUN`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum RUNR {
48 #[doc = "Clock is disabled."]
49 DISABLED,
50 #[doc = "Clock is enabled."]
51 ENABLED,
52}
53impl RUNR {
54 #[doc = r" Returns `true` if the bit is clear (0)"]
55 #[inline]
56 pub fn bit_is_clear(&self) -> bool {
57 !self.bit()
58 }
59 #[doc = r" Returns `true` if the bit is set (1)"]
60 #[inline]
61 pub fn bit_is_set(&self) -> bool {
62 self.bit()
63 }
64 #[doc = r" Value of the field as raw bits"]
65 #[inline]
66 pub fn bit(&self) -> bool {
67 match *self {
68 RUNR::DISABLED => false,
69 RUNR::ENABLED => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> RUNR {
76 match value {
77 false => RUNR::DISABLED,
78 true => RUNR::ENABLED,
79 }
80 }
81 #[doc = "Checks if the value of the field is `DISABLED`"]
82 #[inline]
83 pub fn is_disabled(&self) -> bool {
84 *self == RUNR::DISABLED
85 }
86 #[doc = "Checks if the value of the field is `ENABLED`"]
87 #[inline]
88 pub fn is_enabled(&self) -> bool {
89 *self == RUNR::ENABLED
90 }
91}
92#[doc = "Possible values of the field `AUTO`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum AUTOR {
95 #[doc = "Auto is disabled."]
96 AUTO_IS_DISABLED,
97 #[doc = "Auto is enabled."]
98 AUTO_IS_ENABLED,
99}
100impl AUTOR {
101 #[doc = r" Returns `true` if the bit is clear (0)"]
102 #[inline]
103 pub fn bit_is_clear(&self) -> bool {
104 !self.bit()
105 }
106 #[doc = r" Returns `true` if the bit is set (1)"]
107 #[inline]
108 pub fn bit_is_set(&self) -> bool {
109 self.bit()
110 }
111 #[doc = r" Value of the field as raw bits"]
112 #[inline]
113 pub fn bit(&self) -> bool {
114 match *self {
115 AUTOR::AUTO_IS_DISABLED => false,
116 AUTOR::AUTO_IS_ENABLED => true,
117 }
118 }
119 #[allow(missing_docs)]
120 #[doc(hidden)]
121 #[inline]
122 pub fn _from(value: bool) -> AUTOR {
123 match value {
124 false => AUTOR::AUTO_IS_DISABLED,
125 true => AUTOR::AUTO_IS_ENABLED,
126 }
127 }
128 #[doc = "Checks if the value of the field is `AUTO_IS_DISABLED`"]
129 #[inline]
130 pub fn is_auto_is_disabled(&self) -> bool {
131 *self == AUTOR::AUTO_IS_DISABLED
132 }
133 #[doc = "Checks if the value of the field is `AUTO_IS_ENABLED`"]
134 #[inline]
135 pub fn is_auto_is_enabled(&self) -> bool {
136 *self == AUTOR::AUTO_IS_ENABLED
137 }
138}
139#[doc = "Possible values of the field `WAKEUP`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum WAKEUPR {
142 #[doc = "Wake-up is disabled."]
143 WAKE_UP_IS_DISABLED,
144 #[doc = "Wake-up is enabled."]
145 WAKE_UP_IS_ENABLED,
146}
147impl WAKEUPR {
148 #[doc = r" Returns `true` if the bit is clear (0)"]
149 #[inline]
150 pub fn bit_is_clear(&self) -> bool {
151 !self.bit()
152 }
153 #[doc = r" Returns `true` if the bit is set (1)"]
154 #[inline]
155 pub fn bit_is_set(&self) -> bool {
156 self.bit()
157 }
158 #[doc = r" Value of the field as raw bits"]
159 #[inline]
160 pub fn bit(&self) -> bool {
161 match *self {
162 WAKEUPR::WAKE_UP_IS_DISABLED => false,
163 WAKEUPR::WAKE_UP_IS_ENABLED => true,
164 }
165 }
166 #[allow(missing_docs)]
167 #[doc(hidden)]
168 #[inline]
169 pub fn _from(value: bool) -> WAKEUPR {
170 match value {
171 false => WAKEUPR::WAKE_UP_IS_DISABLED,
172 true => WAKEUPR::WAKE_UP_IS_ENABLED,
173 }
174 }
175 #[doc = "Checks if the value of the field is `WAKE_UP_IS_DISABLED`"]
176 #[inline]
177 pub fn is_wake_up_is_disabled(&self) -> bool {
178 *self == WAKEUPR::WAKE_UP_IS_DISABLED
179 }
180 #[doc = "Checks if the value of the field is `WAKE_UP_IS_ENABLED`"]
181 #[inline]
182 pub fn is_wake_up_is_enabled(&self) -> bool {
183 *self == WAKEUPR::WAKE_UP_IS_ENABLED
184 }
185}
186#[doc = "Values that can be written to the field `RUN`"]
187pub enum RUNW {
188 #[doc = "Clock is disabled."]
189 DISABLED,
190 #[doc = "Clock is enabled."]
191 ENABLED,
192}
193impl RUNW {
194 #[allow(missing_docs)]
195 #[doc(hidden)]
196 #[inline]
197 pub fn _bits(&self) -> bool {
198 match *self {
199 RUNW::DISABLED => false,
200 RUNW::ENABLED => true,
201 }
202 }
203}
204#[doc = r" Proxy"]
205pub struct _RUNW<'a> {
206 w: &'a mut W,
207}
208impl<'a> _RUNW<'a> {
209 #[doc = r" Writes `variant` to the field"]
210 #[inline]
211 pub fn variant(self, variant: RUNW) -> &'a mut W {
212 {
213 self.bit(variant._bits())
214 }
215 }
216 #[doc = "Clock is disabled."]
217 #[inline]
218 pub fn disabled(self) -> &'a mut W {
219 self.variant(RUNW::DISABLED)
220 }
221 #[doc = "Clock is enabled."]
222 #[inline]
223 pub fn enabled(self) -> &'a mut W {
224 self.variant(RUNW::ENABLED)
225 }
226 #[doc = r" Sets the field bit"]
227 pub fn set_bit(self) -> &'a mut W {
228 self.bit(true)
229 }
230 #[doc = r" Clears the field bit"]
231 pub fn clear_bit(self) -> &'a mut W {
232 self.bit(false)
233 }
234 #[doc = r" Writes raw bits to the field"]
235 #[inline]
236 pub fn bit(self, value: bool) -> &'a mut W {
237 const MASK: bool = true;
238 const OFFSET: u8 = 0;
239 self.w.bits &= !((MASK as u32) << OFFSET);
240 self.w.bits |= ((value & MASK) as u32) << OFFSET;
241 self.w
242 }
243}
244#[doc = "Values that can be written to the field `AUTO`"]
245pub enum AUTOW {
246 #[doc = "Auto is disabled."]
247 AUTO_IS_DISABLED,
248 #[doc = "Auto is enabled."]
249 AUTO_IS_ENABLED,
250}
251impl AUTOW {
252 #[allow(missing_docs)]
253 #[doc(hidden)]
254 #[inline]
255 pub fn _bits(&self) -> bool {
256 match *self {
257 AUTOW::AUTO_IS_DISABLED => false,
258 AUTOW::AUTO_IS_ENABLED => true,
259 }
260 }
261}
262#[doc = r" Proxy"]
263pub struct _AUTOW<'a> {
264 w: &'a mut W,
265}
266impl<'a> _AUTOW<'a> {
267 #[doc = r" Writes `variant` to the field"]
268 #[inline]
269 pub fn variant(self, variant: AUTOW) -> &'a mut W {
270 {
271 self.bit(variant._bits())
272 }
273 }
274 #[doc = "Auto is disabled."]
275 #[inline]
276 pub fn auto_is_disabled(self) -> &'a mut W {
277 self.variant(AUTOW::AUTO_IS_DISABLED)
278 }
279 #[doc = "Auto is enabled."]
280 #[inline]
281 pub fn auto_is_enabled(self) -> &'a mut W {
282 self.variant(AUTOW::AUTO_IS_ENABLED)
283 }
284 #[doc = r" Sets the field bit"]
285 pub fn set_bit(self) -> &'a mut W {
286 self.bit(true)
287 }
288 #[doc = r" Clears the field bit"]
289 pub fn clear_bit(self) -> &'a mut W {
290 self.bit(false)
291 }
292 #[doc = r" Writes raw bits to the field"]
293 #[inline]
294 pub fn bit(self, value: bool) -> &'a mut W {
295 const MASK: bool = true;
296 const OFFSET: u8 = 1;
297 self.w.bits &= !((MASK as u32) << OFFSET);
298 self.w.bits |= ((value & MASK) as u32) << OFFSET;
299 self.w
300 }
301}
302#[doc = "Values that can be written to the field `WAKEUP`"]
303pub enum WAKEUPW {
304 #[doc = "Wake-up is disabled."]
305 WAKE_UP_IS_DISABLED,
306 #[doc = "Wake-up is enabled."]
307 WAKE_UP_IS_ENABLED,
308}
309impl WAKEUPW {
310 #[allow(missing_docs)]
311 #[doc(hidden)]
312 #[inline]
313 pub fn _bits(&self) -> bool {
314 match *self {
315 WAKEUPW::WAKE_UP_IS_DISABLED => false,
316 WAKEUPW::WAKE_UP_IS_ENABLED => true,
317 }
318 }
319}
320#[doc = r" Proxy"]
321pub struct _WAKEUPW<'a> {
322 w: &'a mut W,
323}
324impl<'a> _WAKEUPW<'a> {
325 #[doc = r" Writes `variant` to the field"]
326 #[inline]
327 pub fn variant(self, variant: WAKEUPW) -> &'a mut W {
328 {
329 self.bit(variant._bits())
330 }
331 }
332 #[doc = "Wake-up is disabled."]
333 #[inline]
334 pub fn wake_up_is_disabled(self) -> &'a mut W {
335 self.variant(WAKEUPW::WAKE_UP_IS_DISABLED)
336 }
337 #[doc = "Wake-up is enabled."]
338 #[inline]
339 pub fn wake_up_is_enabled(self) -> &'a mut W {
340 self.variant(WAKEUPW::WAKE_UP_IS_ENABLED)
341 }
342 #[doc = r" Sets the field bit"]
343 pub fn set_bit(self) -> &'a mut W {
344 self.bit(true)
345 }
346 #[doc = r" Clears the field bit"]
347 pub fn clear_bit(self) -> &'a mut W {
348 self.bit(false)
349 }
350 #[doc = r" Writes raw bits to the field"]
351 #[inline]
352 pub fn bit(self, value: bool) -> &'a mut W {
353 const MASK: bool = true;
354 const OFFSET: u8 = 2;
355 self.w.bits &= !((MASK as u32) << OFFSET);
356 self.w.bits |= ((value & MASK) as u32) << OFFSET;
357 self.w
358 }
359}
360impl R {
361 #[doc = r" Value of the register as raw bits"]
362 #[inline]
363 pub fn bits(&self) -> u32 {
364 self.bits
365 }
366 #[doc = "Bit 0 - Run enable"]
367 #[inline]
368 pub fn run(&self) -> RUNR {
369 RUNR::_from({
370 const MASK: bool = true;
371 const OFFSET: u8 = 0;
372 ((self.bits >> OFFSET) & MASK as u32) != 0
373 })
374 }
375 #[doc = "Bit 1 - Auto (AHB disable mechanism) enable"]
376 #[inline]
377 pub fn auto(&self) -> AUTOR {
378 AUTOR::_from({
379 const MASK: bool = true;
380 const OFFSET: u8 = 1;
381 ((self.bits >> OFFSET) & MASK as u32) != 0
382 })
383 }
384 #[doc = "Bit 2 - Wake-up mechanism enable"]
385 #[inline]
386 pub fn wakeup(&self) -> WAKEUPR {
387 WAKEUPR::_from({
388 const MASK: bool = true;
389 const OFFSET: u8 = 2;
390 ((self.bits >> OFFSET) & MASK as u32) != 0
391 })
392 }
393}
394impl W {
395 #[doc = r" Reset value of the register"]
396 #[inline]
397 pub fn reset_value() -> W {
398 W { bits: 1 }
399 }
400 #[doc = r" Writes raw bits to the register"]
401 #[inline]
402 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
403 self.bits = bits;
404 self
405 }
406 #[doc = "Bit 0 - Run enable"]
407 #[inline]
408 pub fn run(&mut self) -> _RUNW {
409 _RUNW { w: self }
410 }
411 #[doc = "Bit 1 - Auto (AHB disable mechanism) enable"]
412 #[inline]
413 pub fn auto(&mut self) -> _AUTOW {
414 _AUTOW { w: self }
415 }
416 #[doc = "Bit 2 - Wake-up mechanism enable"]
417 #[inline]
418 pub fn wakeup(&mut self) -> _WAKEUPW {
419 _WAKEUPW { w: self }
420 }
421}