wip_s32k144/ftfc/
fcnfg.rs1#[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 0x02"]
6impl crate::ResetValue for super::FCNFG {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x02
11    }
12}
13#[doc = "Reader of field `EEERDY`"]
14pub type EEERDY_R = crate::R<bool, bool>;
15#[doc = "Reader of field `RAMRDY`"]
16pub type RAMRDY_R = crate::R<bool, bool>;
17#[doc = "Erase Suspend\n\nValue on reset: 0"]
18#[derive(Clone, Copy, Debug, PartialEq)]
19pub enum ERSSUSP_A {
20    #[doc = "0: No suspend requested"]
21    _0 = 0,
22    #[doc = "1: Suspend the current Erase Flash Sector command execution"]
23    _1 = 1,
24}
25impl From<ERSSUSP_A> for bool {
26    #[inline(always)]
27    fn from(variant: ERSSUSP_A) -> Self {
28        variant as u8 != 0
29    }
30}
31#[doc = "Reader of field `ERSSUSP`"]
32pub type ERSSUSP_R = crate::R<bool, ERSSUSP_A>;
33impl ERSSUSP_R {
34    #[doc = r"Get enumerated values variant"]
35    #[inline(always)]
36    pub fn variant(&self) -> ERSSUSP_A {
37        match self.bits {
38            false => ERSSUSP_A::_0,
39            true => ERSSUSP_A::_1,
40        }
41    }
42    #[doc = "Checks if the value of the field is `_0`"]
43    #[inline(always)]
44    pub fn is_0(&self) -> bool {
45        *self == ERSSUSP_A::_0
46    }
47    #[doc = "Checks if the value of the field is `_1`"]
48    #[inline(always)]
49    pub fn is_1(&self) -> bool {
50        *self == ERSSUSP_A::_1
51    }
52}
53#[doc = "Write proxy for field `ERSSUSP`"]
54pub struct ERSSUSP_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> ERSSUSP_W<'a> {
58    #[doc = r"Writes `variant` to the field"]
59    #[inline(always)]
60    pub fn variant(self, variant: ERSSUSP_A) -> &'a mut W {
61        {
62            self.bit(variant.into())
63        }
64    }
65    #[doc = "No suspend requested"]
66    #[inline(always)]
67    pub fn _0(self) -> &'a mut W {
68        self.variant(ERSSUSP_A::_0)
69    }
70    #[doc = "Suspend the current Erase Flash Sector command execution"]
71    #[inline(always)]
72    pub fn _1(self) -> &'a mut W {
73        self.variant(ERSSUSP_A::_1)
74    }
75    #[doc = r"Sets the field bit"]
76    #[inline(always)]
77    pub fn set_bit(self) -> &'a mut W {
78        self.bit(true)
79    }
80    #[doc = r"Clears the field bit"]
81    #[inline(always)]
82    pub fn clear_bit(self) -> &'a mut W {
83        self.bit(false)
84    }
85    #[doc = r"Writes raw bits to the field"]
86    #[inline(always)]
87    pub fn bit(self, value: bool) -> &'a mut W {
88        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
89        self.w
90    }
91}
92#[doc = "Erase All Request\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum ERSAREQ_A {
95    #[doc = "0: No request or request complete"]
96    _0 = 0,
97}
98impl From<ERSAREQ_A> for bool {
99    #[inline(always)]
100    fn from(variant: ERSAREQ_A) -> Self {
101        variant as u8 != 0
102    }
103}
104#[doc = "Reader of field `ERSAREQ`"]
105pub type ERSAREQ_R = crate::R<bool, ERSAREQ_A>;
106impl ERSAREQ_R {
107    #[doc = r"Get enumerated values variant"]
108    #[inline(always)]
109    pub fn variant(&self) -> crate::Variant<bool, ERSAREQ_A> {
110        use crate::Variant::*;
111        match self.bits {
112            false => Val(ERSAREQ_A::_0),
113            i => Res(i),
114        }
115    }
116    #[doc = "Checks if the value of the field is `_0`"]
117    #[inline(always)]
118    pub fn is_0(&self) -> bool {
119        *self == ERSAREQ_A::_0
120    }
121}
122#[doc = "Read Collision Error Interrupt Enable\n\nValue on reset: 0"]
123#[derive(Clone, Copy, Debug, PartialEq)]
124pub enum RDCOLLIE_A {
125    #[doc = "0: Read collision error interrupt disabled"]
126    _0 = 0,
127    #[doc = "1: Read collision error interrupt enabled. An interrupt request is generated whenever an FTFC read collision error is detected (see the description of FSTAT\\[RDCOLERR\\])."]
128    _1 = 1,
129}
130impl From<RDCOLLIE_A> for bool {
131    #[inline(always)]
132    fn from(variant: RDCOLLIE_A) -> Self {
133        variant as u8 != 0
134    }
135}
136#[doc = "Reader of field `RDCOLLIE`"]
137pub type RDCOLLIE_R = crate::R<bool, RDCOLLIE_A>;
138impl RDCOLLIE_R {
139    #[doc = r"Get enumerated values variant"]
140    #[inline(always)]
141    pub fn variant(&self) -> RDCOLLIE_A {
142        match self.bits {
143            false => RDCOLLIE_A::_0,
144            true => RDCOLLIE_A::_1,
145        }
146    }
147    #[doc = "Checks if the value of the field is `_0`"]
148    #[inline(always)]
149    pub fn is_0(&self) -> bool {
150        *self == RDCOLLIE_A::_0
151    }
152    #[doc = "Checks if the value of the field is `_1`"]
153    #[inline(always)]
154    pub fn is_1(&self) -> bool {
155        *self == RDCOLLIE_A::_1
156    }
157}
158#[doc = "Write proxy for field `RDCOLLIE`"]
159pub struct RDCOLLIE_W<'a> {
160    w: &'a mut W,
161}
162impl<'a> RDCOLLIE_W<'a> {
163    #[doc = r"Writes `variant` to the field"]
164    #[inline(always)]
165    pub fn variant(self, variant: RDCOLLIE_A) -> &'a mut W {
166        {
167            self.bit(variant.into())
168        }
169    }
170    #[doc = "Read collision error interrupt disabled"]
171    #[inline(always)]
172    pub fn _0(self) -> &'a mut W {
173        self.variant(RDCOLLIE_A::_0)
174    }
175    #[doc = "Read collision error interrupt enabled. An interrupt request is generated whenever an FTFC read collision error is detected (see the description of FSTAT\\[RDCOLERR\\])."]
176    #[inline(always)]
177    pub fn _1(self) -> &'a mut W {
178        self.variant(RDCOLLIE_A::_1)
179    }
180    #[doc = r"Sets the field bit"]
181    #[inline(always)]
182    pub fn set_bit(self) -> &'a mut W {
183        self.bit(true)
184    }
185    #[doc = r"Clears the field bit"]
186    #[inline(always)]
187    pub fn clear_bit(self) -> &'a mut W {
188        self.bit(false)
189    }
190    #[doc = r"Writes raw bits to the field"]
191    #[inline(always)]
192    pub fn bit(self, value: bool) -> &'a mut W {
193        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
194        self.w
195    }
196}
197#[doc = "Command Complete Interrupt Enable\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub enum CCIE_A {
200    #[doc = "0: Command complete interrupt disabled"]
201    _0 = 0,
202    #[doc = "1: Command complete interrupt enabled. An interrupt request is generated whenever the FSTAT\\[CCIF\\]
203flag is set."]
204    _1 = 1,
205}
206impl From<CCIE_A> for bool {
207    #[inline(always)]
208    fn from(variant: CCIE_A) -> Self {
209        variant as u8 != 0
210    }
211}
212#[doc = "Reader of field `CCIE`"]
213pub type CCIE_R = crate::R<bool, CCIE_A>;
214impl CCIE_R {
215    #[doc = r"Get enumerated values variant"]
216    #[inline(always)]
217    pub fn variant(&self) -> CCIE_A {
218        match self.bits {
219            false => CCIE_A::_0,
220            true => CCIE_A::_1,
221        }
222    }
223    #[doc = "Checks if the value of the field is `_0`"]
224    #[inline(always)]
225    pub fn is_0(&self) -> bool {
226        *self == CCIE_A::_0
227    }
228    #[doc = "Checks if the value of the field is `_1`"]
229    #[inline(always)]
230    pub fn is_1(&self) -> bool {
231        *self == CCIE_A::_1
232    }
233}
234#[doc = "Write proxy for field `CCIE`"]
235pub struct CCIE_W<'a> {
236    w: &'a mut W,
237}
238impl<'a> CCIE_W<'a> {
239    #[doc = r"Writes `variant` to the field"]
240    #[inline(always)]
241    pub fn variant(self, variant: CCIE_A) -> &'a mut W {
242        {
243            self.bit(variant.into())
244        }
245    }
246    #[doc = "Command complete interrupt disabled"]
247    #[inline(always)]
248    pub fn _0(self) -> &'a mut W {
249        self.variant(CCIE_A::_0)
250    }
251    #[doc = "Command complete interrupt enabled. An interrupt request is generated whenever the FSTAT\\[CCIF\\]
252flag is set."]
253    #[inline(always)]
254    pub fn _1(self) -> &'a mut W {
255        self.variant(CCIE_A::_1)
256    }
257    #[doc = r"Sets the field bit"]
258    #[inline(always)]
259    pub fn set_bit(self) -> &'a mut W {
260        self.bit(true)
261    }
262    #[doc = r"Clears the field bit"]
263    #[inline(always)]
264    pub fn clear_bit(self) -> &'a mut W {
265        self.bit(false)
266    }
267    #[doc = r"Writes raw bits to the field"]
268    #[inline(always)]
269    pub fn bit(self, value: bool) -> &'a mut W {
270        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
271        self.w
272    }
273}
274impl R {
275    #[doc = "Bit 0 - EEERDY"]
276    #[inline(always)]
277    pub fn eeerdy(&self) -> EEERDY_R {
278        EEERDY_R::new((self.bits & 0x01) != 0)
279    }
280    #[doc = "Bit 1 - RAM Ready"]
281    #[inline(always)]
282    pub fn ramrdy(&self) -> RAMRDY_R {
283        RAMRDY_R::new(((self.bits >> 1) & 0x01) != 0)
284    }
285    #[doc = "Bit 4 - Erase Suspend"]
286    #[inline(always)]
287    pub fn erssusp(&self) -> ERSSUSP_R {
288        ERSSUSP_R::new(((self.bits >> 4) & 0x01) != 0)
289    }
290    #[doc = "Bit 5 - Erase All Request"]
291    #[inline(always)]
292    pub fn ersareq(&self) -> ERSAREQ_R {
293        ERSAREQ_R::new(((self.bits >> 5) & 0x01) != 0)
294    }
295    #[doc = "Bit 6 - Read Collision Error Interrupt Enable"]
296    #[inline(always)]
297    pub fn rdcollie(&self) -> RDCOLLIE_R {
298        RDCOLLIE_R::new(((self.bits >> 6) & 0x01) != 0)
299    }
300    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
301    #[inline(always)]
302    pub fn ccie(&self) -> CCIE_R {
303        CCIE_R::new(((self.bits >> 7) & 0x01) != 0)
304    }
305}
306impl W {
307    #[doc = "Bit 4 - Erase Suspend"]
308    #[inline(always)]
309    pub fn erssusp(&mut self) -> ERSSUSP_W {
310        ERSSUSP_W { w: self }
311    }
312    #[doc = "Bit 6 - Read Collision Error Interrupt Enable"]
313    #[inline(always)]
314    pub fn rdcollie(&mut self) -> RDCOLLIE_W {
315        RDCOLLIE_W { w: self }
316    }
317    #[doc = "Bit 7 - Command Complete Interrupt Enable"]
318    #[inline(always)]
319    pub fn ccie(&mut self) -> CCIE_W {
320        CCIE_W { w: self }
321    }
322}