Skip to main content

k22f/ftfe/
fcnfg.rs

1#[doc = "Reader of register FCNFG"]
2pub type R = crate::R<u8, super::FCNFG>;
3#[doc = "Writer for register FCNFG"]
4pub type W = crate::W<u8, super::FCNFG>;
5#[doc = "Register FCNFG `reset()`'s with value 0"]
6impl crate::ResetValue for super::FCNFG {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "For devices with FlexNVM: This flag indicates if the EEPROM backup data has been copied to the FlexRAM and is therefore available for read access\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum EEERDY_A {
16    #[doc = "0: For devices with FlexNVM: FlexRAM is not available for EEPROM operation."]
17    _0 = 0,
18    #[doc = "1: For devices with FlexNVM: FlexRAM is available for EEPROM operations where: reads from the FlexRAM return data previously written to the FlexRAM in EEPROM mode and writes launch an EEPROM operation to store the written data in the FlexRAM and EEPROM backup."]
19    _1 = 1,
20}
21impl From<EEERDY_A> for bool {
22    #[inline(always)]
23    fn from(variant: EEERDY_A) -> Self {
24        variant as u8 != 0
25    }
26}
27#[doc = "Reader of field `EEERDY`"]
28pub type EEERDY_R = crate::R<bool, EEERDY_A>;
29impl EEERDY_R {
30    #[doc = r"Get enumerated values variant"]
31    #[inline(always)]
32    pub fn variant(&self) -> EEERDY_A {
33        match self.bits {
34            false => EEERDY_A::_0,
35            true => EEERDY_A::_1,
36        }
37    }
38    #[doc = "Checks if the value of the field is `_0`"]
39    #[inline(always)]
40    pub fn is_0(&self) -> bool {
41        *self == EEERDY_A::_0
42    }
43    #[doc = "Checks if the value of the field is `_1`"]
44    #[inline(always)]
45    pub fn is_1(&self) -> bool {
46        *self == EEERDY_A::_1
47    }
48}
49#[doc = "RAM Ready\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51pub enum RAMRDY_A {
52    #[doc = "0: For devices with FlexNVM: FlexRAM is not available for traditional RAM access. For devices without FlexNVM: Programming acceleration RAM is not available."]
53    _0 = 0,
54    #[doc = "1: For devices with FlexNVM: FlexRAM is available as traditional RAM only; writes to the FlexRAM do not trigger EEPROM operations. For devices without FlexNVM: Programming acceleration RAM is available."]
55    _1 = 1,
56}
57impl From<RAMRDY_A> for bool {
58    #[inline(always)]
59    fn from(variant: RAMRDY_A) -> Self {
60        variant as u8 != 0
61    }
62}
63#[doc = "Reader of field `RAMRDY`"]
64pub type RAMRDY_R = crate::R<bool, RAMRDY_A>;
65impl RAMRDY_R {
66    #[doc = r"Get enumerated values variant"]
67    #[inline(always)]
68    pub fn variant(&self) -> RAMRDY_A {
69        match self.bits {
70            false => RAMRDY_A::_0,
71            true => RAMRDY_A::_1,
72        }
73    }
74    #[doc = "Checks if the value of the field is `_0`"]
75    #[inline(always)]
76    pub fn is_0(&self) -> bool {
77        *self == RAMRDY_A::_0
78    }
79    #[doc = "Checks if the value of the field is `_1`"]
80    #[inline(always)]
81    pub fn is_1(&self) -> bool {
82        *self == RAMRDY_A::_1
83    }
84}
85#[doc = "FTFE configuration\n\nValue on reset: 0"]
86#[derive(Clone, Copy, Debug, PartialEq)]
87pub enum PFLSH_A {
88    #[doc = "0: For devices with FlexNVM: FTFE configuration supports two logical program flash blocks and two logical FlexNVM blocks For devices with program flash only: Reserved"]
89    _0 = 0,
90    #[doc = "1: For devices with FlexNVM: Reserved For devices with program flash only: FTFE configuration supports four logical program flash blocks"]
91    _1 = 1,
92}
93impl From<PFLSH_A> for bool {
94    #[inline(always)]
95    fn from(variant: PFLSH_A) -> Self {
96        variant as u8 != 0
97    }
98}
99#[doc = "Reader of field `PFLSH`"]
100pub type PFLSH_R = crate::R<bool, PFLSH_A>;
101impl PFLSH_R {
102    #[doc = r"Get enumerated values variant"]
103    #[inline(always)]
104    pub fn variant(&self) -> PFLSH_A {
105        match self.bits {
106            false => PFLSH_A::_0,
107            true => PFLSH_A::_1,
108        }
109    }
110    #[doc = "Checks if the value of the field is `_0`"]
111    #[inline(always)]
112    pub fn is_0(&self) -> bool {
113        *self == PFLSH_A::_0
114    }
115    #[doc = "Checks if the value of the field is `_1`"]
116    #[inline(always)]
117    pub fn is_1(&self) -> bool {
118        *self == PFLSH_A::_1
119    }
120}
121#[doc = "Swap\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum SWAP_A {
124    #[doc = "0: For devices with FlexNVM: Logical program flash 0 block is located at relative address 0x0000 For devices with program flash only: Logical program flash 0 block is located at relative address 0x0000"]
125    _0 = 0,
126    #[doc = "1: For devices with FlexNVM: Reserved For devices with program flash only: Logical program flash 1 block is located at relative address 0x0000"]
127    _1 = 1,
128}
129impl From<SWAP_A> for bool {
130    #[inline(always)]
131    fn from(variant: SWAP_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Reader of field `SWAP`"]
136pub type SWAP_R = crate::R<bool, SWAP_A>;
137impl SWAP_R {
138    #[doc = r"Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> SWAP_A {
141        match self.bits {
142            false => SWAP_A::_0,
143            true => SWAP_A::_1,
144        }
145    }
146    #[doc = "Checks if the value of the field is `_0`"]
147    #[inline(always)]
148    pub fn is_0(&self) -> bool {
149        *self == SWAP_A::_0
150    }
151    #[doc = "Checks if the value of the field is `_1`"]
152    #[inline(always)]
153    pub fn is_1(&self) -> bool {
154        *self == SWAP_A::_1
155    }
156}
157#[doc = "Erase Suspend\n\nValue on reset: 0"]
158#[derive(Clone, Copy, Debug, PartialEq)]
159pub enum ERSSUSP_A {
160    #[doc = "0: No suspend requested"]
161    _0 = 0,
162    #[doc = "1: Suspend the current Erase Flash Sector command execution."]
163    _1 = 1,
164}
165impl From<ERSSUSP_A> for bool {
166    #[inline(always)]
167    fn from(variant: ERSSUSP_A) -> Self {
168        variant as u8 != 0
169    }
170}
171#[doc = "Reader of field `ERSSUSP`"]
172pub type ERSSUSP_R = crate::R<bool, ERSSUSP_A>;
173impl ERSSUSP_R {
174    #[doc = r"Get enumerated values variant"]
175    #[inline(always)]
176    pub fn variant(&self) -> ERSSUSP_A {
177        match self.bits {
178            false => ERSSUSP_A::_0,
179            true => ERSSUSP_A::_1,
180        }
181    }
182    #[doc = "Checks if the value of the field is `_0`"]
183    #[inline(always)]
184    pub fn is_0(&self) -> bool {
185        *self == ERSSUSP_A::_0
186    }
187    #[doc = "Checks if the value of the field is `_1`"]
188    #[inline(always)]
189    pub fn is_1(&self) -> bool {
190        *self == ERSSUSP_A::_1
191    }
192}
193#[doc = "Write proxy for field `ERSSUSP`"]
194pub struct ERSSUSP_W<'a> {
195    w: &'a mut W,
196}
197impl<'a> ERSSUSP_W<'a> {
198    #[doc = r"Writes `variant` to the field"]
199    #[inline(always)]
200    pub fn variant(self, variant: ERSSUSP_A) -> &'a mut W {
201        {
202            self.bit(variant.into())
203        }
204    }
205    #[doc = "No suspend requested"]
206    #[inline(always)]
207    pub fn _0(self) -> &'a mut W {
208        self.variant(ERSSUSP_A::_0)
209    }
210    #[doc = "Suspend the current Erase Flash Sector command execution."]
211    #[inline(always)]
212    pub fn _1(self) -> &'a mut W {
213        self.variant(ERSSUSP_A::_1)
214    }
215    #[doc = r"Sets the field bit"]
216    #[inline(always)]
217    pub fn set_bit(self) -> &'a mut W {
218        self.bit(true)
219    }
220    #[doc = r"Clears the field bit"]
221    #[inline(always)]
222    pub fn clear_bit(self) -> &'a mut W {
223        self.bit(false)
224    }
225    #[doc = r"Writes raw bits to the field"]
226    #[inline(always)]
227    pub fn bit(self, value: bool) -> &'a mut W {
228        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
229        self.w
230    }
231}
232#[doc = "Erase All Request\n\nValue on reset: 0"]
233#[derive(Clone, Copy, Debug, PartialEq)]
234pub enum ERSAREQ_A {
235    #[doc = "0: No request or request complete"]
236    _0 = 0,
237    #[doc = "1: Request to: run the Erase All Blocks command, verify the erased state, program the security byte in the Flash Configuration Field to the unsecure state, and release MCU security by setting the FSEC\\[SEC\\]
238field to the unsecure state."]
239    _1 = 1,
240}
241impl From<ERSAREQ_A> for bool {
242    #[inline(always)]
243    fn from(variant: ERSAREQ_A) -> Self {
244        variant as u8 != 0
245    }
246}
247#[doc = "Reader of field `ERSAREQ`"]
248pub type ERSAREQ_R = crate::R<bool, ERSAREQ_A>;
249impl ERSAREQ_R {
250    #[doc = r"Get enumerated values variant"]
251    #[inline(always)]
252    pub fn variant(&self) -> ERSAREQ_A {
253        match self.bits {
254            false => ERSAREQ_A::_0,
255            true => ERSAREQ_A::_1,
256        }
257    }
258    #[doc = "Checks if the value of the field is `_0`"]
259    #[inline(always)]
260    pub fn is_0(&self) -> bool {
261        *self == ERSAREQ_A::_0
262    }
263    #[doc = "Checks if the value of the field is `_1`"]
264    #[inline(always)]
265    pub fn is_1(&self) -> bool {
266        *self == ERSAREQ_A::_1
267    }
268}
269#[doc = "Read Collision Error Interrupt Enable\n\nValue on reset: 0"]
270#[derive(Clone, Copy, Debug, PartialEq)]
271pub enum RDCOLLIE_A {
272    #[doc = "0: Read collision error interrupt disabled"]
273    _0 = 0,
274    #[doc = "1: Read collision error interrupt enabled. An interrupt request is generated whenever an FTFE read collision error is detected (see the description of FSTAT\\[RDCOLERR\\])."]
275    _1 = 1,
276}
277impl From<RDCOLLIE_A> for bool {
278    #[inline(always)]
279    fn from(variant: RDCOLLIE_A) -> Self {
280        variant as u8 != 0
281    }
282}
283#[doc = "Reader of field `RDCOLLIE`"]
284pub type RDCOLLIE_R = crate::R<bool, RDCOLLIE_A>;
285impl RDCOLLIE_R {
286    #[doc = r"Get enumerated values variant"]
287    #[inline(always)]
288    pub fn variant(&self) -> RDCOLLIE_A {
289        match self.bits {
290            false => RDCOLLIE_A::_0,
291            true => RDCOLLIE_A::_1,
292        }
293    }
294    #[doc = "Checks if the value of the field is `_0`"]
295    #[inline(always)]
296    pub fn is_0(&self) -> bool {
297        *self == RDCOLLIE_A::_0
298    }
299    #[doc = "Checks if the value of the field is `_1`"]
300    #[inline(always)]
301    pub fn is_1(&self) -> bool {
302        *self == RDCOLLIE_A::_1
303    }
304}
305#[doc = "Write proxy for field `RDCOLLIE`"]
306pub struct RDCOLLIE_W<'a> {
307    w: &'a mut W,
308}
309impl<'a> RDCOLLIE_W<'a> {
310    #[doc = r"Writes `variant` to the field"]
311    #[inline(always)]
312    pub fn variant(self, variant: RDCOLLIE_A) -> &'a mut W {
313        {
314            self.bit(variant.into())
315        }
316    }
317    #[doc = "Read collision error interrupt disabled"]
318    #[inline(always)]
319    pub fn _0(self) -> &'a mut W {
320        self.variant(RDCOLLIE_A::_0)
321    }
322    #[doc = "Read collision error interrupt enabled. An interrupt request is generated whenever an FTFE read collision error is detected (see the description of FSTAT\\[RDCOLERR\\])."]
323    #[inline(always)]
324    pub fn _1(self) -> &'a mut W {
325        self.variant(RDCOLLIE_A::_1)
326    }
327    #[doc = r"Sets the field bit"]
328    #[inline(always)]
329    pub fn set_bit(self) -> &'a mut W {
330        self.bit(true)
331    }
332    #[doc = r"Clears the field bit"]
333    #[inline(always)]
334    pub fn clear_bit(self) -> &'a mut W {
335        self.bit(false)
336    }
337    #[doc = r"Writes raw bits to the field"]
338    #[inline(always)]
339    pub fn bit(self, value: bool) -> &'a mut W {
340        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
341        self.w
342    }
343}
344#[doc = "Command Complete Interrupt Enable\n\nValue on reset: 0"]
345#[derive(Clone, Copy, Debug, PartialEq)]
346pub enum CCIE_A {
347    #[doc = "0: Command complete interrupt disabled"]
348    _0 = 0,
349    #[doc = "1: Command complete interrupt enabled. An interrupt request is generated whenever the FSTAT\\[CCIF\\]
350flag is set."]
351    _1 = 1,
352}
353impl From<CCIE_A> for bool {
354    #[inline(always)]
355    fn from(variant: CCIE_A) -> Self {
356        variant as u8 != 0
357    }
358}
359#[doc = "Reader of field `CCIE`"]
360pub type CCIE_R = crate::R<bool, CCIE_A>;
361impl CCIE_R {
362    #[doc = r"Get enumerated values variant"]
363    #[inline(always)]
364    pub fn variant(&self) -> CCIE_A {
365        match self.bits {
366            false => CCIE_A::_0,
367            true => CCIE_A::_1,
368        }
369    }
370    #[doc = "Checks if the value of the field is `_0`"]
371    #[inline(always)]
372    pub fn is_0(&self) -> bool {
373        *self == CCIE_A::_0
374    }
375    #[doc = "Checks if the value of the field is `_1`"]
376    #[inline(always)]
377    pub fn is_1(&self) -> bool {
378        *self == CCIE_A::_1
379    }
380}
381#[doc = "Write proxy for field `CCIE`"]
382pub struct CCIE_W<'a> {
383    w: &'a mut W,
384}
385impl<'a> CCIE_W<'a> {
386    #[doc = r"Writes `variant` to the field"]
387    #[inline(always)]
388    pub fn variant(self, variant: CCIE_A) -> &'a mut W {
389        {
390            self.bit(variant.into())
391        }
392    }
393    #[doc = "Command complete interrupt disabled"]
394    #[inline(always)]
395    pub fn _0(self) -> &'a mut W {
396        self.variant(CCIE_A::_0)
397    }
398    #[doc = "Command complete interrupt enabled. An interrupt request is generated whenever the FSTAT\\[CCIF\\]
399flag is set."]
400    #[inline(always)]
401    pub fn _1(self) -> &'a mut W {
402        self.variant(CCIE_A::_1)
403    }
404    #[doc = r"Sets the field bit"]
405    #[inline(always)]
406    pub fn set_bit(self) -> &'a mut W {
407        self.bit(true)
408    }
409    #[doc = r"Clears the field bit"]
410    #[inline(always)]
411    pub fn clear_bit(self) -> &'a mut W {
412        self.bit(false)
413    }
414    #[doc = r"Writes raw bits to the field"]
415    #[inline(always)]
416    pub fn bit(self, value: bool) -> &'a mut W {
417        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
418        self.w
419    }
420}
421impl R {
422    #[doc = "Bit 0 - For devices with FlexNVM: This flag indicates if the EEPROM backup data has been copied to the FlexRAM and is therefore available for read access"]
423    #[inline(always)]
424    pub fn eeerdy(&self) -> EEERDY_R {
425        EEERDY_R::new((self.bits & 0x01) != 0)
426    }
427    #[doc = "Bit 1 - RAM Ready"]
428    #[inline(always)]
429    pub fn ramrdy(&self) -> RAMRDY_R {
430        RAMRDY_R::new(((self.bits >> 1) & 0x01) != 0)
431    }
432    #[doc = "Bit 2 - FTFE configuration"]
433    #[inline(always)]
434    pub fn pflsh(&self) -> PFLSH_R {
435        PFLSH_R::new(((self.bits >> 2) & 0x01) != 0)
436    }
437    #[doc = "Bit 3 - Swap"]
438    #[inline(always)]
439    pub fn swap(&self) -> SWAP_R {
440        SWAP_R::new(((self.bits >> 3) & 0x01) != 0)
441    }
442    #[doc = "Bit 4 - Erase Suspend"]
443    #[inline(always)]
444    pub fn erssusp(&self) -> ERSSUSP_R {
445        ERSSUSP_R::new(((self.bits >> 4) & 0x01) != 0)
446    }
447    #[doc = "Bit 5 - Erase All Request"]
448    #[inline(always)]
449    pub fn ersareq(&self) -> ERSAREQ_R {
450        ERSAREQ_R::new(((self.bits >> 5) & 0x01) != 0)
451    }
452    #[doc = "Bit 6 - Read Collision Error Interrupt Enable"]
453    #[inline(always)]
454    pub fn rdcollie(&self) -> RDCOLLIE_R {
455        RDCOLLIE_R::new(((self.bits >> 6) & 0x01) != 0)
456    }
457    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
458    #[inline(always)]
459    pub fn ccie(&self) -> CCIE_R {
460        CCIE_R::new(((self.bits >> 7) & 0x01) != 0)
461    }
462}
463impl W {
464    #[doc = "Bit 4 - Erase Suspend"]
465    #[inline(always)]
466    pub fn erssusp(&mut self) -> ERSSUSP_W {
467        ERSSUSP_W { w: self }
468    }
469    #[doc = "Bit 6 - Read Collision Error Interrupt Enable"]
470    #[inline(always)]
471    pub fn rdcollie(&mut self) -> RDCOLLIE_W {
472        RDCOLLIE_W { w: self }
473    }
474    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
475    #[inline(always)]
476    pub fn ccie(&mut self) -> CCIE_W {
477        CCIE_W { w: self }
478    }
479}