rp2040/io_qspi/
gpio_qspi_ss_ctrl.rs

1#[doc = "Reader of register GPIO_QSPI_SS_CTRL"]
2pub type R = crate::R<u32, super::GPIO_QSPI_SS_CTRL>;
3#[doc = "Writer for register GPIO_QSPI_SS_CTRL"]
4pub type W = crate::W<u32, super::GPIO_QSPI_SS_CTRL>;
5#[doc = "Register GPIO_QSPI_SS_CTRL `reset()`'s with value 0x1f"]
6impl crate::ResetValue for super::GPIO_QSPI_SS_CTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x1f
11    }
12}
13#[doc = "\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum IRQOVER_A {
17    #[doc = "0: don't invert the interrupt"]
18    NORMAL = 0,
19    #[doc = "1: invert the interrupt"]
20    INVERT = 1,
21    #[doc = "2: drive interrupt low"]
22    LOW = 2,
23    #[doc = "3: drive interrupt high"]
24    HIGH = 3,
25}
26impl From<IRQOVER_A> for u8 {
27    #[inline(always)]
28    fn from(variant: IRQOVER_A) -> Self {
29        variant as _
30    }
31}
32#[doc = "Reader of field `IRQOVER`"]
33pub type IRQOVER_R = crate::R<u8, IRQOVER_A>;
34impl IRQOVER_R {
35    #[doc = r"Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> IRQOVER_A {
38        match self.bits {
39            0 => IRQOVER_A::NORMAL,
40            1 => IRQOVER_A::INVERT,
41            2 => IRQOVER_A::LOW,
42            3 => IRQOVER_A::HIGH,
43            _ => unreachable!(),
44        }
45    }
46    #[doc = "Checks if the value of the field is `NORMAL`"]
47    #[inline(always)]
48    pub fn is_normal(&self) -> bool {
49        *self == IRQOVER_A::NORMAL
50    }
51    #[doc = "Checks if the value of the field is `INVERT`"]
52    #[inline(always)]
53    pub fn is_invert(&self) -> bool {
54        *self == IRQOVER_A::INVERT
55    }
56    #[doc = "Checks if the value of the field is `LOW`"]
57    #[inline(always)]
58    pub fn is_low(&self) -> bool {
59        *self == IRQOVER_A::LOW
60    }
61    #[doc = "Checks if the value of the field is `HIGH`"]
62    #[inline(always)]
63    pub fn is_high(&self) -> bool {
64        *self == IRQOVER_A::HIGH
65    }
66}
67#[doc = "Write proxy for field `IRQOVER`"]
68pub struct IRQOVER_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> IRQOVER_W<'a> {
72    #[doc = r"Writes `variant` to the field"]
73    #[inline(always)]
74    pub fn variant(self, variant: IRQOVER_A) -> &'a mut W {
75        {
76            self.bits(variant.into())
77        }
78    }
79    #[doc = "don't invert the interrupt"]
80    #[inline(always)]
81    pub fn normal(self) -> &'a mut W {
82        self.variant(IRQOVER_A::NORMAL)
83    }
84    #[doc = "invert the interrupt"]
85    #[inline(always)]
86    pub fn invert(self) -> &'a mut W {
87        self.variant(IRQOVER_A::INVERT)
88    }
89    #[doc = "drive interrupt low"]
90    #[inline(always)]
91    pub fn low(self) -> &'a mut W {
92        self.variant(IRQOVER_A::LOW)
93    }
94    #[doc = "drive interrupt high"]
95    #[inline(always)]
96    pub fn high(self) -> &'a mut W {
97        self.variant(IRQOVER_A::HIGH)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !(0x03 << 28)) | (((value as u32) & 0x03) << 28);
103        self.w
104    }
105}
106#[doc = "\n\nValue on reset: 0"]
107#[derive(Clone, Copy, Debug, PartialEq)]
108#[repr(u8)]
109pub enum INOVER_A {
110    #[doc = "0: don't invert the peri input"]
111    NORMAL = 0,
112    #[doc = "1: invert the peri input"]
113    INVERT = 1,
114    #[doc = "2: drive peri input low"]
115    LOW = 2,
116    #[doc = "3: drive peri input high"]
117    HIGH = 3,
118}
119impl From<INOVER_A> for u8 {
120    #[inline(always)]
121    fn from(variant: INOVER_A) -> Self {
122        variant as _
123    }
124}
125#[doc = "Reader of field `INOVER`"]
126pub type INOVER_R = crate::R<u8, INOVER_A>;
127impl INOVER_R {
128    #[doc = r"Get enumerated values variant"]
129    #[inline(always)]
130    pub fn variant(&self) -> INOVER_A {
131        match self.bits {
132            0 => INOVER_A::NORMAL,
133            1 => INOVER_A::INVERT,
134            2 => INOVER_A::LOW,
135            3 => INOVER_A::HIGH,
136            _ => unreachable!(),
137        }
138    }
139    #[doc = "Checks if the value of the field is `NORMAL`"]
140    #[inline(always)]
141    pub fn is_normal(&self) -> bool {
142        *self == INOVER_A::NORMAL
143    }
144    #[doc = "Checks if the value of the field is `INVERT`"]
145    #[inline(always)]
146    pub fn is_invert(&self) -> bool {
147        *self == INOVER_A::INVERT
148    }
149    #[doc = "Checks if the value of the field is `LOW`"]
150    #[inline(always)]
151    pub fn is_low(&self) -> bool {
152        *self == INOVER_A::LOW
153    }
154    #[doc = "Checks if the value of the field is `HIGH`"]
155    #[inline(always)]
156    pub fn is_high(&self) -> bool {
157        *self == INOVER_A::HIGH
158    }
159}
160#[doc = "Write proxy for field `INOVER`"]
161pub struct INOVER_W<'a> {
162    w: &'a mut W,
163}
164impl<'a> INOVER_W<'a> {
165    #[doc = r"Writes `variant` to the field"]
166    #[inline(always)]
167    pub fn variant(self, variant: INOVER_A) -> &'a mut W {
168        {
169            self.bits(variant.into())
170        }
171    }
172    #[doc = "don't invert the peri input"]
173    #[inline(always)]
174    pub fn normal(self) -> &'a mut W {
175        self.variant(INOVER_A::NORMAL)
176    }
177    #[doc = "invert the peri input"]
178    #[inline(always)]
179    pub fn invert(self) -> &'a mut W {
180        self.variant(INOVER_A::INVERT)
181    }
182    #[doc = "drive peri input low"]
183    #[inline(always)]
184    pub fn low(self) -> &'a mut W {
185        self.variant(INOVER_A::LOW)
186    }
187    #[doc = "drive peri input high"]
188    #[inline(always)]
189    pub fn high(self) -> &'a mut W {
190        self.variant(INOVER_A::HIGH)
191    }
192    #[doc = r"Writes raw bits to the field"]
193    #[inline(always)]
194    pub fn bits(self, value: u8) -> &'a mut W {
195        self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
196        self.w
197    }
198}
199#[doc = "\n\nValue on reset: 0"]
200#[derive(Clone, Copy, Debug, PartialEq)]
201#[repr(u8)]
202pub enum OEOVER_A {
203    #[doc = "0: drive output enable from peripheral signal selected by funcsel"]
204    NORMAL = 0,
205    #[doc = "1: drive output enable from inverse of peripheral signal selected by funcsel"]
206    INVERT = 1,
207    #[doc = "2: disable output"]
208    DISABLE = 2,
209    #[doc = "3: enable output"]
210    ENABLE = 3,
211}
212impl From<OEOVER_A> for u8 {
213    #[inline(always)]
214    fn from(variant: OEOVER_A) -> Self {
215        variant as _
216    }
217}
218#[doc = "Reader of field `OEOVER`"]
219pub type OEOVER_R = crate::R<u8, OEOVER_A>;
220impl OEOVER_R {
221    #[doc = r"Get enumerated values variant"]
222    #[inline(always)]
223    pub fn variant(&self) -> OEOVER_A {
224        match self.bits {
225            0 => OEOVER_A::NORMAL,
226            1 => OEOVER_A::INVERT,
227            2 => OEOVER_A::DISABLE,
228            3 => OEOVER_A::ENABLE,
229            _ => unreachable!(),
230        }
231    }
232    #[doc = "Checks if the value of the field is `NORMAL`"]
233    #[inline(always)]
234    pub fn is_normal(&self) -> bool {
235        *self == OEOVER_A::NORMAL
236    }
237    #[doc = "Checks if the value of the field is `INVERT`"]
238    #[inline(always)]
239    pub fn is_invert(&self) -> bool {
240        *self == OEOVER_A::INVERT
241    }
242    #[doc = "Checks if the value of the field is `DISABLE`"]
243    #[inline(always)]
244    pub fn is_disable(&self) -> bool {
245        *self == OEOVER_A::DISABLE
246    }
247    #[doc = "Checks if the value of the field is `ENABLE`"]
248    #[inline(always)]
249    pub fn is_enable(&self) -> bool {
250        *self == OEOVER_A::ENABLE
251    }
252}
253#[doc = "Write proxy for field `OEOVER`"]
254pub struct OEOVER_W<'a> {
255    w: &'a mut W,
256}
257impl<'a> OEOVER_W<'a> {
258    #[doc = r"Writes `variant` to the field"]
259    #[inline(always)]
260    pub fn variant(self, variant: OEOVER_A) -> &'a mut W {
261        {
262            self.bits(variant.into())
263        }
264    }
265    #[doc = "drive output enable from peripheral signal selected by funcsel"]
266    #[inline(always)]
267    pub fn normal(self) -> &'a mut W {
268        self.variant(OEOVER_A::NORMAL)
269    }
270    #[doc = "drive output enable from inverse of peripheral signal selected by funcsel"]
271    #[inline(always)]
272    pub fn invert(self) -> &'a mut W {
273        self.variant(OEOVER_A::INVERT)
274    }
275    #[doc = "disable output"]
276    #[inline(always)]
277    pub fn disable(self) -> &'a mut W {
278        self.variant(OEOVER_A::DISABLE)
279    }
280    #[doc = "enable output"]
281    #[inline(always)]
282    pub fn enable(self) -> &'a mut W {
283        self.variant(OEOVER_A::ENABLE)
284    }
285    #[doc = r"Writes raw bits to the field"]
286    #[inline(always)]
287    pub fn bits(self, value: u8) -> &'a mut W {
288        self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
289        self.w
290    }
291}
292#[doc = "\n\nValue on reset: 0"]
293#[derive(Clone, Copy, Debug, PartialEq)]
294#[repr(u8)]
295pub enum OUTOVER_A {
296    #[doc = "0: drive output from peripheral signal selected by funcsel"]
297    NORMAL = 0,
298    #[doc = "1: drive output from inverse of peripheral signal selected by funcsel"]
299    INVERT = 1,
300    #[doc = "2: drive output low"]
301    LOW = 2,
302    #[doc = "3: drive output high"]
303    HIGH = 3,
304}
305impl From<OUTOVER_A> for u8 {
306    #[inline(always)]
307    fn from(variant: OUTOVER_A) -> Self {
308        variant as _
309    }
310}
311#[doc = "Reader of field `OUTOVER`"]
312pub type OUTOVER_R = crate::R<u8, OUTOVER_A>;
313impl OUTOVER_R {
314    #[doc = r"Get enumerated values variant"]
315    #[inline(always)]
316    pub fn variant(&self) -> OUTOVER_A {
317        match self.bits {
318            0 => OUTOVER_A::NORMAL,
319            1 => OUTOVER_A::INVERT,
320            2 => OUTOVER_A::LOW,
321            3 => OUTOVER_A::HIGH,
322            _ => unreachable!(),
323        }
324    }
325    #[doc = "Checks if the value of the field is `NORMAL`"]
326    #[inline(always)]
327    pub fn is_normal(&self) -> bool {
328        *self == OUTOVER_A::NORMAL
329    }
330    #[doc = "Checks if the value of the field is `INVERT`"]
331    #[inline(always)]
332    pub fn is_invert(&self) -> bool {
333        *self == OUTOVER_A::INVERT
334    }
335    #[doc = "Checks if the value of the field is `LOW`"]
336    #[inline(always)]
337    pub fn is_low(&self) -> bool {
338        *self == OUTOVER_A::LOW
339    }
340    #[doc = "Checks if the value of the field is `HIGH`"]
341    #[inline(always)]
342    pub fn is_high(&self) -> bool {
343        *self == OUTOVER_A::HIGH
344    }
345}
346#[doc = "Write proxy for field `OUTOVER`"]
347pub struct OUTOVER_W<'a> {
348    w: &'a mut W,
349}
350impl<'a> OUTOVER_W<'a> {
351    #[doc = r"Writes `variant` to the field"]
352    #[inline(always)]
353    pub fn variant(self, variant: OUTOVER_A) -> &'a mut W {
354        {
355            self.bits(variant.into())
356        }
357    }
358    #[doc = "drive output from peripheral signal selected by funcsel"]
359    #[inline(always)]
360    pub fn normal(self) -> &'a mut W {
361        self.variant(OUTOVER_A::NORMAL)
362    }
363    #[doc = "drive output from inverse of peripheral signal selected by funcsel"]
364    #[inline(always)]
365    pub fn invert(self) -> &'a mut W {
366        self.variant(OUTOVER_A::INVERT)
367    }
368    #[doc = "drive output low"]
369    #[inline(always)]
370    pub fn low(self) -> &'a mut W {
371        self.variant(OUTOVER_A::LOW)
372    }
373    #[doc = "drive output high"]
374    #[inline(always)]
375    pub fn high(self) -> &'a mut W {
376        self.variant(OUTOVER_A::HIGH)
377    }
378    #[doc = r"Writes raw bits to the field"]
379    #[inline(always)]
380    pub fn bits(self, value: u8) -> &'a mut W {
381        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
382        self.w
383    }
384}
385#[doc = "0-31 -> selects pin function according to the gpio table\\n 31 == NULL\n\nValue on reset: 31"]
386#[derive(Clone, Copy, Debug, PartialEq)]
387#[repr(u8)]
388pub enum FUNCSEL_A {
389    #[doc = "0: `0`"]
390    XIP_SS_N = 0,
391    #[doc = "5: `101`"]
392    SIO_31 = 5,
393    #[doc = "31: `11111`"]
394    NULL = 31,
395}
396impl From<FUNCSEL_A> for u8 {
397    #[inline(always)]
398    fn from(variant: FUNCSEL_A) -> Self {
399        variant as _
400    }
401}
402#[doc = "Reader of field `FUNCSEL`"]
403pub type FUNCSEL_R = crate::R<u8, FUNCSEL_A>;
404impl FUNCSEL_R {
405    #[doc = r"Get enumerated values variant"]
406    #[inline(always)]
407    pub fn variant(&self) -> crate::Variant<u8, FUNCSEL_A> {
408        use crate::Variant::*;
409        match self.bits {
410            0 => Val(FUNCSEL_A::XIP_SS_N),
411            5 => Val(FUNCSEL_A::SIO_31),
412            31 => Val(FUNCSEL_A::NULL),
413            i => Res(i),
414        }
415    }
416    #[doc = "Checks if the value of the field is `XIP_SS_N`"]
417    #[inline(always)]
418    pub fn is_xip_ss_n(&self) -> bool {
419        *self == FUNCSEL_A::XIP_SS_N
420    }
421    #[doc = "Checks if the value of the field is `SIO_31`"]
422    #[inline(always)]
423    pub fn is_sio_31(&self) -> bool {
424        *self == FUNCSEL_A::SIO_31
425    }
426    #[doc = "Checks if the value of the field is `NULL`"]
427    #[inline(always)]
428    pub fn is_null(&self) -> bool {
429        *self == FUNCSEL_A::NULL
430    }
431}
432#[doc = "Write proxy for field `FUNCSEL`"]
433pub struct FUNCSEL_W<'a> {
434    w: &'a mut W,
435}
436impl<'a> FUNCSEL_W<'a> {
437    #[doc = r"Writes `variant` to the field"]
438    #[inline(always)]
439    pub fn variant(self, variant: FUNCSEL_A) -> &'a mut W {
440        unsafe { self.bits(variant.into()) }
441    }
442    #[doc = "`0`"]
443    #[inline(always)]
444    pub fn xip_ss_n(self) -> &'a mut W {
445        self.variant(FUNCSEL_A::XIP_SS_N)
446    }
447    #[doc = "`101`"]
448    #[inline(always)]
449    pub fn sio_31(self) -> &'a mut W {
450        self.variant(FUNCSEL_A::SIO_31)
451    }
452    #[doc = "`11111`"]
453    #[inline(always)]
454    pub fn null(self) -> &'a mut W {
455        self.variant(FUNCSEL_A::NULL)
456    }
457    #[doc = r"Writes raw bits to the field"]
458    #[inline(always)]
459    pub unsafe fn bits(self, value: u8) -> &'a mut W {
460        self.w.bits = (self.w.bits & !0x1f) | ((value as u32) & 0x1f);
461        self.w
462    }
463}
464impl R {
465    #[doc = "Bits 28:29"]
466    #[inline(always)]
467    pub fn irqover(&self) -> IRQOVER_R {
468        IRQOVER_R::new(((self.bits >> 28) & 0x03) as u8)
469    }
470    #[doc = "Bits 16:17"]
471    #[inline(always)]
472    pub fn inover(&self) -> INOVER_R {
473        INOVER_R::new(((self.bits >> 16) & 0x03) as u8)
474    }
475    #[doc = "Bits 12:13"]
476    #[inline(always)]
477    pub fn oeover(&self) -> OEOVER_R {
478        OEOVER_R::new(((self.bits >> 12) & 0x03) as u8)
479    }
480    #[doc = "Bits 8:9"]
481    #[inline(always)]
482    pub fn outover(&self) -> OUTOVER_R {
483        OUTOVER_R::new(((self.bits >> 8) & 0x03) as u8)
484    }
485    #[doc = "Bits 0:4 - 0-31 -> selects pin function according to the gpio table\\n 31 == NULL"]
486    #[inline(always)]
487    pub fn funcsel(&self) -> FUNCSEL_R {
488        FUNCSEL_R::new((self.bits & 0x1f) as u8)
489    }
490}
491impl W {
492    #[doc = "Bits 28:29"]
493    #[inline(always)]
494    pub fn irqover(&mut self) -> IRQOVER_W {
495        IRQOVER_W { w: self }
496    }
497    #[doc = "Bits 16:17"]
498    #[inline(always)]
499    pub fn inover(&mut self) -> INOVER_W {
500        INOVER_W { w: self }
501    }
502    #[doc = "Bits 12:13"]
503    #[inline(always)]
504    pub fn oeover(&mut self) -> OEOVER_W {
505        OEOVER_W { w: self }
506    }
507    #[doc = "Bits 8:9"]
508    #[inline(always)]
509    pub fn outover(&mut self) -> OUTOVER_W {
510        OUTOVER_W { w: self }
511    }
512    #[doc = "Bits 0:4 - 0-31 -> selects pin function according to the gpio table\\n 31 == NULL"]
513    #[inline(always)]
514    pub fn funcsel(&mut self) -> FUNCSEL_W {
515        FUNCSEL_W { w: self }
516    }
517}