efm32hg309_pac/pcnt0/
input.rs1#[doc = "Register `INPUT` reader"]
2pub struct R(crate::R<INPUT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<INPUT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<INPUT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<INPUT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `INPUT` writer"]
17pub struct W(crate::W<INPUT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<INPUT_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<INPUT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<INPUT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "S0IN PRS Channel Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum S0PRSSEL_A {
41 #[doc = "0: PRS Channel 0 selected."]
42 PRSCH0 = 0,
43 #[doc = "1: PRS Channel 1 selected."]
44 PRSCH1 = 1,
45 #[doc = "2: PRS Channel 2 selected."]
46 PRSCH2 = 2,
47 #[doc = "3: PRS Channel 3 selected."]
48 PRSCH3 = 3,
49 #[doc = "4: PRS Channel 4 selected."]
50 PRSCH4 = 4,
51 #[doc = "5: PRS Channel 5 selected."]
52 PRSCH5 = 5,
53}
54impl From<S0PRSSEL_A> for u8 {
55 #[inline(always)]
56 fn from(variant: S0PRSSEL_A) -> Self {
57 variant as _
58 }
59}
60#[doc = "Field `S0PRSSEL` reader - S0IN PRS Channel Select"]
61pub type S0PRSSEL_R = crate::FieldReader<u8, S0PRSSEL_A>;
62impl S0PRSSEL_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> Option<S0PRSSEL_A> {
66 match self.bits {
67 0 => Some(S0PRSSEL_A::PRSCH0),
68 1 => Some(S0PRSSEL_A::PRSCH1),
69 2 => Some(S0PRSSEL_A::PRSCH2),
70 3 => Some(S0PRSSEL_A::PRSCH3),
71 4 => Some(S0PRSSEL_A::PRSCH4),
72 5 => Some(S0PRSSEL_A::PRSCH5),
73 _ => None,
74 }
75 }
76 #[doc = "Checks if the value of the field is `PRSCH0`"]
77 #[inline(always)]
78 pub fn is_prsch0(&self) -> bool {
79 *self == S0PRSSEL_A::PRSCH0
80 }
81 #[doc = "Checks if the value of the field is `PRSCH1`"]
82 #[inline(always)]
83 pub fn is_prsch1(&self) -> bool {
84 *self == S0PRSSEL_A::PRSCH1
85 }
86 #[doc = "Checks if the value of the field is `PRSCH2`"]
87 #[inline(always)]
88 pub fn is_prsch2(&self) -> bool {
89 *self == S0PRSSEL_A::PRSCH2
90 }
91 #[doc = "Checks if the value of the field is `PRSCH3`"]
92 #[inline(always)]
93 pub fn is_prsch3(&self) -> bool {
94 *self == S0PRSSEL_A::PRSCH3
95 }
96 #[doc = "Checks if the value of the field is `PRSCH4`"]
97 #[inline(always)]
98 pub fn is_prsch4(&self) -> bool {
99 *self == S0PRSSEL_A::PRSCH4
100 }
101 #[doc = "Checks if the value of the field is `PRSCH5`"]
102 #[inline(always)]
103 pub fn is_prsch5(&self) -> bool {
104 *self == S0PRSSEL_A::PRSCH5
105 }
106}
107#[doc = "Field `S0PRSSEL` writer - S0IN PRS Channel Select"]
108pub type S0PRSSEL_W<'a> = crate::FieldWriter<'a, u32, INPUT_SPEC, u8, S0PRSSEL_A, 3, 0>;
109impl<'a> S0PRSSEL_W<'a> {
110 #[doc = "PRS Channel 0 selected."]
111 #[inline(always)]
112 pub fn prsch0(self) -> &'a mut W {
113 self.variant(S0PRSSEL_A::PRSCH0)
114 }
115 #[doc = "PRS Channel 1 selected."]
116 #[inline(always)]
117 pub fn prsch1(self) -> &'a mut W {
118 self.variant(S0PRSSEL_A::PRSCH1)
119 }
120 #[doc = "PRS Channel 2 selected."]
121 #[inline(always)]
122 pub fn prsch2(self) -> &'a mut W {
123 self.variant(S0PRSSEL_A::PRSCH2)
124 }
125 #[doc = "PRS Channel 3 selected."]
126 #[inline(always)]
127 pub fn prsch3(self) -> &'a mut W {
128 self.variant(S0PRSSEL_A::PRSCH3)
129 }
130 #[doc = "PRS Channel 4 selected."]
131 #[inline(always)]
132 pub fn prsch4(self) -> &'a mut W {
133 self.variant(S0PRSSEL_A::PRSCH4)
134 }
135 #[doc = "PRS Channel 5 selected."]
136 #[inline(always)]
137 pub fn prsch5(self) -> &'a mut W {
138 self.variant(S0PRSSEL_A::PRSCH5)
139 }
140}
141#[doc = "Field `S0PRSEN` reader - S0IN PRS Enable"]
142pub type S0PRSEN_R = crate::BitReader<bool>;
143#[doc = "Field `S0PRSEN` writer - S0IN PRS Enable"]
144pub type S0PRSEN_W<'a> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, 4>;
145#[doc = "S1IN PRS Channel Select\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq)]
147#[repr(u8)]
148pub enum S1PRSSEL_A {
149 #[doc = "0: PRS Channel 0 selected."]
150 PRSCH0 = 0,
151 #[doc = "1: PRS Channel 1 selected."]
152 PRSCH1 = 1,
153 #[doc = "2: PRS Channel 2 selected."]
154 PRSCH2 = 2,
155 #[doc = "3: PRS Channel 3 selected."]
156 PRSCH3 = 3,
157 #[doc = "4: PRS Channel 4 selected."]
158 PRSCH4 = 4,
159 #[doc = "5: PRS Channel 5 selected."]
160 PRSCH5 = 5,
161}
162impl From<S1PRSSEL_A> for u8 {
163 #[inline(always)]
164 fn from(variant: S1PRSSEL_A) -> Self {
165 variant as _
166 }
167}
168#[doc = "Field `S1PRSSEL` reader - S1IN PRS Channel Select"]
169pub type S1PRSSEL_R = crate::FieldReader<u8, S1PRSSEL_A>;
170impl S1PRSSEL_R {
171 #[doc = "Get enumerated values variant"]
172 #[inline(always)]
173 pub fn variant(&self) -> Option<S1PRSSEL_A> {
174 match self.bits {
175 0 => Some(S1PRSSEL_A::PRSCH0),
176 1 => Some(S1PRSSEL_A::PRSCH1),
177 2 => Some(S1PRSSEL_A::PRSCH2),
178 3 => Some(S1PRSSEL_A::PRSCH3),
179 4 => Some(S1PRSSEL_A::PRSCH4),
180 5 => Some(S1PRSSEL_A::PRSCH5),
181 _ => None,
182 }
183 }
184 #[doc = "Checks if the value of the field is `PRSCH0`"]
185 #[inline(always)]
186 pub fn is_prsch0(&self) -> bool {
187 *self == S1PRSSEL_A::PRSCH0
188 }
189 #[doc = "Checks if the value of the field is `PRSCH1`"]
190 #[inline(always)]
191 pub fn is_prsch1(&self) -> bool {
192 *self == S1PRSSEL_A::PRSCH1
193 }
194 #[doc = "Checks if the value of the field is `PRSCH2`"]
195 #[inline(always)]
196 pub fn is_prsch2(&self) -> bool {
197 *self == S1PRSSEL_A::PRSCH2
198 }
199 #[doc = "Checks if the value of the field is `PRSCH3`"]
200 #[inline(always)]
201 pub fn is_prsch3(&self) -> bool {
202 *self == S1PRSSEL_A::PRSCH3
203 }
204 #[doc = "Checks if the value of the field is `PRSCH4`"]
205 #[inline(always)]
206 pub fn is_prsch4(&self) -> bool {
207 *self == S1PRSSEL_A::PRSCH4
208 }
209 #[doc = "Checks if the value of the field is `PRSCH5`"]
210 #[inline(always)]
211 pub fn is_prsch5(&self) -> bool {
212 *self == S1PRSSEL_A::PRSCH5
213 }
214}
215#[doc = "Field `S1PRSSEL` writer - S1IN PRS Channel Select"]
216pub type S1PRSSEL_W<'a> = crate::FieldWriter<'a, u32, INPUT_SPEC, u8, S1PRSSEL_A, 3, 6>;
217impl<'a> S1PRSSEL_W<'a> {
218 #[doc = "PRS Channel 0 selected."]
219 #[inline(always)]
220 pub fn prsch0(self) -> &'a mut W {
221 self.variant(S1PRSSEL_A::PRSCH0)
222 }
223 #[doc = "PRS Channel 1 selected."]
224 #[inline(always)]
225 pub fn prsch1(self) -> &'a mut W {
226 self.variant(S1PRSSEL_A::PRSCH1)
227 }
228 #[doc = "PRS Channel 2 selected."]
229 #[inline(always)]
230 pub fn prsch2(self) -> &'a mut W {
231 self.variant(S1PRSSEL_A::PRSCH2)
232 }
233 #[doc = "PRS Channel 3 selected."]
234 #[inline(always)]
235 pub fn prsch3(self) -> &'a mut W {
236 self.variant(S1PRSSEL_A::PRSCH3)
237 }
238 #[doc = "PRS Channel 4 selected."]
239 #[inline(always)]
240 pub fn prsch4(self) -> &'a mut W {
241 self.variant(S1PRSSEL_A::PRSCH4)
242 }
243 #[doc = "PRS Channel 5 selected."]
244 #[inline(always)]
245 pub fn prsch5(self) -> &'a mut W {
246 self.variant(S1PRSSEL_A::PRSCH5)
247 }
248}
249#[doc = "Field `S1PRSEN` reader - S1IN PRS Enable"]
250pub type S1PRSEN_R = crate::BitReader<bool>;
251#[doc = "Field `S1PRSEN` writer - S1IN PRS Enable"]
252pub type S1PRSEN_W<'a> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, 10>;
253impl R {
254 #[doc = "Bits 0:2 - S0IN PRS Channel Select"]
255 #[inline(always)]
256 pub fn s0prssel(&self) -> S0PRSSEL_R {
257 S0PRSSEL_R::new((self.bits & 7) as u8)
258 }
259 #[doc = "Bit 4 - S0IN PRS Enable"]
260 #[inline(always)]
261 pub fn s0prsen(&self) -> S0PRSEN_R {
262 S0PRSEN_R::new(((self.bits >> 4) & 1) != 0)
263 }
264 #[doc = "Bits 6:8 - S1IN PRS Channel Select"]
265 #[inline(always)]
266 pub fn s1prssel(&self) -> S1PRSSEL_R {
267 S1PRSSEL_R::new(((self.bits >> 6) & 7) as u8)
268 }
269 #[doc = "Bit 10 - S1IN PRS Enable"]
270 #[inline(always)]
271 pub fn s1prsen(&self) -> S1PRSEN_R {
272 S1PRSEN_R::new(((self.bits >> 10) & 1) != 0)
273 }
274}
275impl W {
276 #[doc = "Bits 0:2 - S0IN PRS Channel Select"]
277 #[inline(always)]
278 pub fn s0prssel(&mut self) -> S0PRSSEL_W {
279 S0PRSSEL_W::new(self)
280 }
281 #[doc = "Bit 4 - S0IN PRS Enable"]
282 #[inline(always)]
283 pub fn s0prsen(&mut self) -> S0PRSEN_W {
284 S0PRSEN_W::new(self)
285 }
286 #[doc = "Bits 6:8 - S1IN PRS Channel Select"]
287 #[inline(always)]
288 pub fn s1prssel(&mut self) -> S1PRSSEL_W {
289 S1PRSSEL_W::new(self)
290 }
291 #[doc = "Bit 10 - S1IN PRS Enable"]
292 #[inline(always)]
293 pub fn s1prsen(&mut self) -> S1PRSEN_W {
294 S1PRSEN_W::new(self)
295 }
296 #[doc = "Writes raw bits to the register."]
297 #[inline(always)]
298 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
299 self.0.bits(bits);
300 self
301 }
302}
303#[doc = "PCNT Input 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 [input](index.html) module"]
304pub struct INPUT_SPEC;
305impl crate::RegisterSpec for INPUT_SPEC {
306 type Ux = u32;
307}
308#[doc = "`read()` method returns [input::R](R) reader structure"]
309impl crate::Readable for INPUT_SPEC {
310 type Reader = R;
311}
312#[doc = "`write(|w| ..)` method takes [input::W](W) writer structure"]
313impl crate::Writable for INPUT_SPEC {
314 type Writer = W;
315}
316#[doc = "`reset()` method sets INPUT to value 0"]
317impl crate::Resettable for INPUT_SPEC {
318 #[inline(always)]
319 fn reset_value() -> Self::Ux {
320 0
321 }
322}