mimxrt595s/flexio0/
shiftcfg.rs

1#[doc = "Register `SHIFTCFG[%s]` reader"]
2pub struct R(crate::R<SHIFTCFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SHIFTCFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SHIFTCFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SHIFTCFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SHIFTCFG[%s]` writer"]
17pub struct W(crate::W<SHIFTCFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SHIFTCFG_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<SHIFTCFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SHIFTCFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SSTART` reader - Shifter Start bit"]
38pub type SSTART_R = crate::FieldReader<u8, SSTART_A>;
39#[doc = "Shifter Start bit\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SSTART_A {
43    #[doc = "0: Start bit disabled for transmitter/receiver/match store, transmitter loads data on enable"]
44    VALUE00 = 0,
45    #[doc = "1: Start bit disabled for transmitter/receiver/match store, transmitter loads data on first shift"]
46    VALUE01 = 1,
47    #[doc = "2: Transmitter outputs start bit value 0 before loading data on first shift, receiver/match store sets error flag if start bit is not 0"]
48    VALUE10 = 2,
49    #[doc = "3: Transmitter outputs start bit value 1 before loading data on first shift, receiver/match store sets error flag if start bit is not 1"]
50    VALUE11 = 3,
51}
52impl From<SSTART_A> for u8 {
53    #[inline(always)]
54    fn from(variant: SSTART_A) -> Self {
55        variant as _
56    }
57}
58impl SSTART_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> SSTART_A {
62        match self.bits {
63            0 => SSTART_A::VALUE00,
64            1 => SSTART_A::VALUE01,
65            2 => SSTART_A::VALUE10,
66            3 => SSTART_A::VALUE11,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `VALUE00`"]
71    #[inline(always)]
72    pub fn is_value00(&self) -> bool {
73        *self == SSTART_A::VALUE00
74    }
75    #[doc = "Checks if the value of the field is `VALUE01`"]
76    #[inline(always)]
77    pub fn is_value01(&self) -> bool {
78        *self == SSTART_A::VALUE01
79    }
80    #[doc = "Checks if the value of the field is `VALUE10`"]
81    #[inline(always)]
82    pub fn is_value10(&self) -> bool {
83        *self == SSTART_A::VALUE10
84    }
85    #[doc = "Checks if the value of the field is `VALUE11`"]
86    #[inline(always)]
87    pub fn is_value11(&self) -> bool {
88        *self == SSTART_A::VALUE11
89    }
90}
91#[doc = "Field `SSTART` writer - Shifter Start bit"]
92pub type SSTART_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, SHIFTCFG_SPEC, u8, SSTART_A, 2, O>;
94impl<'a, const O: u8> SSTART_W<'a, O> {
95    #[doc = "Start bit disabled for transmitter/receiver/match store, transmitter loads data on enable"]
96    #[inline(always)]
97    pub fn value00(self) -> &'a mut W {
98        self.variant(SSTART_A::VALUE00)
99    }
100    #[doc = "Start bit disabled for transmitter/receiver/match store, transmitter loads data on first shift"]
101    #[inline(always)]
102    pub fn value01(self) -> &'a mut W {
103        self.variant(SSTART_A::VALUE01)
104    }
105    #[doc = "Transmitter outputs start bit value 0 before loading data on first shift, receiver/match store sets error flag if start bit is not 0"]
106    #[inline(always)]
107    pub fn value10(self) -> &'a mut W {
108        self.variant(SSTART_A::VALUE10)
109    }
110    #[doc = "Transmitter outputs start bit value 1 before loading data on first shift, receiver/match store sets error flag if start bit is not 1"]
111    #[inline(always)]
112    pub fn value11(self) -> &'a mut W {
113        self.variant(SSTART_A::VALUE11)
114    }
115}
116#[doc = "Field `SSTOP` reader - Shifter Stop bit"]
117pub type SSTOP_R = crate::FieldReader<u8, SSTOP_A>;
118#[doc = "Shifter Stop bit\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum SSTOP_A {
122    #[doc = "0: Stop bit disabled for transmitter/receiver/match store"]
123    VALUE00 = 0,
124    #[doc = "1: Stop bit disabled for transmitter/receiver/match store, receiver/match store will store receive data on the configured shift edge when timer in stop condition"]
125    VALUE01 = 1,
126    #[doc = "2: Transmitter outputs stop bit value 0 on store, receiver/match store sets error flag if stop bit is not 0, receiver/match store will also store receive data on the configured shift edge when timer in stop condition"]
127    VALUE10 = 2,
128    #[doc = "3: Transmitter outputs stop bit value 1 on store, receiver/match store sets error flag if stop bit is not 1, receiver/match store will also store receive data on the configured shift edge when timer in stop condition"]
129    VALUE11 = 3,
130}
131impl From<SSTOP_A> for u8 {
132    #[inline(always)]
133    fn from(variant: SSTOP_A) -> Self {
134        variant as _
135    }
136}
137impl SSTOP_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> SSTOP_A {
141        match self.bits {
142            0 => SSTOP_A::VALUE00,
143            1 => SSTOP_A::VALUE01,
144            2 => SSTOP_A::VALUE10,
145            3 => SSTOP_A::VALUE11,
146            _ => unreachable!(),
147        }
148    }
149    #[doc = "Checks if the value of the field is `VALUE00`"]
150    #[inline(always)]
151    pub fn is_value00(&self) -> bool {
152        *self == SSTOP_A::VALUE00
153    }
154    #[doc = "Checks if the value of the field is `VALUE01`"]
155    #[inline(always)]
156    pub fn is_value01(&self) -> bool {
157        *self == SSTOP_A::VALUE01
158    }
159    #[doc = "Checks if the value of the field is `VALUE10`"]
160    #[inline(always)]
161    pub fn is_value10(&self) -> bool {
162        *self == SSTOP_A::VALUE10
163    }
164    #[doc = "Checks if the value of the field is `VALUE11`"]
165    #[inline(always)]
166    pub fn is_value11(&self) -> bool {
167        *self == SSTOP_A::VALUE11
168    }
169}
170#[doc = "Field `SSTOP` writer - Shifter Stop bit"]
171pub type SSTOP_W<'a, const O: u8> =
172    crate::FieldWriterSafe<'a, u32, SHIFTCFG_SPEC, u8, SSTOP_A, 2, O>;
173impl<'a, const O: u8> SSTOP_W<'a, O> {
174    #[doc = "Stop bit disabled for transmitter/receiver/match store"]
175    #[inline(always)]
176    pub fn value00(self) -> &'a mut W {
177        self.variant(SSTOP_A::VALUE00)
178    }
179    #[doc = "Stop bit disabled for transmitter/receiver/match store, receiver/match store will store receive data on the configured shift edge when timer in stop condition"]
180    #[inline(always)]
181    pub fn value01(self) -> &'a mut W {
182        self.variant(SSTOP_A::VALUE01)
183    }
184    #[doc = "Transmitter outputs stop bit value 0 on store, receiver/match store sets error flag if stop bit is not 0, receiver/match store will also store receive data on the configured shift edge when timer in stop condition"]
185    #[inline(always)]
186    pub fn value10(self) -> &'a mut W {
187        self.variant(SSTOP_A::VALUE10)
188    }
189    #[doc = "Transmitter outputs stop bit value 1 on store, receiver/match store sets error flag if stop bit is not 1, receiver/match store will also store receive data on the configured shift edge when timer in stop condition"]
190    #[inline(always)]
191    pub fn value11(self) -> &'a mut W {
192        self.variant(SSTOP_A::VALUE11)
193    }
194}
195#[doc = "Field `INSRC` reader - Input Source"]
196pub type INSRC_R = crate::BitReader<INSRC_A>;
197#[doc = "Input Source\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199pub enum INSRC_A {
200    #[doc = "0: Pin"]
201    PIN = 0,
202    #[doc = "1: Shifter N+1 Output"]
203    SHIFTER_NPLUS1 = 1,
204}
205impl From<INSRC_A> for bool {
206    #[inline(always)]
207    fn from(variant: INSRC_A) -> Self {
208        variant as u8 != 0
209    }
210}
211impl INSRC_R {
212    #[doc = "Get enumerated values variant"]
213    #[inline(always)]
214    pub fn variant(&self) -> INSRC_A {
215        match self.bits {
216            false => INSRC_A::PIN,
217            true => INSRC_A::SHIFTER_NPLUS1,
218        }
219    }
220    #[doc = "Checks if the value of the field is `PIN`"]
221    #[inline(always)]
222    pub fn is_pin(&self) -> bool {
223        *self == INSRC_A::PIN
224    }
225    #[doc = "Checks if the value of the field is `SHIFTER_NPLUS1`"]
226    #[inline(always)]
227    pub fn is_shifter_nplus1(&self) -> bool {
228        *self == INSRC_A::SHIFTER_NPLUS1
229    }
230}
231#[doc = "Field `INSRC` writer - Input Source"]
232pub type INSRC_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHIFTCFG_SPEC, INSRC_A, O>;
233impl<'a, const O: u8> INSRC_W<'a, O> {
234    #[doc = "Pin"]
235    #[inline(always)]
236    pub fn pin(self) -> &'a mut W {
237        self.variant(INSRC_A::PIN)
238    }
239    #[doc = "Shifter N+1 Output"]
240    #[inline(always)]
241    pub fn shifter_nplus1(self) -> &'a mut W {
242        self.variant(INSRC_A::SHIFTER_NPLUS1)
243    }
244}
245#[doc = "Field `LATST` reader - Late Store"]
246pub type LATST_R = crate::BitReader<LATST_A>;
247#[doc = "Late Store\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq, Eq)]
249pub enum LATST_A {
250    #[doc = "0: Shift register stores the pre-shift register state."]
251    PRESHIFT = 0,
252    #[doc = "1: Shift register stores the post-shift register state."]
253    POSTSHIFT = 1,
254}
255impl From<LATST_A> for bool {
256    #[inline(always)]
257    fn from(variant: LATST_A) -> Self {
258        variant as u8 != 0
259    }
260}
261impl LATST_R {
262    #[doc = "Get enumerated values variant"]
263    #[inline(always)]
264    pub fn variant(&self) -> LATST_A {
265        match self.bits {
266            false => LATST_A::PRESHIFT,
267            true => LATST_A::POSTSHIFT,
268        }
269    }
270    #[doc = "Checks if the value of the field is `PRESHIFT`"]
271    #[inline(always)]
272    pub fn is_preshift(&self) -> bool {
273        *self == LATST_A::PRESHIFT
274    }
275    #[doc = "Checks if the value of the field is `POSTSHIFT`"]
276    #[inline(always)]
277    pub fn is_postshift(&self) -> bool {
278        *self == LATST_A::POSTSHIFT
279    }
280}
281#[doc = "Field `LATST` writer - Late Store"]
282pub type LATST_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHIFTCFG_SPEC, LATST_A, O>;
283impl<'a, const O: u8> LATST_W<'a, O> {
284    #[doc = "Shift register stores the pre-shift register state."]
285    #[inline(always)]
286    pub fn preshift(self) -> &'a mut W {
287        self.variant(LATST_A::PRESHIFT)
288    }
289    #[doc = "Shift register stores the post-shift register state."]
290    #[inline(always)]
291    pub fn postshift(self) -> &'a mut W {
292        self.variant(LATST_A::POSTSHIFT)
293    }
294}
295#[doc = "Field `SSIZE` reader - Shifter Size"]
296pub type SSIZE_R = crate::BitReader<SSIZE_A>;
297#[doc = "Shifter Size\n\nValue on reset: 0"]
298#[derive(Clone, Copy, Debug, PartialEq, Eq)]
299pub enum SSIZE_A {
300    #[doc = "0: Shift register is 32-bit."]
301    WIDTH32 = 0,
302    #[doc = "1: Shift register is 24-bit."]
303    WIDTH24 = 1,
304}
305impl From<SSIZE_A> for bool {
306    #[inline(always)]
307    fn from(variant: SSIZE_A) -> Self {
308        variant as u8 != 0
309    }
310}
311impl SSIZE_R {
312    #[doc = "Get enumerated values variant"]
313    #[inline(always)]
314    pub fn variant(&self) -> SSIZE_A {
315        match self.bits {
316            false => SSIZE_A::WIDTH32,
317            true => SSIZE_A::WIDTH24,
318        }
319    }
320    #[doc = "Checks if the value of the field is `WIDTH32`"]
321    #[inline(always)]
322    pub fn is_width32(&self) -> bool {
323        *self == SSIZE_A::WIDTH32
324    }
325    #[doc = "Checks if the value of the field is `WIDTH24`"]
326    #[inline(always)]
327    pub fn is_width24(&self) -> bool {
328        *self == SSIZE_A::WIDTH24
329    }
330}
331#[doc = "Field `SSIZE` writer - Shifter Size"]
332pub type SSIZE_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHIFTCFG_SPEC, SSIZE_A, O>;
333impl<'a, const O: u8> SSIZE_W<'a, O> {
334    #[doc = "Shift register is 32-bit."]
335    #[inline(always)]
336    pub fn width32(self) -> &'a mut W {
337        self.variant(SSIZE_A::WIDTH32)
338    }
339    #[doc = "Shift register is 24-bit."]
340    #[inline(always)]
341    pub fn width24(self) -> &'a mut W {
342        self.variant(SSIZE_A::WIDTH24)
343    }
344}
345#[doc = "Field `PWIDTH` reader - Parallel Width"]
346pub type PWIDTH_R = crate::FieldReader<u8, u8>;
347#[doc = "Field `PWIDTH` writer - Parallel Width"]
348pub type PWIDTH_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SHIFTCFG_SPEC, u8, u8, 4, O>;
349impl R {
350    #[doc = "Bits 0:1 - Shifter Start bit"]
351    #[inline(always)]
352    pub fn sstart(&self) -> SSTART_R {
353        SSTART_R::new((self.bits & 3) as u8)
354    }
355    #[doc = "Bits 4:5 - Shifter Stop bit"]
356    #[inline(always)]
357    pub fn sstop(&self) -> SSTOP_R {
358        SSTOP_R::new(((self.bits >> 4) & 3) as u8)
359    }
360    #[doc = "Bit 8 - Input Source"]
361    #[inline(always)]
362    pub fn insrc(&self) -> INSRC_R {
363        INSRC_R::new(((self.bits >> 8) & 1) != 0)
364    }
365    #[doc = "Bit 9 - Late Store"]
366    #[inline(always)]
367    pub fn latst(&self) -> LATST_R {
368        LATST_R::new(((self.bits >> 9) & 1) != 0)
369    }
370    #[doc = "Bit 12 - Shifter Size"]
371    #[inline(always)]
372    pub fn ssize(&self) -> SSIZE_R {
373        SSIZE_R::new(((self.bits >> 12) & 1) != 0)
374    }
375    #[doc = "Bits 16:19 - Parallel Width"]
376    #[inline(always)]
377    pub fn pwidth(&self) -> PWIDTH_R {
378        PWIDTH_R::new(((self.bits >> 16) & 0x0f) as u8)
379    }
380}
381impl W {
382    #[doc = "Bits 0:1 - Shifter Start bit"]
383    #[inline(always)]
384    #[must_use]
385    pub fn sstart(&mut self) -> SSTART_W<0> {
386        SSTART_W::new(self)
387    }
388    #[doc = "Bits 4:5 - Shifter Stop bit"]
389    #[inline(always)]
390    #[must_use]
391    pub fn sstop(&mut self) -> SSTOP_W<4> {
392        SSTOP_W::new(self)
393    }
394    #[doc = "Bit 8 - Input Source"]
395    #[inline(always)]
396    #[must_use]
397    pub fn insrc(&mut self) -> INSRC_W<8> {
398        INSRC_W::new(self)
399    }
400    #[doc = "Bit 9 - Late Store"]
401    #[inline(always)]
402    #[must_use]
403    pub fn latst(&mut self) -> LATST_W<9> {
404        LATST_W::new(self)
405    }
406    #[doc = "Bit 12 - Shifter Size"]
407    #[inline(always)]
408    #[must_use]
409    pub fn ssize(&mut self) -> SSIZE_W<12> {
410        SSIZE_W::new(self)
411    }
412    #[doc = "Bits 16:19 - Parallel Width"]
413    #[inline(always)]
414    #[must_use]
415    pub fn pwidth(&mut self) -> PWIDTH_W<16> {
416        PWIDTH_W::new(self)
417    }
418    #[doc = "Writes raw bits to the register."]
419    #[inline(always)]
420    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
421        self.0.bits(bits);
422        self
423    }
424}
425#[doc = "Shifter Configuration 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 [shiftcfg](index.html) module"]
426pub struct SHIFTCFG_SPEC;
427impl crate::RegisterSpec for SHIFTCFG_SPEC {
428    type Ux = u32;
429}
430#[doc = "`read()` method returns [shiftcfg::R](R) reader structure"]
431impl crate::Readable for SHIFTCFG_SPEC {
432    type Reader = R;
433}
434#[doc = "`write(|w| ..)` method takes [shiftcfg::W](W) writer structure"]
435impl crate::Writable for SHIFTCFG_SPEC {
436    type Writer = W;
437    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
438    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
439}
440#[doc = "`reset()` method sets SHIFTCFG[%s]
441to value 0"]
442impl crate::Resettable for SHIFTCFG_SPEC {
443    const RESET_VALUE: Self::Ux = 0;
444}