ra2e2/flcn/
fstatr2.rs

1#[doc = "Register `FSTATR2` reader"]
2pub struct R(crate::R<FSTATR2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FSTATR2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FSTATR2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FSTATR2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `ERERR` reader - Erase Error Flag"]
17pub type ERERR_R = crate::BitReader<ERERR_A>;
18#[doc = "Erase Error Flag\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum ERERR_A {
21    #[doc = "0: Erasure terminates normally"]
22    _0 = 0,
23    #[doc = "1: An error occurs during erasure"]
24    _1 = 1,
25}
26impl From<ERERR_A> for bool {
27    #[inline(always)]
28    fn from(variant: ERERR_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl ERERR_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> ERERR_A {
36        match self.bits {
37            false => ERERR_A::_0,
38            true => ERERR_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == ERERR_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == ERERR_A::_1
50    }
51}
52#[doc = "Field `PRGERR` reader - Program Error Flag"]
53pub type PRGERR_R = crate::BitReader<PRGERR_A>;
54#[doc = "Program Error Flag\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum PRGERR_A {
57    #[doc = "0: Programming terminates normally"]
58    _0 = 0,
59    #[doc = "1: An error occurs during programming."]
60    _1 = 1,
61}
62impl From<PRGERR_A> for bool {
63    #[inline(always)]
64    fn from(variant: PRGERR_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl PRGERR_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> PRGERR_A {
72        match self.bits {
73            false => PRGERR_A::_0,
74            true => PRGERR_A::_1,
75        }
76    }
77    #[doc = "Checks if the value of the field is `_0`"]
78    #[inline(always)]
79    pub fn is_0(&self) -> bool {
80        *self == PRGERR_A::_0
81    }
82    #[doc = "Checks if the value of the field is `_1`"]
83    #[inline(always)]
84    pub fn is_1(&self) -> bool {
85        *self == PRGERR_A::_1
86    }
87}
88#[doc = "Field `PRGERR01` reader - Program Error Flag 01"]
89pub type PRGERR01_R = crate::BitReader<PRGERR01_A>;
90#[doc = "Program Error Flag 01\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum PRGERR01_A {
93    #[doc = "0: Programming by the FEXCR register terminates normally"]
94    _0 = 0,
95    #[doc = "1: An error occurs during programming."]
96    _1 = 1,
97}
98impl From<PRGERR01_A> for bool {
99    #[inline(always)]
100    fn from(variant: PRGERR01_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl PRGERR01_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> PRGERR01_A {
108        match self.bits {
109            false => PRGERR01_A::_0,
110            true => PRGERR01_A::_1,
111        }
112    }
113    #[doc = "Checks if the value of the field is `_0`"]
114    #[inline(always)]
115    pub fn is_0(&self) -> bool {
116        *self == PRGERR01_A::_0
117    }
118    #[doc = "Checks if the value of the field is `_1`"]
119    #[inline(always)]
120    pub fn is_1(&self) -> bool {
121        *self == PRGERR01_A::_1
122    }
123}
124#[doc = "Field `BCERR` reader - Blank Check Error Flag"]
125pub type BCERR_R = crate::BitReader<BCERR_A>;
126#[doc = "Blank Check Error Flag\n\nValue on reset: 0"]
127#[derive(Clone, Copy, Debug, PartialEq, Eq)]
128pub enum BCERR_A {
129    #[doc = "0: Blank checking terminates normally"]
130    _0 = 0,
131    #[doc = "1: An error occurs during blank checking."]
132    _1 = 1,
133}
134impl From<BCERR_A> for bool {
135    #[inline(always)]
136    fn from(variant: BCERR_A) -> Self {
137        variant as u8 != 0
138    }
139}
140impl BCERR_R {
141    #[doc = "Get enumerated values variant"]
142    #[inline(always)]
143    pub fn variant(&self) -> BCERR_A {
144        match self.bits {
145            false => BCERR_A::_0,
146            true => BCERR_A::_1,
147        }
148    }
149    #[doc = "Checks if the value of the field is `_0`"]
150    #[inline(always)]
151    pub fn is_0(&self) -> bool {
152        *self == BCERR_A::_0
153    }
154    #[doc = "Checks if the value of the field is `_1`"]
155    #[inline(always)]
156    pub fn is_1(&self) -> bool {
157        *self == BCERR_A::_1
158    }
159}
160#[doc = "Field `ILGLERR` reader - Illegal Command Error Flag"]
161pub type ILGLERR_R = crate::BitReader<ILGLERR_A>;
162#[doc = "Illegal Command Error Flag\n\nValue on reset: 0"]
163#[derive(Clone, Copy, Debug, PartialEq, Eq)]
164pub enum ILGLERR_A {
165    #[doc = "0: No illegal software command or illegal access is detected"]
166    _0 = 0,
167    #[doc = "1: An illegal command or illegal access is detected."]
168    _1 = 1,
169}
170impl From<ILGLERR_A> for bool {
171    #[inline(always)]
172    fn from(variant: ILGLERR_A) -> Self {
173        variant as u8 != 0
174    }
175}
176impl ILGLERR_R {
177    #[doc = "Get enumerated values variant"]
178    #[inline(always)]
179    pub fn variant(&self) -> ILGLERR_A {
180        match self.bits {
181            false => ILGLERR_A::_0,
182            true => ILGLERR_A::_1,
183        }
184    }
185    #[doc = "Checks if the value of the field is `_0`"]
186    #[inline(always)]
187    pub fn is_0(&self) -> bool {
188        *self == ILGLERR_A::_0
189    }
190    #[doc = "Checks if the value of the field is `_1`"]
191    #[inline(always)]
192    pub fn is_1(&self) -> bool {
193        *self == ILGLERR_A::_1
194    }
195}
196#[doc = "Field `EILGLERR` reader - Extra Area Illegal Command Error Flag"]
197pub type EILGLERR_R = crate::BitReader<EILGLERR_A>;
198#[doc = "Extra Area Illegal Command Error Flag\n\nValue on reset: 0"]
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
200pub enum EILGLERR_A {
201    #[doc = "0: No illegal command or illegal access to the extra area is detected"]
202    _0 = 0,
203    #[doc = "1: An illegal command or illegal access to the extra area is detected."]
204    _1 = 1,
205}
206impl From<EILGLERR_A> for bool {
207    #[inline(always)]
208    fn from(variant: EILGLERR_A) -> Self {
209        variant as u8 != 0
210    }
211}
212impl EILGLERR_R {
213    #[doc = "Get enumerated values variant"]
214    #[inline(always)]
215    pub fn variant(&self) -> EILGLERR_A {
216        match self.bits {
217            false => EILGLERR_A::_0,
218            true => EILGLERR_A::_1,
219        }
220    }
221    #[doc = "Checks if the value of the field is `_0`"]
222    #[inline(always)]
223    pub fn is_0(&self) -> bool {
224        *self == EILGLERR_A::_0
225    }
226    #[doc = "Checks if the value of the field is `_1`"]
227    #[inline(always)]
228    pub fn is_1(&self) -> bool {
229        *self == EILGLERR_A::_1
230    }
231}
232impl R {
233    #[doc = "Bit 0 - Erase Error Flag"]
234    #[inline(always)]
235    pub fn ererr(&self) -> ERERR_R {
236        ERERR_R::new((self.bits & 1) != 0)
237    }
238    #[doc = "Bit 1 - Program Error Flag"]
239    #[inline(always)]
240    pub fn prgerr(&self) -> PRGERR_R {
241        PRGERR_R::new(((self.bits >> 1) & 1) != 0)
242    }
243    #[doc = "Bit 2 - Program Error Flag 01"]
244    #[inline(always)]
245    pub fn prgerr01(&self) -> PRGERR01_R {
246        PRGERR01_R::new(((self.bits >> 2) & 1) != 0)
247    }
248    #[doc = "Bit 3 - Blank Check Error Flag"]
249    #[inline(always)]
250    pub fn bcerr(&self) -> BCERR_R {
251        BCERR_R::new(((self.bits >> 3) & 1) != 0)
252    }
253    #[doc = "Bit 4 - Illegal Command Error Flag"]
254    #[inline(always)]
255    pub fn ilglerr(&self) -> ILGLERR_R {
256        ILGLERR_R::new(((self.bits >> 4) & 1) != 0)
257    }
258    #[doc = "Bit 5 - Extra Area Illegal Command Error Flag"]
259    #[inline(always)]
260    pub fn eilglerr(&self) -> EILGLERR_R {
261        EILGLERR_R::new(((self.bits >> 5) & 1) != 0)
262    }
263}
264#[doc = "Flash Status Register 2\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fstatr2](index.html) module"]
265pub struct FSTATR2_SPEC;
266impl crate::RegisterSpec for FSTATR2_SPEC {
267    type Ux = u16;
268}
269#[doc = "`read()` method returns [fstatr2::R](R) reader structure"]
270impl crate::Readable for FSTATR2_SPEC {
271    type Reader = R;
272}
273#[doc = "`reset()` method sets FSTATR2 to value 0"]
274impl crate::Resettable for FSTATR2_SPEC {
275    const RESET_VALUE: Self::Ux = 0;
276}