xmc4400/vadc_g0/
sevnp.rs

1#[doc = "Register `SEVNP` reader"]
2pub type R = crate::R<SEVNP_SPEC>;
3#[doc = "Register `SEVNP` writer"]
4pub type W = crate::W<SEVNP_SPEC>;
5#[doc = "Service Request Node Pointer Source Event i\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum SEV0NP_A {
9    #[doc = "0: Select service request line 0 of group x"]
10    VALUE1 = 0,
11    #[doc = "3: Select service request line 3 of group x"]
12    VALUE2 = 3,
13    #[doc = "4: Select shared service request line 0"]
14    VALUE3 = 4,
15    #[doc = "7: Select shared service request line 3"]
16    VALUE4 = 7,
17}
18impl From<SEV0NP_A> for u8 {
19    #[inline(always)]
20    fn from(variant: SEV0NP_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for SEV0NP_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for SEV0NP_A {}
28#[doc = "Field `SEV0NP` reader - Service Request Node Pointer Source Event i"]
29pub type SEV0NP_R = crate::FieldReader<SEV0NP_A>;
30impl SEV0NP_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Option<SEV0NP_A> {
34        match self.bits {
35            0 => Some(SEV0NP_A::VALUE1),
36            3 => Some(SEV0NP_A::VALUE2),
37            4 => Some(SEV0NP_A::VALUE3),
38            7 => Some(SEV0NP_A::VALUE4),
39            _ => None,
40        }
41    }
42    #[doc = "Select service request line 0 of group x"]
43    #[inline(always)]
44    pub fn is_value1(&self) -> bool {
45        *self == SEV0NP_A::VALUE1
46    }
47    #[doc = "Select service request line 3 of group x"]
48    #[inline(always)]
49    pub fn is_value2(&self) -> bool {
50        *self == SEV0NP_A::VALUE2
51    }
52    #[doc = "Select shared service request line 0"]
53    #[inline(always)]
54    pub fn is_value3(&self) -> bool {
55        *self == SEV0NP_A::VALUE3
56    }
57    #[doc = "Select shared service request line 3"]
58    #[inline(always)]
59    pub fn is_value4(&self) -> bool {
60        *self == SEV0NP_A::VALUE4
61    }
62}
63#[doc = "Field `SEV0NP` writer - Service Request Node Pointer Source Event i"]
64pub type SEV0NP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, SEV0NP_A>;
65impl<'a, REG> SEV0NP_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "Select service request line 0 of group x"]
71    #[inline(always)]
72    pub fn value1(self) -> &'a mut crate::W<REG> {
73        self.variant(SEV0NP_A::VALUE1)
74    }
75    #[doc = "Select service request line 3 of group x"]
76    #[inline(always)]
77    pub fn value2(self) -> &'a mut crate::W<REG> {
78        self.variant(SEV0NP_A::VALUE2)
79    }
80    #[doc = "Select shared service request line 0"]
81    #[inline(always)]
82    pub fn value3(self) -> &'a mut crate::W<REG> {
83        self.variant(SEV0NP_A::VALUE3)
84    }
85    #[doc = "Select shared service request line 3"]
86    #[inline(always)]
87    pub fn value4(self) -> &'a mut crate::W<REG> {
88        self.variant(SEV0NP_A::VALUE4)
89    }
90}
91#[doc = "Service Request Node Pointer Source Event i\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum SEV1NP_A {
95    #[doc = "0: Select service request line 0 of group x"]
96    VALUE1 = 0,
97    #[doc = "3: Select service request line 3 of group x"]
98    VALUE2 = 3,
99    #[doc = "4: Select shared service request line 0"]
100    VALUE3 = 4,
101    #[doc = "7: Select shared service request line 3"]
102    VALUE4 = 7,
103}
104impl From<SEV1NP_A> for u8 {
105    #[inline(always)]
106    fn from(variant: SEV1NP_A) -> Self {
107        variant as _
108    }
109}
110impl crate::FieldSpec for SEV1NP_A {
111    type Ux = u8;
112}
113impl crate::IsEnum for SEV1NP_A {}
114#[doc = "Field `SEV1NP` reader - Service Request Node Pointer Source Event i"]
115pub type SEV1NP_R = crate::FieldReader<SEV1NP_A>;
116impl SEV1NP_R {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub const fn variant(&self) -> Option<SEV1NP_A> {
120        match self.bits {
121            0 => Some(SEV1NP_A::VALUE1),
122            3 => Some(SEV1NP_A::VALUE2),
123            4 => Some(SEV1NP_A::VALUE3),
124            7 => Some(SEV1NP_A::VALUE4),
125            _ => None,
126        }
127    }
128    #[doc = "Select service request line 0 of group x"]
129    #[inline(always)]
130    pub fn is_value1(&self) -> bool {
131        *self == SEV1NP_A::VALUE1
132    }
133    #[doc = "Select service request line 3 of group x"]
134    #[inline(always)]
135    pub fn is_value2(&self) -> bool {
136        *self == SEV1NP_A::VALUE2
137    }
138    #[doc = "Select shared service request line 0"]
139    #[inline(always)]
140    pub fn is_value3(&self) -> bool {
141        *self == SEV1NP_A::VALUE3
142    }
143    #[doc = "Select shared service request line 3"]
144    #[inline(always)]
145    pub fn is_value4(&self) -> bool {
146        *self == SEV1NP_A::VALUE4
147    }
148}
149#[doc = "Field `SEV1NP` writer - Service Request Node Pointer Source Event i"]
150pub type SEV1NP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, SEV1NP_A>;
151impl<'a, REG> SEV1NP_W<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154    REG::Ux: From<u8>,
155{
156    #[doc = "Select service request line 0 of group x"]
157    #[inline(always)]
158    pub fn value1(self) -> &'a mut crate::W<REG> {
159        self.variant(SEV1NP_A::VALUE1)
160    }
161    #[doc = "Select service request line 3 of group x"]
162    #[inline(always)]
163    pub fn value2(self) -> &'a mut crate::W<REG> {
164        self.variant(SEV1NP_A::VALUE2)
165    }
166    #[doc = "Select shared service request line 0"]
167    #[inline(always)]
168    pub fn value3(self) -> &'a mut crate::W<REG> {
169        self.variant(SEV1NP_A::VALUE3)
170    }
171    #[doc = "Select shared service request line 3"]
172    #[inline(always)]
173    pub fn value4(self) -> &'a mut crate::W<REG> {
174        self.variant(SEV1NP_A::VALUE4)
175    }
176}
177impl R {
178    #[doc = "Bits 0:3 - Service Request Node Pointer Source Event i"]
179    #[inline(always)]
180    pub fn sev0np(&self) -> SEV0NP_R {
181        SEV0NP_R::new((self.bits & 0x0f) as u8)
182    }
183    #[doc = "Bits 4:7 - Service Request Node Pointer Source Event i"]
184    #[inline(always)]
185    pub fn sev1np(&self) -> SEV1NP_R {
186        SEV1NP_R::new(((self.bits >> 4) & 0x0f) as u8)
187    }
188}
189impl W {
190    #[doc = "Bits 0:3 - Service Request Node Pointer Source Event i"]
191    #[inline(always)]
192    pub fn sev0np(&mut self) -> SEV0NP_W<SEVNP_SPEC> {
193        SEV0NP_W::new(self, 0)
194    }
195    #[doc = "Bits 4:7 - Service Request Node Pointer Source Event i"]
196    #[inline(always)]
197    pub fn sev1np(&mut self) -> SEV1NP_W<SEVNP_SPEC> {
198        SEV1NP_W::new(self, 4)
199    }
200}
201#[doc = "Source Event Node Pointer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sevnp::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sevnp::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
202pub struct SEVNP_SPEC;
203impl crate::RegisterSpec for SEVNP_SPEC {
204    type Ux = u32;
205}
206#[doc = "`read()` method returns [`sevnp::R`](R) reader structure"]
207impl crate::Readable for SEVNP_SPEC {}
208#[doc = "`write(|w| ..)` method takes [`sevnp::W`](W) writer structure"]
209impl crate::Writable for SEVNP_SPEC {
210    type Safety = crate::Unsafe;
211    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
212    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
213}
214#[doc = "`reset()` method sets SEVNP to value 0"]
215impl crate::Resettable for SEVNP_SPEC {
216    const RESET_VALUE: u32 = 0;
217}