efm32jg12b_pac/efm32jg12b500/usart0/
irctrl.rs1#[doc = "Register `IRCTRL` reader"]
2pub struct R(crate::R<IRCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<IRCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<IRCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<IRCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `IRCTRL` writer"]
17pub struct W(crate::W<IRCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<IRCTRL_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<IRCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<IRCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `IREN` reader - Enable IrDA Module"]
38pub type IREN_R = crate::BitReader<bool>;
39#[doc = "Field `IREN` writer - Enable IrDA Module"]
40pub type IREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, O>;
41#[doc = "Field `IRPW` reader - IrDA TX Pulse Width"]
42pub type IRPW_R = crate::FieldReader<u8, IRPW_A>;
43#[doc = "IrDA TX Pulse Width\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum IRPW_A {
47 #[doc = "0: IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
48 ONE = 0,
49 #[doc = "1: IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
50 TWO = 1,
51 #[doc = "2: IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
52 THREE = 2,
53 #[doc = "3: IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
54 FOUR = 3,
55}
56impl From<IRPW_A> for u8 {
57 #[inline(always)]
58 fn from(variant: IRPW_A) -> Self {
59 variant as _
60 }
61}
62impl IRPW_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> IRPW_A {
66 match self.bits {
67 0 => IRPW_A::ONE,
68 1 => IRPW_A::TWO,
69 2 => IRPW_A::THREE,
70 3 => IRPW_A::FOUR,
71 _ => unreachable!(),
72 }
73 }
74 #[doc = "Checks if the value of the field is `ONE`"]
75 #[inline(always)]
76 pub fn is_one(&self) -> bool {
77 *self == IRPW_A::ONE
78 }
79 #[doc = "Checks if the value of the field is `TWO`"]
80 #[inline(always)]
81 pub fn is_two(&self) -> bool {
82 *self == IRPW_A::TWO
83 }
84 #[doc = "Checks if the value of the field is `THREE`"]
85 #[inline(always)]
86 pub fn is_three(&self) -> bool {
87 *self == IRPW_A::THREE
88 }
89 #[doc = "Checks if the value of the field is `FOUR`"]
90 #[inline(always)]
91 pub fn is_four(&self) -> bool {
92 *self == IRPW_A::FOUR
93 }
94}
95#[doc = "Field `IRPW` writer - IrDA TX Pulse Width"]
96pub type IRPW_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, IRCTRL_SPEC, u8, IRPW_A, 2, O>;
97impl<'a, const O: u8> IRPW_W<'a, O> {
98 #[doc = "IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
99 #[inline(always)]
100 pub fn one(self) -> &'a mut W {
101 self.variant(IRPW_A::ONE)
102 }
103 #[doc = "IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
104 #[inline(always)]
105 pub fn two(self) -> &'a mut W {
106 self.variant(IRPW_A::TWO)
107 }
108 #[doc = "IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
109 #[inline(always)]
110 pub fn three(self) -> &'a mut W {
111 self.variant(IRPW_A::THREE)
112 }
113 #[doc = "IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
114 #[inline(always)]
115 pub fn four(self) -> &'a mut W {
116 self.variant(IRPW_A::FOUR)
117 }
118}
119#[doc = "Field `IRFILT` reader - IrDA RX Filter"]
120pub type IRFILT_R = crate::BitReader<bool>;
121#[doc = "Field `IRFILT` writer - IrDA RX Filter"]
122pub type IRFILT_W<'a, const O: u8> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, O>;
123#[doc = "Field `IRPRSEN` reader - IrDA PRS Channel Enable"]
124pub type IRPRSEN_R = crate::BitReader<bool>;
125#[doc = "Field `IRPRSEN` writer - IrDA PRS Channel Enable"]
126pub type IRPRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, O>;
127#[doc = "Field `IRPRSSEL` reader - IrDA PRS Channel Select"]
128pub type IRPRSSEL_R = crate::FieldReader<u8, IRPRSSEL_A>;
129#[doc = "IrDA PRS Channel Select\n\nValue on reset: 0"]
130#[derive(Clone, Copy, Debug, PartialEq, Eq)]
131#[repr(u8)]
132pub enum IRPRSSEL_A {
133 #[doc = "0: PRS Channel 0 selected"]
134 PRSCH0 = 0,
135 #[doc = "1: PRS Channel 1 selected"]
136 PRSCH1 = 1,
137 #[doc = "2: PRS Channel 2 selected"]
138 PRSCH2 = 2,
139 #[doc = "3: PRS Channel 3 selected"]
140 PRSCH3 = 3,
141 #[doc = "4: PRS Channel 4 selected"]
142 PRSCH4 = 4,
143 #[doc = "5: PRS Channel 5 selected"]
144 PRSCH5 = 5,
145 #[doc = "6: PRS Channel 6 selected"]
146 PRSCH6 = 6,
147 #[doc = "7: PRS Channel 7 selected"]
148 PRSCH7 = 7,
149 #[doc = "8: PRS Channel 8 selected"]
150 PRSCH8 = 8,
151 #[doc = "9: PRS Channel 9 selected"]
152 PRSCH9 = 9,
153 #[doc = "10: PRS Channel 10 selected"]
154 PRSCH10 = 10,
155 #[doc = "11: PRS Channel 11 selected"]
156 PRSCH11 = 11,
157}
158impl From<IRPRSSEL_A> for u8 {
159 #[inline(always)]
160 fn from(variant: IRPRSSEL_A) -> Self {
161 variant as _
162 }
163}
164impl IRPRSSEL_R {
165 #[doc = "Get enumerated values variant"]
166 #[inline(always)]
167 pub fn variant(&self) -> Option<IRPRSSEL_A> {
168 match self.bits {
169 0 => Some(IRPRSSEL_A::PRSCH0),
170 1 => Some(IRPRSSEL_A::PRSCH1),
171 2 => Some(IRPRSSEL_A::PRSCH2),
172 3 => Some(IRPRSSEL_A::PRSCH3),
173 4 => Some(IRPRSSEL_A::PRSCH4),
174 5 => Some(IRPRSSEL_A::PRSCH5),
175 6 => Some(IRPRSSEL_A::PRSCH6),
176 7 => Some(IRPRSSEL_A::PRSCH7),
177 8 => Some(IRPRSSEL_A::PRSCH8),
178 9 => Some(IRPRSSEL_A::PRSCH9),
179 10 => Some(IRPRSSEL_A::PRSCH10),
180 11 => Some(IRPRSSEL_A::PRSCH11),
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 == IRPRSSEL_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 == IRPRSSEL_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 == IRPRSSEL_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 == IRPRSSEL_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 == IRPRSSEL_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 == IRPRSSEL_A::PRSCH5
213 }
214 #[doc = "Checks if the value of the field is `PRSCH6`"]
215 #[inline(always)]
216 pub fn is_prsch6(&self) -> bool {
217 *self == IRPRSSEL_A::PRSCH6
218 }
219 #[doc = "Checks if the value of the field is `PRSCH7`"]
220 #[inline(always)]
221 pub fn is_prsch7(&self) -> bool {
222 *self == IRPRSSEL_A::PRSCH7
223 }
224 #[doc = "Checks if the value of the field is `PRSCH8`"]
225 #[inline(always)]
226 pub fn is_prsch8(&self) -> bool {
227 *self == IRPRSSEL_A::PRSCH8
228 }
229 #[doc = "Checks if the value of the field is `PRSCH9`"]
230 #[inline(always)]
231 pub fn is_prsch9(&self) -> bool {
232 *self == IRPRSSEL_A::PRSCH9
233 }
234 #[doc = "Checks if the value of the field is `PRSCH10`"]
235 #[inline(always)]
236 pub fn is_prsch10(&self) -> bool {
237 *self == IRPRSSEL_A::PRSCH10
238 }
239 #[doc = "Checks if the value of the field is `PRSCH11`"]
240 #[inline(always)]
241 pub fn is_prsch11(&self) -> bool {
242 *self == IRPRSSEL_A::PRSCH11
243 }
244}
245#[doc = "Field `IRPRSSEL` writer - IrDA PRS Channel Select"]
246pub type IRPRSSEL_W<'a, const O: u8> =
247 crate::FieldWriter<'a, u32, IRCTRL_SPEC, u8, IRPRSSEL_A, 4, O>;
248impl<'a, const O: u8> IRPRSSEL_W<'a, O> {
249 #[doc = "PRS Channel 0 selected"]
250 #[inline(always)]
251 pub fn prsch0(self) -> &'a mut W {
252 self.variant(IRPRSSEL_A::PRSCH0)
253 }
254 #[doc = "PRS Channel 1 selected"]
255 #[inline(always)]
256 pub fn prsch1(self) -> &'a mut W {
257 self.variant(IRPRSSEL_A::PRSCH1)
258 }
259 #[doc = "PRS Channel 2 selected"]
260 #[inline(always)]
261 pub fn prsch2(self) -> &'a mut W {
262 self.variant(IRPRSSEL_A::PRSCH2)
263 }
264 #[doc = "PRS Channel 3 selected"]
265 #[inline(always)]
266 pub fn prsch3(self) -> &'a mut W {
267 self.variant(IRPRSSEL_A::PRSCH3)
268 }
269 #[doc = "PRS Channel 4 selected"]
270 #[inline(always)]
271 pub fn prsch4(self) -> &'a mut W {
272 self.variant(IRPRSSEL_A::PRSCH4)
273 }
274 #[doc = "PRS Channel 5 selected"]
275 #[inline(always)]
276 pub fn prsch5(self) -> &'a mut W {
277 self.variant(IRPRSSEL_A::PRSCH5)
278 }
279 #[doc = "PRS Channel 6 selected"]
280 #[inline(always)]
281 pub fn prsch6(self) -> &'a mut W {
282 self.variant(IRPRSSEL_A::PRSCH6)
283 }
284 #[doc = "PRS Channel 7 selected"]
285 #[inline(always)]
286 pub fn prsch7(self) -> &'a mut W {
287 self.variant(IRPRSSEL_A::PRSCH7)
288 }
289 #[doc = "PRS Channel 8 selected"]
290 #[inline(always)]
291 pub fn prsch8(self) -> &'a mut W {
292 self.variant(IRPRSSEL_A::PRSCH8)
293 }
294 #[doc = "PRS Channel 9 selected"]
295 #[inline(always)]
296 pub fn prsch9(self) -> &'a mut W {
297 self.variant(IRPRSSEL_A::PRSCH9)
298 }
299 #[doc = "PRS Channel 10 selected"]
300 #[inline(always)]
301 pub fn prsch10(self) -> &'a mut W {
302 self.variant(IRPRSSEL_A::PRSCH10)
303 }
304 #[doc = "PRS Channel 11 selected"]
305 #[inline(always)]
306 pub fn prsch11(self) -> &'a mut W {
307 self.variant(IRPRSSEL_A::PRSCH11)
308 }
309}
310impl R {
311 #[doc = "Bit 0 - Enable IrDA Module"]
312 #[inline(always)]
313 pub fn iren(&self) -> IREN_R {
314 IREN_R::new((self.bits & 1) != 0)
315 }
316 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
317 #[inline(always)]
318 pub fn irpw(&self) -> IRPW_R {
319 IRPW_R::new(((self.bits >> 1) & 3) as u8)
320 }
321 #[doc = "Bit 3 - IrDA RX Filter"]
322 #[inline(always)]
323 pub fn irfilt(&self) -> IRFILT_R {
324 IRFILT_R::new(((self.bits >> 3) & 1) != 0)
325 }
326 #[doc = "Bit 7 - IrDA PRS Channel Enable"]
327 #[inline(always)]
328 pub fn irprsen(&self) -> IRPRSEN_R {
329 IRPRSEN_R::new(((self.bits >> 7) & 1) != 0)
330 }
331 #[doc = "Bits 8:11 - IrDA PRS Channel Select"]
332 #[inline(always)]
333 pub fn irprssel(&self) -> IRPRSSEL_R {
334 IRPRSSEL_R::new(((self.bits >> 8) & 0x0f) as u8)
335 }
336}
337impl W {
338 #[doc = "Bit 0 - Enable IrDA Module"]
339 #[inline(always)]
340 #[must_use]
341 pub fn iren(&mut self) -> IREN_W<0> {
342 IREN_W::new(self)
343 }
344 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
345 #[inline(always)]
346 #[must_use]
347 pub fn irpw(&mut self) -> IRPW_W<1> {
348 IRPW_W::new(self)
349 }
350 #[doc = "Bit 3 - IrDA RX Filter"]
351 #[inline(always)]
352 #[must_use]
353 pub fn irfilt(&mut self) -> IRFILT_W<3> {
354 IRFILT_W::new(self)
355 }
356 #[doc = "Bit 7 - IrDA PRS Channel Enable"]
357 #[inline(always)]
358 #[must_use]
359 pub fn irprsen(&mut self) -> IRPRSEN_W<7> {
360 IRPRSEN_W::new(self)
361 }
362 #[doc = "Bits 8:11 - IrDA PRS Channel Select"]
363 #[inline(always)]
364 #[must_use]
365 pub fn irprssel(&mut self) -> IRPRSSEL_W<8> {
366 IRPRSSEL_W::new(self)
367 }
368 #[doc = "Writes raw bits to the register."]
369 #[inline(always)]
370 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
371 self.0.bits(bits);
372 self
373 }
374}
375#[doc = "IrDA Control 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 [irctrl](index.html) module"]
376pub struct IRCTRL_SPEC;
377impl crate::RegisterSpec for IRCTRL_SPEC {
378 type Ux = u32;
379}
380#[doc = "`read()` method returns [irctrl::R](R) reader structure"]
381impl crate::Readable for IRCTRL_SPEC {
382 type Reader = R;
383}
384#[doc = "`write(|w| ..)` method takes [irctrl::W](W) writer structure"]
385impl crate::Writable for IRCTRL_SPEC {
386 type Writer = W;
387 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
388 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
389}
390#[doc = "`reset()` method sets IRCTRL to value 0"]
391impl crate::Resettable for IRCTRL_SPEC {
392 const RESET_VALUE: Self::Ux = 0;
393}