efm32gg12b110_pac/uart1/
trigctrl.rs

1#[doc = "Register `TRIGCTRL` reader"]
2pub struct R(crate::R<TRIGCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TRIGCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TRIGCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TRIGCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TRIGCTRL` writer"]
17pub struct W(crate::W<TRIGCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TRIGCTRL_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<TRIGCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TRIGCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RXTEN` reader - Receive Trigger Enable"]
38pub type RXTEN_R = crate::BitReader<bool>;
39#[doc = "Field `RXTEN` writer - Receive Trigger Enable"]
40pub type RXTEN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 4>;
41#[doc = "Field `TXTEN` reader - Transmit Trigger Enable"]
42pub type TXTEN_R = crate::BitReader<bool>;
43#[doc = "Field `TXTEN` writer - Transmit Trigger Enable"]
44pub type TXTEN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 5>;
45#[doc = "Field `AUTOTXTEN` reader - AUTOTX Trigger Enable"]
46pub type AUTOTXTEN_R = crate::BitReader<bool>;
47#[doc = "Field `AUTOTXTEN` writer - AUTOTX Trigger Enable"]
48pub type AUTOTXTEN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 6>;
49#[doc = "Field `TXARX0EN` reader - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
50pub type TXARX0EN_R = crate::BitReader<bool>;
51#[doc = "Field `TXARX0EN` writer - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
52pub type TXARX0EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 7>;
53#[doc = "Field `TXARX1EN` reader - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
54pub type TXARX1EN_R = crate::BitReader<bool>;
55#[doc = "Field `TXARX1EN` writer - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
56pub type TXARX1EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 8>;
57#[doc = "Field `TXARX2EN` reader - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
58pub type TXARX2EN_R = crate::BitReader<bool>;
59#[doc = "Field `TXARX2EN` writer - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
60pub type TXARX2EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 9>;
61#[doc = "Field `RXATX0EN` reader - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
62pub type RXATX0EN_R = crate::BitReader<bool>;
63#[doc = "Field `RXATX0EN` writer - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
64pub type RXATX0EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 10>;
65#[doc = "Field `RXATX1EN` reader - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
66pub type RXATX1EN_R = crate::BitReader<bool>;
67#[doc = "Field `RXATX1EN` writer - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
68pub type RXATX1EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 11>;
69#[doc = "Field `RXATX2EN` reader - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
70pub type RXATX2EN_R = crate::BitReader<bool>;
71#[doc = "Field `RXATX2EN` writer - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
72pub type RXATX2EN_W<'a> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, 12>;
73#[doc = "Trigger PRS Channel Select\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75#[repr(u8)]
76pub enum TSEL_A {
77    #[doc = "0: PRS Channel 0 selected"]
78    PRSCH0 = 0,
79    #[doc = "1: PRS Channel 1 selected"]
80    PRSCH1 = 1,
81    #[doc = "2: PRS Channel 2 selected"]
82    PRSCH2 = 2,
83    #[doc = "3: PRS Channel 3 selected"]
84    PRSCH3 = 3,
85    #[doc = "4: PRS Channel 4 selected"]
86    PRSCH4 = 4,
87    #[doc = "5: PRS Channel 5 selected"]
88    PRSCH5 = 5,
89    #[doc = "6: PRS Channel 6 selected"]
90    PRSCH6 = 6,
91    #[doc = "7: PRS Channel 7 selected"]
92    PRSCH7 = 7,
93    #[doc = "8: PRS Channel 8 selected"]
94    PRSCH8 = 8,
95    #[doc = "9: PRS Channel 9 selected"]
96    PRSCH9 = 9,
97    #[doc = "10: PRS Channel 10 selected"]
98    PRSCH10 = 10,
99    #[doc = "11: PRS Channel 11 selected"]
100    PRSCH11 = 11,
101    #[doc = "12: PRS Channel 12 selected"]
102    PRSCH12 = 12,
103    #[doc = "13: PRS Channel 13 selected"]
104    PRSCH13 = 13,
105    #[doc = "14: PRS Channel 14 selected"]
106    PRSCH14 = 14,
107    #[doc = "15: PRS Channel 15 selected"]
108    PRSCH15 = 15,
109}
110impl From<TSEL_A> for u8 {
111    #[inline(always)]
112    fn from(variant: TSEL_A) -> Self {
113        variant as _
114    }
115}
116#[doc = "Field `TSEL` reader - Trigger PRS Channel Select"]
117pub type TSEL_R = crate::FieldReader<u8, TSEL_A>;
118impl TSEL_R {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub fn variant(&self) -> TSEL_A {
122        match self.bits {
123            0 => TSEL_A::PRSCH0,
124            1 => TSEL_A::PRSCH1,
125            2 => TSEL_A::PRSCH2,
126            3 => TSEL_A::PRSCH3,
127            4 => TSEL_A::PRSCH4,
128            5 => TSEL_A::PRSCH5,
129            6 => TSEL_A::PRSCH6,
130            7 => TSEL_A::PRSCH7,
131            8 => TSEL_A::PRSCH8,
132            9 => TSEL_A::PRSCH9,
133            10 => TSEL_A::PRSCH10,
134            11 => TSEL_A::PRSCH11,
135            12 => TSEL_A::PRSCH12,
136            13 => TSEL_A::PRSCH13,
137            14 => TSEL_A::PRSCH14,
138            15 => TSEL_A::PRSCH15,
139            _ => unreachable!(),
140        }
141    }
142    #[doc = "Checks if the value of the field is `PRSCH0`"]
143    #[inline(always)]
144    pub fn is_prsch0(&self) -> bool {
145        *self == TSEL_A::PRSCH0
146    }
147    #[doc = "Checks if the value of the field is `PRSCH1`"]
148    #[inline(always)]
149    pub fn is_prsch1(&self) -> bool {
150        *self == TSEL_A::PRSCH1
151    }
152    #[doc = "Checks if the value of the field is `PRSCH2`"]
153    #[inline(always)]
154    pub fn is_prsch2(&self) -> bool {
155        *self == TSEL_A::PRSCH2
156    }
157    #[doc = "Checks if the value of the field is `PRSCH3`"]
158    #[inline(always)]
159    pub fn is_prsch3(&self) -> bool {
160        *self == TSEL_A::PRSCH3
161    }
162    #[doc = "Checks if the value of the field is `PRSCH4`"]
163    #[inline(always)]
164    pub fn is_prsch4(&self) -> bool {
165        *self == TSEL_A::PRSCH4
166    }
167    #[doc = "Checks if the value of the field is `PRSCH5`"]
168    #[inline(always)]
169    pub fn is_prsch5(&self) -> bool {
170        *self == TSEL_A::PRSCH5
171    }
172    #[doc = "Checks if the value of the field is `PRSCH6`"]
173    #[inline(always)]
174    pub fn is_prsch6(&self) -> bool {
175        *self == TSEL_A::PRSCH6
176    }
177    #[doc = "Checks if the value of the field is `PRSCH7`"]
178    #[inline(always)]
179    pub fn is_prsch7(&self) -> bool {
180        *self == TSEL_A::PRSCH7
181    }
182    #[doc = "Checks if the value of the field is `PRSCH8`"]
183    #[inline(always)]
184    pub fn is_prsch8(&self) -> bool {
185        *self == TSEL_A::PRSCH8
186    }
187    #[doc = "Checks if the value of the field is `PRSCH9`"]
188    #[inline(always)]
189    pub fn is_prsch9(&self) -> bool {
190        *self == TSEL_A::PRSCH9
191    }
192    #[doc = "Checks if the value of the field is `PRSCH10`"]
193    #[inline(always)]
194    pub fn is_prsch10(&self) -> bool {
195        *self == TSEL_A::PRSCH10
196    }
197    #[doc = "Checks if the value of the field is `PRSCH11`"]
198    #[inline(always)]
199    pub fn is_prsch11(&self) -> bool {
200        *self == TSEL_A::PRSCH11
201    }
202    #[doc = "Checks if the value of the field is `PRSCH12`"]
203    #[inline(always)]
204    pub fn is_prsch12(&self) -> bool {
205        *self == TSEL_A::PRSCH12
206    }
207    #[doc = "Checks if the value of the field is `PRSCH13`"]
208    #[inline(always)]
209    pub fn is_prsch13(&self) -> bool {
210        *self == TSEL_A::PRSCH13
211    }
212    #[doc = "Checks if the value of the field is `PRSCH14`"]
213    #[inline(always)]
214    pub fn is_prsch14(&self) -> bool {
215        *self == TSEL_A::PRSCH14
216    }
217    #[doc = "Checks if the value of the field is `PRSCH15`"]
218    #[inline(always)]
219    pub fn is_prsch15(&self) -> bool {
220        *self == TSEL_A::PRSCH15
221    }
222}
223#[doc = "Field `TSEL` writer - Trigger PRS Channel Select"]
224pub type TSEL_W<'a> = crate::FieldWriterSafe<'a, u32, TRIGCTRL_SPEC, u8, TSEL_A, 4, 16>;
225impl<'a> TSEL_W<'a> {
226    #[doc = "PRS Channel 0 selected"]
227    #[inline(always)]
228    pub fn prsch0(self) -> &'a mut W {
229        self.variant(TSEL_A::PRSCH0)
230    }
231    #[doc = "PRS Channel 1 selected"]
232    #[inline(always)]
233    pub fn prsch1(self) -> &'a mut W {
234        self.variant(TSEL_A::PRSCH1)
235    }
236    #[doc = "PRS Channel 2 selected"]
237    #[inline(always)]
238    pub fn prsch2(self) -> &'a mut W {
239        self.variant(TSEL_A::PRSCH2)
240    }
241    #[doc = "PRS Channel 3 selected"]
242    #[inline(always)]
243    pub fn prsch3(self) -> &'a mut W {
244        self.variant(TSEL_A::PRSCH3)
245    }
246    #[doc = "PRS Channel 4 selected"]
247    #[inline(always)]
248    pub fn prsch4(self) -> &'a mut W {
249        self.variant(TSEL_A::PRSCH4)
250    }
251    #[doc = "PRS Channel 5 selected"]
252    #[inline(always)]
253    pub fn prsch5(self) -> &'a mut W {
254        self.variant(TSEL_A::PRSCH5)
255    }
256    #[doc = "PRS Channel 6 selected"]
257    #[inline(always)]
258    pub fn prsch6(self) -> &'a mut W {
259        self.variant(TSEL_A::PRSCH6)
260    }
261    #[doc = "PRS Channel 7 selected"]
262    #[inline(always)]
263    pub fn prsch7(self) -> &'a mut W {
264        self.variant(TSEL_A::PRSCH7)
265    }
266    #[doc = "PRS Channel 8 selected"]
267    #[inline(always)]
268    pub fn prsch8(self) -> &'a mut W {
269        self.variant(TSEL_A::PRSCH8)
270    }
271    #[doc = "PRS Channel 9 selected"]
272    #[inline(always)]
273    pub fn prsch9(self) -> &'a mut W {
274        self.variant(TSEL_A::PRSCH9)
275    }
276    #[doc = "PRS Channel 10 selected"]
277    #[inline(always)]
278    pub fn prsch10(self) -> &'a mut W {
279        self.variant(TSEL_A::PRSCH10)
280    }
281    #[doc = "PRS Channel 11 selected"]
282    #[inline(always)]
283    pub fn prsch11(self) -> &'a mut W {
284        self.variant(TSEL_A::PRSCH11)
285    }
286    #[doc = "PRS Channel 12 selected"]
287    #[inline(always)]
288    pub fn prsch12(self) -> &'a mut W {
289        self.variant(TSEL_A::PRSCH12)
290    }
291    #[doc = "PRS Channel 13 selected"]
292    #[inline(always)]
293    pub fn prsch13(self) -> &'a mut W {
294        self.variant(TSEL_A::PRSCH13)
295    }
296    #[doc = "PRS Channel 14 selected"]
297    #[inline(always)]
298    pub fn prsch14(self) -> &'a mut W {
299        self.variant(TSEL_A::PRSCH14)
300    }
301    #[doc = "PRS Channel 15 selected"]
302    #[inline(always)]
303    pub fn prsch15(self) -> &'a mut W {
304        self.variant(TSEL_A::PRSCH15)
305    }
306}
307impl R {
308    #[doc = "Bit 4 - Receive Trigger Enable"]
309    #[inline(always)]
310    pub fn rxten(&self) -> RXTEN_R {
311        RXTEN_R::new(((self.bits >> 4) & 1) != 0)
312    }
313    #[doc = "Bit 5 - Transmit Trigger Enable"]
314    #[inline(always)]
315    pub fn txten(&self) -> TXTEN_R {
316        TXTEN_R::new(((self.bits >> 5) & 1) != 0)
317    }
318    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
319    #[inline(always)]
320    pub fn autotxten(&self) -> AUTOTXTEN_R {
321        AUTOTXTEN_R::new(((self.bits >> 6) & 1) != 0)
322    }
323    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
324    #[inline(always)]
325    pub fn txarx0en(&self) -> TXARX0EN_R {
326        TXARX0EN_R::new(((self.bits >> 7) & 1) != 0)
327    }
328    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
329    #[inline(always)]
330    pub fn txarx1en(&self) -> TXARX1EN_R {
331        TXARX1EN_R::new(((self.bits >> 8) & 1) != 0)
332    }
333    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
334    #[inline(always)]
335    pub fn txarx2en(&self) -> TXARX2EN_R {
336        TXARX2EN_R::new(((self.bits >> 9) & 1) != 0)
337    }
338    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
339    #[inline(always)]
340    pub fn rxatx0en(&self) -> RXATX0EN_R {
341        RXATX0EN_R::new(((self.bits >> 10) & 1) != 0)
342    }
343    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
344    #[inline(always)]
345    pub fn rxatx1en(&self) -> RXATX1EN_R {
346        RXATX1EN_R::new(((self.bits >> 11) & 1) != 0)
347    }
348    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
349    #[inline(always)]
350    pub fn rxatx2en(&self) -> RXATX2EN_R {
351        RXATX2EN_R::new(((self.bits >> 12) & 1) != 0)
352    }
353    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
354    #[inline(always)]
355    pub fn tsel(&self) -> TSEL_R {
356        TSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
357    }
358}
359impl W {
360    #[doc = "Bit 4 - Receive Trigger Enable"]
361    #[inline(always)]
362    pub fn rxten(&mut self) -> RXTEN_W {
363        RXTEN_W::new(self)
364    }
365    #[doc = "Bit 5 - Transmit Trigger Enable"]
366    #[inline(always)]
367    pub fn txten(&mut self) -> TXTEN_W {
368        TXTEN_W::new(self)
369    }
370    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
371    #[inline(always)]
372    pub fn autotxten(&mut self) -> AUTOTXTEN_W {
373        AUTOTXTEN_W::new(self)
374    }
375    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
376    #[inline(always)]
377    pub fn txarx0en(&mut self) -> TXARX0EN_W {
378        TXARX0EN_W::new(self)
379    }
380    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
381    #[inline(always)]
382    pub fn txarx1en(&mut self) -> TXARX1EN_W {
383        TXARX1EN_W::new(self)
384    }
385    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
386    #[inline(always)]
387    pub fn txarx2en(&mut self) -> TXARX2EN_W {
388        TXARX2EN_W::new(self)
389    }
390    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
391    #[inline(always)]
392    pub fn rxatx0en(&mut self) -> RXATX0EN_W {
393        RXATX0EN_W::new(self)
394    }
395    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
396    #[inline(always)]
397    pub fn rxatx1en(&mut self) -> RXATX1EN_W {
398        RXATX1EN_W::new(self)
399    }
400    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
401    #[inline(always)]
402    pub fn rxatx2en(&mut self) -> RXATX2EN_W {
403        RXATX2EN_W::new(self)
404    }
405    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
406    #[inline(always)]
407    pub fn tsel(&mut self) -> TSEL_W {
408        TSEL_W::new(self)
409    }
410    #[doc = "Writes raw bits to the register."]
411    #[inline(always)]
412    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
413        self.0.bits(bits);
414        self
415    }
416}
417#[doc = "USART Trigger 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 [trigctrl](index.html) module"]
418pub struct TRIGCTRL_SPEC;
419impl crate::RegisterSpec for TRIGCTRL_SPEC {
420    type Ux = u32;
421}
422#[doc = "`read()` method returns [trigctrl::R](R) reader structure"]
423impl crate::Readable for TRIGCTRL_SPEC {
424    type Reader = R;
425}
426#[doc = "`write(|w| ..)` method takes [trigctrl::W](W) writer structure"]
427impl crate::Writable for TRIGCTRL_SPEC {
428    type Writer = W;
429}
430#[doc = "`reset()` method sets TRIGCTRL to value 0"]
431impl crate::Resettable for TRIGCTRL_SPEC {
432    #[inline(always)]
433    fn reset_value() -> Self::Ux {
434        0
435    }
436}