efm32tg11b540_pac/usart0/
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}
94impl From<TSEL_A> for u8 {
95    #[inline(always)]
96    fn from(variant: TSEL_A) -> Self {
97        variant as _
98    }
99}
100#[doc = "Field `TSEL` reader - Trigger PRS Channel Select"]
101pub type TSEL_R = crate::FieldReader<u8, TSEL_A>;
102impl TSEL_R {
103    #[doc = "Get enumerated values variant"]
104    #[inline(always)]
105    pub fn variant(&self) -> TSEL_A {
106        match self.bits {
107            0 => TSEL_A::PRSCH0,
108            1 => TSEL_A::PRSCH1,
109            2 => TSEL_A::PRSCH2,
110            3 => TSEL_A::PRSCH3,
111            4 => TSEL_A::PRSCH4,
112            5 => TSEL_A::PRSCH5,
113            6 => TSEL_A::PRSCH6,
114            7 => TSEL_A::PRSCH7,
115            _ => unreachable!(),
116        }
117    }
118    #[doc = "Checks if the value of the field is `PRSCH0`"]
119    #[inline(always)]
120    pub fn is_prsch0(&self) -> bool {
121        *self == TSEL_A::PRSCH0
122    }
123    #[doc = "Checks if the value of the field is `PRSCH1`"]
124    #[inline(always)]
125    pub fn is_prsch1(&self) -> bool {
126        *self == TSEL_A::PRSCH1
127    }
128    #[doc = "Checks if the value of the field is `PRSCH2`"]
129    #[inline(always)]
130    pub fn is_prsch2(&self) -> bool {
131        *self == TSEL_A::PRSCH2
132    }
133    #[doc = "Checks if the value of the field is `PRSCH3`"]
134    #[inline(always)]
135    pub fn is_prsch3(&self) -> bool {
136        *self == TSEL_A::PRSCH3
137    }
138    #[doc = "Checks if the value of the field is `PRSCH4`"]
139    #[inline(always)]
140    pub fn is_prsch4(&self) -> bool {
141        *self == TSEL_A::PRSCH4
142    }
143    #[doc = "Checks if the value of the field is `PRSCH5`"]
144    #[inline(always)]
145    pub fn is_prsch5(&self) -> bool {
146        *self == TSEL_A::PRSCH5
147    }
148    #[doc = "Checks if the value of the field is `PRSCH6`"]
149    #[inline(always)]
150    pub fn is_prsch6(&self) -> bool {
151        *self == TSEL_A::PRSCH6
152    }
153    #[doc = "Checks if the value of the field is `PRSCH7`"]
154    #[inline(always)]
155    pub fn is_prsch7(&self) -> bool {
156        *self == TSEL_A::PRSCH7
157    }
158}
159#[doc = "Field `TSEL` writer - Trigger PRS Channel Select"]
160pub type TSEL_W<'a> = crate::FieldWriterSafe<'a, u32, TRIGCTRL_SPEC, u8, TSEL_A, 3, 16>;
161impl<'a> TSEL_W<'a> {
162    #[doc = "PRS Channel 0 selected"]
163    #[inline(always)]
164    pub fn prsch0(self) -> &'a mut W {
165        self.variant(TSEL_A::PRSCH0)
166    }
167    #[doc = "PRS Channel 1 selected"]
168    #[inline(always)]
169    pub fn prsch1(self) -> &'a mut W {
170        self.variant(TSEL_A::PRSCH1)
171    }
172    #[doc = "PRS Channel 2 selected"]
173    #[inline(always)]
174    pub fn prsch2(self) -> &'a mut W {
175        self.variant(TSEL_A::PRSCH2)
176    }
177    #[doc = "PRS Channel 3 selected"]
178    #[inline(always)]
179    pub fn prsch3(self) -> &'a mut W {
180        self.variant(TSEL_A::PRSCH3)
181    }
182    #[doc = "PRS Channel 4 selected"]
183    #[inline(always)]
184    pub fn prsch4(self) -> &'a mut W {
185        self.variant(TSEL_A::PRSCH4)
186    }
187    #[doc = "PRS Channel 5 selected"]
188    #[inline(always)]
189    pub fn prsch5(self) -> &'a mut W {
190        self.variant(TSEL_A::PRSCH5)
191    }
192    #[doc = "PRS Channel 6 selected"]
193    #[inline(always)]
194    pub fn prsch6(self) -> &'a mut W {
195        self.variant(TSEL_A::PRSCH6)
196    }
197    #[doc = "PRS Channel 7 selected"]
198    #[inline(always)]
199    pub fn prsch7(self) -> &'a mut W {
200        self.variant(TSEL_A::PRSCH7)
201    }
202}
203impl R {
204    #[doc = "Bit 4 - Receive Trigger Enable"]
205    #[inline(always)]
206    pub fn rxten(&self) -> RXTEN_R {
207        RXTEN_R::new(((self.bits >> 4) & 1) != 0)
208    }
209    #[doc = "Bit 5 - Transmit Trigger Enable"]
210    #[inline(always)]
211    pub fn txten(&self) -> TXTEN_R {
212        TXTEN_R::new(((self.bits >> 5) & 1) != 0)
213    }
214    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
215    #[inline(always)]
216    pub fn autotxten(&self) -> AUTOTXTEN_R {
217        AUTOTXTEN_R::new(((self.bits >> 6) & 1) != 0)
218    }
219    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
220    #[inline(always)]
221    pub fn txarx0en(&self) -> TXARX0EN_R {
222        TXARX0EN_R::new(((self.bits >> 7) & 1) != 0)
223    }
224    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
225    #[inline(always)]
226    pub fn txarx1en(&self) -> TXARX1EN_R {
227        TXARX1EN_R::new(((self.bits >> 8) & 1) != 0)
228    }
229    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
230    #[inline(always)]
231    pub fn txarx2en(&self) -> TXARX2EN_R {
232        TXARX2EN_R::new(((self.bits >> 9) & 1) != 0)
233    }
234    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
235    #[inline(always)]
236    pub fn rxatx0en(&self) -> RXATX0EN_R {
237        RXATX0EN_R::new(((self.bits >> 10) & 1) != 0)
238    }
239    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
240    #[inline(always)]
241    pub fn rxatx1en(&self) -> RXATX1EN_R {
242        RXATX1EN_R::new(((self.bits >> 11) & 1) != 0)
243    }
244    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
245    #[inline(always)]
246    pub fn rxatx2en(&self) -> RXATX2EN_R {
247        RXATX2EN_R::new(((self.bits >> 12) & 1) != 0)
248    }
249    #[doc = "Bits 16:18 - Trigger PRS Channel Select"]
250    #[inline(always)]
251    pub fn tsel(&self) -> TSEL_R {
252        TSEL_R::new(((self.bits >> 16) & 7) as u8)
253    }
254}
255impl W {
256    #[doc = "Bit 4 - Receive Trigger Enable"]
257    #[inline(always)]
258    pub fn rxten(&mut self) -> RXTEN_W {
259        RXTEN_W::new(self)
260    }
261    #[doc = "Bit 5 - Transmit Trigger Enable"]
262    #[inline(always)]
263    pub fn txten(&mut self) -> TXTEN_W {
264        TXTEN_W::new(self)
265    }
266    #[doc = "Bit 6 - AUTOTX Trigger Enable"]
267    #[inline(always)]
268    pub fn autotxten(&mut self) -> AUTOTXTEN_W {
269        AUTOTXTEN_W::new(self)
270    }
271    #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
272    #[inline(always)]
273    pub fn txarx0en(&mut self) -> TXARX0EN_W {
274        TXARX0EN_W::new(self)
275    }
276    #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
277    #[inline(always)]
278    pub fn txarx1en(&mut self) -> TXARX1EN_W {
279        TXARX1EN_W::new(self)
280    }
281    #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
282    #[inline(always)]
283    pub fn txarx2en(&mut self) -> TXARX2EN_W {
284        TXARX2EN_W::new(self)
285    }
286    #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
287    #[inline(always)]
288    pub fn rxatx0en(&mut self) -> RXATX0EN_W {
289        RXATX0EN_W::new(self)
290    }
291    #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
292    #[inline(always)]
293    pub fn rxatx1en(&mut self) -> RXATX1EN_W {
294        RXATX1EN_W::new(self)
295    }
296    #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
297    #[inline(always)]
298    pub fn rxatx2en(&mut self) -> RXATX2EN_W {
299        RXATX2EN_W::new(self)
300    }
301    #[doc = "Bits 16:18 - Trigger PRS Channel Select"]
302    #[inline(always)]
303    pub fn tsel(&mut self) -> TSEL_W {
304        TSEL_W::new(self)
305    }
306    #[doc = "Writes raw bits to the register."]
307    #[inline(always)]
308    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
309        self.0.bits(bits);
310        self
311    }
312}
313#[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"]
314pub struct TRIGCTRL_SPEC;
315impl crate::RegisterSpec for TRIGCTRL_SPEC {
316    type Ux = u32;
317}
318#[doc = "`read()` method returns [trigctrl::R](R) reader structure"]
319impl crate::Readable for TRIGCTRL_SPEC {
320    type Reader = R;
321}
322#[doc = "`write(|w| ..)` method takes [trigctrl::W](W) writer structure"]
323impl crate::Writable for TRIGCTRL_SPEC {
324    type Writer = W;
325}
326#[doc = "`reset()` method sets TRIGCTRL to value 0"]
327impl crate::Resettable for TRIGCTRL_SPEC {
328    #[inline(always)]
329    fn reset_value() -> Self::Ux {
330        0
331    }
332}