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