eos_s3/iomux/
s_intr_3_sel.rs

1#[doc = "Register `S_INTR_3_SEL` reader"]
2pub struct R(crate::R<S_INTR_3_SEL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<S_INTR_3_SEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<S_INTR_3_SEL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<S_INTR_3_SEL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `S_INTR_3_SEL` writer"]
17pub struct W(crate::W<S_INTR_3_SEL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<S_INTR_3_SEL_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<S_INTR_3_SEL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<S_INTR_3_SEL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Sel\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SEL_A {
41    #[doc = "0: undefined (0:0 in documentation)"]
42    UNDEFINED = 0,
43    #[doc = "1: Selects pad #2 as the trigger"]
44    PAD_05 = 1,
45    #[doc = "2: Selects pad #9 as the trigger"]
46    PAD_09 = 2,
47    #[doc = "3: Selects pad #22 as the trigger"]
48    PAD_22 = 3,
49    #[doc = "4: Selects pad #28 as the trigger"]
50    PAD_28 = 4,
51    #[doc = "5: Selects pad #39 as the trigger"]
52    PAD_39 = 5,
53    #[doc = "6: Selects pad #40 as the trigger"]
54    PAD_40 = 6,
55}
56impl From<SEL_A> for u8 {
57    #[inline(always)]
58    fn from(variant: SEL_A) -> Self {
59        variant as _
60    }
61}
62#[doc = "Field `SEL` reader - Sel"]
63pub struct SEL_R(crate::FieldReader<u8, SEL_A>);
64impl SEL_R {
65    #[inline(always)]
66    pub(crate) fn new(bits: u8) -> Self {
67        SEL_R(crate::FieldReader::new(bits))
68    }
69    #[doc = r"Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> Option<SEL_A> {
72        match self.bits {
73            0 => Some(SEL_A::UNDEFINED),
74            1 => Some(SEL_A::PAD_05),
75            2 => Some(SEL_A::PAD_09),
76            3 => Some(SEL_A::PAD_22),
77            4 => Some(SEL_A::PAD_28),
78            5 => Some(SEL_A::PAD_39),
79            6 => Some(SEL_A::PAD_40),
80            _ => None,
81        }
82    }
83    #[doc = "Checks if the value of the field is `UNDEFINED`"]
84    #[inline(always)]
85    pub fn is_undefined(&self) -> bool {
86        **self == SEL_A::UNDEFINED
87    }
88    #[doc = "Checks if the value of the field is `PAD_05`"]
89    #[inline(always)]
90    pub fn is_pad_05(&self) -> bool {
91        **self == SEL_A::PAD_05
92    }
93    #[doc = "Checks if the value of the field is `PAD_09`"]
94    #[inline(always)]
95    pub fn is_pad_09(&self) -> bool {
96        **self == SEL_A::PAD_09
97    }
98    #[doc = "Checks if the value of the field is `PAD_22`"]
99    #[inline(always)]
100    pub fn is_pad_22(&self) -> bool {
101        **self == SEL_A::PAD_22
102    }
103    #[doc = "Checks if the value of the field is `PAD_28`"]
104    #[inline(always)]
105    pub fn is_pad_28(&self) -> bool {
106        **self == SEL_A::PAD_28
107    }
108    #[doc = "Checks if the value of the field is `PAD_39`"]
109    #[inline(always)]
110    pub fn is_pad_39(&self) -> bool {
111        **self == SEL_A::PAD_39
112    }
113    #[doc = "Checks if the value of the field is `PAD_40`"]
114    #[inline(always)]
115    pub fn is_pad_40(&self) -> bool {
116        **self == SEL_A::PAD_40
117    }
118}
119impl core::ops::Deref for SEL_R {
120    type Target = crate::FieldReader<u8, SEL_A>;
121    #[inline(always)]
122    fn deref(&self) -> &Self::Target {
123        &self.0
124    }
125}
126#[doc = "Field `SEL` writer - Sel"]
127pub struct SEL_W<'a> {
128    w: &'a mut W,
129}
130impl<'a> SEL_W<'a> {
131    #[doc = r"Writes `variant` to the field"]
132    #[inline(always)]
133    pub fn variant(self, variant: SEL_A) -> &'a mut W {
134        unsafe { self.bits(variant.into()) }
135    }
136    #[doc = "undefined (0:0 in documentation)"]
137    #[inline(always)]
138    pub fn undefined(self) -> &'a mut W {
139        self.variant(SEL_A::UNDEFINED)
140    }
141    #[doc = "Selects pad #2 as the trigger"]
142    #[inline(always)]
143    pub fn pad_05(self) -> &'a mut W {
144        self.variant(SEL_A::PAD_05)
145    }
146    #[doc = "Selects pad #9 as the trigger"]
147    #[inline(always)]
148    pub fn pad_09(self) -> &'a mut W {
149        self.variant(SEL_A::PAD_09)
150    }
151    #[doc = "Selects pad #22 as the trigger"]
152    #[inline(always)]
153    pub fn pad_22(self) -> &'a mut W {
154        self.variant(SEL_A::PAD_22)
155    }
156    #[doc = "Selects pad #28 as the trigger"]
157    #[inline(always)]
158    pub fn pad_28(self) -> &'a mut W {
159        self.variant(SEL_A::PAD_28)
160    }
161    #[doc = "Selects pad #39 as the trigger"]
162    #[inline(always)]
163    pub fn pad_39(self) -> &'a mut W {
164        self.variant(SEL_A::PAD_39)
165    }
166    #[doc = "Selects pad #40 as the trigger"]
167    #[inline(always)]
168    pub fn pad_40(self) -> &'a mut W {
169        self.variant(SEL_A::PAD_40)
170    }
171    #[doc = r"Writes raw bits to the field"]
172    #[inline(always)]
173    pub unsafe fn bits(self, value: u8) -> &'a mut W {
174        self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
175        self.w
176    }
177}
178impl R {
179    #[doc = "Bits 0:2 - Sel"]
180    #[inline(always)]
181    pub fn sel(&self) -> SEL_R {
182        SEL_R::new((self.bits & 0x07) as u8)
183    }
184}
185impl W {
186    #[doc = "Bits 0:2 - Sel"]
187    #[inline(always)]
188    pub fn sel(&mut self) -> SEL_W {
189        SEL_W { w: self }
190    }
191    #[doc = "Writes raw bits to the register."]
192    #[inline(always)]
193    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
194        self.0.bits(bits);
195        self
196    }
197}
198#[doc = "Select pad that triggers GPIO interrupt 3\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 [s_intr_3_sel](index.html) module"]
199pub struct S_INTR_3_SEL_SPEC;
200impl crate::RegisterSpec for S_INTR_3_SEL_SPEC {
201    type Ux = u32;
202}
203#[doc = "`read()` method returns [s_intr_3_sel::R](R) reader structure"]
204impl crate::Readable for S_INTR_3_SEL_SPEC {
205    type Reader = R;
206}
207#[doc = "`write(|w| ..)` method takes [s_intr_3_sel::W](W) writer structure"]
208impl crate::Writable for S_INTR_3_SEL_SPEC {
209    type Writer = W;
210}
211#[doc = "`reset()` method sets S_INTR_3_SEL to value 0"]
212impl crate::Resettable for S_INTR_3_SEL_SPEC {
213    #[inline(always)]
214    fn reset_value() -> Self::Ux {
215        0
216    }
217}