nrf52840_pac/qspi/
cinstrconf.rs

1#[doc = "Register `CINSTRCONF` reader"]
2pub struct R(crate::R<CINSTRCONF_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CINSTRCONF_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CINSTRCONF_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CINSTRCONF_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CINSTRCONF` writer"]
17pub struct W(crate::W<CINSTRCONF_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CINSTRCONF_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<CINSTRCONF_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CINSTRCONF_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OPCODE` reader - Opcode of Custom instruction."]
38pub type OPCODE_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `OPCODE` writer - Opcode of Custom instruction."]
40pub type OPCODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CINSTRCONF_SPEC, u8, u8, 8, O>;
41#[doc = "Field `LENGTH` reader - Length of custom instruction in number of bytes."]
42pub type LENGTH_R = crate::FieldReader<u8, LENGTH_A>;
43#[doc = "Length of custom instruction in number of bytes.\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45#[repr(u8)]
46pub enum LENGTH_A {
47    #[doc = "1: Send opcode only."]
48    _1B = 1,
49    #[doc = "2: Send opcode, CINSTRDAT0.BYTE0."]
50    _2B = 2,
51    #[doc = "3: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE1."]
52    _3B = 3,
53    #[doc = "4: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE2."]
54    _4B = 4,
55    #[doc = "5: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE3."]
56    _5B = 5,
57    #[doc = "6: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE4."]
58    _6B = 6,
59    #[doc = "7: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE5."]
60    _7B = 7,
61    #[doc = "8: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE6."]
62    _8B = 8,
63    #[doc = "9: Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE7."]
64    _9B = 9,
65}
66impl From<LENGTH_A> for u8 {
67    #[inline(always)]
68    fn from(variant: LENGTH_A) -> Self {
69        variant as _
70    }
71}
72impl LENGTH_R {
73    #[doc = "Get enumerated values variant"]
74    #[inline(always)]
75    pub fn variant(&self) -> Option<LENGTH_A> {
76        match self.bits {
77            1 => Some(LENGTH_A::_1B),
78            2 => Some(LENGTH_A::_2B),
79            3 => Some(LENGTH_A::_3B),
80            4 => Some(LENGTH_A::_4B),
81            5 => Some(LENGTH_A::_5B),
82            6 => Some(LENGTH_A::_6B),
83            7 => Some(LENGTH_A::_7B),
84            8 => Some(LENGTH_A::_8B),
85            9 => Some(LENGTH_A::_9B),
86            _ => None,
87        }
88    }
89    #[doc = "Checks if the value of the field is `_1B`"]
90    #[inline(always)]
91    pub fn is_1b(&self) -> bool {
92        *self == LENGTH_A::_1B
93    }
94    #[doc = "Checks if the value of the field is `_2B`"]
95    #[inline(always)]
96    pub fn is_2b(&self) -> bool {
97        *self == LENGTH_A::_2B
98    }
99    #[doc = "Checks if the value of the field is `_3B`"]
100    #[inline(always)]
101    pub fn is_3b(&self) -> bool {
102        *self == LENGTH_A::_3B
103    }
104    #[doc = "Checks if the value of the field is `_4B`"]
105    #[inline(always)]
106    pub fn is_4b(&self) -> bool {
107        *self == LENGTH_A::_4B
108    }
109    #[doc = "Checks if the value of the field is `_5B`"]
110    #[inline(always)]
111    pub fn is_5b(&self) -> bool {
112        *self == LENGTH_A::_5B
113    }
114    #[doc = "Checks if the value of the field is `_6B`"]
115    #[inline(always)]
116    pub fn is_6b(&self) -> bool {
117        *self == LENGTH_A::_6B
118    }
119    #[doc = "Checks if the value of the field is `_7B`"]
120    #[inline(always)]
121    pub fn is_7b(&self) -> bool {
122        *self == LENGTH_A::_7B
123    }
124    #[doc = "Checks if the value of the field is `_8B`"]
125    #[inline(always)]
126    pub fn is_8b(&self) -> bool {
127        *self == LENGTH_A::_8B
128    }
129    #[doc = "Checks if the value of the field is `_9B`"]
130    #[inline(always)]
131    pub fn is_9b(&self) -> bool {
132        *self == LENGTH_A::_9B
133    }
134}
135#[doc = "Field `LENGTH` writer - Length of custom instruction in number of bytes."]
136pub type LENGTH_W<'a, const O: u8> =
137    crate::FieldWriter<'a, u32, CINSTRCONF_SPEC, u8, LENGTH_A, 4, O>;
138impl<'a, const O: u8> LENGTH_W<'a, O> {
139    #[doc = "Send opcode only."]
140    #[inline(always)]
141    pub fn _1b(self) -> &'a mut W {
142        self.variant(LENGTH_A::_1B)
143    }
144    #[doc = "Send opcode, CINSTRDAT0.BYTE0."]
145    #[inline(always)]
146    pub fn _2b(self) -> &'a mut W {
147        self.variant(LENGTH_A::_2B)
148    }
149    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE1."]
150    #[inline(always)]
151    pub fn _3b(self) -> &'a mut W {
152        self.variant(LENGTH_A::_3B)
153    }
154    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE2."]
155    #[inline(always)]
156    pub fn _4b(self) -> &'a mut W {
157        self.variant(LENGTH_A::_4B)
158    }
159    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT0.BYTE3."]
160    #[inline(always)]
161    pub fn _5b(self) -> &'a mut W {
162        self.variant(LENGTH_A::_5B)
163    }
164    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE4."]
165    #[inline(always)]
166    pub fn _6b(self) -> &'a mut W {
167        self.variant(LENGTH_A::_6B)
168    }
169    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE5."]
170    #[inline(always)]
171    pub fn _7b(self) -> &'a mut W {
172        self.variant(LENGTH_A::_7B)
173    }
174    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE6."]
175    #[inline(always)]
176    pub fn _8b(self) -> &'a mut W {
177        self.variant(LENGTH_A::_8B)
178    }
179    #[doc = "Send opcode, CINSTRDAT0.BYTE0 -&gt; CINSTRDAT1.BYTE7."]
180    #[inline(always)]
181    pub fn _9b(self) -> &'a mut W {
182        self.variant(LENGTH_A::_9B)
183    }
184}
185#[doc = "Field `LIO2` reader - Level of the IO2 pin (if connected) during transmission of custom instruction."]
186pub type LIO2_R = crate::BitReader<bool>;
187#[doc = "Field `LIO2` writer - Level of the IO2 pin (if connected) during transmission of custom instruction."]
188pub type LIO2_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, bool, O>;
189#[doc = "Field `LIO3` reader - Level of the IO3 pin (if connected) during transmission of custom instruction."]
190pub type LIO3_R = crate::BitReader<bool>;
191#[doc = "Field `LIO3` writer - Level of the IO3 pin (if connected) during transmission of custom instruction."]
192pub type LIO3_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, bool, O>;
193#[doc = "Field `WIPWAIT` reader - Wait for write complete before sending command."]
194pub type WIPWAIT_R = crate::BitReader<WIPWAIT_A>;
195#[doc = "Wait for write complete before sending command.\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq)]
197pub enum WIPWAIT_A {
198    #[doc = "0: No wait."]
199    DISABLE = 0,
200    #[doc = "1: Wait."]
201    ENABLE = 1,
202}
203impl From<WIPWAIT_A> for bool {
204    #[inline(always)]
205    fn from(variant: WIPWAIT_A) -> Self {
206        variant as u8 != 0
207    }
208}
209impl WIPWAIT_R {
210    #[doc = "Get enumerated values variant"]
211    #[inline(always)]
212    pub fn variant(&self) -> WIPWAIT_A {
213        match self.bits {
214            false => WIPWAIT_A::DISABLE,
215            true => WIPWAIT_A::ENABLE,
216        }
217    }
218    #[doc = "Checks if the value of the field is `DISABLE`"]
219    #[inline(always)]
220    pub fn is_disable(&self) -> bool {
221        *self == WIPWAIT_A::DISABLE
222    }
223    #[doc = "Checks if the value of the field is `ENABLE`"]
224    #[inline(always)]
225    pub fn is_enable(&self) -> bool {
226        *self == WIPWAIT_A::ENABLE
227    }
228}
229#[doc = "Field `WIPWAIT` writer - Wait for write complete before sending command."]
230pub type WIPWAIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, WIPWAIT_A, O>;
231impl<'a, const O: u8> WIPWAIT_W<'a, O> {
232    #[doc = "No wait."]
233    #[inline(always)]
234    pub fn disable(self) -> &'a mut W {
235        self.variant(WIPWAIT_A::DISABLE)
236    }
237    #[doc = "Wait."]
238    #[inline(always)]
239    pub fn enable(self) -> &'a mut W {
240        self.variant(WIPWAIT_A::ENABLE)
241    }
242}
243#[doc = "Field `WREN` reader - Send WREN (write enable opcode 0x06) before instruction."]
244pub type WREN_R = crate::BitReader<WREN_A>;
245#[doc = "Send WREN (write enable opcode 0x06) before instruction.\n\nValue on reset: 0"]
246#[derive(Clone, Copy, Debug, PartialEq)]
247pub enum WREN_A {
248    #[doc = "0: Do not send WREN."]
249    DISABLE = 0,
250    #[doc = "1: Send WREN."]
251    ENABLE = 1,
252}
253impl From<WREN_A> for bool {
254    #[inline(always)]
255    fn from(variant: WREN_A) -> Self {
256        variant as u8 != 0
257    }
258}
259impl WREN_R {
260    #[doc = "Get enumerated values variant"]
261    #[inline(always)]
262    pub fn variant(&self) -> WREN_A {
263        match self.bits {
264            false => WREN_A::DISABLE,
265            true => WREN_A::ENABLE,
266        }
267    }
268    #[doc = "Checks if the value of the field is `DISABLE`"]
269    #[inline(always)]
270    pub fn is_disable(&self) -> bool {
271        *self == WREN_A::DISABLE
272    }
273    #[doc = "Checks if the value of the field is `ENABLE`"]
274    #[inline(always)]
275    pub fn is_enable(&self) -> bool {
276        *self == WREN_A::ENABLE
277    }
278}
279#[doc = "Field `WREN` writer - Send WREN (write enable opcode 0x06) before instruction."]
280pub type WREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, WREN_A, O>;
281impl<'a, const O: u8> WREN_W<'a, O> {
282    #[doc = "Do not send WREN."]
283    #[inline(always)]
284    pub fn disable(self) -> &'a mut W {
285        self.variant(WREN_A::DISABLE)
286    }
287    #[doc = "Send WREN."]
288    #[inline(always)]
289    pub fn enable(self) -> &'a mut W {
290        self.variant(WREN_A::ENABLE)
291    }
292}
293#[doc = "Field `LFEN` reader - Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
294pub type LFEN_R = crate::BitReader<LFEN_A>;
295#[doc = "Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field.\n\nValue on reset: 0"]
296#[derive(Clone, Copy, Debug, PartialEq)]
297pub enum LFEN_A {
298    #[doc = "0: Long frame mode disabled"]
299    DISABLE = 0,
300    #[doc = "1: Long frame mode enabled"]
301    ENABLE = 1,
302}
303impl From<LFEN_A> for bool {
304    #[inline(always)]
305    fn from(variant: LFEN_A) -> Self {
306        variant as u8 != 0
307    }
308}
309impl LFEN_R {
310    #[doc = "Get enumerated values variant"]
311    #[inline(always)]
312    pub fn variant(&self) -> LFEN_A {
313        match self.bits {
314            false => LFEN_A::DISABLE,
315            true => LFEN_A::ENABLE,
316        }
317    }
318    #[doc = "Checks if the value of the field is `DISABLE`"]
319    #[inline(always)]
320    pub fn is_disable(&self) -> bool {
321        *self == LFEN_A::DISABLE
322    }
323    #[doc = "Checks if the value of the field is `ENABLE`"]
324    #[inline(always)]
325    pub fn is_enable(&self) -> bool {
326        *self == LFEN_A::ENABLE
327    }
328}
329#[doc = "Field `LFEN` writer - Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
330pub type LFEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, LFEN_A, O>;
331impl<'a, const O: u8> LFEN_W<'a, O> {
332    #[doc = "Long frame mode disabled"]
333    #[inline(always)]
334    pub fn disable(self) -> &'a mut W {
335        self.variant(LFEN_A::DISABLE)
336    }
337    #[doc = "Long frame mode enabled"]
338    #[inline(always)]
339    pub fn enable(self) -> &'a mut W {
340        self.variant(LFEN_A::ENABLE)
341    }
342}
343#[doc = "Field `LFSTOP` reader - Stop (finalize) long frame transaction"]
344pub type LFSTOP_R = crate::BitReader<LFSTOP_A>;
345#[doc = "Stop (finalize) long frame transaction\n\nValue on reset: 0"]
346#[derive(Clone, Copy, Debug, PartialEq)]
347pub enum LFSTOP_A {
348    #[doc = "1: Stop"]
349    STOP = 1,
350}
351impl From<LFSTOP_A> for bool {
352    #[inline(always)]
353    fn from(variant: LFSTOP_A) -> Self {
354        variant as u8 != 0
355    }
356}
357impl LFSTOP_R {
358    #[doc = "Get enumerated values variant"]
359    #[inline(always)]
360    pub fn variant(&self) -> Option<LFSTOP_A> {
361        match self.bits {
362            true => Some(LFSTOP_A::STOP),
363            _ => None,
364        }
365    }
366    #[doc = "Checks if the value of the field is `STOP`"]
367    #[inline(always)]
368    pub fn is_stop(&self) -> bool {
369        *self == LFSTOP_A::STOP
370    }
371}
372#[doc = "Field `LFSTOP` writer - Stop (finalize) long frame transaction"]
373pub type LFSTOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CINSTRCONF_SPEC, LFSTOP_A, O>;
374impl<'a, const O: u8> LFSTOP_W<'a, O> {
375    #[doc = "Stop"]
376    #[inline(always)]
377    pub fn stop(self) -> &'a mut W {
378        self.variant(LFSTOP_A::STOP)
379    }
380}
381impl R {
382    #[doc = "Bits 0:7 - Opcode of Custom instruction."]
383    #[inline(always)]
384    pub fn opcode(&self) -> OPCODE_R {
385        OPCODE_R::new((self.bits & 0xff) as u8)
386    }
387    #[doc = "Bits 8:11 - Length of custom instruction in number of bytes."]
388    #[inline(always)]
389    pub fn length(&self) -> LENGTH_R {
390        LENGTH_R::new(((self.bits >> 8) & 0x0f) as u8)
391    }
392    #[doc = "Bit 12 - Level of the IO2 pin (if connected) during transmission of custom instruction."]
393    #[inline(always)]
394    pub fn lio2(&self) -> LIO2_R {
395        LIO2_R::new(((self.bits >> 12) & 1) != 0)
396    }
397    #[doc = "Bit 13 - Level of the IO3 pin (if connected) during transmission of custom instruction."]
398    #[inline(always)]
399    pub fn lio3(&self) -> LIO3_R {
400        LIO3_R::new(((self.bits >> 13) & 1) != 0)
401    }
402    #[doc = "Bit 14 - Wait for write complete before sending command."]
403    #[inline(always)]
404    pub fn wipwait(&self) -> WIPWAIT_R {
405        WIPWAIT_R::new(((self.bits >> 14) & 1) != 0)
406    }
407    #[doc = "Bit 15 - Send WREN (write enable opcode 0x06) before instruction."]
408    #[inline(always)]
409    pub fn wren(&self) -> WREN_R {
410        WREN_R::new(((self.bits >> 15) & 1) != 0)
411    }
412    #[doc = "Bit 16 - Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
413    #[inline(always)]
414    pub fn lfen(&self) -> LFEN_R {
415        LFEN_R::new(((self.bits >> 16) & 1) != 0)
416    }
417    #[doc = "Bit 17 - Stop (finalize) long frame transaction"]
418    #[inline(always)]
419    pub fn lfstop(&self) -> LFSTOP_R {
420        LFSTOP_R::new(((self.bits >> 17) & 1) != 0)
421    }
422}
423impl W {
424    #[doc = "Bits 0:7 - Opcode of Custom instruction."]
425    #[inline(always)]
426    pub fn opcode(&mut self) -> OPCODE_W<0> {
427        OPCODE_W::new(self)
428    }
429    #[doc = "Bits 8:11 - Length of custom instruction in number of bytes."]
430    #[inline(always)]
431    pub fn length(&mut self) -> LENGTH_W<8> {
432        LENGTH_W::new(self)
433    }
434    #[doc = "Bit 12 - Level of the IO2 pin (if connected) during transmission of custom instruction."]
435    #[inline(always)]
436    pub fn lio2(&mut self) -> LIO2_W<12> {
437        LIO2_W::new(self)
438    }
439    #[doc = "Bit 13 - Level of the IO3 pin (if connected) during transmission of custom instruction."]
440    #[inline(always)]
441    pub fn lio3(&mut self) -> LIO3_W<13> {
442        LIO3_W::new(self)
443    }
444    #[doc = "Bit 14 - Wait for write complete before sending command."]
445    #[inline(always)]
446    pub fn wipwait(&mut self) -> WIPWAIT_W<14> {
447        WIPWAIT_W::new(self)
448    }
449    #[doc = "Bit 15 - Send WREN (write enable opcode 0x06) before instruction."]
450    #[inline(always)]
451    pub fn wren(&mut self) -> WREN_W<15> {
452        WREN_W::new(self)
453    }
454    #[doc = "Bit 16 - Enable long frame mode. When enabled, a custom instruction transaction has to be ended by writing the LFSTOP field."]
455    #[inline(always)]
456    pub fn lfen(&mut self) -> LFEN_W<16> {
457        LFEN_W::new(self)
458    }
459    #[doc = "Bit 17 - Stop (finalize) long frame transaction"]
460    #[inline(always)]
461    pub fn lfstop(&mut self) -> LFSTOP_W<17> {
462        LFSTOP_W::new(self)
463    }
464    #[doc = "Writes raw bits to the register."]
465    #[inline(always)]
466    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
467        self.0.bits(bits);
468        self
469    }
470}
471#[doc = "Custom instruction configuration 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 [cinstrconf](index.html) module"]
472pub struct CINSTRCONF_SPEC;
473impl crate::RegisterSpec for CINSTRCONF_SPEC {
474    type Ux = u32;
475}
476#[doc = "`read()` method returns [cinstrconf::R](R) reader structure"]
477impl crate::Readable for CINSTRCONF_SPEC {
478    type Reader = R;
479}
480#[doc = "`write(|w| ..)` method takes [cinstrconf::W](W) writer structure"]
481impl crate::Writable for CINSTRCONF_SPEC {
482    type Writer = W;
483}
484#[doc = "`reset()` method sets CINSTRCONF to value 0x2000"]
485impl crate::Resettable for CINSTRCONF_SPEC {
486    #[inline(always)]
487    fn reset_value() -> Self::Ux {
488        0x2000
489    }
490}