efm32gg11b/usart0/
irctrl.rs1#[doc = "Reader of register IRCTRL"]
2pub type R = crate::R<u32, super::IRCTRL>;
3#[doc = "Writer for register IRCTRL"]
4pub type W = crate::W<u32, super::IRCTRL>;
5#[doc = "Register IRCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::IRCTRL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type { 0 }
10}
11#[doc = "Reader of field `IREN`"]
12pub type IREN_R = crate::R<bool, bool>;
13#[doc = "Write proxy for field `IREN`"]
14pub struct IREN_W<'a> {
15 w: &'a mut W,
16}
17impl<'a> IREN_W<'a> {
18 #[doc = r"Sets the field bit"]
19 #[inline(always)]
20 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
21 #[doc = r"Clears the field bit"]
22 #[inline(always)]
23 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
24 #[doc = r"Writes raw bits to the field"]
25 #[inline(always)]
26 pub fn bit(self, value: bool) -> &'a mut W {
27 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
28 self.w
29 }
30}
31#[doc = "IrDA TX Pulse Width\n\nValue on reset: 0"]
32#[derive(Clone, Copy, Debug, PartialEq)]
33#[repr(u8)]
34pub enum IRPW_A {
35 #[doc = "0: IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
36 ONE = 0,
37 #[doc = "1: IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
38 TWO = 1,
39 #[doc = "2: IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
40 THREE = 2,
41 #[doc = "3: IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
42 FOUR = 3,
43}
44impl From<IRPW_A> for u8 {
45 #[inline(always)]
46 fn from(variant: IRPW_A) -> Self { variant as _ }
47}
48#[doc = "Reader of field `IRPW`"]
49pub type IRPW_R = crate::R<u8, IRPW_A>;
50impl IRPW_R {
51 #[doc = r"Get enumerated values variant"]
52 #[inline(always)]
53 pub fn variant(&self) -> IRPW_A {
54 match self.bits {
55 0 => IRPW_A::ONE,
56 1 => IRPW_A::TWO,
57 2 => IRPW_A::THREE,
58 3 => IRPW_A::FOUR,
59 _ => unreachable!(),
60 }
61 }
62 #[doc = "Checks if the value of the field is `ONE`"]
63 #[inline(always)]
64 pub fn is_one(&self) -> bool { *self == IRPW_A::ONE }
65 #[doc = "Checks if the value of the field is `TWO`"]
66 #[inline(always)]
67 pub fn is_two(&self) -> bool { *self == IRPW_A::TWO }
68 #[doc = "Checks if the value of the field is `THREE`"]
69 #[inline(always)]
70 pub fn is_three(&self) -> bool { *self == IRPW_A::THREE }
71 #[doc = "Checks if the value of the field is `FOUR`"]
72 #[inline(always)]
73 pub fn is_four(&self) -> bool { *self == IRPW_A::FOUR }
74}
75#[doc = "Write proxy for field `IRPW`"]
76pub struct IRPW_W<'a> {
77 w: &'a mut W,
78}
79impl<'a> IRPW_W<'a> {
80 #[doc = r"Writes `variant` to the field"]
81 #[inline(always)]
82 pub fn variant(self, variant: IRPW_A) -> &'a mut W {
83 {
84 self.bits(variant.into())
85 }
86 }
87 #[doc = "IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
88 #[inline(always)]
89 pub fn one(self) -> &'a mut W { self.variant(IRPW_A::ONE) }
90 #[doc = "IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
91 #[inline(always)]
92 pub fn two(self) -> &'a mut W { self.variant(IRPW_A::TWO) }
93 #[doc = "IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
94 #[inline(always)]
95 pub fn three(self) -> &'a mut W { self.variant(IRPW_A::THREE) }
96 #[doc = "IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
97 #[inline(always)]
98 pub fn four(self) -> &'a mut W { self.variant(IRPW_A::FOUR) }
99 #[doc = r"Writes raw bits to the field"]
100 #[inline(always)]
101 pub fn bits(self, value: u8) -> &'a mut W {
102 self.w.bits = (self.w.bits & !(0x03 << 1)) | (((value as u32) & 0x03) << 1);
103 self.w
104 }
105}
106#[doc = "Reader of field `IRFILT`"]
107pub type IRFILT_R = crate::R<bool, bool>;
108#[doc = "Write proxy for field `IRFILT`"]
109pub struct IRFILT_W<'a> {
110 w: &'a mut W,
111}
112impl<'a> IRFILT_W<'a> {
113 #[doc = r"Sets the field bit"]
114 #[inline(always)]
115 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
116 #[doc = r"Clears the field bit"]
117 #[inline(always)]
118 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
119 #[doc = r"Writes raw bits to the field"]
120 #[inline(always)]
121 pub fn bit(self, value: bool) -> &'a mut W {
122 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
123 self.w
124 }
125}
126#[doc = "Reader of field `IRPRSEN`"]
127pub type IRPRSEN_R = crate::R<bool, bool>;
128#[doc = "Write proxy for field `IRPRSEN`"]
129pub struct IRPRSEN_W<'a> {
130 w: &'a mut W,
131}
132impl<'a> IRPRSEN_W<'a> {
133 #[doc = r"Sets the field bit"]
134 #[inline(always)]
135 pub fn set_bit(self) -> &'a mut W { self.bit(true) }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
139 #[doc = r"Writes raw bits to the field"]
140 #[inline(always)]
141 pub fn bit(self, value: bool) -> &'a mut W {
142 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
143 self.w
144 }
145}
146#[doc = "IrDA PRS Channel Select\n\nValue on reset: 0"]
147#[derive(Clone, Copy, Debug, PartialEq)]
148#[repr(u8)]
149pub enum IRPRSSEL_A {
150 #[doc = "0: PRS Channel 0 selected"]
151 PRSCH0 = 0,
152 #[doc = "1: PRS Channel 1 selected"]
153 PRSCH1 = 1,
154 #[doc = "2: PRS Channel 2 selected"]
155 PRSCH2 = 2,
156 #[doc = "3: PRS Channel 3 selected"]
157 PRSCH3 = 3,
158 #[doc = "4: PRS Channel 4 selected"]
159 PRSCH4 = 4,
160 #[doc = "5: PRS Channel 5 selected"]
161 PRSCH5 = 5,
162 #[doc = "6: PRS Channel 6 selected"]
163 PRSCH6 = 6,
164 #[doc = "7: PRS Channel 7 selected"]
165 PRSCH7 = 7,
166 #[doc = "8: PRS Channel 8 selected"]
167 PRSCH8 = 8,
168 #[doc = "9: PRS Channel 9 selected"]
169 PRSCH9 = 9,
170 #[doc = "10: PRS Channel 10 selected"]
171 PRSCH10 = 10,
172 #[doc = "11: PRS Channel 11 selected"]
173 PRSCH11 = 11,
174 #[doc = "12: PRS Channel 12 selected"]
175 PRSCH12 = 12,
176 #[doc = "13: PRS Channel 13 selected"]
177 PRSCH13 = 13,
178 #[doc = "14: PRS Channel 14 selected"]
179 PRSCH14 = 14,
180 #[doc = "15: PRS Channel 15 selected"]
181 PRSCH15 = 15,
182 #[doc = "16: PRS Channel 16 selected"]
183 PRSCH16 = 16,
184 #[doc = "17: PRS Channel 17 selected"]
185 PRSCH17 = 17,
186 #[doc = "18: PRS Channel 18 selected"]
187 PRSCH18 = 18,
188 #[doc = "19: PRS Channel 19 selected"]
189 PRSCH19 = 19,
190 #[doc = "20: PRS Channel 20 selected"]
191 PRSCH20 = 20,
192 #[doc = "21: PRS Channel 21 selected"]
193 PRSCH21 = 21,
194 #[doc = "22: PRS Channel 22 selected"]
195 PRSCH22 = 22,
196 #[doc = "23: PRS Channel 23 selected"]
197 PRSCH23 = 23,
198}
199impl From<IRPRSSEL_A> for u8 {
200 #[inline(always)]
201 fn from(variant: IRPRSSEL_A) -> Self { variant as _ }
202}
203#[doc = "Reader of field `IRPRSSEL`"]
204pub type IRPRSSEL_R = crate::R<u8, IRPRSSEL_A>;
205impl IRPRSSEL_R {
206 #[doc = r"Get enumerated values variant"]
207 #[inline(always)]
208 pub fn variant(&self) -> crate::Variant<u8, IRPRSSEL_A> {
209 use crate::Variant::*;
210 match self.bits {
211 0 => Val(IRPRSSEL_A::PRSCH0),
212 1 => Val(IRPRSSEL_A::PRSCH1),
213 2 => Val(IRPRSSEL_A::PRSCH2),
214 3 => Val(IRPRSSEL_A::PRSCH3),
215 4 => Val(IRPRSSEL_A::PRSCH4),
216 5 => Val(IRPRSSEL_A::PRSCH5),
217 6 => Val(IRPRSSEL_A::PRSCH6),
218 7 => Val(IRPRSSEL_A::PRSCH7),
219 8 => Val(IRPRSSEL_A::PRSCH8),
220 9 => Val(IRPRSSEL_A::PRSCH9),
221 10 => Val(IRPRSSEL_A::PRSCH10),
222 11 => Val(IRPRSSEL_A::PRSCH11),
223 12 => Val(IRPRSSEL_A::PRSCH12),
224 13 => Val(IRPRSSEL_A::PRSCH13),
225 14 => Val(IRPRSSEL_A::PRSCH14),
226 15 => Val(IRPRSSEL_A::PRSCH15),
227 16 => Val(IRPRSSEL_A::PRSCH16),
228 17 => Val(IRPRSSEL_A::PRSCH17),
229 18 => Val(IRPRSSEL_A::PRSCH18),
230 19 => Val(IRPRSSEL_A::PRSCH19),
231 20 => Val(IRPRSSEL_A::PRSCH20),
232 21 => Val(IRPRSSEL_A::PRSCH21),
233 22 => Val(IRPRSSEL_A::PRSCH22),
234 23 => Val(IRPRSSEL_A::PRSCH23),
235 i => Res(i),
236 }
237 }
238 #[doc = "Checks if the value of the field is `PRSCH0`"]
239 #[inline(always)]
240 pub fn is_prsch0(&self) -> bool { *self == IRPRSSEL_A::PRSCH0 }
241 #[doc = "Checks if the value of the field is `PRSCH1`"]
242 #[inline(always)]
243 pub fn is_prsch1(&self) -> bool { *self == IRPRSSEL_A::PRSCH1 }
244 #[doc = "Checks if the value of the field is `PRSCH2`"]
245 #[inline(always)]
246 pub fn is_prsch2(&self) -> bool { *self == IRPRSSEL_A::PRSCH2 }
247 #[doc = "Checks if the value of the field is `PRSCH3`"]
248 #[inline(always)]
249 pub fn is_prsch3(&self) -> bool { *self == IRPRSSEL_A::PRSCH3 }
250 #[doc = "Checks if the value of the field is `PRSCH4`"]
251 #[inline(always)]
252 pub fn is_prsch4(&self) -> bool { *self == IRPRSSEL_A::PRSCH4 }
253 #[doc = "Checks if the value of the field is `PRSCH5`"]
254 #[inline(always)]
255 pub fn is_prsch5(&self) -> bool { *self == IRPRSSEL_A::PRSCH5 }
256 #[doc = "Checks if the value of the field is `PRSCH6`"]
257 #[inline(always)]
258 pub fn is_prsch6(&self) -> bool { *self == IRPRSSEL_A::PRSCH6 }
259 #[doc = "Checks if the value of the field is `PRSCH7`"]
260 #[inline(always)]
261 pub fn is_prsch7(&self) -> bool { *self == IRPRSSEL_A::PRSCH7 }
262 #[doc = "Checks if the value of the field is `PRSCH8`"]
263 #[inline(always)]
264 pub fn is_prsch8(&self) -> bool { *self == IRPRSSEL_A::PRSCH8 }
265 #[doc = "Checks if the value of the field is `PRSCH9`"]
266 #[inline(always)]
267 pub fn is_prsch9(&self) -> bool { *self == IRPRSSEL_A::PRSCH9 }
268 #[doc = "Checks if the value of the field is `PRSCH10`"]
269 #[inline(always)]
270 pub fn is_prsch10(&self) -> bool { *self == IRPRSSEL_A::PRSCH10 }
271 #[doc = "Checks if the value of the field is `PRSCH11`"]
272 #[inline(always)]
273 pub fn is_prsch11(&self) -> bool { *self == IRPRSSEL_A::PRSCH11 }
274 #[doc = "Checks if the value of the field is `PRSCH12`"]
275 #[inline(always)]
276 pub fn is_prsch12(&self) -> bool { *self == IRPRSSEL_A::PRSCH12 }
277 #[doc = "Checks if the value of the field is `PRSCH13`"]
278 #[inline(always)]
279 pub fn is_prsch13(&self) -> bool { *self == IRPRSSEL_A::PRSCH13 }
280 #[doc = "Checks if the value of the field is `PRSCH14`"]
281 #[inline(always)]
282 pub fn is_prsch14(&self) -> bool { *self == IRPRSSEL_A::PRSCH14 }
283 #[doc = "Checks if the value of the field is `PRSCH15`"]
284 #[inline(always)]
285 pub fn is_prsch15(&self) -> bool { *self == IRPRSSEL_A::PRSCH15 }
286 #[doc = "Checks if the value of the field is `PRSCH16`"]
287 #[inline(always)]
288 pub fn is_prsch16(&self) -> bool { *self == IRPRSSEL_A::PRSCH16 }
289 #[doc = "Checks if the value of the field is `PRSCH17`"]
290 #[inline(always)]
291 pub fn is_prsch17(&self) -> bool { *self == IRPRSSEL_A::PRSCH17 }
292 #[doc = "Checks if the value of the field is `PRSCH18`"]
293 #[inline(always)]
294 pub fn is_prsch18(&self) -> bool { *self == IRPRSSEL_A::PRSCH18 }
295 #[doc = "Checks if the value of the field is `PRSCH19`"]
296 #[inline(always)]
297 pub fn is_prsch19(&self) -> bool { *self == IRPRSSEL_A::PRSCH19 }
298 #[doc = "Checks if the value of the field is `PRSCH20`"]
299 #[inline(always)]
300 pub fn is_prsch20(&self) -> bool { *self == IRPRSSEL_A::PRSCH20 }
301 #[doc = "Checks if the value of the field is `PRSCH21`"]
302 #[inline(always)]
303 pub fn is_prsch21(&self) -> bool { *self == IRPRSSEL_A::PRSCH21 }
304 #[doc = "Checks if the value of the field is `PRSCH22`"]
305 #[inline(always)]
306 pub fn is_prsch22(&self) -> bool { *self == IRPRSSEL_A::PRSCH22 }
307 #[doc = "Checks if the value of the field is `PRSCH23`"]
308 #[inline(always)]
309 pub fn is_prsch23(&self) -> bool { *self == IRPRSSEL_A::PRSCH23 }
310}
311#[doc = "Write proxy for field `IRPRSSEL`"]
312pub struct IRPRSSEL_W<'a> {
313 w: &'a mut W,
314}
315impl<'a> IRPRSSEL_W<'a> {
316 #[doc = r"Writes `variant` to the field"]
317 #[inline(always)]
318 pub fn variant(self, variant: IRPRSSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } }
319 #[doc = "PRS Channel 0 selected"]
320 #[inline(always)]
321 pub fn prsch0(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH0) }
322 #[doc = "PRS Channel 1 selected"]
323 #[inline(always)]
324 pub fn prsch1(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH1) }
325 #[doc = "PRS Channel 2 selected"]
326 #[inline(always)]
327 pub fn prsch2(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH2) }
328 #[doc = "PRS Channel 3 selected"]
329 #[inline(always)]
330 pub fn prsch3(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH3) }
331 #[doc = "PRS Channel 4 selected"]
332 #[inline(always)]
333 pub fn prsch4(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH4) }
334 #[doc = "PRS Channel 5 selected"]
335 #[inline(always)]
336 pub fn prsch5(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH5) }
337 #[doc = "PRS Channel 6 selected"]
338 #[inline(always)]
339 pub fn prsch6(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH6) }
340 #[doc = "PRS Channel 7 selected"]
341 #[inline(always)]
342 pub fn prsch7(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH7) }
343 #[doc = "PRS Channel 8 selected"]
344 #[inline(always)]
345 pub fn prsch8(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH8) }
346 #[doc = "PRS Channel 9 selected"]
347 #[inline(always)]
348 pub fn prsch9(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH9) }
349 #[doc = "PRS Channel 10 selected"]
350 #[inline(always)]
351 pub fn prsch10(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH10) }
352 #[doc = "PRS Channel 11 selected"]
353 #[inline(always)]
354 pub fn prsch11(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH11) }
355 #[doc = "PRS Channel 12 selected"]
356 #[inline(always)]
357 pub fn prsch12(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH12) }
358 #[doc = "PRS Channel 13 selected"]
359 #[inline(always)]
360 pub fn prsch13(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH13) }
361 #[doc = "PRS Channel 14 selected"]
362 #[inline(always)]
363 pub fn prsch14(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH14) }
364 #[doc = "PRS Channel 15 selected"]
365 #[inline(always)]
366 pub fn prsch15(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH15) }
367 #[doc = "PRS Channel 16 selected"]
368 #[inline(always)]
369 pub fn prsch16(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH16) }
370 #[doc = "PRS Channel 17 selected"]
371 #[inline(always)]
372 pub fn prsch17(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH17) }
373 #[doc = "PRS Channel 18 selected"]
374 #[inline(always)]
375 pub fn prsch18(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH18) }
376 #[doc = "PRS Channel 19 selected"]
377 #[inline(always)]
378 pub fn prsch19(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH19) }
379 #[doc = "PRS Channel 20 selected"]
380 #[inline(always)]
381 pub fn prsch20(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH20) }
382 #[doc = "PRS Channel 21 selected"]
383 #[inline(always)]
384 pub fn prsch21(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH21) }
385 #[doc = "PRS Channel 22 selected"]
386 #[inline(always)]
387 pub fn prsch22(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH22) }
388 #[doc = "PRS Channel 23 selected"]
389 #[inline(always)]
390 pub fn prsch23(self) -> &'a mut W { self.variant(IRPRSSEL_A::PRSCH23) }
391 #[doc = r"Writes raw bits to the field"]
392 #[inline(always)]
393 pub unsafe fn bits(self, value: u8) -> &'a mut W {
394 self.w.bits = (self.w.bits & !(0x1f << 8)) | (((value as u32) & 0x1f) << 8);
395 self.w
396 }
397}
398impl R {
399 #[doc = "Bit 0 - Enable IrDA Module"]
400 #[inline(always)]
401 pub fn iren(&self) -> IREN_R { IREN_R::new((self.bits & 0x01) != 0) }
402 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
403 #[inline(always)]
404 pub fn irpw(&self) -> IRPW_R { IRPW_R::new(((self.bits >> 1) & 0x03) as u8) }
405 #[doc = "Bit 3 - IrDA RX Filter"]
406 #[inline(always)]
407 pub fn irfilt(&self) -> IRFILT_R { IRFILT_R::new(((self.bits >> 3) & 0x01) != 0) }
408 #[doc = "Bit 7 - IrDA PRS Channel Enable"]
409 #[inline(always)]
410 pub fn irprsen(&self) -> IRPRSEN_R { IRPRSEN_R::new(((self.bits >> 7) & 0x01) != 0) }
411 #[doc = "Bits 8:12 - IrDA PRS Channel Select"]
412 #[inline(always)]
413 pub fn irprssel(&self) -> IRPRSSEL_R { IRPRSSEL_R::new(((self.bits >> 8) & 0x1f) as u8) }
414}
415impl W {
416 #[doc = "Bit 0 - Enable IrDA Module"]
417 #[inline(always)]
418 pub fn iren(&mut self) -> IREN_W { IREN_W { w: self } }
419 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
420 #[inline(always)]
421 pub fn irpw(&mut self) -> IRPW_W { IRPW_W { w: self } }
422 #[doc = "Bit 3 - IrDA RX Filter"]
423 #[inline(always)]
424 pub fn irfilt(&mut self) -> IRFILT_W { IRFILT_W { w: self } }
425 #[doc = "Bit 7 - IrDA PRS Channel Enable"]
426 #[inline(always)]
427 pub fn irprsen(&mut self) -> IRPRSEN_W { IRPRSEN_W { w: self } }
428 #[doc = "Bits 8:12 - IrDA PRS Channel Select"]
429 #[inline(always)]
430 pub fn irprssel(&mut self) -> IRPRSSEL_W { IRPRSSEL_W { w: self } }
431}