efm32jg12b_pac/efm32jg12b500/usart3/
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, TRIGCTRL_SPEC, bool, O>;
73#[doc = "Field `TSEL` reader - Trigger PRS Channel Select"]
74pub type TSEL_R = crate::FieldReader<u8, TSEL_A>;
75#[doc = "Trigger PRS Channel Select\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77#[repr(u8)]
78pub enum TSEL_A {
79    #[doc = "0: PRS Channel 0 selected"]
80    PRSCH0 = 0,
81    #[doc = "1: PRS Channel 1 selected"]
82    PRSCH1 = 1,
83    #[doc = "2: PRS Channel 2 selected"]
84    PRSCH2 = 2,
85    #[doc = "3: PRS Channel 3 selected"]
86    PRSCH3 = 3,
87    #[doc = "4: PRS Channel 4 selected"]
88    PRSCH4 = 4,
89    #[doc = "5: PRS Channel 5 selected"]
90    PRSCH5 = 5,
91    #[doc = "6: PRS Channel 6 selected"]
92    PRSCH6 = 6,
93    #[doc = "7: PRS Channel 7 selected"]
94    PRSCH7 = 7,
95    #[doc = "8: PRS Channel 8 selected"]
96    PRSCH8 = 8,
97    #[doc = "9: PRS Channel 9 selected"]
98    PRSCH9 = 9,
99    #[doc = "10: PRS Channel 10 selected"]
100    PRSCH10 = 10,
101    #[doc = "11: PRS Channel 11 selected"]
102    PRSCH11 = 11,
103}
104impl From<TSEL_A> for u8 {
105    #[inline(always)]
106    fn from(variant: TSEL_A) -> Self {
107        variant as _
108    }
109}
110impl TSEL_R {
111    #[doc = "Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> Option<TSEL_A> {
114        match self.bits {
115            0 => Some(TSEL_A::PRSCH0),
116            1 => Some(TSEL_A::PRSCH1),
117            2 => Some(TSEL_A::PRSCH2),
118            3 => Some(TSEL_A::PRSCH3),
119            4 => Some(TSEL_A::PRSCH4),
120            5 => Some(TSEL_A::PRSCH5),
121            6 => Some(TSEL_A::PRSCH6),
122            7 => Some(TSEL_A::PRSCH7),
123            8 => Some(TSEL_A::PRSCH8),
124            9 => Some(TSEL_A::PRSCH9),
125            10 => Some(TSEL_A::PRSCH10),
126            11 => Some(TSEL_A::PRSCH11),
127            _ => None,
128        }
129    }
130    #[doc = "Checks if the value of the field is `PRSCH0`"]
131    #[inline(always)]
132    pub fn is_prsch0(&self) -> bool {
133        *self == TSEL_A::PRSCH0
134    }
135    #[doc = "Checks if the value of the field is `PRSCH1`"]
136    #[inline(always)]
137    pub fn is_prsch1(&self) -> bool {
138        *self == TSEL_A::PRSCH1
139    }
140    #[doc = "Checks if the value of the field is `PRSCH2`"]
141    #[inline(always)]
142    pub fn is_prsch2(&self) -> bool {
143        *self == TSEL_A::PRSCH2
144    }
145    #[doc = "Checks if the value of the field is `PRSCH3`"]
146    #[inline(always)]
147    pub fn is_prsch3(&self) -> bool {
148        *self == TSEL_A::PRSCH3
149    }
150    #[doc = "Checks if the value of the field is `PRSCH4`"]
151    #[inline(always)]
152    pub fn is_prsch4(&self) -> bool {
153        *self == TSEL_A::PRSCH4
154    }
155    #[doc = "Checks if the value of the field is `PRSCH5`"]
156    #[inline(always)]
157    pub fn is_prsch5(&self) -> bool {
158        *self == TSEL_A::PRSCH5
159    }
160    #[doc = "Checks if the value of the field is `PRSCH6`"]
161    #[inline(always)]
162    pub fn is_prsch6(&self) -> bool {
163        *self == TSEL_A::PRSCH6
164    }
165    #[doc = "Checks if the value of the field is `PRSCH7`"]
166    #[inline(always)]
167    pub fn is_prsch7(&self) -> bool {
168        *self == TSEL_A::PRSCH7
169    }
170    #[doc = "Checks if the value of the field is `PRSCH8`"]
171    #[inline(always)]
172    pub fn is_prsch8(&self) -> bool {
173        *self == TSEL_A::PRSCH8
174    }
175    #[doc = "Checks if the value of the field is `PRSCH9`"]
176    #[inline(always)]
177    pub fn is_prsch9(&self) -> bool {
178        *self == TSEL_A::PRSCH9
179    }
180    #[doc = "Checks if the value of the field is `PRSCH10`"]
181    #[inline(always)]
182    pub fn is_prsch10(&self) -> bool {
183        *self == TSEL_A::PRSCH10
184    }
185    #[doc = "Checks if the value of the field is `PRSCH11`"]
186    #[inline(always)]
187    pub fn is_prsch11(&self) -> bool {
188        *self == TSEL_A::PRSCH11
189    }
190}
191#[doc = "Field `TSEL` writer - Trigger PRS Channel Select"]
192pub type TSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TRIGCTRL_SPEC, u8, TSEL_A, 4, O>;
193impl<'a, const O: u8> TSEL_W<'a, O> {
194    #[doc = "PRS Channel 0 selected"]
195    #[inline(always)]
196    pub fn prsch0(self) -> &'a mut W {
197        self.variant(TSEL_A::PRSCH0)
198    }
199    #[doc = "PRS Channel 1 selected"]
200    #[inline(always)]
201    pub fn prsch1(self) -> &'a mut W {
202        self.variant(TSEL_A::PRSCH1)
203    }
204    #[doc = "PRS Channel 2 selected"]
205    #[inline(always)]
206    pub fn prsch2(self) -> &'a mut W {
207        self.variant(TSEL_A::PRSCH2)
208    }
209    #[doc = "PRS Channel 3 selected"]
210    #[inline(always)]
211    pub fn prsch3(self) -> &'a mut W {
212        self.variant(TSEL_A::PRSCH3)
213    }
214    #[doc = "PRS Channel 4 selected"]
215    #[inline(always)]
216    pub fn prsch4(self) -> &'a mut W {
217        self.variant(TSEL_A::PRSCH4)
218    }
219    #[doc = "PRS Channel 5 selected"]
220    #[inline(always)]
221    pub fn prsch5(self) -> &'a mut W {
222        self.variant(TSEL_A::PRSCH5)
223    }
224    #[doc = "PRS Channel 6 selected"]
225    #[inline(always)]
226    pub fn prsch6(self) -> &'a mut W {
227        self.variant(TSEL_A::PRSCH6)
228    }
229    #[doc = "PRS Channel 7 selected"]
230    #[inline(always)]
231    pub fn prsch7(self) -> &'a mut W {
232        self.variant(TSEL_A::PRSCH7)
233    }
234    #[doc = "PRS Channel 8 selected"]
235    #[inline(always)]
236    pub fn prsch8(self) -> &'a mut W {
237        self.variant(TSEL_A::PRSCH8)
238    }
239    #[doc = "PRS Channel 9 selected"]
240    #[inline(always)]
241    pub fn prsch9(self) -> &'a mut W {
242        self.variant(TSEL_A::PRSCH9)
243    }
244    #[doc = "PRS Channel 10 selected"]
245    #[inline(always)]
246    pub fn prsch10(self) -> &'a mut W {
247        self.variant(TSEL_A::PRSCH10)
248    }
249    #[doc = "PRS Channel 11 selected"]
250    #[inline(always)]
251    pub fn prsch11(self) -> &'a mut W {
252        self.variant(TSEL_A::PRSCH11)
253    }
254}
255impl R {
256    #[doc = "Bit 4 - Receive Trigger Enable"]
257    #[inline(always)]
258    pub fn rxten(&self) -> RXTEN_R {
259        RXTEN_R::new(((self.bits >> 4) & 1) != 0)
260    }
261    #[doc = "Bit 5 - Transmit Trigger Enable"]
262    #[inline(always)]
263    pub fn txten(&self) -> TXTEN_R {
264        TXTEN_R::new(((self.bits >> 5) & 1) != 0)
265    }
266    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
267    #[inline(always)]
268    pub fn autotxten(&self) -> AUTOTXTEN_R {
269        AUTOTXTEN_R::new(((self.bits >> 6) & 1) != 0)
270    }
271    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
272    #[inline(always)]
273    pub fn txarx0en(&self) -> TXARX0EN_R {
274        TXARX0EN_R::new(((self.bits >> 7) & 1) != 0)
275    }
276    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
277    #[inline(always)]
278    pub fn txarx1en(&self) -> TXARX1EN_R {
279        TXARX1EN_R::new(((self.bits >> 8) & 1) != 0)
280    }
281    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
282    #[inline(always)]
283    pub fn txarx2en(&self) -> TXARX2EN_R {
284        TXARX2EN_R::new(((self.bits >> 9) & 1) != 0)
285    }
286    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
287    #[inline(always)]
288    pub fn rxatx0en(&self) -> RXATX0EN_R {
289        RXATX0EN_R::new(((self.bits >> 10) & 1) != 0)
290    }
291    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
292    #[inline(always)]
293    pub fn rxatx1en(&self) -> RXATX1EN_R {
294        RXATX1EN_R::new(((self.bits >> 11) & 1) != 0)
295    }
296    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
297    #[inline(always)]
298    pub fn rxatx2en(&self) -> RXATX2EN_R {
299        RXATX2EN_R::new(((self.bits >> 12) & 1) != 0)
300    }
301    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
302    #[inline(always)]
303    pub fn tsel(&self) -> TSEL_R {
304        TSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
305    }
306}
307impl W {
308    #[doc = "Bit 4 - Receive Trigger Enable"]
309    #[inline(always)]
310    #[must_use]
311    pub fn rxten(&mut self) -> RXTEN_W<4> {
312        RXTEN_W::new(self)
313    }
314    #[doc = "Bit 5 - Transmit Trigger Enable"]
315    #[inline(always)]
316    #[must_use]
317    pub fn txten(&mut self) -> TXTEN_W<5> {
318        TXTEN_W::new(self)
319    }
320    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
321    #[inline(always)]
322    #[must_use]
323    pub fn autotxten(&mut self) -> AUTOTXTEN_W<6> {
324        AUTOTXTEN_W::new(self)
325    }
326    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
327    #[inline(always)]
328    #[must_use]
329    pub fn txarx0en(&mut self) -> TXARX0EN_W<7> {
330        TXARX0EN_W::new(self)
331    }
332    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
333    #[inline(always)]
334    #[must_use]
335    pub fn txarx1en(&mut self) -> TXARX1EN_W<8> {
336        TXARX1EN_W::new(self)
337    }
338    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
339    #[inline(always)]
340    #[must_use]
341    pub fn txarx2en(&mut self) -> TXARX2EN_W<9> {
342        TXARX2EN_W::new(self)
343    }
344    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
345    #[inline(always)]
346    #[must_use]
347    pub fn rxatx0en(&mut self) -> RXATX0EN_W<10> {
348        RXATX0EN_W::new(self)
349    }
350    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
351    #[inline(always)]
352    #[must_use]
353    pub fn rxatx1en(&mut self) -> RXATX1EN_W<11> {
354        RXATX1EN_W::new(self)
355    }
356    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
357    #[inline(always)]
358    #[must_use]
359    pub fn rxatx2en(&mut self) -> RXATX2EN_W<12> {
360        RXATX2EN_W::new(self)
361    }
362    #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
363    #[inline(always)]
364    #[must_use]
365    pub fn tsel(&mut self) -> TSEL_W<16> {
366        TSEL_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 = "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"]
376pub struct TRIGCTRL_SPEC;
377impl crate::RegisterSpec for TRIGCTRL_SPEC {
378    type Ux = u32;
379}
380#[doc = "`read()` method returns [trigctrl::R](R) reader structure"]
381impl crate::Readable for TRIGCTRL_SPEC {
382    type Reader = R;
383}
384#[doc = "`write(|w| ..)` method takes [trigctrl::W](W) writer structure"]
385impl crate::Writable for TRIGCTRL_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 TRIGCTRL to value 0"]
391impl crate::Resettable for TRIGCTRL_SPEC {
392    const RESET_VALUE: Self::Ux = 0;
393}