efm32pg12_pac/usart0/
trigctrl.rs

1#[doc = "Reader of register TRIGCTRL"]
2pub type R = crate::R<u32, super::TRIGCTRL>;
3#[doc = "Writer for register TRIGCTRL"]
4pub type W = crate::W<u32, super::TRIGCTRL>;
5#[doc = "Register TRIGCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::TRIGCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `RXTEN`"]
14pub type RXTEN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `RXTEN`"]
16pub struct RXTEN_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RXTEN_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
34        self.w
35    }
36}
37#[doc = "Reader of field `TXTEN`"]
38pub type TXTEN_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `TXTEN`"]
40pub struct TXTEN_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> TXTEN_W<'a> {
44    #[doc = r"Sets the field bit"]
45    #[inline(always)]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r"Clears the field bit"]
50    #[inline(always)]
51    pub fn clear_bit(self) -> &'a mut W {
52        self.bit(false)
53    }
54    #[doc = r"Writes raw bits to the field"]
55    #[inline(always)]
56    pub fn bit(self, value: bool) -> &'a mut W {
57        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
58        self.w
59    }
60}
61#[doc = "Reader of field `AUTOTXTEN`"]
62pub type AUTOTXTEN_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `AUTOTXTEN`"]
64pub struct AUTOTXTEN_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> AUTOTXTEN_W<'a> {
68    #[doc = r"Sets the field bit"]
69    #[inline(always)]
70    pub fn set_bit(self) -> &'a mut W {
71        self.bit(true)
72    }
73    #[doc = r"Clears the field bit"]
74    #[inline(always)]
75    pub fn clear_bit(self) -> &'a mut W {
76        self.bit(false)
77    }
78    #[doc = r"Writes raw bits to the field"]
79    #[inline(always)]
80    pub fn bit(self, value: bool) -> &'a mut W {
81        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
82        self.w
83    }
84}
85#[doc = "Reader of field `TXARX0EN`"]
86pub type TXARX0EN_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `TXARX0EN`"]
88pub struct TXARX0EN_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> TXARX0EN_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
106        self.w
107    }
108}
109#[doc = "Reader of field `TXARX1EN`"]
110pub type TXARX1EN_R = crate::R<bool, bool>;
111#[doc = "Write proxy for field `TXARX1EN`"]
112pub struct TXARX1EN_W<'a> {
113    w: &'a mut W,
114}
115impl<'a> TXARX1EN_W<'a> {
116    #[doc = r"Sets the field bit"]
117    #[inline(always)]
118    pub fn set_bit(self) -> &'a mut W {
119        self.bit(true)
120    }
121    #[doc = r"Clears the field bit"]
122    #[inline(always)]
123    pub fn clear_bit(self) -> &'a mut W {
124        self.bit(false)
125    }
126    #[doc = r"Writes raw bits to the field"]
127    #[inline(always)]
128    pub fn bit(self, value: bool) -> &'a mut W {
129        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
130        self.w
131    }
132}
133#[doc = "Reader of field `TXARX2EN`"]
134pub type TXARX2EN_R = crate::R<bool, bool>;
135#[doc = "Write proxy for field `TXARX2EN`"]
136pub struct TXARX2EN_W<'a> {
137    w: &'a mut W,
138}
139impl<'a> TXARX2EN_W<'a> {
140    #[doc = r"Sets the field bit"]
141    #[inline(always)]
142    pub fn set_bit(self) -> &'a mut W {
143        self.bit(true)
144    }
145    #[doc = r"Clears the field bit"]
146    #[inline(always)]
147    pub fn clear_bit(self) -> &'a mut W {
148        self.bit(false)
149    }
150    #[doc = r"Writes raw bits to the field"]
151    #[inline(always)]
152    pub fn bit(self, value: bool) -> &'a mut W {
153        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
154        self.w
155    }
156}
157#[doc = "Reader of field `RXATX0EN`"]
158pub type RXATX0EN_R = crate::R<bool, bool>;
159#[doc = "Write proxy for field `RXATX0EN`"]
160pub struct RXATX0EN_W<'a> {
161    w: &'a mut W,
162}
163impl<'a> RXATX0EN_W<'a> {
164    #[doc = r"Sets the field bit"]
165    #[inline(always)]
166    pub fn set_bit(self) -> &'a mut W {
167        self.bit(true)
168    }
169    #[doc = r"Clears the field bit"]
170    #[inline(always)]
171    pub fn clear_bit(self) -> &'a mut W {
172        self.bit(false)
173    }
174    #[doc = r"Writes raw bits to the field"]
175    #[inline(always)]
176    pub fn bit(self, value: bool) -> &'a mut W {
177        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
178        self.w
179    }
180}
181#[doc = "Reader of field `RXATX1EN`"]
182pub type RXATX1EN_R = crate::R<bool, bool>;
183#[doc = "Write proxy for field `RXATX1EN`"]
184pub struct RXATX1EN_W<'a> {
185    w: &'a mut W,
186}
187impl<'a> RXATX1EN_W<'a> {
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
202        self.w
203    }
204}
205#[doc = "Reader of field `RXATX2EN`"]
206pub type RXATX2EN_R = crate::R<bool, bool>;
207#[doc = "Write proxy for field `RXATX2EN`"]
208pub struct RXATX2EN_W<'a> {
209    w: &'a mut W,
210}
211impl<'a> RXATX2EN_W<'a> {
212    #[doc = r"Sets the field bit"]
213    #[inline(always)]
214    pub fn set_bit(self) -> &'a mut W {
215        self.bit(true)
216    }
217    #[doc = r"Clears the field bit"]
218    #[inline(always)]
219    pub fn clear_bit(self) -> &'a mut W {
220        self.bit(false)
221    }
222    #[doc = r"Writes raw bits to the field"]
223    #[inline(always)]
224    pub fn bit(self, value: bool) -> &'a mut W {
225        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
226        self.w
227    }
228}
229#[doc = "Trigger PRS Channel Select\n\nValue on reset: 0"]
230#[derive(Clone, Copy, Debug, PartialEq)]
231#[repr(u8)]
232pub enum TSEL_A {
233    #[doc = "0: PRS Channel 0 selected"]
234    PRSCH0 = 0,
235    #[doc = "1: PRS Channel 1 selected"]
236    PRSCH1 = 1,
237    #[doc = "2: PRS Channel 2 selected"]
238    PRSCH2 = 2,
239    #[doc = "3: PRS Channel 3 selected"]
240    PRSCH3 = 3,
241    #[doc = "4: PRS Channel 4 selected"]
242    PRSCH4 = 4,
243    #[doc = "5: PRS Channel 5 selected"]
244    PRSCH5 = 5,
245    #[doc = "6: PRS Channel 6 selected"]
246    PRSCH6 = 6,
247    #[doc = "7: PRS Channel 7 selected"]
248    PRSCH7 = 7,
249    #[doc = "8: PRS Channel 8 selected"]
250    PRSCH8 = 8,
251    #[doc = "9: PRS Channel 9 selected"]
252    PRSCH9 = 9,
253    #[doc = "10: PRS Channel 10 selected"]
254    PRSCH10 = 10,
255    #[doc = "11: PRS Channel 11 selected"]
256    PRSCH11 = 11,
257}
258impl From<TSEL_A> for u8 {
259    #[inline(always)]
260    fn from(variant: TSEL_A) -> Self {
261        variant as _
262    }
263}
264#[doc = "Reader of field `TSEL`"]
265pub type TSEL_R = crate::R<u8, TSEL_A>;
266impl TSEL_R {
267    #[doc = r"Get enumerated values variant"]
268    #[inline(always)]
269    pub fn variant(&self) -> crate::Variant<u8, TSEL_A> {
270        use crate::Variant::*;
271        match self.bits {
272            0 => Val(TSEL_A::PRSCH0),
273            1 => Val(TSEL_A::PRSCH1),
274            2 => Val(TSEL_A::PRSCH2),
275            3 => Val(TSEL_A::PRSCH3),
276            4 => Val(TSEL_A::PRSCH4),
277            5 => Val(TSEL_A::PRSCH5),
278            6 => Val(TSEL_A::PRSCH6),
279            7 => Val(TSEL_A::PRSCH7),
280            8 => Val(TSEL_A::PRSCH8),
281            9 => Val(TSEL_A::PRSCH9),
282            10 => Val(TSEL_A::PRSCH10),
283            11 => Val(TSEL_A::PRSCH11),
284            i => Res(i),
285        }
286    }
287    #[doc = "Checks if the value of the field is `PRSCH0`"]
288    #[inline(always)]
289    pub fn is_prsch0(&self) -> bool {
290        *self == TSEL_A::PRSCH0
291    }
292    #[doc = "Checks if the value of the field is `PRSCH1`"]
293    #[inline(always)]
294    pub fn is_prsch1(&self) -> bool {
295        *self == TSEL_A::PRSCH1
296    }
297    #[doc = "Checks if the value of the field is `PRSCH2`"]
298    #[inline(always)]
299    pub fn is_prsch2(&self) -> bool {
300        *self == TSEL_A::PRSCH2
301    }
302    #[doc = "Checks if the value of the field is `PRSCH3`"]
303    #[inline(always)]
304    pub fn is_prsch3(&self) -> bool {
305        *self == TSEL_A::PRSCH3
306    }
307    #[doc = "Checks if the value of the field is `PRSCH4`"]
308    #[inline(always)]
309    pub fn is_prsch4(&self) -> bool {
310        *self == TSEL_A::PRSCH4
311    }
312    #[doc = "Checks if the value of the field is `PRSCH5`"]
313    #[inline(always)]
314    pub fn is_prsch5(&self) -> bool {
315        *self == TSEL_A::PRSCH5
316    }
317    #[doc = "Checks if the value of the field is `PRSCH6`"]
318    #[inline(always)]
319    pub fn is_prsch6(&self) -> bool {
320        *self == TSEL_A::PRSCH6
321    }
322    #[doc = "Checks if the value of the field is `PRSCH7`"]
323    #[inline(always)]
324    pub fn is_prsch7(&self) -> bool {
325        *self == TSEL_A::PRSCH7
326    }
327    #[doc = "Checks if the value of the field is `PRSCH8`"]
328    #[inline(always)]
329    pub fn is_prsch8(&self) -> bool {
330        *self == TSEL_A::PRSCH8
331    }
332    #[doc = "Checks if the value of the field is `PRSCH9`"]
333    #[inline(always)]
334    pub fn is_prsch9(&self) -> bool {
335        *self == TSEL_A::PRSCH9
336    }
337    #[doc = "Checks if the value of the field is `PRSCH10`"]
338    #[inline(always)]
339    pub fn is_prsch10(&self) -> bool {
340        *self == TSEL_A::PRSCH10
341    }
342    #[doc = "Checks if the value of the field is `PRSCH11`"]
343    #[inline(always)]
344    pub fn is_prsch11(&self) -> bool {
345        *self == TSEL_A::PRSCH11
346    }
347}
348#[doc = "Write proxy for field `TSEL`"]
349pub struct TSEL_W<'a> {
350    w: &'a mut W,
351}
352impl<'a> TSEL_W<'a> {
353    #[doc = r"Writes `variant` to the field"]
354    #[inline(always)]
355    pub fn variant(self, variant: TSEL_A) -> &'a mut W {
356        unsafe { self.bits(variant.into()) }
357    }
358    #[doc = "PRS Channel 0 selected"]
359    #[inline(always)]
360    pub fn prsch0(self) -> &'a mut W {
361        self.variant(TSEL_A::PRSCH0)
362    }
363    #[doc = "PRS Channel 1 selected"]
364    #[inline(always)]
365    pub fn prsch1(self) -> &'a mut W {
366        self.variant(TSEL_A::PRSCH1)
367    }
368    #[doc = "PRS Channel 2 selected"]
369    #[inline(always)]
370    pub fn prsch2(self) -> &'a mut W {
371        self.variant(TSEL_A::PRSCH2)
372    }
373    #[doc = "PRS Channel 3 selected"]
374    #[inline(always)]
375    pub fn prsch3(self) -> &'a mut W {
376        self.variant(TSEL_A::PRSCH3)
377    }
378    #[doc = "PRS Channel 4 selected"]
379    #[inline(always)]
380    pub fn prsch4(self) -> &'a mut W {
381        self.variant(TSEL_A::PRSCH4)
382    }
383    #[doc = "PRS Channel 5 selected"]
384    #[inline(always)]
385    pub fn prsch5(self) -> &'a mut W {
386        self.variant(TSEL_A::PRSCH5)
387    }
388    #[doc = "PRS Channel 6 selected"]
389    #[inline(always)]
390    pub fn prsch6(self) -> &'a mut W {
391        self.variant(TSEL_A::PRSCH6)
392    }
393    #[doc = "PRS Channel 7 selected"]
394    #[inline(always)]
395    pub fn prsch7(self) -> &'a mut W {
396        self.variant(TSEL_A::PRSCH7)
397    }
398    #[doc = "PRS Channel 8 selected"]
399    #[inline(always)]
400    pub fn prsch8(self) -> &'a mut W {
401        self.variant(TSEL_A::PRSCH8)
402    }
403    #[doc = "PRS Channel 9 selected"]
404    #[inline(always)]
405    pub fn prsch9(self) -> &'a mut W {
406        self.variant(TSEL_A::PRSCH9)
407    }
408    #[doc = "PRS Channel 10 selected"]
409    #[inline(always)]
410    pub fn prsch10(self) -> &'a mut W {
411        self.variant(TSEL_A::PRSCH10)
412    }
413    #[doc = "PRS Channel 11 selected"]
414    #[inline(always)]
415    pub fn prsch11(self) -> &'a mut W {
416        self.variant(TSEL_A::PRSCH11)
417    }
418    #[doc = r"Writes raw bits to the field"]
419    #[inline(always)]
420    pub unsafe fn bits(self, value: u8) -> &'a mut W {
421        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
422        self.w
423    }
424}
425impl R {
426    #[doc = "Bit 4 - Receive Trigger Enable"]
427    #[inline(always)]
428    pub fn rxten(&self) -> RXTEN_R {
429        RXTEN_R::new(((self.bits >> 4) & 0x01) != 0)
430    }
431    #[doc = "Bit 5 - Transmit Trigger Enable"]
432    #[inline(always)]
433    pub fn txten(&self) -> TXTEN_R {
434        TXTEN_R::new(((self.bits >> 5) & 0x01) != 0)
435    }
436    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
437    #[inline(always)]
438    pub fn autotxten(&self) -> AUTOTXTEN_R {
439        AUTOTXTEN_R::new(((self.bits >> 6) & 0x01) != 0)
440    }
441    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
442    #[inline(always)]
443    pub fn txarx0en(&self) -> TXARX0EN_R {
444        TXARX0EN_R::new(((self.bits >> 7) & 0x01) != 0)
445    }
446    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
447    #[inline(always)]
448    pub fn txarx1en(&self) -> TXARX1EN_R {
449        TXARX1EN_R::new(((self.bits >> 8) & 0x01) != 0)
450    }
451    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
452    #[inline(always)]
453    pub fn txarx2en(&self) -> TXARX2EN_R {
454        TXARX2EN_R::new(((self.bits >> 9) & 0x01) != 0)
455    }
456    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
457    #[inline(always)]
458    pub fn rxatx0en(&self) -> RXATX0EN_R {
459        RXATX0EN_R::new(((self.bits >> 10) & 0x01) != 0)
460    }
461    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
462    #[inline(always)]
463    pub fn rxatx1en(&self) -> RXATX1EN_R {
464        RXATX1EN_R::new(((self.bits >> 11) & 0x01) != 0)
465    }
466    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
467    #[inline(always)]
468    pub fn rxatx2en(&self) -> RXATX2EN_R {
469        RXATX2EN_R::new(((self.bits >> 12) & 0x01) != 0)
470    }
471    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
472    #[inline(always)]
473    pub fn tsel(&self) -> TSEL_R {
474        TSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
475    }
476}
477impl W {
478    #[doc = "Bit 4 - Receive Trigger Enable"]
479    #[inline(always)]
480    pub fn rxten(&mut self) -> RXTEN_W {
481        RXTEN_W { w: self }
482    }
483    #[doc = "Bit 5 - Transmit Trigger Enable"]
484    #[inline(always)]
485    pub fn txten(&mut self) -> TXTEN_W {
486        TXTEN_W { w: self }
487    }
488    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
489    #[inline(always)]
490    pub fn autotxten(&mut self) -> AUTOTXTEN_W {
491        AUTOTXTEN_W { w: self }
492    }
493    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
494    #[inline(always)]
495    pub fn txarx0en(&mut self) -> TXARX0EN_W {
496        TXARX0EN_W { w: self }
497    }
498    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
499    #[inline(always)]
500    pub fn txarx1en(&mut self) -> TXARX1EN_W {
501        TXARX1EN_W { w: self }
502    }
503    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
504    #[inline(always)]
505    pub fn txarx2en(&mut self) -> TXARX2EN_W {
506        TXARX2EN_W { w: self }
507    }
508    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
509    #[inline(always)]
510    pub fn rxatx0en(&mut self) -> RXATX0EN_W {
511        RXATX0EN_W { w: self }
512    }
513    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
514    #[inline(always)]
515    pub fn rxatx1en(&mut self) -> RXATX1EN_W {
516        RXATX1EN_W { w: self }
517    }
518    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
519    #[inline(always)]
520    pub fn rxatx2en(&mut self) -> RXATX2EN_W {
521        RXATX2EN_W { w: self }
522    }
523    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
524    #[inline(always)]
525    pub fn tsel(&mut self) -> TSEL_W {
526        TSEL_W { w: self }
527    }
528}