mimxrt595s/flexio0/
shiftctl.rs

1#[doc = "Register `SHIFTCTL[%s]` reader"]
2pub struct R(crate::R<SHIFTCTL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SHIFTCTL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SHIFTCTL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SHIFTCTL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SHIFTCTL[%s]` writer"]
17pub struct W(crate::W<SHIFTCTL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SHIFTCTL_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<SHIFTCTL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SHIFTCTL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SMOD` reader - Shifter Mode"]
38pub type SMOD_R = crate::FieldReader<u8, SMOD_A>;
39#[doc = "Shifter Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SMOD_A {
43    #[doc = "0: Disabled."]
44    DISABLE = 0,
45    #[doc = "1: Receive mode. Captures the current Shifter content into the SHIFTBUF on expiration of the Timer."]
46    RECEIVE = 1,
47    #[doc = "2: Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer."]
48    TRANSMIT = 2,
49    #[doc = "4: Match Store mode. Shifter data is compared to SHIFTBUF content on expiration of the Timer."]
50    MATCHSTORE = 4,
51    #[doc = "5: Match Continuous mode. Shifter data is continuously compared to SHIFTBUF contents."]
52    MATCHCONT = 5,
53    #[doc = "6: State mode. SHIFTBUF contents are used for storing programmable state attributes."]
54    STATE = 6,
55    #[doc = "7: Logic mode. SHIFTBUF contents are used for implementing programmable logic look up table."]
56    LOGIC = 7,
57}
58impl From<SMOD_A> for u8 {
59    #[inline(always)]
60    fn from(variant: SMOD_A) -> Self {
61        variant as _
62    }
63}
64impl SMOD_R {
65    #[doc = "Get enumerated values variant"]
66    #[inline(always)]
67    pub fn variant(&self) -> Option<SMOD_A> {
68        match self.bits {
69            0 => Some(SMOD_A::DISABLE),
70            1 => Some(SMOD_A::RECEIVE),
71            2 => Some(SMOD_A::TRANSMIT),
72            4 => Some(SMOD_A::MATCHSTORE),
73            5 => Some(SMOD_A::MATCHCONT),
74            6 => Some(SMOD_A::STATE),
75            7 => Some(SMOD_A::LOGIC),
76            _ => None,
77        }
78    }
79    #[doc = "Checks if the value of the field is `DISABLE`"]
80    #[inline(always)]
81    pub fn is_disable(&self) -> bool {
82        *self == SMOD_A::DISABLE
83    }
84    #[doc = "Checks if the value of the field is `RECEIVE`"]
85    #[inline(always)]
86    pub fn is_receive(&self) -> bool {
87        *self == SMOD_A::RECEIVE
88    }
89    #[doc = "Checks if the value of the field is `TRANSMIT`"]
90    #[inline(always)]
91    pub fn is_transmit(&self) -> bool {
92        *self == SMOD_A::TRANSMIT
93    }
94    #[doc = "Checks if the value of the field is `MATCHSTORE`"]
95    #[inline(always)]
96    pub fn is_matchstore(&self) -> bool {
97        *self == SMOD_A::MATCHSTORE
98    }
99    #[doc = "Checks if the value of the field is `MATCHCONT`"]
100    #[inline(always)]
101    pub fn is_matchcont(&self) -> bool {
102        *self == SMOD_A::MATCHCONT
103    }
104    #[doc = "Checks if the value of the field is `STATE`"]
105    #[inline(always)]
106    pub fn is_state(&self) -> bool {
107        *self == SMOD_A::STATE
108    }
109    #[doc = "Checks if the value of the field is `LOGIC`"]
110    #[inline(always)]
111    pub fn is_logic(&self) -> bool {
112        *self == SMOD_A::LOGIC
113    }
114}
115#[doc = "Field `SMOD` writer - Shifter Mode"]
116pub type SMOD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SHIFTCTL_SPEC, u8, SMOD_A, 3, O>;
117impl<'a, const O: u8> SMOD_W<'a, O> {
118    #[doc = "Disabled."]
119    #[inline(always)]
120    pub fn disable(self) -> &'a mut W {
121        self.variant(SMOD_A::DISABLE)
122    }
123    #[doc = "Receive mode. Captures the current Shifter content into the SHIFTBUF on expiration of the Timer."]
124    #[inline(always)]
125    pub fn receive(self) -> &'a mut W {
126        self.variant(SMOD_A::RECEIVE)
127    }
128    #[doc = "Transmit mode. Load SHIFTBUF contents into the Shifter on expiration of the Timer."]
129    #[inline(always)]
130    pub fn transmit(self) -> &'a mut W {
131        self.variant(SMOD_A::TRANSMIT)
132    }
133    #[doc = "Match Store mode. Shifter data is compared to SHIFTBUF content on expiration of the Timer."]
134    #[inline(always)]
135    pub fn matchstore(self) -> &'a mut W {
136        self.variant(SMOD_A::MATCHSTORE)
137    }
138    #[doc = "Match Continuous mode. Shifter data is continuously compared to SHIFTBUF contents."]
139    #[inline(always)]
140    pub fn matchcont(self) -> &'a mut W {
141        self.variant(SMOD_A::MATCHCONT)
142    }
143    #[doc = "State mode. SHIFTBUF contents are used for storing programmable state attributes."]
144    #[inline(always)]
145    pub fn state(self) -> &'a mut W {
146        self.variant(SMOD_A::STATE)
147    }
148    #[doc = "Logic mode. SHIFTBUF contents are used for implementing programmable logic look up table."]
149    #[inline(always)]
150    pub fn logic(self) -> &'a mut W {
151        self.variant(SMOD_A::LOGIC)
152    }
153}
154#[doc = "Field `PINPOL` reader - Shifter Pin Polarity"]
155pub type PINPOL_R = crate::BitReader<PINPOL_A>;
156#[doc = "Shifter Pin Polarity\n\nValue on reset: 0"]
157#[derive(Clone, Copy, Debug, PartialEq, Eq)]
158pub enum PINPOL_A {
159    #[doc = "0: Pin is active high"]
160    ACTIVE_HIGH = 0,
161    #[doc = "1: Pin is active low"]
162    ACTIVE_LOW = 1,
163}
164impl From<PINPOL_A> for bool {
165    #[inline(always)]
166    fn from(variant: PINPOL_A) -> Self {
167        variant as u8 != 0
168    }
169}
170impl PINPOL_R {
171    #[doc = "Get enumerated values variant"]
172    #[inline(always)]
173    pub fn variant(&self) -> PINPOL_A {
174        match self.bits {
175            false => PINPOL_A::ACTIVE_HIGH,
176            true => PINPOL_A::ACTIVE_LOW,
177        }
178    }
179    #[doc = "Checks if the value of the field is `ACTIVE_HIGH`"]
180    #[inline(always)]
181    pub fn is_active_high(&self) -> bool {
182        *self == PINPOL_A::ACTIVE_HIGH
183    }
184    #[doc = "Checks if the value of the field is `ACTIVE_LOW`"]
185    #[inline(always)]
186    pub fn is_active_low(&self) -> bool {
187        *self == PINPOL_A::ACTIVE_LOW
188    }
189}
190#[doc = "Field `PINPOL` writer - Shifter Pin Polarity"]
191pub type PINPOL_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHIFTCTL_SPEC, PINPOL_A, O>;
192impl<'a, const O: u8> PINPOL_W<'a, O> {
193    #[doc = "Pin is active high"]
194    #[inline(always)]
195    pub fn active_high(self) -> &'a mut W {
196        self.variant(PINPOL_A::ACTIVE_HIGH)
197    }
198    #[doc = "Pin is active low"]
199    #[inline(always)]
200    pub fn active_low(self) -> &'a mut W {
201        self.variant(PINPOL_A::ACTIVE_LOW)
202    }
203}
204#[doc = "Field `PINSEL` reader - Shifter Pin Select"]
205pub type PINSEL_R = crate::FieldReader<u8, u8>;
206#[doc = "Field `PINSEL` writer - Shifter Pin Select"]
207pub type PINSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SHIFTCTL_SPEC, u8, u8, 4, O>;
208#[doc = "Field `PINCFG` reader - Shifter Pin Configuration"]
209pub type PINCFG_R = crate::FieldReader<u8, PINCFG_A>;
210#[doc = "Shifter Pin Configuration\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq, Eq)]
212#[repr(u8)]
213pub enum PINCFG_A {
214    #[doc = "0: Shifter pin output disabled"]
215    DISABLE = 0,
216    #[doc = "1: Shifter pin open drain or bidirectional output enable"]
217    OPEND_BIDIROUTEN = 1,
218    #[doc = "2: Shifter pin bidirectional output data"]
219    BIDIR_OUTDATA = 2,
220    #[doc = "3: Shifter pin output"]
221    OUTPUT = 3,
222}
223impl From<PINCFG_A> for u8 {
224    #[inline(always)]
225    fn from(variant: PINCFG_A) -> Self {
226        variant as _
227    }
228}
229impl PINCFG_R {
230    #[doc = "Get enumerated values variant"]
231    #[inline(always)]
232    pub fn variant(&self) -> PINCFG_A {
233        match self.bits {
234            0 => PINCFG_A::DISABLE,
235            1 => PINCFG_A::OPEND_BIDIROUTEN,
236            2 => PINCFG_A::BIDIR_OUTDATA,
237            3 => PINCFG_A::OUTPUT,
238            _ => unreachable!(),
239        }
240    }
241    #[doc = "Checks if the value of the field is `DISABLE`"]
242    #[inline(always)]
243    pub fn is_disable(&self) -> bool {
244        *self == PINCFG_A::DISABLE
245    }
246    #[doc = "Checks if the value of the field is `OPEND_BIDIROUTEN`"]
247    #[inline(always)]
248    pub fn is_opend_bidirouten(&self) -> bool {
249        *self == PINCFG_A::OPEND_BIDIROUTEN
250    }
251    #[doc = "Checks if the value of the field is `BIDIR_OUTDATA`"]
252    #[inline(always)]
253    pub fn is_bidir_outdata(&self) -> bool {
254        *self == PINCFG_A::BIDIR_OUTDATA
255    }
256    #[doc = "Checks if the value of the field is `OUTPUT`"]
257    #[inline(always)]
258    pub fn is_output(&self) -> bool {
259        *self == PINCFG_A::OUTPUT
260    }
261}
262#[doc = "Field `PINCFG` writer - Shifter Pin Configuration"]
263pub type PINCFG_W<'a, const O: u8> =
264    crate::FieldWriterSafe<'a, u32, SHIFTCTL_SPEC, u8, PINCFG_A, 2, O>;
265impl<'a, const O: u8> PINCFG_W<'a, O> {
266    #[doc = "Shifter pin output disabled"]
267    #[inline(always)]
268    pub fn disable(self) -> &'a mut W {
269        self.variant(PINCFG_A::DISABLE)
270    }
271    #[doc = "Shifter pin open drain or bidirectional output enable"]
272    #[inline(always)]
273    pub fn opend_bidirouten(self) -> &'a mut W {
274        self.variant(PINCFG_A::OPEND_BIDIROUTEN)
275    }
276    #[doc = "Shifter pin bidirectional output data"]
277    #[inline(always)]
278    pub fn bidir_outdata(self) -> &'a mut W {
279        self.variant(PINCFG_A::BIDIR_OUTDATA)
280    }
281    #[doc = "Shifter pin output"]
282    #[inline(always)]
283    pub fn output(self) -> &'a mut W {
284        self.variant(PINCFG_A::OUTPUT)
285    }
286}
287#[doc = "Field `TIMPOL` reader - Timer Polarity"]
288pub type TIMPOL_R = crate::BitReader<TIMPOL_A>;
289#[doc = "Timer Polarity\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum TIMPOL_A {
292    #[doc = "0: Shift on posedge of Shift clock"]
293    POSEDGE = 0,
294    #[doc = "1: Shift on negedge of Shift clock"]
295    NEGEDGE = 1,
296}
297impl From<TIMPOL_A> for bool {
298    #[inline(always)]
299    fn from(variant: TIMPOL_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl TIMPOL_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> TIMPOL_A {
307        match self.bits {
308            false => TIMPOL_A::POSEDGE,
309            true => TIMPOL_A::NEGEDGE,
310        }
311    }
312    #[doc = "Checks if the value of the field is `POSEDGE`"]
313    #[inline(always)]
314    pub fn is_posedge(&self) -> bool {
315        *self == TIMPOL_A::POSEDGE
316    }
317    #[doc = "Checks if the value of the field is `NEGEDGE`"]
318    #[inline(always)]
319    pub fn is_negedge(&self) -> bool {
320        *self == TIMPOL_A::NEGEDGE
321    }
322}
323#[doc = "Field `TIMPOL` writer - Timer Polarity"]
324pub type TIMPOL_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHIFTCTL_SPEC, TIMPOL_A, O>;
325impl<'a, const O: u8> TIMPOL_W<'a, O> {
326    #[doc = "Shift on posedge of Shift clock"]
327    #[inline(always)]
328    pub fn posedge(self) -> &'a mut W {
329        self.variant(TIMPOL_A::POSEDGE)
330    }
331    #[doc = "Shift on negedge of Shift clock"]
332    #[inline(always)]
333    pub fn negedge(self) -> &'a mut W {
334        self.variant(TIMPOL_A::NEGEDGE)
335    }
336}
337#[doc = "Field `TIMSEL` reader - Timer Select"]
338pub type TIMSEL_R = crate::FieldReader<u8, u8>;
339#[doc = "Field `TIMSEL` writer - Timer Select"]
340pub type TIMSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SHIFTCTL_SPEC, u8, u8, 3, O>;
341impl R {
342    #[doc = "Bits 0:2 - Shifter Mode"]
343    #[inline(always)]
344    pub fn smod(&self) -> SMOD_R {
345        SMOD_R::new((self.bits & 7) as u8)
346    }
347    #[doc = "Bit 7 - Shifter Pin Polarity"]
348    #[inline(always)]
349    pub fn pinpol(&self) -> PINPOL_R {
350        PINPOL_R::new(((self.bits >> 7) & 1) != 0)
351    }
352    #[doc = "Bits 8:11 - Shifter Pin Select"]
353    #[inline(always)]
354    pub fn pinsel(&self) -> PINSEL_R {
355        PINSEL_R::new(((self.bits >> 8) & 0x0f) as u8)
356    }
357    #[doc = "Bits 16:17 - Shifter Pin Configuration"]
358    #[inline(always)]
359    pub fn pincfg(&self) -> PINCFG_R {
360        PINCFG_R::new(((self.bits >> 16) & 3) as u8)
361    }
362    #[doc = "Bit 23 - Timer Polarity"]
363    #[inline(always)]
364    pub fn timpol(&self) -> TIMPOL_R {
365        TIMPOL_R::new(((self.bits >> 23) & 1) != 0)
366    }
367    #[doc = "Bits 24:26 - Timer Select"]
368    #[inline(always)]
369    pub fn timsel(&self) -> TIMSEL_R {
370        TIMSEL_R::new(((self.bits >> 24) & 7) as u8)
371    }
372}
373impl W {
374    #[doc = "Bits 0:2 - Shifter Mode"]
375    #[inline(always)]
376    #[must_use]
377    pub fn smod(&mut self) -> SMOD_W<0> {
378        SMOD_W::new(self)
379    }
380    #[doc = "Bit 7 - Shifter Pin Polarity"]
381    #[inline(always)]
382    #[must_use]
383    pub fn pinpol(&mut self) -> PINPOL_W<7> {
384        PINPOL_W::new(self)
385    }
386    #[doc = "Bits 8:11 - Shifter Pin Select"]
387    #[inline(always)]
388    #[must_use]
389    pub fn pinsel(&mut self) -> PINSEL_W<8> {
390        PINSEL_W::new(self)
391    }
392    #[doc = "Bits 16:17 - Shifter Pin Configuration"]
393    #[inline(always)]
394    #[must_use]
395    pub fn pincfg(&mut self) -> PINCFG_W<16> {
396        PINCFG_W::new(self)
397    }
398    #[doc = "Bit 23 - Timer Polarity"]
399    #[inline(always)]
400    #[must_use]
401    pub fn timpol(&mut self) -> TIMPOL_W<23> {
402        TIMPOL_W::new(self)
403    }
404    #[doc = "Bits 24:26 - Timer Select"]
405    #[inline(always)]
406    #[must_use]
407    pub fn timsel(&mut self) -> TIMSEL_W<24> {
408        TIMSEL_W::new(self)
409    }
410    #[doc = "Writes raw bits to the register."]
411    #[inline(always)]
412    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
413        self.0.bits(bits);
414        self
415    }
416}
417#[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 [shiftctl](index.html) module"]
418pub struct SHIFTCTL_SPEC;
419impl crate::RegisterSpec for SHIFTCTL_SPEC {
420    type Ux = u32;
421}
422#[doc = "`read()` method returns [shiftctl::R](R) reader structure"]
423impl crate::Readable for SHIFTCTL_SPEC {
424    type Reader = R;
425}
426#[doc = "`write(|w| ..)` method takes [shiftctl::W](W) writer structure"]
427impl crate::Writable for SHIFTCTL_SPEC {
428    type Writer = W;
429    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
430    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
431}
432#[doc = "`reset()` method sets SHIFTCTL[%s]
433to value 0"]
434impl crate::Resettable for SHIFTCTL_SPEC {
435    const RESET_VALUE: Self::Ux = 0;
436}