nrf52840_pac/qspi/
ifconfig0.rs

1#[doc = "Register `IFCONFIG0` reader"]
2pub struct R(crate::R<IFCONFIG0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<IFCONFIG0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<IFCONFIG0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<IFCONFIG0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `IFCONFIG0` writer"]
17pub struct W(crate::W<IFCONFIG0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<IFCONFIG0_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<IFCONFIG0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<IFCONFIG0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `READOC` reader - Configure number of data lines and opcode used for reading."]
38pub type READOC_R = crate::FieldReader<u8, READOC_A>;
39#[doc = "Configure number of data lines and opcode used for reading.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum READOC_A {
43    #[doc = "0: Single data line SPI. FAST_READ (opcode 0x0B)."]
44    FASTREAD = 0,
45    #[doc = "1: Dual data line SPI. READ2O (opcode 0x3B)."]
46    READ2O = 1,
47    #[doc = "2: Dual data line SPI. READ2IO (opcode 0xBB)."]
48    READ2IO = 2,
49    #[doc = "3: Quad data line SPI. READ4O (opcode 0x6B)."]
50    READ4O = 3,
51    #[doc = "4: Quad data line SPI. READ4IO (opcode 0xEB)."]
52    READ4IO = 4,
53}
54impl From<READOC_A> for u8 {
55    #[inline(always)]
56    fn from(variant: READOC_A) -> Self {
57        variant as _
58    }
59}
60impl READOC_R {
61    #[doc = "Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> Option<READOC_A> {
64        match self.bits {
65            0 => Some(READOC_A::FASTREAD),
66            1 => Some(READOC_A::READ2O),
67            2 => Some(READOC_A::READ2IO),
68            3 => Some(READOC_A::READ4O),
69            4 => Some(READOC_A::READ4IO),
70            _ => None,
71        }
72    }
73    #[doc = "Checks if the value of the field is `FASTREAD`"]
74    #[inline(always)]
75    pub fn is_fastread(&self) -> bool {
76        *self == READOC_A::FASTREAD
77    }
78    #[doc = "Checks if the value of the field is `READ2O`"]
79    #[inline(always)]
80    pub fn is_read2o(&self) -> bool {
81        *self == READOC_A::READ2O
82    }
83    #[doc = "Checks if the value of the field is `READ2IO`"]
84    #[inline(always)]
85    pub fn is_read2io(&self) -> bool {
86        *self == READOC_A::READ2IO
87    }
88    #[doc = "Checks if the value of the field is `READ4O`"]
89    #[inline(always)]
90    pub fn is_read4o(&self) -> bool {
91        *self == READOC_A::READ4O
92    }
93    #[doc = "Checks if the value of the field is `READ4IO`"]
94    #[inline(always)]
95    pub fn is_read4io(&self) -> bool {
96        *self == READOC_A::READ4IO
97    }
98}
99#[doc = "Field `READOC` writer - Configure number of data lines and opcode used for reading."]
100pub type READOC_W<'a, const O: u8> =
101    crate::FieldWriter<'a, u32, IFCONFIG0_SPEC, u8, READOC_A, 3, O>;
102impl<'a, const O: u8> READOC_W<'a, O> {
103    #[doc = "Single data line SPI. FAST_READ (opcode 0x0B)."]
104    #[inline(always)]
105    pub fn fastread(self) -> &'a mut W {
106        self.variant(READOC_A::FASTREAD)
107    }
108    #[doc = "Dual data line SPI. READ2O (opcode 0x3B)."]
109    #[inline(always)]
110    pub fn read2o(self) -> &'a mut W {
111        self.variant(READOC_A::READ2O)
112    }
113    #[doc = "Dual data line SPI. READ2IO (opcode 0xBB)."]
114    #[inline(always)]
115    pub fn read2io(self) -> &'a mut W {
116        self.variant(READOC_A::READ2IO)
117    }
118    #[doc = "Quad data line SPI. READ4O (opcode 0x6B)."]
119    #[inline(always)]
120    pub fn read4o(self) -> &'a mut W {
121        self.variant(READOC_A::READ4O)
122    }
123    #[doc = "Quad data line SPI. READ4IO (opcode 0xEB)."]
124    #[inline(always)]
125    pub fn read4io(self) -> &'a mut W {
126        self.variant(READOC_A::READ4IO)
127    }
128}
129#[doc = "Field `WRITEOC` reader - Configure number of data lines and opcode used for writing."]
130pub type WRITEOC_R = crate::FieldReader<u8, WRITEOC_A>;
131#[doc = "Configure number of data lines and opcode used for writing.\n\nValue on reset: 0"]
132#[derive(Clone, Copy, Debug, PartialEq)]
133#[repr(u8)]
134pub enum WRITEOC_A {
135    #[doc = "0: Single data line SPI. PP (opcode 0x02)."]
136    PP = 0,
137    #[doc = "1: Dual data line SPI. PP2O (opcode 0xA2)."]
138    PP2O = 1,
139    #[doc = "2: Quad data line SPI. PP4O (opcode 0x32)."]
140    PP4O = 2,
141    #[doc = "3: Quad data line SPI. PP4IO (opcode 0x38)."]
142    PP4IO = 3,
143}
144impl From<WRITEOC_A> for u8 {
145    #[inline(always)]
146    fn from(variant: WRITEOC_A) -> Self {
147        variant as _
148    }
149}
150impl WRITEOC_R {
151    #[doc = "Get enumerated values variant"]
152    #[inline(always)]
153    pub fn variant(&self) -> Option<WRITEOC_A> {
154        match self.bits {
155            0 => Some(WRITEOC_A::PP),
156            1 => Some(WRITEOC_A::PP2O),
157            2 => Some(WRITEOC_A::PP4O),
158            3 => Some(WRITEOC_A::PP4IO),
159            _ => None,
160        }
161    }
162    #[doc = "Checks if the value of the field is `PP`"]
163    #[inline(always)]
164    pub fn is_pp(&self) -> bool {
165        *self == WRITEOC_A::PP
166    }
167    #[doc = "Checks if the value of the field is `PP2O`"]
168    #[inline(always)]
169    pub fn is_pp2o(&self) -> bool {
170        *self == WRITEOC_A::PP2O
171    }
172    #[doc = "Checks if the value of the field is `PP4O`"]
173    #[inline(always)]
174    pub fn is_pp4o(&self) -> bool {
175        *self == WRITEOC_A::PP4O
176    }
177    #[doc = "Checks if the value of the field is `PP4IO`"]
178    #[inline(always)]
179    pub fn is_pp4io(&self) -> bool {
180        *self == WRITEOC_A::PP4IO
181    }
182}
183#[doc = "Field `WRITEOC` writer - Configure number of data lines and opcode used for writing."]
184pub type WRITEOC_W<'a, const O: u8> =
185    crate::FieldWriter<'a, u32, IFCONFIG0_SPEC, u8, WRITEOC_A, 3, O>;
186impl<'a, const O: u8> WRITEOC_W<'a, O> {
187    #[doc = "Single data line SPI. PP (opcode 0x02)."]
188    #[inline(always)]
189    pub fn pp(self) -> &'a mut W {
190        self.variant(WRITEOC_A::PP)
191    }
192    #[doc = "Dual data line SPI. PP2O (opcode 0xA2)."]
193    #[inline(always)]
194    pub fn pp2o(self) -> &'a mut W {
195        self.variant(WRITEOC_A::PP2O)
196    }
197    #[doc = "Quad data line SPI. PP4O (opcode 0x32)."]
198    #[inline(always)]
199    pub fn pp4o(self) -> &'a mut W {
200        self.variant(WRITEOC_A::PP4O)
201    }
202    #[doc = "Quad data line SPI. PP4IO (opcode 0x38)."]
203    #[inline(always)]
204    pub fn pp4io(self) -> &'a mut W {
205        self.variant(WRITEOC_A::PP4IO)
206    }
207}
208#[doc = "Field `ADDRMODE` reader - Addressing mode."]
209pub type ADDRMODE_R = crate::BitReader<ADDRMODE_A>;
210#[doc = "Addressing mode.\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq)]
212pub enum ADDRMODE_A {
213    #[doc = "0: 24-bit addressing."]
214    _24BIT = 0,
215    #[doc = "1: 32-bit addressing."]
216    _32BIT = 1,
217}
218impl From<ADDRMODE_A> for bool {
219    #[inline(always)]
220    fn from(variant: ADDRMODE_A) -> Self {
221        variant as u8 != 0
222    }
223}
224impl ADDRMODE_R {
225    #[doc = "Get enumerated values variant"]
226    #[inline(always)]
227    pub fn variant(&self) -> ADDRMODE_A {
228        match self.bits {
229            false => ADDRMODE_A::_24BIT,
230            true => ADDRMODE_A::_32BIT,
231        }
232    }
233    #[doc = "Checks if the value of the field is `_24BIT`"]
234    #[inline(always)]
235    pub fn is_24bit(&self) -> bool {
236        *self == ADDRMODE_A::_24BIT
237    }
238    #[doc = "Checks if the value of the field is `_32BIT`"]
239    #[inline(always)]
240    pub fn is_32bit(&self) -> bool {
241        *self == ADDRMODE_A::_32BIT
242    }
243}
244#[doc = "Field `ADDRMODE` writer - Addressing mode."]
245pub type ADDRMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IFCONFIG0_SPEC, ADDRMODE_A, O>;
246impl<'a, const O: u8> ADDRMODE_W<'a, O> {
247    #[doc = "24-bit addressing."]
248    #[inline(always)]
249    pub fn _24bit(self) -> &'a mut W {
250        self.variant(ADDRMODE_A::_24BIT)
251    }
252    #[doc = "32-bit addressing."]
253    #[inline(always)]
254    pub fn _32bit(self) -> &'a mut W {
255        self.variant(ADDRMODE_A::_32BIT)
256    }
257}
258#[doc = "Field `DPMENABLE` reader - Enable deep power-down mode (DPM) feature."]
259pub type DPMENABLE_R = crate::BitReader<DPMENABLE_A>;
260#[doc = "Enable deep power-down mode (DPM) feature.\n\nValue on reset: 0"]
261#[derive(Clone, Copy, Debug, PartialEq)]
262pub enum DPMENABLE_A {
263    #[doc = "0: Disable DPM feature."]
264    DISABLE = 0,
265    #[doc = "1: Enable DPM feature."]
266    ENABLE = 1,
267}
268impl From<DPMENABLE_A> for bool {
269    #[inline(always)]
270    fn from(variant: DPMENABLE_A) -> Self {
271        variant as u8 != 0
272    }
273}
274impl DPMENABLE_R {
275    #[doc = "Get enumerated values variant"]
276    #[inline(always)]
277    pub fn variant(&self) -> DPMENABLE_A {
278        match self.bits {
279            false => DPMENABLE_A::DISABLE,
280            true => DPMENABLE_A::ENABLE,
281        }
282    }
283    #[doc = "Checks if the value of the field is `DISABLE`"]
284    #[inline(always)]
285    pub fn is_disable(&self) -> bool {
286        *self == DPMENABLE_A::DISABLE
287    }
288    #[doc = "Checks if the value of the field is `ENABLE`"]
289    #[inline(always)]
290    pub fn is_enable(&self) -> bool {
291        *self == DPMENABLE_A::ENABLE
292    }
293}
294#[doc = "Field `DPMENABLE` writer - Enable deep power-down mode (DPM) feature."]
295pub type DPMENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IFCONFIG0_SPEC, DPMENABLE_A, O>;
296impl<'a, const O: u8> DPMENABLE_W<'a, O> {
297    #[doc = "Disable DPM feature."]
298    #[inline(always)]
299    pub fn disable(self) -> &'a mut W {
300        self.variant(DPMENABLE_A::DISABLE)
301    }
302    #[doc = "Enable DPM feature."]
303    #[inline(always)]
304    pub fn enable(self) -> &'a mut W {
305        self.variant(DPMENABLE_A::ENABLE)
306    }
307}
308#[doc = "Field `PPSIZE` reader - Page size for commands PP, PP2O, PP4O and PP4IO."]
309pub type PPSIZE_R = crate::BitReader<PPSIZE_A>;
310#[doc = "Page size for commands PP, PP2O, PP4O and PP4IO.\n\nValue on reset: 0"]
311#[derive(Clone, Copy, Debug, PartialEq)]
312pub enum PPSIZE_A {
313    #[doc = "0: 256 bytes."]
314    _256BYTES = 0,
315    #[doc = "1: 512 bytes."]
316    _512BYTES = 1,
317}
318impl From<PPSIZE_A> for bool {
319    #[inline(always)]
320    fn from(variant: PPSIZE_A) -> Self {
321        variant as u8 != 0
322    }
323}
324impl PPSIZE_R {
325    #[doc = "Get enumerated values variant"]
326    #[inline(always)]
327    pub fn variant(&self) -> PPSIZE_A {
328        match self.bits {
329            false => PPSIZE_A::_256BYTES,
330            true => PPSIZE_A::_512BYTES,
331        }
332    }
333    #[doc = "Checks if the value of the field is `_256BYTES`"]
334    #[inline(always)]
335    pub fn is_256bytes(&self) -> bool {
336        *self == PPSIZE_A::_256BYTES
337    }
338    #[doc = "Checks if the value of the field is `_512BYTES`"]
339    #[inline(always)]
340    pub fn is_512bytes(&self) -> bool {
341        *self == PPSIZE_A::_512BYTES
342    }
343}
344#[doc = "Field `PPSIZE` writer - Page size for commands PP, PP2O, PP4O and PP4IO."]
345pub type PPSIZE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IFCONFIG0_SPEC, PPSIZE_A, O>;
346impl<'a, const O: u8> PPSIZE_W<'a, O> {
347    #[doc = "256 bytes."]
348    #[inline(always)]
349    pub fn _256bytes(self) -> &'a mut W {
350        self.variant(PPSIZE_A::_256BYTES)
351    }
352    #[doc = "512 bytes."]
353    #[inline(always)]
354    pub fn _512bytes(self) -> &'a mut W {
355        self.variant(PPSIZE_A::_512BYTES)
356    }
357}
358impl R {
359    #[doc = "Bits 0:2 - Configure number of data lines and opcode used for reading."]
360    #[inline(always)]
361    pub fn readoc(&self) -> READOC_R {
362        READOC_R::new((self.bits & 7) as u8)
363    }
364    #[doc = "Bits 3:5 - Configure number of data lines and opcode used for writing."]
365    #[inline(always)]
366    pub fn writeoc(&self) -> WRITEOC_R {
367        WRITEOC_R::new(((self.bits >> 3) & 7) as u8)
368    }
369    #[doc = "Bit 6 - Addressing mode."]
370    #[inline(always)]
371    pub fn addrmode(&self) -> ADDRMODE_R {
372        ADDRMODE_R::new(((self.bits >> 6) & 1) != 0)
373    }
374    #[doc = "Bit 7 - Enable deep power-down mode (DPM) feature."]
375    #[inline(always)]
376    pub fn dpmenable(&self) -> DPMENABLE_R {
377        DPMENABLE_R::new(((self.bits >> 7) & 1) != 0)
378    }
379    #[doc = "Bit 12 - Page size for commands PP, PP2O, PP4O and PP4IO."]
380    #[inline(always)]
381    pub fn ppsize(&self) -> PPSIZE_R {
382        PPSIZE_R::new(((self.bits >> 12) & 1) != 0)
383    }
384}
385impl W {
386    #[doc = "Bits 0:2 - Configure number of data lines and opcode used for reading."]
387    #[inline(always)]
388    pub fn readoc(&mut self) -> READOC_W<0> {
389        READOC_W::new(self)
390    }
391    #[doc = "Bits 3:5 - Configure number of data lines and opcode used for writing."]
392    #[inline(always)]
393    pub fn writeoc(&mut self) -> WRITEOC_W<3> {
394        WRITEOC_W::new(self)
395    }
396    #[doc = "Bit 6 - Addressing mode."]
397    #[inline(always)]
398    pub fn addrmode(&mut self) -> ADDRMODE_W<6> {
399        ADDRMODE_W::new(self)
400    }
401    #[doc = "Bit 7 - Enable deep power-down mode (DPM) feature."]
402    #[inline(always)]
403    pub fn dpmenable(&mut self) -> DPMENABLE_W<7> {
404        DPMENABLE_W::new(self)
405    }
406    #[doc = "Bit 12 - Page size for commands PP, PP2O, PP4O and PP4IO."]
407    #[inline(always)]
408    pub fn ppsize(&mut self) -> PPSIZE_W<12> {
409        PPSIZE_W::new(self)
410    }
411    #[doc = "Writes raw bits to the register."]
412    #[inline(always)]
413    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
414        self.0.bits(bits);
415        self
416    }
417}
418#[doc = "Interface configuration.\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 [ifconfig0](index.html) module"]
419pub struct IFCONFIG0_SPEC;
420impl crate::RegisterSpec for IFCONFIG0_SPEC {
421    type Ux = u32;
422}
423#[doc = "`read()` method returns [ifconfig0::R](R) reader structure"]
424impl crate::Readable for IFCONFIG0_SPEC {
425    type Reader = R;
426}
427#[doc = "`write(|w| ..)` method takes [ifconfig0::W](W) writer structure"]
428impl crate::Writable for IFCONFIG0_SPEC {
429    type Writer = W;
430}
431#[doc = "`reset()` method sets IFCONFIG0 to value 0"]
432impl crate::Resettable for IFCONFIG0_SPEC {
433    #[inline(always)]
434    fn reset_value() -> Self::Ux {
435        0
436    }
437}