s32k116_pac/flexio/
shiftctl2.rs1#[doc = "Register `SHIFTCTL2` reader"]
2pub struct R(crate::R<SHIFTCTL2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SHIFTCTL2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SHIFTCTL2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SHIFTCTL2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SHIFTCTL2` writer"]
17pub struct W(crate::W<SHIFTCTL2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SHIFTCTL2_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<SHIFTCTL2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SHIFTCTL2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Shifter Mode\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SMOD_A {
41 #[doc = "0: Disabled."]
42 _0 = 0,
43 #[doc = "1: Receive mode. Captures the current Shifter content into the SHIFTBUF on expiration of the Timer."]
44 _1 = 1,
45 #[doc = "2: Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer."]
46 _10 = 2,
47 #[doc = "4: Match Store mode. Shifter data is compared to SHIFTBUF content on expiration of the Timer."]
48 _100 = 4,
49 #[doc = "5: Match Continuous mode. Shifter data is continuously compared to SHIFTBUF contents."]
50 _101 = 5,
51}
52impl From<SMOD_A> for u8 {
53 #[inline(always)]
54 fn from(variant: SMOD_A) -> Self {
55 variant as _
56 }
57}
58#[doc = "Field `SMOD` reader - Shifter Mode"]
59pub struct SMOD_R(crate::FieldReader<u8, SMOD_A>);
60impl SMOD_R {
61 #[inline(always)]
62 pub(crate) fn new(bits: u8) -> Self {
63 SMOD_R(crate::FieldReader::new(bits))
64 }
65 #[doc = r"Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<SMOD_A> {
68 match self.bits {
69 0 => Some(SMOD_A::_0),
70 1 => Some(SMOD_A::_1),
71 2 => Some(SMOD_A::_10),
72 4 => Some(SMOD_A::_100),
73 5 => Some(SMOD_A::_101),
74 _ => None,
75 }
76 }
77 #[doc = "Checks if the value of the field is `_0`"]
78 #[inline(always)]
79 pub fn is_0(&self) -> bool {
80 **self == SMOD_A::_0
81 }
82 #[doc = "Checks if the value of the field is `_1`"]
83 #[inline(always)]
84 pub fn is_1(&self) -> bool {
85 **self == SMOD_A::_1
86 }
87 #[doc = "Checks if the value of the field is `_10`"]
88 #[inline(always)]
89 pub fn is_10(&self) -> bool {
90 **self == SMOD_A::_10
91 }
92 #[doc = "Checks if the value of the field is `_100`"]
93 #[inline(always)]
94 pub fn is_100(&self) -> bool {
95 **self == SMOD_A::_100
96 }
97 #[doc = "Checks if the value of the field is `_101`"]
98 #[inline(always)]
99 pub fn is_101(&self) -> bool {
100 **self == SMOD_A::_101
101 }
102}
103impl core::ops::Deref for SMOD_R {
104 type Target = crate::FieldReader<u8, SMOD_A>;
105 #[inline(always)]
106 fn deref(&self) -> &Self::Target {
107 &self.0
108 }
109}
110#[doc = "Field `SMOD` writer - Shifter Mode"]
111pub struct SMOD_W<'a> {
112 w: &'a mut W,
113}
114impl<'a> SMOD_W<'a> {
115 #[doc = r"Writes `variant` to the field"]
116 #[inline(always)]
117 pub fn variant(self, variant: SMOD_A) -> &'a mut W {
118 unsafe { self.bits(variant.into()) }
119 }
120 #[doc = "Disabled."]
121 #[inline(always)]
122 pub fn _0(self) -> &'a mut W {
123 self.variant(SMOD_A::_0)
124 }
125 #[doc = "Receive mode. Captures the current Shifter content into the SHIFTBUF on expiration of the Timer."]
126 #[inline(always)]
127 pub fn _1(self) -> &'a mut W {
128 self.variant(SMOD_A::_1)
129 }
130 #[doc = "Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer."]
131 #[inline(always)]
132 pub fn _10(self) -> &'a mut W {
133 self.variant(SMOD_A::_10)
134 }
135 #[doc = "Match Store mode. Shifter data is compared to SHIFTBUF content on expiration of the Timer."]
136 #[inline(always)]
137 pub fn _100(self) -> &'a mut W {
138 self.variant(SMOD_A::_100)
139 }
140 #[doc = "Match Continuous mode. Shifter data is continuously compared to SHIFTBUF contents."]
141 #[inline(always)]
142 pub fn _101(self) -> &'a mut W {
143 self.variant(SMOD_A::_101)
144 }
145 #[doc = r"Writes raw bits to the field"]
146 #[inline(always)]
147 pub unsafe fn bits(self, value: u8) -> &'a mut W {
148 self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
149 self.w
150 }
151}
152#[doc = "Shifter Pin Polarity\n\nValue on reset: 0"]
153#[derive(Clone, Copy, Debug, PartialEq)]
154pub enum PINPOL_A {
155 #[doc = "0: Pin is active high"]
156 _0 = 0,
157 #[doc = "1: Pin is active low"]
158 _1 = 1,
159}
160impl From<PINPOL_A> for bool {
161 #[inline(always)]
162 fn from(variant: PINPOL_A) -> Self {
163 variant as u8 != 0
164 }
165}
166#[doc = "Field `PINPOL` reader - Shifter Pin Polarity"]
167pub struct PINPOL_R(crate::FieldReader<bool, PINPOL_A>);
168impl PINPOL_R {
169 #[inline(always)]
170 pub(crate) fn new(bits: bool) -> Self {
171 PINPOL_R(crate::FieldReader::new(bits))
172 }
173 #[doc = r"Get enumerated values variant"]
174 #[inline(always)]
175 pub fn variant(&self) -> PINPOL_A {
176 match self.bits {
177 false => PINPOL_A::_0,
178 true => PINPOL_A::_1,
179 }
180 }
181 #[doc = "Checks if the value of the field is `_0`"]
182 #[inline(always)]
183 pub fn is_0(&self) -> bool {
184 **self == PINPOL_A::_0
185 }
186 #[doc = "Checks if the value of the field is `_1`"]
187 #[inline(always)]
188 pub fn is_1(&self) -> bool {
189 **self == PINPOL_A::_1
190 }
191}
192impl core::ops::Deref for PINPOL_R {
193 type Target = crate::FieldReader<bool, PINPOL_A>;
194 #[inline(always)]
195 fn deref(&self) -> &Self::Target {
196 &self.0
197 }
198}
199#[doc = "Field `PINPOL` writer - Shifter Pin Polarity"]
200pub struct PINPOL_W<'a> {
201 w: &'a mut W,
202}
203impl<'a> PINPOL_W<'a> {
204 #[doc = r"Writes `variant` to the field"]
205 #[inline(always)]
206 pub fn variant(self, variant: PINPOL_A) -> &'a mut W {
207 self.bit(variant.into())
208 }
209 #[doc = "Pin is active high"]
210 #[inline(always)]
211 pub fn _0(self) -> &'a mut W {
212 self.variant(PINPOL_A::_0)
213 }
214 #[doc = "Pin is active low"]
215 #[inline(always)]
216 pub fn _1(self) -> &'a mut W {
217 self.variant(PINPOL_A::_1)
218 }
219 #[doc = r"Sets the field bit"]
220 #[inline(always)]
221 pub fn set_bit(self) -> &'a mut W {
222 self.bit(true)
223 }
224 #[doc = r"Clears the field bit"]
225 #[inline(always)]
226 pub fn clear_bit(self) -> &'a mut W {
227 self.bit(false)
228 }
229 #[doc = r"Writes raw bits to the field"]
230 #[inline(always)]
231 pub fn bit(self, value: bool) -> &'a mut W {
232 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
233 self.w
234 }
235}
236#[doc = "Field `PINSEL` reader - Shifter Pin Select"]
237pub struct PINSEL_R(crate::FieldReader<u8, u8>);
238impl PINSEL_R {
239 #[inline(always)]
240 pub(crate) fn new(bits: u8) -> Self {
241 PINSEL_R(crate::FieldReader::new(bits))
242 }
243}
244impl core::ops::Deref for PINSEL_R {
245 type Target = crate::FieldReader<u8, u8>;
246 #[inline(always)]
247 fn deref(&self) -> &Self::Target {
248 &self.0
249 }
250}
251#[doc = "Field `PINSEL` writer - Shifter Pin Select"]
252pub struct PINSEL_W<'a> {
253 w: &'a mut W,
254}
255impl<'a> PINSEL_W<'a> {
256 #[doc = r"Writes raw bits to the field"]
257 #[inline(always)]
258 pub unsafe fn bits(self, value: u8) -> &'a mut W {
259 self.w.bits = (self.w.bits & !(0x07 << 8)) | ((value as u32 & 0x07) << 8);
260 self.w
261 }
262}
263#[doc = "Shifter Pin Configuration\n\nValue on reset: 0"]
264#[derive(Clone, Copy, Debug, PartialEq)]
265#[repr(u8)]
266pub enum PINCFG_A {
267 #[doc = "0: Shifter pin output disabled"]
268 _0 = 0,
269 #[doc = "1: Shifter pin open drain or bidirectional output enable"]
270 _1 = 1,
271 #[doc = "2: Shifter pin bidirectional output data"]
272 _10 = 2,
273 #[doc = "3: Shifter pin output"]
274 _11 = 3,
275}
276impl From<PINCFG_A> for u8 {
277 #[inline(always)]
278 fn from(variant: PINCFG_A) -> Self {
279 variant as _
280 }
281}
282#[doc = "Field `PINCFG` reader - Shifter Pin Configuration"]
283pub struct PINCFG_R(crate::FieldReader<u8, PINCFG_A>);
284impl PINCFG_R {
285 #[inline(always)]
286 pub(crate) fn new(bits: u8) -> Self {
287 PINCFG_R(crate::FieldReader::new(bits))
288 }
289 #[doc = r"Get enumerated values variant"]
290 #[inline(always)]
291 pub fn variant(&self) -> PINCFG_A {
292 match self.bits {
293 0 => PINCFG_A::_0,
294 1 => PINCFG_A::_1,
295 2 => PINCFG_A::_10,
296 3 => PINCFG_A::_11,
297 _ => unreachable!(),
298 }
299 }
300 #[doc = "Checks if the value of the field is `_0`"]
301 #[inline(always)]
302 pub fn is_0(&self) -> bool {
303 **self == PINCFG_A::_0
304 }
305 #[doc = "Checks if the value of the field is `_1`"]
306 #[inline(always)]
307 pub fn is_1(&self) -> bool {
308 **self == PINCFG_A::_1
309 }
310 #[doc = "Checks if the value of the field is `_10`"]
311 #[inline(always)]
312 pub fn is_10(&self) -> bool {
313 **self == PINCFG_A::_10
314 }
315 #[doc = "Checks if the value of the field is `_11`"]
316 #[inline(always)]
317 pub fn is_11(&self) -> bool {
318 **self == PINCFG_A::_11
319 }
320}
321impl core::ops::Deref for PINCFG_R {
322 type Target = crate::FieldReader<u8, PINCFG_A>;
323 #[inline(always)]
324 fn deref(&self) -> &Self::Target {
325 &self.0
326 }
327}
328#[doc = "Field `PINCFG` writer - Shifter Pin Configuration"]
329pub struct PINCFG_W<'a> {
330 w: &'a mut W,
331}
332impl<'a> PINCFG_W<'a> {
333 #[doc = r"Writes `variant` to the field"]
334 #[inline(always)]
335 pub fn variant(self, variant: PINCFG_A) -> &'a mut W {
336 self.bits(variant.into())
337 }
338 #[doc = "Shifter pin output disabled"]
339 #[inline(always)]
340 pub fn _0(self) -> &'a mut W {
341 self.variant(PINCFG_A::_0)
342 }
343 #[doc = "Shifter pin open drain or bidirectional output enable"]
344 #[inline(always)]
345 pub fn _1(self) -> &'a mut W {
346 self.variant(PINCFG_A::_1)
347 }
348 #[doc = "Shifter pin bidirectional output data"]
349 #[inline(always)]
350 pub fn _10(self) -> &'a mut W {
351 self.variant(PINCFG_A::_10)
352 }
353 #[doc = "Shifter pin output"]
354 #[inline(always)]
355 pub fn _11(self) -> &'a mut W {
356 self.variant(PINCFG_A::_11)
357 }
358 #[doc = r"Writes raw bits to the field"]
359 #[inline(always)]
360 pub fn bits(self, value: u8) -> &'a mut W {
361 self.w.bits = (self.w.bits & !(0x03 << 16)) | ((value as u32 & 0x03) << 16);
362 self.w
363 }
364}
365#[doc = "Timer Polarity\n\nValue on reset: 0"]
366#[derive(Clone, Copy, Debug, PartialEq)]
367pub enum TIMPOL_A {
368 #[doc = "0: Shift on posedge of Shift clock"]
369 _0 = 0,
370 #[doc = "1: Shift on negedge of Shift clock"]
371 _1 = 1,
372}
373impl From<TIMPOL_A> for bool {
374 #[inline(always)]
375 fn from(variant: TIMPOL_A) -> Self {
376 variant as u8 != 0
377 }
378}
379#[doc = "Field `TIMPOL` reader - Timer Polarity"]
380pub struct TIMPOL_R(crate::FieldReader<bool, TIMPOL_A>);
381impl TIMPOL_R {
382 #[inline(always)]
383 pub(crate) fn new(bits: bool) -> Self {
384 TIMPOL_R(crate::FieldReader::new(bits))
385 }
386 #[doc = r"Get enumerated values variant"]
387 #[inline(always)]
388 pub fn variant(&self) -> TIMPOL_A {
389 match self.bits {
390 false => TIMPOL_A::_0,
391 true => TIMPOL_A::_1,
392 }
393 }
394 #[doc = "Checks if the value of the field is `_0`"]
395 #[inline(always)]
396 pub fn is_0(&self) -> bool {
397 **self == TIMPOL_A::_0
398 }
399 #[doc = "Checks if the value of the field is `_1`"]
400 #[inline(always)]
401 pub fn is_1(&self) -> bool {
402 **self == TIMPOL_A::_1
403 }
404}
405impl core::ops::Deref for TIMPOL_R {
406 type Target = crate::FieldReader<bool, TIMPOL_A>;
407 #[inline(always)]
408 fn deref(&self) -> &Self::Target {
409 &self.0
410 }
411}
412#[doc = "Field `TIMPOL` writer - Timer Polarity"]
413pub struct TIMPOL_W<'a> {
414 w: &'a mut W,
415}
416impl<'a> TIMPOL_W<'a> {
417 #[doc = r"Writes `variant` to the field"]
418 #[inline(always)]
419 pub fn variant(self, variant: TIMPOL_A) -> &'a mut W {
420 self.bit(variant.into())
421 }
422 #[doc = "Shift on posedge of Shift clock"]
423 #[inline(always)]
424 pub fn _0(self) -> &'a mut W {
425 self.variant(TIMPOL_A::_0)
426 }
427 #[doc = "Shift on negedge of Shift clock"]
428 #[inline(always)]
429 pub fn _1(self) -> &'a mut W {
430 self.variant(TIMPOL_A::_1)
431 }
432 #[doc = r"Sets the field bit"]
433 #[inline(always)]
434 pub fn set_bit(self) -> &'a mut W {
435 self.bit(true)
436 }
437 #[doc = r"Clears the field bit"]
438 #[inline(always)]
439 pub fn clear_bit(self) -> &'a mut W {
440 self.bit(false)
441 }
442 #[doc = r"Writes raw bits to the field"]
443 #[inline(always)]
444 pub fn bit(self, value: bool) -> &'a mut W {
445 self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
446 self.w
447 }
448}
449#[doc = "Field `TIMSEL` reader - Timer Select"]
450pub struct TIMSEL_R(crate::FieldReader<u8, u8>);
451impl TIMSEL_R {
452 #[inline(always)]
453 pub(crate) fn new(bits: u8) -> Self {
454 TIMSEL_R(crate::FieldReader::new(bits))
455 }
456}
457impl core::ops::Deref for TIMSEL_R {
458 type Target = crate::FieldReader<u8, u8>;
459 #[inline(always)]
460 fn deref(&self) -> &Self::Target {
461 &self.0
462 }
463}
464#[doc = "Field `TIMSEL` writer - Timer Select"]
465pub struct TIMSEL_W<'a> {
466 w: &'a mut W,
467}
468impl<'a> TIMSEL_W<'a> {
469 #[doc = r"Writes raw bits to the field"]
470 #[inline(always)]
471 pub unsafe fn bits(self, value: u8) -> &'a mut W {
472 self.w.bits = (self.w.bits & !(0x03 << 24)) | ((value as u32 & 0x03) << 24);
473 self.w
474 }
475}
476impl R {
477 #[doc = "Bits 0:2 - Shifter Mode"]
478 #[inline(always)]
479 pub fn smod(&self) -> SMOD_R {
480 SMOD_R::new((self.bits & 0x07) as u8)
481 }
482 #[doc = "Bit 7 - Shifter Pin Polarity"]
483 #[inline(always)]
484 pub fn pinpol(&self) -> PINPOL_R {
485 PINPOL_R::new(((self.bits >> 7) & 0x01) != 0)
486 }
487 #[doc = "Bits 8:10 - Shifter Pin Select"]
488 #[inline(always)]
489 pub fn pinsel(&self) -> PINSEL_R {
490 PINSEL_R::new(((self.bits >> 8) & 0x07) as u8)
491 }
492 #[doc = "Bits 16:17 - Shifter Pin Configuration"]
493 #[inline(always)]
494 pub fn pincfg(&self) -> PINCFG_R {
495 PINCFG_R::new(((self.bits >> 16) & 0x03) as u8)
496 }
497 #[doc = "Bit 23 - Timer Polarity"]
498 #[inline(always)]
499 pub fn timpol(&self) -> TIMPOL_R {
500 TIMPOL_R::new(((self.bits >> 23) & 0x01) != 0)
501 }
502 #[doc = "Bits 24:25 - Timer Select"]
503 #[inline(always)]
504 pub fn timsel(&self) -> TIMSEL_R {
505 TIMSEL_R::new(((self.bits >> 24) & 0x03) as u8)
506 }
507}
508impl W {
509 #[doc = "Bits 0:2 - Shifter Mode"]
510 #[inline(always)]
511 pub fn smod(&mut self) -> SMOD_W {
512 SMOD_W { w: self }
513 }
514 #[doc = "Bit 7 - Shifter Pin Polarity"]
515 #[inline(always)]
516 pub fn pinpol(&mut self) -> PINPOL_W {
517 PINPOL_W { w: self }
518 }
519 #[doc = "Bits 8:10 - Shifter Pin Select"]
520 #[inline(always)]
521 pub fn pinsel(&mut self) -> PINSEL_W {
522 PINSEL_W { w: self }
523 }
524 #[doc = "Bits 16:17 - Shifter Pin Configuration"]
525 #[inline(always)]
526 pub fn pincfg(&mut self) -> PINCFG_W {
527 PINCFG_W { w: self }
528 }
529 #[doc = "Bit 23 - Timer Polarity"]
530 #[inline(always)]
531 pub fn timpol(&mut self) -> TIMPOL_W {
532 TIMPOL_W { w: self }
533 }
534 #[doc = "Bits 24:25 - Timer Select"]
535 #[inline(always)]
536 pub fn timsel(&mut self) -> TIMSEL_W {
537 TIMSEL_W { w: self }
538 }
539 #[doc = "Writes raw bits to the register."]
540 #[inline(always)]
541 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
542 self.0.bits(bits);
543 self
544 }
545}
546#[doc = "Shifter Control N 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 [shiftctl2](index.html) module"]
547pub struct SHIFTCTL2_SPEC;
548impl crate::RegisterSpec for SHIFTCTL2_SPEC {
549 type Ux = u32;
550}
551#[doc = "`read()` method returns [shiftctl2::R](R) reader structure"]
552impl crate::Readable for SHIFTCTL2_SPEC {
553 type Reader = R;
554}
555#[doc = "`write(|w| ..)` method takes [shiftctl2::W](W) writer structure"]
556impl crate::Writable for SHIFTCTL2_SPEC {
557 type Writer = W;
558}
559#[doc = "`reset()` method sets SHIFTCTL2 to value 0"]
560impl crate::Resettable for SHIFTCTL2_SPEC {
561 #[inline(always)]
562 fn reset_value() -> Self::Ux {
563 0
564 }
565}