eos_s3/iomux/
s_intr_4_sel.rs

1#[doc = "Register `S_INTR_4_SEL` reader"]
2pub struct R(crate::R<S_INTR_4_SEL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<S_INTR_4_SEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<S_INTR_4_SEL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<S_INTR_4_SEL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `S_INTR_4_SEL` writer"]
17pub struct W(crate::W<S_INTR_4_SEL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<S_INTR_4_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_4_SEL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<S_INTR_4_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 #7 as the trigger"]
44    PAD_07 = 1,
45    #[doc = "2: Selects pad #10 as the trigger"]
46    PAD_10 = 2,
47    #[doc = "3: Selects pad #26 as the trigger"]
48    PAD_26 = 3,
49    #[doc = "4: Selects pad #29 as the trigger"]
50    PAD_29 = 4,
51    #[doc = "5: Selects pad #44 as the trigger"]
52    PAD_44 = 5,
53}
54impl From<SEL_A> for u8 {
55    #[inline(always)]
56    fn from(variant: SEL_A) -> Self {
57        variant as _
58    }
59}
60#[doc = "Field `SEL` reader - Sel"]
61pub struct SEL_R(crate::FieldReader<u8, SEL_A>);
62impl SEL_R {
63    #[inline(always)]
64    pub(crate) fn new(bits: u8) -> Self {
65        SEL_R(crate::FieldReader::new(bits))
66    }
67    #[doc = r"Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<SEL_A> {
70        match self.bits {
71            0 => Some(SEL_A::UNDEFINED),
72            1 => Some(SEL_A::PAD_07),
73            2 => Some(SEL_A::PAD_10),
74            3 => Some(SEL_A::PAD_26),
75            4 => Some(SEL_A::PAD_29),
76            5 => Some(SEL_A::PAD_44),
77            _ => None,
78        }
79    }
80    #[doc = "Checks if the value of the field is `UNDEFINED`"]
81    #[inline(always)]
82    pub fn is_undefined(&self) -> bool {
83        **self == SEL_A::UNDEFINED
84    }
85    #[doc = "Checks if the value of the field is `PAD_07`"]
86    #[inline(always)]
87    pub fn is_pad_07(&self) -> bool {
88        **self == SEL_A::PAD_07
89    }
90    #[doc = "Checks if the value of the field is `PAD_10`"]
91    #[inline(always)]
92    pub fn is_pad_10(&self) -> bool {
93        **self == SEL_A::PAD_10
94    }
95    #[doc = "Checks if the value of the field is `PAD_26`"]
96    #[inline(always)]
97    pub fn is_pad_26(&self) -> bool {
98        **self == SEL_A::PAD_26
99    }
100    #[doc = "Checks if the value of the field is `PAD_29`"]
101    #[inline(always)]
102    pub fn is_pad_29(&self) -> bool {
103        **self == SEL_A::PAD_29
104    }
105    #[doc = "Checks if the value of the field is `PAD_44`"]
106    #[inline(always)]
107    pub fn is_pad_44(&self) -> bool {
108        **self == SEL_A::PAD_44
109    }
110}
111impl core::ops::Deref for SEL_R {
112    type Target = crate::FieldReader<u8, SEL_A>;
113    #[inline(always)]
114    fn deref(&self) -> &Self::Target {
115        &self.0
116    }
117}
118#[doc = "Field `SEL` writer - Sel"]
119pub struct SEL_W<'a> {
120    w: &'a mut W,
121}
122impl<'a> SEL_W<'a> {
123    #[doc = r"Writes `variant` to the field"]
124    #[inline(always)]
125    pub fn variant(self, variant: SEL_A) -> &'a mut W {
126        unsafe { self.bits(variant.into()) }
127    }
128    #[doc = "undefined (0:0 in documentation)"]
129    #[inline(always)]
130    pub fn undefined(self) -> &'a mut W {
131        self.variant(SEL_A::UNDEFINED)
132    }
133    #[doc = "Selects pad #7 as the trigger"]
134    #[inline(always)]
135    pub fn pad_07(self) -> &'a mut W {
136        self.variant(SEL_A::PAD_07)
137    }
138    #[doc = "Selects pad #10 as the trigger"]
139    #[inline(always)]
140    pub fn pad_10(self) -> &'a mut W {
141        self.variant(SEL_A::PAD_10)
142    }
143    #[doc = "Selects pad #26 as the trigger"]
144    #[inline(always)]
145    pub fn pad_26(self) -> &'a mut W {
146        self.variant(SEL_A::PAD_26)
147    }
148    #[doc = "Selects pad #29 as the trigger"]
149    #[inline(always)]
150    pub fn pad_29(self) -> &'a mut W {
151        self.variant(SEL_A::PAD_29)
152    }
153    #[doc = "Selects pad #44 as the trigger"]
154    #[inline(always)]
155    pub fn pad_44(self) -> &'a mut W {
156        self.variant(SEL_A::PAD_44)
157    }
158    #[doc = r"Writes raw bits to the field"]
159    #[inline(always)]
160    pub unsafe fn bits(self, value: u8) -> &'a mut W {
161        self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
162        self.w
163    }
164}
165impl R {
166    #[doc = "Bits 0:2 - Sel"]
167    #[inline(always)]
168    pub fn sel(&self) -> SEL_R {
169        SEL_R::new((self.bits & 0x07) as u8)
170    }
171}
172impl W {
173    #[doc = "Bits 0:2 - Sel"]
174    #[inline(always)]
175    pub fn sel(&mut self) -> SEL_W {
176        SEL_W { w: self }
177    }
178    #[doc = "Writes raw bits to the register."]
179    #[inline(always)]
180    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
181        self.0.bits(bits);
182        self
183    }
184}
185#[doc = "Select pad that triggers GPIO interrupt 4\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_4_sel](index.html) module"]
186pub struct S_INTR_4_SEL_SPEC;
187impl crate::RegisterSpec for S_INTR_4_SEL_SPEC {
188    type Ux = u32;
189}
190#[doc = "`read()` method returns [s_intr_4_sel::R](R) reader structure"]
191impl crate::Readable for S_INTR_4_SEL_SPEC {
192    type Reader = R;
193}
194#[doc = "`write(|w| ..)` method takes [s_intr_4_sel::W](W) writer structure"]
195impl crate::Writable for S_INTR_4_SEL_SPEC {
196    type Writer = W;
197}
198#[doc = "`reset()` method sets S_INTR_4_SEL to value 0"]
199impl crate::Resettable for S_INTR_4_SEL_SPEC {
200    #[inline(always)]
201    fn reset_value() -> Self::Ux {
202        0
203    }
204}