corstone300_pac/fpgaio/
led.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `LED` reader"]
6pub struct R(crate::R<LED_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<LED_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<LED_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<LED_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `LED` writer"]
21pub struct W(crate::W<LED_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<LED_SPEC>;
24    #[inline(always)]
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29impl core::ops::DerefMut for W {
30    #[inline(always)]
31    fn deref_mut(&mut self) -> &mut Self::Target {
32        &mut self.0
33    }
34}
35impl From<crate::W<LED_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<LED_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `LED0` reader - "]
42pub type LED0_R = crate::BitReader<LED0_A>;
43#[doc = "\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum LED0_A {
46    #[doc = "0: LED is off"]
47    OFF = 0,
48    #[doc = "1: LED is on"]
49    ON = 1,
50}
51impl From<LED0_A> for bool {
52    #[inline(always)]
53    fn from(variant: LED0_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl LED0_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> LED0_A {
61        match self.bits {
62            false => LED0_A::OFF,
63            true => LED0_A::ON,
64        }
65    }
66    #[doc = "Checks if the value of the field is `OFF`"]
67    #[inline(always)]
68    pub fn is_off(&self) -> bool {
69        *self == LED0_A::OFF
70    }
71    #[doc = "Checks if the value of the field is `ON`"]
72    #[inline(always)]
73    pub fn is_on(&self) -> bool {
74        *self == LED0_A::ON
75    }
76}
77#[doc = "Field `LED0` writer - "]
78pub type LED0_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED0_A, O>;
79impl<'a, const O: u8> LED0_W<'a, O> {
80    #[doc = "LED is off"]
81    #[inline(always)]
82    pub fn off(self) -> &'a mut W {
83        self.variant(LED0_A::OFF)
84    }
85    #[doc = "LED is on"]
86    #[inline(always)]
87    pub fn on(self) -> &'a mut W {
88        self.variant(LED0_A::ON)
89    }
90}
91#[doc = "Field `LED1` reader - "]
92pub type LED1_R = crate::BitReader<LED1_A>;
93#[doc = "\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum LED1_A {
96    #[doc = "0: LED is off"]
97    OFF = 0,
98    #[doc = "1: LED is on"]
99    ON = 1,
100}
101impl From<LED1_A> for bool {
102    #[inline(always)]
103    fn from(variant: LED1_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl LED1_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> LED1_A {
111        match self.bits {
112            false => LED1_A::OFF,
113            true => LED1_A::ON,
114        }
115    }
116    #[doc = "Checks if the value of the field is `OFF`"]
117    #[inline(always)]
118    pub fn is_off(&self) -> bool {
119        *self == LED1_A::OFF
120    }
121    #[doc = "Checks if the value of the field is `ON`"]
122    #[inline(always)]
123    pub fn is_on(&self) -> bool {
124        *self == LED1_A::ON
125    }
126}
127#[doc = "Field `LED1` writer - "]
128pub type LED1_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED1_A, O>;
129impl<'a, const O: u8> LED1_W<'a, O> {
130    #[doc = "LED is off"]
131    #[inline(always)]
132    pub fn off(self) -> &'a mut W {
133        self.variant(LED1_A::OFF)
134    }
135    #[doc = "LED is on"]
136    #[inline(always)]
137    pub fn on(self) -> &'a mut W {
138        self.variant(LED1_A::ON)
139    }
140}
141#[doc = "Field `LED2` reader - "]
142pub type LED2_R = crate::BitReader<LED2_A>;
143#[doc = "\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum LED2_A {
146    #[doc = "0: LED is off"]
147    OFF = 0,
148    #[doc = "1: LED is on"]
149    ON = 1,
150}
151impl From<LED2_A> for bool {
152    #[inline(always)]
153    fn from(variant: LED2_A) -> Self {
154        variant as u8 != 0
155    }
156}
157impl LED2_R {
158    #[doc = "Get enumerated values variant"]
159    #[inline(always)]
160    pub fn variant(&self) -> LED2_A {
161        match self.bits {
162            false => LED2_A::OFF,
163            true => LED2_A::ON,
164        }
165    }
166    #[doc = "Checks if the value of the field is `OFF`"]
167    #[inline(always)]
168    pub fn is_off(&self) -> bool {
169        *self == LED2_A::OFF
170    }
171    #[doc = "Checks if the value of the field is `ON`"]
172    #[inline(always)]
173    pub fn is_on(&self) -> bool {
174        *self == LED2_A::ON
175    }
176}
177#[doc = "Field `LED2` writer - "]
178pub type LED2_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED2_A, O>;
179impl<'a, const O: u8> LED2_W<'a, O> {
180    #[doc = "LED is off"]
181    #[inline(always)]
182    pub fn off(self) -> &'a mut W {
183        self.variant(LED2_A::OFF)
184    }
185    #[doc = "LED is on"]
186    #[inline(always)]
187    pub fn on(self) -> &'a mut W {
188        self.variant(LED2_A::ON)
189    }
190}
191#[doc = "Field `LED3` reader - "]
192pub type LED3_R = crate::BitReader<LED3_A>;
193#[doc = "\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum LED3_A {
196    #[doc = "0: LED is off"]
197    OFF = 0,
198    #[doc = "1: LED is on"]
199    ON = 1,
200}
201impl From<LED3_A> for bool {
202    #[inline(always)]
203    fn from(variant: LED3_A) -> Self {
204        variant as u8 != 0
205    }
206}
207impl LED3_R {
208    #[doc = "Get enumerated values variant"]
209    #[inline(always)]
210    pub fn variant(&self) -> LED3_A {
211        match self.bits {
212            false => LED3_A::OFF,
213            true => LED3_A::ON,
214        }
215    }
216    #[doc = "Checks if the value of the field is `OFF`"]
217    #[inline(always)]
218    pub fn is_off(&self) -> bool {
219        *self == LED3_A::OFF
220    }
221    #[doc = "Checks if the value of the field is `ON`"]
222    #[inline(always)]
223    pub fn is_on(&self) -> bool {
224        *self == LED3_A::ON
225    }
226}
227#[doc = "Field `LED3` writer - "]
228pub type LED3_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED3_A, O>;
229impl<'a, const O: u8> LED3_W<'a, O> {
230    #[doc = "LED is off"]
231    #[inline(always)]
232    pub fn off(self) -> &'a mut W {
233        self.variant(LED3_A::OFF)
234    }
235    #[doc = "LED is on"]
236    #[inline(always)]
237    pub fn on(self) -> &'a mut W {
238        self.variant(LED3_A::ON)
239    }
240}
241#[doc = "Field `LED4` reader - "]
242pub type LED4_R = crate::BitReader<LED4_A>;
243#[doc = "\n\nValue on reset: 0"]
244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
245pub enum LED4_A {
246    #[doc = "0: LED is off"]
247    OFF = 0,
248    #[doc = "1: LED is on"]
249    ON = 1,
250}
251impl From<LED4_A> for bool {
252    #[inline(always)]
253    fn from(variant: LED4_A) -> Self {
254        variant as u8 != 0
255    }
256}
257impl LED4_R {
258    #[doc = "Get enumerated values variant"]
259    #[inline(always)]
260    pub fn variant(&self) -> LED4_A {
261        match self.bits {
262            false => LED4_A::OFF,
263            true => LED4_A::ON,
264        }
265    }
266    #[doc = "Checks if the value of the field is `OFF`"]
267    #[inline(always)]
268    pub fn is_off(&self) -> bool {
269        *self == LED4_A::OFF
270    }
271    #[doc = "Checks if the value of the field is `ON`"]
272    #[inline(always)]
273    pub fn is_on(&self) -> bool {
274        *self == LED4_A::ON
275    }
276}
277#[doc = "Field `LED4` writer - "]
278pub type LED4_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED4_A, O>;
279impl<'a, const O: u8> LED4_W<'a, O> {
280    #[doc = "LED is off"]
281    #[inline(always)]
282    pub fn off(self) -> &'a mut W {
283        self.variant(LED4_A::OFF)
284    }
285    #[doc = "LED is on"]
286    #[inline(always)]
287    pub fn on(self) -> &'a mut W {
288        self.variant(LED4_A::ON)
289    }
290}
291#[doc = "Field `LED5` reader - "]
292pub type LED5_R = crate::BitReader<LED5_A>;
293#[doc = "\n\nValue on reset: 0"]
294#[derive(Clone, Copy, Debug, PartialEq, Eq)]
295pub enum LED5_A {
296    #[doc = "0: LED is off"]
297    OFF = 0,
298    #[doc = "1: LED is on"]
299    ON = 1,
300}
301impl From<LED5_A> for bool {
302    #[inline(always)]
303    fn from(variant: LED5_A) -> Self {
304        variant as u8 != 0
305    }
306}
307impl LED5_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub fn variant(&self) -> LED5_A {
311        match self.bits {
312            false => LED5_A::OFF,
313            true => LED5_A::ON,
314        }
315    }
316    #[doc = "Checks if the value of the field is `OFF`"]
317    #[inline(always)]
318    pub fn is_off(&self) -> bool {
319        *self == LED5_A::OFF
320    }
321    #[doc = "Checks if the value of the field is `ON`"]
322    #[inline(always)]
323    pub fn is_on(&self) -> bool {
324        *self == LED5_A::ON
325    }
326}
327#[doc = "Field `LED5` writer - "]
328pub type LED5_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED5_A, O>;
329impl<'a, const O: u8> LED5_W<'a, O> {
330    #[doc = "LED is off"]
331    #[inline(always)]
332    pub fn off(self) -> &'a mut W {
333        self.variant(LED5_A::OFF)
334    }
335    #[doc = "LED is on"]
336    #[inline(always)]
337    pub fn on(self) -> &'a mut W {
338        self.variant(LED5_A::ON)
339    }
340}
341#[doc = "Field `LED6` reader - "]
342pub type LED6_R = crate::BitReader<LED6_A>;
343#[doc = "\n\nValue on reset: 0"]
344#[derive(Clone, Copy, Debug, PartialEq, Eq)]
345pub enum LED6_A {
346    #[doc = "0: LED is off"]
347    OFF = 0,
348    #[doc = "1: LED is on"]
349    ON = 1,
350}
351impl From<LED6_A> for bool {
352    #[inline(always)]
353    fn from(variant: LED6_A) -> Self {
354        variant as u8 != 0
355    }
356}
357impl LED6_R {
358    #[doc = "Get enumerated values variant"]
359    #[inline(always)]
360    pub fn variant(&self) -> LED6_A {
361        match self.bits {
362            false => LED6_A::OFF,
363            true => LED6_A::ON,
364        }
365    }
366    #[doc = "Checks if the value of the field is `OFF`"]
367    #[inline(always)]
368    pub fn is_off(&self) -> bool {
369        *self == LED6_A::OFF
370    }
371    #[doc = "Checks if the value of the field is `ON`"]
372    #[inline(always)]
373    pub fn is_on(&self) -> bool {
374        *self == LED6_A::ON
375    }
376}
377#[doc = "Field `LED6` writer - "]
378pub type LED6_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED6_A, O>;
379impl<'a, const O: u8> LED6_W<'a, O> {
380    #[doc = "LED is off"]
381    #[inline(always)]
382    pub fn off(self) -> &'a mut W {
383        self.variant(LED6_A::OFF)
384    }
385    #[doc = "LED is on"]
386    #[inline(always)]
387    pub fn on(self) -> &'a mut W {
388        self.variant(LED6_A::ON)
389    }
390}
391#[doc = "Field `LED7` reader - "]
392pub type LED7_R = crate::BitReader<LED7_A>;
393#[doc = "\n\nValue on reset: 0"]
394#[derive(Clone, Copy, Debug, PartialEq, Eq)]
395pub enum LED7_A {
396    #[doc = "0: LED is off"]
397    OFF = 0,
398    #[doc = "1: LED is on"]
399    ON = 1,
400}
401impl From<LED7_A> for bool {
402    #[inline(always)]
403    fn from(variant: LED7_A) -> Self {
404        variant as u8 != 0
405    }
406}
407impl LED7_R {
408    #[doc = "Get enumerated values variant"]
409    #[inline(always)]
410    pub fn variant(&self) -> LED7_A {
411        match self.bits {
412            false => LED7_A::OFF,
413            true => LED7_A::ON,
414        }
415    }
416    #[doc = "Checks if the value of the field is `OFF`"]
417    #[inline(always)]
418    pub fn is_off(&self) -> bool {
419        *self == LED7_A::OFF
420    }
421    #[doc = "Checks if the value of the field is `ON`"]
422    #[inline(always)]
423    pub fn is_on(&self) -> bool {
424        *self == LED7_A::ON
425    }
426}
427#[doc = "Field `LED7` writer - "]
428pub type LED7_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED7_A, O>;
429impl<'a, const O: u8> LED7_W<'a, O> {
430    #[doc = "LED is off"]
431    #[inline(always)]
432    pub fn off(self) -> &'a mut W {
433        self.variant(LED7_A::OFF)
434    }
435    #[doc = "LED is on"]
436    #[inline(always)]
437    pub fn on(self) -> &'a mut W {
438        self.variant(LED7_A::ON)
439    }
440}
441#[doc = "Field `LED8` reader - "]
442pub type LED8_R = crate::BitReader<LED8_A>;
443#[doc = "\n\nValue on reset: 0"]
444#[derive(Clone, Copy, Debug, PartialEq, Eq)]
445pub enum LED8_A {
446    #[doc = "0: LED is off"]
447    OFF = 0,
448    #[doc = "1: LED is on"]
449    ON = 1,
450}
451impl From<LED8_A> for bool {
452    #[inline(always)]
453    fn from(variant: LED8_A) -> Self {
454        variant as u8 != 0
455    }
456}
457impl LED8_R {
458    #[doc = "Get enumerated values variant"]
459    #[inline(always)]
460    pub fn variant(&self) -> LED8_A {
461        match self.bits {
462            false => LED8_A::OFF,
463            true => LED8_A::ON,
464        }
465    }
466    #[doc = "Checks if the value of the field is `OFF`"]
467    #[inline(always)]
468    pub fn is_off(&self) -> bool {
469        *self == LED8_A::OFF
470    }
471    #[doc = "Checks if the value of the field is `ON`"]
472    #[inline(always)]
473    pub fn is_on(&self) -> bool {
474        *self == LED8_A::ON
475    }
476}
477#[doc = "Field `LED8` writer - "]
478pub type LED8_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED8_A, O>;
479impl<'a, const O: u8> LED8_W<'a, O> {
480    #[doc = "LED is off"]
481    #[inline(always)]
482    pub fn off(self) -> &'a mut W {
483        self.variant(LED8_A::OFF)
484    }
485    #[doc = "LED is on"]
486    #[inline(always)]
487    pub fn on(self) -> &'a mut W {
488        self.variant(LED8_A::ON)
489    }
490}
491#[doc = "Field `LED9` reader - "]
492pub type LED9_R = crate::BitReader<LED9_A>;
493#[doc = "\n\nValue on reset: 0"]
494#[derive(Clone, Copy, Debug, PartialEq, Eq)]
495pub enum LED9_A {
496    #[doc = "0: LED is off"]
497    OFF = 0,
498    #[doc = "1: LED is on"]
499    ON = 1,
500}
501impl From<LED9_A> for bool {
502    #[inline(always)]
503    fn from(variant: LED9_A) -> Self {
504        variant as u8 != 0
505    }
506}
507impl LED9_R {
508    #[doc = "Get enumerated values variant"]
509    #[inline(always)]
510    pub fn variant(&self) -> LED9_A {
511        match self.bits {
512            false => LED9_A::OFF,
513            true => LED9_A::ON,
514        }
515    }
516    #[doc = "Checks if the value of the field is `OFF`"]
517    #[inline(always)]
518    pub fn is_off(&self) -> bool {
519        *self == LED9_A::OFF
520    }
521    #[doc = "Checks if the value of the field is `ON`"]
522    #[inline(always)]
523    pub fn is_on(&self) -> bool {
524        *self == LED9_A::ON
525    }
526}
527#[doc = "Field `LED9` writer - "]
528pub type LED9_W<'a, const O: u8> = crate::BitWriter<'a, u32, LED_SPEC, LED9_A, O>;
529impl<'a, const O: u8> LED9_W<'a, O> {
530    #[doc = "LED is off"]
531    #[inline(always)]
532    pub fn off(self) -> &'a mut W {
533        self.variant(LED9_A::OFF)
534    }
535    #[doc = "LED is on"]
536    #[inline(always)]
537    pub fn on(self) -> &'a mut W {
538        self.variant(LED9_A::ON)
539    }
540}
541impl R {
542    #[doc = "Bit 0"]
543    #[inline(always)]
544    pub fn led0(&self) -> LED0_R {
545        LED0_R::new((self.bits & 1) != 0)
546    }
547    #[doc = "Bit 1"]
548    #[inline(always)]
549    pub fn led1(&self) -> LED1_R {
550        LED1_R::new(((self.bits >> 1) & 1) != 0)
551    }
552    #[doc = "Bit 2"]
553    #[inline(always)]
554    pub fn led2(&self) -> LED2_R {
555        LED2_R::new(((self.bits >> 2) & 1) != 0)
556    }
557    #[doc = "Bit 3"]
558    #[inline(always)]
559    pub fn led3(&self) -> LED3_R {
560        LED3_R::new(((self.bits >> 3) & 1) != 0)
561    }
562    #[doc = "Bit 4"]
563    #[inline(always)]
564    pub fn led4(&self) -> LED4_R {
565        LED4_R::new(((self.bits >> 4) & 1) != 0)
566    }
567    #[doc = "Bit 5"]
568    #[inline(always)]
569    pub fn led5(&self) -> LED5_R {
570        LED5_R::new(((self.bits >> 5) & 1) != 0)
571    }
572    #[doc = "Bit 6"]
573    #[inline(always)]
574    pub fn led6(&self) -> LED6_R {
575        LED6_R::new(((self.bits >> 6) & 1) != 0)
576    }
577    #[doc = "Bit 7"]
578    #[inline(always)]
579    pub fn led7(&self) -> LED7_R {
580        LED7_R::new(((self.bits >> 7) & 1) != 0)
581    }
582    #[doc = "Bit 8"]
583    #[inline(always)]
584    pub fn led8(&self) -> LED8_R {
585        LED8_R::new(((self.bits >> 8) & 1) != 0)
586    }
587    #[doc = "Bit 9"]
588    #[inline(always)]
589    pub fn led9(&self) -> LED9_R {
590        LED9_R::new(((self.bits >> 9) & 1) != 0)
591    }
592}
593impl W {
594    #[doc = "Bit 0"]
595    #[inline(always)]
596    pub fn led0(&mut self) -> LED0_W<0> {
597        LED0_W::new(self)
598    }
599    #[doc = "Bit 1"]
600    #[inline(always)]
601    pub fn led1(&mut self) -> LED1_W<1> {
602        LED1_W::new(self)
603    }
604    #[doc = "Bit 2"]
605    #[inline(always)]
606    pub fn led2(&mut self) -> LED2_W<2> {
607        LED2_W::new(self)
608    }
609    #[doc = "Bit 3"]
610    #[inline(always)]
611    pub fn led3(&mut self) -> LED3_W<3> {
612        LED3_W::new(self)
613    }
614    #[doc = "Bit 4"]
615    #[inline(always)]
616    pub fn led4(&mut self) -> LED4_W<4> {
617        LED4_W::new(self)
618    }
619    #[doc = "Bit 5"]
620    #[inline(always)]
621    pub fn led5(&mut self) -> LED5_W<5> {
622        LED5_W::new(self)
623    }
624    #[doc = "Bit 6"]
625    #[inline(always)]
626    pub fn led6(&mut self) -> LED6_W<6> {
627        LED6_W::new(self)
628    }
629    #[doc = "Bit 7"]
630    #[inline(always)]
631    pub fn led7(&mut self) -> LED7_W<7> {
632        LED7_W::new(self)
633    }
634    #[doc = "Bit 8"]
635    #[inline(always)]
636    pub fn led8(&mut self) -> LED8_W<8> {
637        LED8_W::new(self)
638    }
639    #[doc = "Bit 9"]
640    #[inline(always)]
641    pub fn led9(&mut self) -> LED9_W<9> {
642        LED9_W::new(self)
643    }
644    #[doc = "Writes raw bits to the register."]
645    #[inline(always)]
646    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
647        self.0.bits(bits);
648        self
649    }
650}
651#[doc = "LED Connections\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 [led](index.html) module"]
652pub struct LED_SPEC;
653impl crate::RegisterSpec for LED_SPEC {
654    type Ux = u32;
655}
656#[doc = "`read()` method returns [led::R](R) reader structure"]
657impl crate::Readable for LED_SPEC {
658    type Reader = R;
659}
660#[doc = "`write(|w| ..)` method takes [led::W](W) writer structure"]
661impl crate::Writable for LED_SPEC {
662    type Writer = W;
663}
664#[doc = "`reset()` method sets LED to value 0"]
665impl crate::Resettable for LED_SPEC {
666    #[inline(always)]
667    fn reset_value() -> Self::Ux {
668        0
669    }
670}