stm32f4_staging/stm32f413/flash/
cr.rs1pub type R = crate::R<CRrs>;
3pub type W = crate::W<CRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum PG {
11 Program = 1,
13}
14impl From<PG> for bool {
15 #[inline(always)]
16 fn from(variant: PG) -> Self {
17 variant as u8 != 0
18 }
19}
20pub type PG_R = crate::BitReader<PG>;
22impl PG_R {
23 #[inline(always)]
25 pub const fn variant(&self) -> Option<PG> {
26 match self.bits {
27 true => Some(PG::Program),
28 _ => None,
29 }
30 }
31 #[inline(always)]
33 pub fn is_program(&self) -> bool {
34 *self == PG::Program
35 }
36}
37pub type PG_W<'a, REG> = crate::BitWriter<'a, REG, PG>;
39impl<'a, REG> PG_W<'a, REG>
40where
41 REG: crate::Writable + crate::RegisterSpec,
42{
43 #[inline(always)]
45 pub fn program(self) -> &'a mut crate::W<REG> {
46 self.variant(PG::Program)
47 }
48}
49#[cfg_attr(feature = "defmt", derive(defmt::Format))]
53#[derive(Clone, Copy, Debug, PartialEq, Eq)]
54pub enum SER {
55 SectorErase = 1,
57}
58impl From<SER> for bool {
59 #[inline(always)]
60 fn from(variant: SER) -> Self {
61 variant as u8 != 0
62 }
63}
64pub type SER_R = crate::BitReader<SER>;
66impl SER_R {
67 #[inline(always)]
69 pub const fn variant(&self) -> Option<SER> {
70 match self.bits {
71 true => Some(SER::SectorErase),
72 _ => None,
73 }
74 }
75 #[inline(always)]
77 pub fn is_sector_erase(&self) -> bool {
78 *self == SER::SectorErase
79 }
80}
81pub type SER_W<'a, REG> = crate::BitWriter<'a, REG, SER>;
83impl<'a, REG> SER_W<'a, REG>
84where
85 REG: crate::Writable + crate::RegisterSpec,
86{
87 #[inline(always)]
89 pub fn sector_erase(self) -> &'a mut crate::W<REG> {
90 self.variant(SER::SectorErase)
91 }
92}
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
97#[derive(Clone, Copy, Debug, PartialEq, Eq)]
98pub enum MER {
99 MassErase = 1,
101}
102impl From<MER> for bool {
103 #[inline(always)]
104 fn from(variant: MER) -> Self {
105 variant as u8 != 0
106 }
107}
108pub type MER_R = crate::BitReader<MER>;
110impl MER_R {
111 #[inline(always)]
113 pub const fn variant(&self) -> Option<MER> {
114 match self.bits {
115 true => Some(MER::MassErase),
116 _ => None,
117 }
118 }
119 #[inline(always)]
121 pub fn is_mass_erase(&self) -> bool {
122 *self == MER::MassErase
123 }
124}
125pub type MER_W<'a, REG> = crate::BitWriter<'a, REG, MER>;
127impl<'a, REG> MER_W<'a, REG>
128where
129 REG: crate::Writable + crate::RegisterSpec,
130{
131 #[inline(always)]
133 pub fn mass_erase(self) -> &'a mut crate::W<REG> {
134 self.variant(MER::MassErase)
135 }
136}
137pub type SNB_R = crate::FieldReader;
139pub type SNB_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
141#[cfg_attr(feature = "defmt", derive(defmt::Format))]
145#[derive(Clone, Copy, Debug, PartialEq, Eq)]
146#[repr(u8)]
147pub enum PSIZE {
148 Psize8 = 0,
150 Psize16 = 1,
152 Psize32 = 2,
154 Psize64 = 3,
156}
157impl From<PSIZE> for u8 {
158 #[inline(always)]
159 fn from(variant: PSIZE) -> Self {
160 variant as _
161 }
162}
163impl crate::FieldSpec for PSIZE {
164 type Ux = u8;
165}
166impl crate::IsEnum for PSIZE {}
167pub type PSIZE_R = crate::FieldReader<PSIZE>;
169impl PSIZE_R {
170 #[inline(always)]
172 pub const fn variant(&self) -> PSIZE {
173 match self.bits {
174 0 => PSIZE::Psize8,
175 1 => PSIZE::Psize16,
176 2 => PSIZE::Psize32,
177 3 => PSIZE::Psize64,
178 _ => unreachable!(),
179 }
180 }
181 #[inline(always)]
183 pub fn is_psize8(&self) -> bool {
184 *self == PSIZE::Psize8
185 }
186 #[inline(always)]
188 pub fn is_psize16(&self) -> bool {
189 *self == PSIZE::Psize16
190 }
191 #[inline(always)]
193 pub fn is_psize32(&self) -> bool {
194 *self == PSIZE::Psize32
195 }
196 #[inline(always)]
198 pub fn is_psize64(&self) -> bool {
199 *self == PSIZE::Psize64
200 }
201}
202pub type PSIZE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSIZE, crate::Safe>;
204impl<'a, REG> PSIZE_W<'a, REG>
205where
206 REG: crate::Writable + crate::RegisterSpec,
207 REG::Ux: From<u8>,
208{
209 #[inline(always)]
211 pub fn psize8(self) -> &'a mut crate::W<REG> {
212 self.variant(PSIZE::Psize8)
213 }
214 #[inline(always)]
216 pub fn psize16(self) -> &'a mut crate::W<REG> {
217 self.variant(PSIZE::Psize16)
218 }
219 #[inline(always)]
221 pub fn psize32(self) -> &'a mut crate::W<REG> {
222 self.variant(PSIZE::Psize32)
223 }
224 #[inline(always)]
226 pub fn psize64(self) -> &'a mut crate::W<REG> {
227 self.variant(PSIZE::Psize64)
228 }
229}
230#[cfg_attr(feature = "defmt", derive(defmt::Format))]
234#[derive(Clone, Copy, Debug, PartialEq, Eq)]
235pub enum STRT {
236 Start = 1,
238}
239impl From<STRT> for bool {
240 #[inline(always)]
241 fn from(variant: STRT) -> Self {
242 variant as u8 != 0
243 }
244}
245pub type STRT_R = crate::BitReader<STRT>;
247impl STRT_R {
248 #[inline(always)]
250 pub const fn variant(&self) -> Option<STRT> {
251 match self.bits {
252 true => Some(STRT::Start),
253 _ => None,
254 }
255 }
256 #[inline(always)]
258 pub fn is_start(&self) -> bool {
259 *self == STRT::Start
260 }
261}
262pub type STRT_W<'a, REG> = crate::BitWriter<'a, REG, STRT>;
264impl<'a, REG> STRT_W<'a, REG>
265where
266 REG: crate::Writable + crate::RegisterSpec,
267{
268 #[inline(always)]
270 pub fn start(self) -> &'a mut crate::W<REG> {
271 self.variant(STRT::Start)
272 }
273}
274#[cfg_attr(feature = "defmt", derive(defmt::Format))]
278#[derive(Clone, Copy, Debug, PartialEq, Eq)]
279pub enum EOPIE {
280 Disabled = 0,
282 Enabled = 1,
284}
285impl From<EOPIE> for bool {
286 #[inline(always)]
287 fn from(variant: EOPIE) -> Self {
288 variant as u8 != 0
289 }
290}
291pub type EOPIE_R = crate::BitReader<EOPIE>;
293impl EOPIE_R {
294 #[inline(always)]
296 pub const fn variant(&self) -> EOPIE {
297 match self.bits {
298 false => EOPIE::Disabled,
299 true => EOPIE::Enabled,
300 }
301 }
302 #[inline(always)]
304 pub fn is_disabled(&self) -> bool {
305 *self == EOPIE::Disabled
306 }
307 #[inline(always)]
309 pub fn is_enabled(&self) -> bool {
310 *self == EOPIE::Enabled
311 }
312}
313pub type EOPIE_W<'a, REG> = crate::BitWriter<'a, REG, EOPIE>;
315impl<'a, REG> EOPIE_W<'a, REG>
316where
317 REG: crate::Writable + crate::RegisterSpec,
318{
319 #[inline(always)]
321 pub fn disabled(self) -> &'a mut crate::W<REG> {
322 self.variant(EOPIE::Disabled)
323 }
324 #[inline(always)]
326 pub fn enabled(self) -> &'a mut crate::W<REG> {
327 self.variant(EOPIE::Enabled)
328 }
329}
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
334#[derive(Clone, Copy, Debug, PartialEq, Eq)]
335pub enum ERRIE {
336 Disabled = 0,
338 Enabled = 1,
340}
341impl From<ERRIE> for bool {
342 #[inline(always)]
343 fn from(variant: ERRIE) -> Self {
344 variant as u8 != 0
345 }
346}
347pub type ERRIE_R = crate::BitReader<ERRIE>;
349impl ERRIE_R {
350 #[inline(always)]
352 pub const fn variant(&self) -> ERRIE {
353 match self.bits {
354 false => ERRIE::Disabled,
355 true => ERRIE::Enabled,
356 }
357 }
358 #[inline(always)]
360 pub fn is_disabled(&self) -> bool {
361 *self == ERRIE::Disabled
362 }
363 #[inline(always)]
365 pub fn is_enabled(&self) -> bool {
366 *self == ERRIE::Enabled
367 }
368}
369pub type ERRIE_W<'a, REG> = crate::BitWriter<'a, REG, ERRIE>;
371impl<'a, REG> ERRIE_W<'a, REG>
372where
373 REG: crate::Writable + crate::RegisterSpec,
374{
375 #[inline(always)]
377 pub fn disabled(self) -> &'a mut crate::W<REG> {
378 self.variant(ERRIE::Disabled)
379 }
380 #[inline(always)]
382 pub fn enabled(self) -> &'a mut crate::W<REG> {
383 self.variant(ERRIE::Enabled)
384 }
385}
386#[cfg_attr(feature = "defmt", derive(defmt::Format))]
390#[derive(Clone, Copy, Debug, PartialEq, Eq)]
391pub enum LOCK {
392 Unlocked = 0,
394 Locked = 1,
396}
397impl From<LOCK> for bool {
398 #[inline(always)]
399 fn from(variant: LOCK) -> Self {
400 variant as u8 != 0
401 }
402}
403pub type LOCK_R = crate::BitReader<LOCK>;
405impl LOCK_R {
406 #[inline(always)]
408 pub const fn variant(&self) -> LOCK {
409 match self.bits {
410 false => LOCK::Unlocked,
411 true => LOCK::Locked,
412 }
413 }
414 #[inline(always)]
416 pub fn is_unlocked(&self) -> bool {
417 *self == LOCK::Unlocked
418 }
419 #[inline(always)]
421 pub fn is_locked(&self) -> bool {
422 *self == LOCK::Locked
423 }
424}
425pub type LOCK_W<'a, REG> = crate::BitWriter<'a, REG, LOCK>;
427impl<'a, REG> LOCK_W<'a, REG>
428where
429 REG: crate::Writable + crate::RegisterSpec,
430{
431 #[inline(always)]
433 pub fn unlocked(self) -> &'a mut crate::W<REG> {
434 self.variant(LOCK::Unlocked)
435 }
436 #[inline(always)]
438 pub fn locked(self) -> &'a mut crate::W<REG> {
439 self.variant(LOCK::Locked)
440 }
441}
442impl R {
443 #[inline(always)]
445 pub fn pg(&self) -> PG_R {
446 PG_R::new((self.bits & 1) != 0)
447 }
448 #[inline(always)]
450 pub fn ser(&self) -> SER_R {
451 SER_R::new(((self.bits >> 1) & 1) != 0)
452 }
453 #[inline(always)]
455 pub fn mer(&self) -> MER_R {
456 MER_R::new(((self.bits >> 2) & 1) != 0)
457 }
458 #[inline(always)]
460 pub fn snb(&self) -> SNB_R {
461 SNB_R::new(((self.bits >> 3) & 0x0f) as u8)
462 }
463 #[inline(always)]
465 pub fn psize(&self) -> PSIZE_R {
466 PSIZE_R::new(((self.bits >> 8) & 3) as u8)
467 }
468 #[inline(always)]
470 pub fn strt(&self) -> STRT_R {
471 STRT_R::new(((self.bits >> 16) & 1) != 0)
472 }
473 #[inline(always)]
475 pub fn eopie(&self) -> EOPIE_R {
476 EOPIE_R::new(((self.bits >> 24) & 1) != 0)
477 }
478 #[inline(always)]
480 pub fn errie(&self) -> ERRIE_R {
481 ERRIE_R::new(((self.bits >> 25) & 1) != 0)
482 }
483 #[inline(always)]
485 pub fn lock(&self) -> LOCK_R {
486 LOCK_R::new(((self.bits >> 31) & 1) != 0)
487 }
488}
489impl core::fmt::Debug for R {
490 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
491 f.debug_struct("CR")
492 .field("pg", &self.pg())
493 .field("ser", &self.ser())
494 .field("mer", &self.mer())
495 .field("snb", &self.snb())
496 .field("psize", &self.psize())
497 .field("strt", &self.strt())
498 .field("eopie", &self.eopie())
499 .field("errie", &self.errie())
500 .field("lock", &self.lock())
501 .finish()
502 }
503}
504impl W {
505 #[inline(always)]
507 pub fn pg(&mut self) -> PG_W<CRrs> {
508 PG_W::new(self, 0)
509 }
510 #[inline(always)]
512 pub fn ser(&mut self) -> SER_W<CRrs> {
513 SER_W::new(self, 1)
514 }
515 #[inline(always)]
517 pub fn mer(&mut self) -> MER_W<CRrs> {
518 MER_W::new(self, 2)
519 }
520 #[inline(always)]
522 pub fn snb(&mut self) -> SNB_W<CRrs> {
523 SNB_W::new(self, 3)
524 }
525 #[inline(always)]
527 pub fn psize(&mut self) -> PSIZE_W<CRrs> {
528 PSIZE_W::new(self, 8)
529 }
530 #[inline(always)]
532 pub fn strt(&mut self) -> STRT_W<CRrs> {
533 STRT_W::new(self, 16)
534 }
535 #[inline(always)]
537 pub fn eopie(&mut self) -> EOPIE_W<CRrs> {
538 EOPIE_W::new(self, 24)
539 }
540 #[inline(always)]
542 pub fn errie(&mut self) -> ERRIE_W<CRrs> {
543 ERRIE_W::new(self, 25)
544 }
545 #[inline(always)]
547 pub fn lock(&mut self) -> LOCK_W<CRrs> {
548 LOCK_W::new(self, 31)
549 }
550}
551pub struct CRrs;
557impl crate::RegisterSpec for CRrs {
558 type Ux = u32;
559}
560impl crate::Readable for CRrs {}
562impl crate::Writable for CRrs {
564 type Safety = crate::Unsafe;
565}
566impl crate::Resettable for CRrs {
568 const RESET_VALUE: u32 = 0x8000_0000;
569}