stm32f4_staging/stm32f469/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, 5>;
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 MER1 {
236 MassErase = 1,
238}
239impl From<MER1> for bool {
240 #[inline(always)]
241 fn from(variant: MER1) -> Self {
242 variant as u8 != 0
243 }
244}
245pub type MER1_R = crate::BitReader<MER1>;
247impl MER1_R {
248 #[inline(always)]
250 pub const fn variant(&self) -> Option<MER1> {
251 match self.bits {
252 true => Some(MER1::MassErase),
253 _ => None,
254 }
255 }
256 #[inline(always)]
258 pub fn is_mass_erase(&self) -> bool {
259 *self == MER1::MassErase
260 }
261}
262pub type MER1_W<'a, REG> = crate::BitWriter<'a, REG, MER1>;
264impl<'a, REG> MER1_W<'a, REG>
265where
266 REG: crate::Writable + crate::RegisterSpec,
267{
268 #[inline(always)]
270 pub fn mass_erase(self) -> &'a mut crate::W<REG> {
271 self.variant(MER1::MassErase)
272 }
273}
274#[cfg_attr(feature = "defmt", derive(defmt::Format))]
278#[derive(Clone, Copy, Debug, PartialEq, Eq)]
279pub enum STRT {
280 Start = 1,
282}
283impl From<STRT> for bool {
284 #[inline(always)]
285 fn from(variant: STRT) -> Self {
286 variant as u8 != 0
287 }
288}
289pub type STRT_R = crate::BitReader<STRT>;
291impl STRT_R {
292 #[inline(always)]
294 pub const fn variant(&self) -> Option<STRT> {
295 match self.bits {
296 true => Some(STRT::Start),
297 _ => None,
298 }
299 }
300 #[inline(always)]
302 pub fn is_start(&self) -> bool {
303 *self == STRT::Start
304 }
305}
306pub type STRT_W<'a, REG> = crate::BitWriter<'a, REG, STRT>;
308impl<'a, REG> STRT_W<'a, REG>
309where
310 REG: crate::Writable + crate::RegisterSpec,
311{
312 #[inline(always)]
314 pub fn start(self) -> &'a mut crate::W<REG> {
315 self.variant(STRT::Start)
316 }
317}
318#[cfg_attr(feature = "defmt", derive(defmt::Format))]
322#[derive(Clone, Copy, Debug, PartialEq, Eq)]
323pub enum EOPIE {
324 Disabled = 0,
326 Enabled = 1,
328}
329impl From<EOPIE> for bool {
330 #[inline(always)]
331 fn from(variant: EOPIE) -> Self {
332 variant as u8 != 0
333 }
334}
335pub type EOPIE_R = crate::BitReader<EOPIE>;
337impl EOPIE_R {
338 #[inline(always)]
340 pub const fn variant(&self) -> EOPIE {
341 match self.bits {
342 false => EOPIE::Disabled,
343 true => EOPIE::Enabled,
344 }
345 }
346 #[inline(always)]
348 pub fn is_disabled(&self) -> bool {
349 *self == EOPIE::Disabled
350 }
351 #[inline(always)]
353 pub fn is_enabled(&self) -> bool {
354 *self == EOPIE::Enabled
355 }
356}
357pub type EOPIE_W<'a, REG> = crate::BitWriter<'a, REG, EOPIE>;
359impl<'a, REG> EOPIE_W<'a, REG>
360where
361 REG: crate::Writable + crate::RegisterSpec,
362{
363 #[inline(always)]
365 pub fn disabled(self) -> &'a mut crate::W<REG> {
366 self.variant(EOPIE::Disabled)
367 }
368 #[inline(always)]
370 pub fn enabled(self) -> &'a mut crate::W<REG> {
371 self.variant(EOPIE::Enabled)
372 }
373}
374#[cfg_attr(feature = "defmt", derive(defmt::Format))]
378#[derive(Clone, Copy, Debug, PartialEq, Eq)]
379pub enum ERRIE {
380 Disabled = 0,
382 Enabled = 1,
384}
385impl From<ERRIE> for bool {
386 #[inline(always)]
387 fn from(variant: ERRIE) -> Self {
388 variant as u8 != 0
389 }
390}
391pub type ERRIE_R = crate::BitReader<ERRIE>;
393impl ERRIE_R {
394 #[inline(always)]
396 pub const fn variant(&self) -> ERRIE {
397 match self.bits {
398 false => ERRIE::Disabled,
399 true => ERRIE::Enabled,
400 }
401 }
402 #[inline(always)]
404 pub fn is_disabled(&self) -> bool {
405 *self == ERRIE::Disabled
406 }
407 #[inline(always)]
409 pub fn is_enabled(&self) -> bool {
410 *self == ERRIE::Enabled
411 }
412}
413pub type ERRIE_W<'a, REG> = crate::BitWriter<'a, REG, ERRIE>;
415impl<'a, REG> ERRIE_W<'a, REG>
416where
417 REG: crate::Writable + crate::RegisterSpec,
418{
419 #[inline(always)]
421 pub fn disabled(self) -> &'a mut crate::W<REG> {
422 self.variant(ERRIE::Disabled)
423 }
424 #[inline(always)]
426 pub fn enabled(self) -> &'a mut crate::W<REG> {
427 self.variant(ERRIE::Enabled)
428 }
429}
430#[cfg_attr(feature = "defmt", derive(defmt::Format))]
434#[derive(Clone, Copy, Debug, PartialEq, Eq)]
435pub enum LOCK {
436 Unlocked = 0,
438 Locked = 1,
440}
441impl From<LOCK> for bool {
442 #[inline(always)]
443 fn from(variant: LOCK) -> Self {
444 variant as u8 != 0
445 }
446}
447pub type LOCK_R = crate::BitReader<LOCK>;
449impl LOCK_R {
450 #[inline(always)]
452 pub const fn variant(&self) -> LOCK {
453 match self.bits {
454 false => LOCK::Unlocked,
455 true => LOCK::Locked,
456 }
457 }
458 #[inline(always)]
460 pub fn is_unlocked(&self) -> bool {
461 *self == LOCK::Unlocked
462 }
463 #[inline(always)]
465 pub fn is_locked(&self) -> bool {
466 *self == LOCK::Locked
467 }
468}
469pub type LOCK_W<'a, REG> = crate::BitWriter<'a, REG, LOCK>;
471impl<'a, REG> LOCK_W<'a, REG>
472where
473 REG: crate::Writable + crate::RegisterSpec,
474{
475 #[inline(always)]
477 pub fn unlocked(self) -> &'a mut crate::W<REG> {
478 self.variant(LOCK::Unlocked)
479 }
480 #[inline(always)]
482 pub fn locked(self) -> &'a mut crate::W<REG> {
483 self.variant(LOCK::Locked)
484 }
485}
486impl R {
487 #[inline(always)]
489 pub fn pg(&self) -> PG_R {
490 PG_R::new((self.bits & 1) != 0)
491 }
492 #[inline(always)]
494 pub fn ser(&self) -> SER_R {
495 SER_R::new(((self.bits >> 1) & 1) != 0)
496 }
497 #[inline(always)]
499 pub fn mer(&self) -> MER_R {
500 MER_R::new(((self.bits >> 2) & 1) != 0)
501 }
502 #[inline(always)]
504 pub fn snb(&self) -> SNB_R {
505 SNB_R::new(((self.bits >> 3) & 0x1f) as u8)
506 }
507 #[inline(always)]
509 pub fn psize(&self) -> PSIZE_R {
510 PSIZE_R::new(((self.bits >> 8) & 3) as u8)
511 }
512 #[inline(always)]
514 pub fn mer1(&self) -> MER1_R {
515 MER1_R::new(((self.bits >> 15) & 1) != 0)
516 }
517 #[inline(always)]
519 pub fn strt(&self) -> STRT_R {
520 STRT_R::new(((self.bits >> 16) & 1) != 0)
521 }
522 #[inline(always)]
524 pub fn eopie(&self) -> EOPIE_R {
525 EOPIE_R::new(((self.bits >> 24) & 1) != 0)
526 }
527 #[inline(always)]
529 pub fn errie(&self) -> ERRIE_R {
530 ERRIE_R::new(((self.bits >> 25) & 1) != 0)
531 }
532 #[inline(always)]
534 pub fn lock(&self) -> LOCK_R {
535 LOCK_R::new(((self.bits >> 31) & 1) != 0)
536 }
537}
538impl core::fmt::Debug for R {
539 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
540 f.debug_struct("CR")
541 .field("pg", &self.pg())
542 .field("ser", &self.ser())
543 .field("mer", &self.mer())
544 .field("snb", &self.snb())
545 .field("psize", &self.psize())
546 .field("mer1", &self.mer1())
547 .field("strt", &self.strt())
548 .field("eopie", &self.eopie())
549 .field("errie", &self.errie())
550 .field("lock", &self.lock())
551 .finish()
552 }
553}
554impl W {
555 #[inline(always)]
557 pub fn pg(&mut self) -> PG_W<CRrs> {
558 PG_W::new(self, 0)
559 }
560 #[inline(always)]
562 pub fn ser(&mut self) -> SER_W<CRrs> {
563 SER_W::new(self, 1)
564 }
565 #[inline(always)]
567 pub fn mer(&mut self) -> MER_W<CRrs> {
568 MER_W::new(self, 2)
569 }
570 #[inline(always)]
572 pub fn snb(&mut self) -> SNB_W<CRrs> {
573 SNB_W::new(self, 3)
574 }
575 #[inline(always)]
577 pub fn psize(&mut self) -> PSIZE_W<CRrs> {
578 PSIZE_W::new(self, 8)
579 }
580 #[inline(always)]
582 pub fn mer1(&mut self) -> MER1_W<CRrs> {
583 MER1_W::new(self, 15)
584 }
585 #[inline(always)]
587 pub fn strt(&mut self) -> STRT_W<CRrs> {
588 STRT_W::new(self, 16)
589 }
590 #[inline(always)]
592 pub fn eopie(&mut self) -> EOPIE_W<CRrs> {
593 EOPIE_W::new(self, 24)
594 }
595 #[inline(always)]
597 pub fn errie(&mut self) -> ERRIE_W<CRrs> {
598 ERRIE_W::new(self, 25)
599 }
600 #[inline(always)]
602 pub fn lock(&mut self) -> LOCK_W<CRrs> {
603 LOCK_W::new(self, 31)
604 }
605}
606pub struct CRrs;
612impl crate::RegisterSpec for CRrs {
613 type Ux = u32;
614}
615impl crate::Readable for CRrs {}
617impl crate::Writable for CRrs {
619 type Safety = crate::Unsafe;
620}
621impl crate::Resettable for CRrs {
623 const RESET_VALUE: u32 = 0x8000_0000;
624}