msp430f5529/usb_control/
usbmaint.rs1#[doc = "Register `USBMAINT` reader"]
2pub struct R(crate::R<USBMAINT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USBMAINT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USBMAINT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USBMAINT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `USBMAINT` writer"]
17pub struct W(crate::W<USBMAINT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<USBMAINT_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<USBMAINT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<USBMAINT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `UTIFG` reader - USB - Timer Interrupt Flag"]
38pub struct UTIFG_R(crate::FieldReader<bool, bool>);
39impl UTIFG_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 UTIFG_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for UTIFG_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `UTIFG` writer - USB - Timer Interrupt Flag"]
53pub struct UTIFG_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> UTIFG_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !0x01) | (value as u16 & 0x01);
71 self.w
72 }
73}
74#[doc = "Field `UTIE` reader - USB - Timer Interrupt Enable"]
75pub struct UTIE_R(crate::FieldReader<bool, bool>);
76impl UTIE_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 UTIE_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for UTIE_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `UTIE` writer - USB - Timer Interrupt Enable"]
90pub struct UTIE_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> UTIE_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u16 & 0x01) << 1);
108 self.w
109 }
110}
111#[doc = "Field `TSGEN` reader - USB - Time Stamp Generator Enable"]
112pub struct TSGEN_R(crate::FieldReader<bool, bool>);
113impl TSGEN_R {
114 #[inline(always)]
115 pub(crate) fn new(bits: bool) -> Self {
116 TSGEN_R(crate::FieldReader::new(bits))
117 }
118}
119impl core::ops::Deref for TSGEN_R {
120 type Target = crate::FieldReader<bool, bool>;
121 #[inline(always)]
122 fn deref(&self) -> &Self::Target {
123 &self.0
124 }
125}
126#[doc = "Field `TSGEN` writer - USB - Time Stamp Generator Enable"]
127pub struct TSGEN_W<'a> {
128 w: &'a mut W,
129}
130impl<'a> TSGEN_W<'a> {
131 #[doc = r"Sets the field bit"]
132 #[inline(always)]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W {
139 self.bit(false)
140 }
141 #[doc = r"Writes raw bits to the field"]
142 #[inline(always)]
143 pub fn bit(self, value: bool) -> &'a mut W {
144 self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u16 & 0x01) << 8);
145 self.w
146 }
147}
148#[doc = "USB - Time Stamp Event Select Bit 0\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq)]
150#[repr(u8)]
151pub enum TSESEL_A {
152 #[doc = "0: USB - Time Stamp Event Select: 0"]
153 TSESEL_0 = 0,
154 #[doc = "1: USB - Time Stamp Event Select: 1"]
155 TSESEL_1 = 1,
156 #[doc = "2: USB - Time Stamp Event Select: 2"]
157 TSESEL_2 = 2,
158 #[doc = "3: USB - Time Stamp Event Select: 3"]
159 TSESEL_3 = 3,
160}
161impl From<TSESEL_A> for u8 {
162 #[inline(always)]
163 fn from(variant: TSESEL_A) -> Self {
164 variant as _
165 }
166}
167#[doc = "Field `TSESEL` reader - USB - Time Stamp Event Select Bit 0"]
168pub struct TSESEL_R(crate::FieldReader<u8, TSESEL_A>);
169impl TSESEL_R {
170 #[inline(always)]
171 pub(crate) fn new(bits: u8) -> Self {
172 TSESEL_R(crate::FieldReader::new(bits))
173 }
174 #[doc = r"Get enumerated values variant"]
175 #[inline(always)]
176 pub fn variant(&self) -> TSESEL_A {
177 match self.bits {
178 0 => TSESEL_A::TSESEL_0,
179 1 => TSESEL_A::TSESEL_1,
180 2 => TSESEL_A::TSESEL_2,
181 3 => TSESEL_A::TSESEL_3,
182 _ => unreachable!(),
183 }
184 }
185 #[doc = "Checks if the value of the field is `TSESEL_0`"]
186 #[inline(always)]
187 pub fn is_tsesel_0(&self) -> bool {
188 **self == TSESEL_A::TSESEL_0
189 }
190 #[doc = "Checks if the value of the field is `TSESEL_1`"]
191 #[inline(always)]
192 pub fn is_tsesel_1(&self) -> bool {
193 **self == TSESEL_A::TSESEL_1
194 }
195 #[doc = "Checks if the value of the field is `TSESEL_2`"]
196 #[inline(always)]
197 pub fn is_tsesel_2(&self) -> bool {
198 **self == TSESEL_A::TSESEL_2
199 }
200 #[doc = "Checks if the value of the field is `TSESEL_3`"]
201 #[inline(always)]
202 pub fn is_tsesel_3(&self) -> bool {
203 **self == TSESEL_A::TSESEL_3
204 }
205}
206impl core::ops::Deref for TSESEL_R {
207 type Target = crate::FieldReader<u8, TSESEL_A>;
208 #[inline(always)]
209 fn deref(&self) -> &Self::Target {
210 &self.0
211 }
212}
213#[doc = "Field `TSESEL` writer - USB - Time Stamp Event Select Bit 0"]
214pub struct TSESEL_W<'a> {
215 w: &'a mut W,
216}
217impl<'a> TSESEL_W<'a> {
218 #[doc = r"Writes `variant` to the field"]
219 #[inline(always)]
220 pub fn variant(self, variant: TSESEL_A) -> &'a mut W {
221 self.bits(variant.into())
222 }
223 #[doc = "USB - Time Stamp Event Select: 0"]
224 #[inline(always)]
225 pub fn tsesel_0(self) -> &'a mut W {
226 self.variant(TSESEL_A::TSESEL_0)
227 }
228 #[doc = "USB - Time Stamp Event Select: 1"]
229 #[inline(always)]
230 pub fn tsesel_1(self) -> &'a mut W {
231 self.variant(TSESEL_A::TSESEL_1)
232 }
233 #[doc = "USB - Time Stamp Event Select: 2"]
234 #[inline(always)]
235 pub fn tsesel_2(self) -> &'a mut W {
236 self.variant(TSESEL_A::TSESEL_2)
237 }
238 #[doc = "USB - Time Stamp Event Select: 3"]
239 #[inline(always)]
240 pub fn tsesel_3(self) -> &'a mut W {
241 self.variant(TSESEL_A::TSESEL_3)
242 }
243 #[doc = r"Writes raw bits to the field"]
244 #[inline(always)]
245 pub fn bits(self, value: u8) -> &'a mut W {
246 self.w.bits = (self.w.bits & !(0x03 << 9)) | ((value as u16 & 0x03) << 9);
247 self.w
248 }
249}
250#[doc = "Field `TSE3` reader - USB - Time Stamp Event #3 Bit"]
251pub struct TSE3_R(crate::FieldReader<bool, bool>);
252impl TSE3_R {
253 #[inline(always)]
254 pub(crate) fn new(bits: bool) -> Self {
255 TSE3_R(crate::FieldReader::new(bits))
256 }
257}
258impl core::ops::Deref for TSE3_R {
259 type Target = crate::FieldReader<bool, bool>;
260 #[inline(always)]
261 fn deref(&self) -> &Self::Target {
262 &self.0
263 }
264}
265#[doc = "Field `TSE3` writer - USB - Time Stamp Event #3 Bit"]
266pub struct TSE3_W<'a> {
267 w: &'a mut W,
268}
269impl<'a> TSE3_W<'a> {
270 #[doc = r"Sets the field bit"]
271 #[inline(always)]
272 pub fn set_bit(self) -> &'a mut W {
273 self.bit(true)
274 }
275 #[doc = r"Clears the field bit"]
276 #[inline(always)]
277 pub fn clear_bit(self) -> &'a mut W {
278 self.bit(false)
279 }
280 #[doc = r"Writes raw bits to the field"]
281 #[inline(always)]
282 pub fn bit(self, value: bool) -> &'a mut W {
283 self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u16 & 0x01) << 11);
284 self.w
285 }
286}
287#[doc = "USB - Timer Select Bit 0\n\nValue on reset: 0"]
288#[derive(Clone, Copy, Debug, PartialEq)]
289#[repr(u8)]
290pub enum UTSEL_A {
291 #[doc = "0: USB - Timer Select: 0"]
292 UTSEL_0 = 0,
293 #[doc = "1: USB - Timer Select: 1"]
294 UTSEL_1 = 1,
295 #[doc = "2: USB - Timer Select: 2"]
296 UTSEL_2 = 2,
297 #[doc = "3: USB - Timer Select: 3"]
298 UTSEL_3 = 3,
299 #[doc = "4: USB - Timer Select: 4"]
300 UTSEL_4 = 4,
301 #[doc = "5: USB - Timer Select: 5"]
302 UTSEL_5 = 5,
303 #[doc = "6: USB - Timer Select: 6"]
304 UTSEL_6 = 6,
305 #[doc = "7: USB - Timer Select: 7"]
306 UTSEL_7 = 7,
307}
308impl From<UTSEL_A> for u8 {
309 #[inline(always)]
310 fn from(variant: UTSEL_A) -> Self {
311 variant as _
312 }
313}
314#[doc = "Field `UTSEL` reader - USB - Timer Select Bit 0"]
315pub struct UTSEL_R(crate::FieldReader<u8, UTSEL_A>);
316impl UTSEL_R {
317 #[inline(always)]
318 pub(crate) fn new(bits: u8) -> Self {
319 UTSEL_R(crate::FieldReader::new(bits))
320 }
321 #[doc = r"Get enumerated values variant"]
322 #[inline(always)]
323 pub fn variant(&self) -> UTSEL_A {
324 match self.bits {
325 0 => UTSEL_A::UTSEL_0,
326 1 => UTSEL_A::UTSEL_1,
327 2 => UTSEL_A::UTSEL_2,
328 3 => UTSEL_A::UTSEL_3,
329 4 => UTSEL_A::UTSEL_4,
330 5 => UTSEL_A::UTSEL_5,
331 6 => UTSEL_A::UTSEL_6,
332 7 => UTSEL_A::UTSEL_7,
333 _ => unreachable!(),
334 }
335 }
336 #[doc = "Checks if the value of the field is `UTSEL_0`"]
337 #[inline(always)]
338 pub fn is_utsel_0(&self) -> bool {
339 **self == UTSEL_A::UTSEL_0
340 }
341 #[doc = "Checks if the value of the field is `UTSEL_1`"]
342 #[inline(always)]
343 pub fn is_utsel_1(&self) -> bool {
344 **self == UTSEL_A::UTSEL_1
345 }
346 #[doc = "Checks if the value of the field is `UTSEL_2`"]
347 #[inline(always)]
348 pub fn is_utsel_2(&self) -> bool {
349 **self == UTSEL_A::UTSEL_2
350 }
351 #[doc = "Checks if the value of the field is `UTSEL_3`"]
352 #[inline(always)]
353 pub fn is_utsel_3(&self) -> bool {
354 **self == UTSEL_A::UTSEL_3
355 }
356 #[doc = "Checks if the value of the field is `UTSEL_4`"]
357 #[inline(always)]
358 pub fn is_utsel_4(&self) -> bool {
359 **self == UTSEL_A::UTSEL_4
360 }
361 #[doc = "Checks if the value of the field is `UTSEL_5`"]
362 #[inline(always)]
363 pub fn is_utsel_5(&self) -> bool {
364 **self == UTSEL_A::UTSEL_5
365 }
366 #[doc = "Checks if the value of the field is `UTSEL_6`"]
367 #[inline(always)]
368 pub fn is_utsel_6(&self) -> bool {
369 **self == UTSEL_A::UTSEL_6
370 }
371 #[doc = "Checks if the value of the field is `UTSEL_7`"]
372 #[inline(always)]
373 pub fn is_utsel_7(&self) -> bool {
374 **self == UTSEL_A::UTSEL_7
375 }
376}
377impl core::ops::Deref for UTSEL_R {
378 type Target = crate::FieldReader<u8, UTSEL_A>;
379 #[inline(always)]
380 fn deref(&self) -> &Self::Target {
381 &self.0
382 }
383}
384#[doc = "Field `UTSEL` writer - USB - Timer Select Bit 0"]
385pub struct UTSEL_W<'a> {
386 w: &'a mut W,
387}
388impl<'a> UTSEL_W<'a> {
389 #[doc = r"Writes `variant` to the field"]
390 #[inline(always)]
391 pub fn variant(self, variant: UTSEL_A) -> &'a mut W {
392 self.bits(variant.into())
393 }
394 #[doc = "USB - Timer Select: 0"]
395 #[inline(always)]
396 pub fn utsel_0(self) -> &'a mut W {
397 self.variant(UTSEL_A::UTSEL_0)
398 }
399 #[doc = "USB - Timer Select: 1"]
400 #[inline(always)]
401 pub fn utsel_1(self) -> &'a mut W {
402 self.variant(UTSEL_A::UTSEL_1)
403 }
404 #[doc = "USB - Timer Select: 2"]
405 #[inline(always)]
406 pub fn utsel_2(self) -> &'a mut W {
407 self.variant(UTSEL_A::UTSEL_2)
408 }
409 #[doc = "USB - Timer Select: 3"]
410 #[inline(always)]
411 pub fn utsel_3(self) -> &'a mut W {
412 self.variant(UTSEL_A::UTSEL_3)
413 }
414 #[doc = "USB - Timer Select: 4"]
415 #[inline(always)]
416 pub fn utsel_4(self) -> &'a mut W {
417 self.variant(UTSEL_A::UTSEL_4)
418 }
419 #[doc = "USB - Timer Select: 5"]
420 #[inline(always)]
421 pub fn utsel_5(self) -> &'a mut W {
422 self.variant(UTSEL_A::UTSEL_5)
423 }
424 #[doc = "USB - Timer Select: 6"]
425 #[inline(always)]
426 pub fn utsel_6(self) -> &'a mut W {
427 self.variant(UTSEL_A::UTSEL_6)
428 }
429 #[doc = "USB - Timer Select: 7"]
430 #[inline(always)]
431 pub fn utsel_7(self) -> &'a mut W {
432 self.variant(UTSEL_A::UTSEL_7)
433 }
434 #[doc = r"Writes raw bits to the field"]
435 #[inline(always)]
436 pub fn bits(self, value: u8) -> &'a mut W {
437 self.w.bits = (self.w.bits & !(0x07 << 13)) | ((value as u16 & 0x07) << 13);
438 self.w
439 }
440}
441impl R {
442 #[doc = "Bit 0 - USB - Timer Interrupt Flag"]
443 #[inline(always)]
444 pub fn utifg(&self) -> UTIFG_R {
445 UTIFG_R::new((self.bits & 0x01) != 0)
446 }
447 #[doc = "Bit 1 - USB - Timer Interrupt Enable"]
448 #[inline(always)]
449 pub fn utie(&self) -> UTIE_R {
450 UTIE_R::new(((self.bits >> 1) & 0x01) != 0)
451 }
452 #[doc = "Bit 8 - USB - Time Stamp Generator Enable"]
453 #[inline(always)]
454 pub fn tsgen(&self) -> TSGEN_R {
455 TSGEN_R::new(((self.bits >> 8) & 0x01) != 0)
456 }
457 #[doc = "Bits 9:10 - USB - Time Stamp Event Select Bit 0"]
458 #[inline(always)]
459 pub fn tsesel(&self) -> TSESEL_R {
460 TSESEL_R::new(((self.bits >> 9) & 0x03) as u8)
461 }
462 #[doc = "Bit 11 - USB - Time Stamp Event #3 Bit"]
463 #[inline(always)]
464 pub fn tse3(&self) -> TSE3_R {
465 TSE3_R::new(((self.bits >> 11) & 0x01) != 0)
466 }
467 #[doc = "Bits 13:15 - USB - Timer Select Bit 0"]
468 #[inline(always)]
469 pub fn utsel(&self) -> UTSEL_R {
470 UTSEL_R::new(((self.bits >> 13) & 0x07) as u8)
471 }
472}
473impl W {
474 #[doc = "Bit 0 - USB - Timer Interrupt Flag"]
475 #[inline(always)]
476 pub fn utifg(&mut self) -> UTIFG_W {
477 UTIFG_W { w: self }
478 }
479 #[doc = "Bit 1 - USB - Timer Interrupt Enable"]
480 #[inline(always)]
481 pub fn utie(&mut self) -> UTIE_W {
482 UTIE_W { w: self }
483 }
484 #[doc = "Bit 8 - USB - Time Stamp Generator Enable"]
485 #[inline(always)]
486 pub fn tsgen(&mut self) -> TSGEN_W {
487 TSGEN_W { w: self }
488 }
489 #[doc = "Bits 9:10 - USB - Time Stamp Event Select Bit 0"]
490 #[inline(always)]
491 pub fn tsesel(&mut self) -> TSESEL_W {
492 TSESEL_W { w: self }
493 }
494 #[doc = "Bit 11 - USB - Time Stamp Event #3 Bit"]
495 #[inline(always)]
496 pub fn tse3(&mut self) -> TSE3_W {
497 TSE3_W { w: self }
498 }
499 #[doc = "Bits 13:15 - USB - Timer Select Bit 0"]
500 #[inline(always)]
501 pub fn utsel(&mut self) -> UTSEL_W {
502 UTSEL_W { w: self }
503 }
504 #[doc = "Writes raw bits to the register."]
505 #[inline(always)]
506 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
507 self.0.bits(bits);
508 self
509 }
510}
511#[doc = "USB maintenance register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbmaint](index.html) module"]
512pub struct USBMAINT_SPEC;
513impl crate::RegisterSpec for USBMAINT_SPEC {
514 type Ux = u16;
515}
516#[doc = "`read()` method returns [usbmaint::R](R) reader structure"]
517impl crate::Readable for USBMAINT_SPEC {
518 type Reader = R;
519}
520#[doc = "`write(|w| ..)` method takes [usbmaint::W](W) writer structure"]
521impl crate::Writable for USBMAINT_SPEC {
522 type Writer = W;
523}
524#[doc = "`reset()` method sets USBMAINT to value 0"]
525impl crate::Resettable for USBMAINT_SPEC {
526 #[inline(always)]
527 fn reset_value() -> Self::Ux {
528 0
529 }
530}