efm32pg12b500_pac/usart3/
trigctrl.rs1#[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}
102impl From<TSEL_A> for u8 {
103 #[inline(always)]
104 fn from(variant: TSEL_A) -> Self {
105 variant as _
106 }
107}
108#[doc = "Field `TSEL` reader - Trigger PRS Channel Select"]
109pub type TSEL_R = crate::FieldReader<u8, TSEL_A>;
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> = crate::FieldWriter<'a, u32, TRIGCTRL_SPEC, u8, TSEL_A, 4, 16>;
193impl<'a> TSEL_W<'a> {
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 pub fn rxten(&mut self) -> RXTEN_W {
311 RXTEN_W::new(self)
312 }
313 #[doc = "Bit 5 - Transmit Trigger Enable"]
314 #[inline(always)]
315 pub fn txten(&mut self) -> TXTEN_W {
316 TXTEN_W::new(self)
317 }
318 #[doc = "Bit 6 - AUTOTX Trigger Enable"]
319 #[inline(always)]
320 pub fn autotxten(&mut self) -> AUTOTXTEN_W {
321 AUTOTXTEN_W::new(self)
322 }
323 #[doc = "Bit 7 - Enable Transmit Trigger After RX End of Frame Plus TCMP0VAL"]
324 #[inline(always)]
325 pub fn txarx0en(&mut self) -> TXARX0EN_W {
326 TXARX0EN_W::new(self)
327 }
328 #[doc = "Bit 8 - Enable Transmit Trigger After RX End of Frame Plus TCMP1VAL"]
329 #[inline(always)]
330 pub fn txarx1en(&mut self) -> TXARX1EN_W {
331 TXARX1EN_W::new(self)
332 }
333 #[doc = "Bit 9 - Enable Transmit Trigger After RX End of Frame Plus TCMP2VAL"]
334 #[inline(always)]
335 pub fn txarx2en(&mut self) -> TXARX2EN_W {
336 TXARX2EN_W::new(self)
337 }
338 #[doc = "Bit 10 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL0 Baud-times"]
339 #[inline(always)]
340 pub fn rxatx0en(&mut self) -> RXATX0EN_W {
341 RXATX0EN_W::new(self)
342 }
343 #[doc = "Bit 11 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL1 Baud-times"]
344 #[inline(always)]
345 pub fn rxatx1en(&mut self) -> RXATX1EN_W {
346 RXATX1EN_W::new(self)
347 }
348 #[doc = "Bit 12 - Enable Receive Trigger After TX End of Frame Plus TCMPVAL2 Baud-times"]
349 #[inline(always)]
350 pub fn rxatx2en(&mut self) -> RXATX2EN_W {
351 RXATX2EN_W::new(self)
352 }
353 #[doc = "Bits 16:19 - Trigger PRS Channel Select"]
354 #[inline(always)]
355 pub fn tsel(&mut self) -> TSEL_W {
356 TSEL_W::new(self)
357 }
358 #[doc = "Writes raw bits to the register."]
359 #[inline(always)]
360 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
361 self.0.bits(bits);
362 self
363 }
364}
365#[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"]
366pub struct TRIGCTRL_SPEC;
367impl crate::RegisterSpec for TRIGCTRL_SPEC {
368 type Ux = u32;
369}
370#[doc = "`read()` method returns [trigctrl::R](R) reader structure"]
371impl crate::Readable for TRIGCTRL_SPEC {
372 type Reader = R;
373}
374#[doc = "`write(|w| ..)` method takes [trigctrl::W](W) writer structure"]
375impl crate::Writable for TRIGCTRL_SPEC {
376 type Writer = W;
377}
378#[doc = "`reset()` method sets TRIGCTRL to value 0"]
379impl crate::Resettable for TRIGCTRL_SPEC {
380 #[inline(always)]
381 fn reset_value() -> Self::Ux {
382 0
383 }
384}