1#[doc = "Register `CTL` reader"]
2pub type R = crate::R<CtlSpec>;
3#[doc = "Register `CTL` writer"]
4pub type W = crate::W<CtlSpec>;
5#[doc = "Main flash program for bank0 command bit\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Pg {
8 #[doc = "1: Flash programming activated"]
9 Program = 1,
10}
11impl From<Pg> for bool {
12 #[inline(always)]
13 fn from(variant: Pg) -> Self {
14 variant as u8 != 0
15 }
16}
17#[doc = "Field `PG` reader - Main flash program for bank0 command bit"]
18pub type PgR = crate::BitReader<Pg>;
19impl PgR {
20 #[doc = "Get enumerated values variant"]
21 #[inline(always)]
22 pub const fn variant(&self) -> Option<Pg> {
23 match self.bits {
24 true => Some(Pg::Program),
25 _ => None,
26 }
27 }
28 #[doc = "Flash programming activated"]
29 #[inline(always)]
30 pub fn is_program(&self) -> bool {
31 *self == Pg::Program
32 }
33}
34#[doc = "Field `PG` writer - Main flash program for bank0 command bit"]
35pub type PgW<'a, REG> = crate::BitWriter<'a, REG, Pg>;
36impl<'a, REG> PgW<'a, REG>
37where
38 REG: crate::Writable + crate::RegisterSpec,
39{
40 #[doc = "Flash programming activated"]
41 #[inline(always)]
42 pub fn program(self) -> &'a mut crate::W<REG> {
43 self.variant(Pg::Program)
44 }
45}
46#[doc = "Main flash page erase for bank0 command bit\n\nValue on reset: 0"]
47#[derive(Clone, Copy, Debug, PartialEq, Eq)]
48pub enum Per {
49 #[doc = "1: Erase activated for selected page"]
50 PageErase = 1,
51}
52impl From<Per> for bool {
53 #[inline(always)]
54 fn from(variant: Per) -> Self {
55 variant as u8 != 0
56 }
57}
58#[doc = "Field `PER` reader - Main flash page erase for bank0 command bit"]
59pub type PerR = crate::BitReader<Per>;
60impl PerR {
61 #[doc = "Get enumerated values variant"]
62 #[inline(always)]
63 pub const fn variant(&self) -> Option<Per> {
64 match self.bits {
65 true => Some(Per::PageErase),
66 _ => None,
67 }
68 }
69 #[doc = "Erase activated for selected page"]
70 #[inline(always)]
71 pub fn is_page_erase(&self) -> bool {
72 *self == Per::PageErase
73 }
74}
75#[doc = "Field `PER` writer - Main flash page erase for bank0 command bit"]
76pub type PerW<'a, REG> = crate::BitWriter<'a, REG, Per>;
77impl<'a, REG> PerW<'a, REG>
78where
79 REG: crate::Writable + crate::RegisterSpec,
80{
81 #[doc = "Erase activated for selected page"]
82 #[inline(always)]
83 pub fn page_erase(self) -> &'a mut crate::W<REG> {
84 self.variant(Per::PageErase)
85 }
86}
87#[doc = "Main flash mass erase for bank0 command bit\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq, Eq)]
89pub enum Mer {
90 #[doc = "1: Erase activated for all user sectors"]
91 MassErase = 1,
92}
93impl From<Mer> for bool {
94 #[inline(always)]
95 fn from(variant: Mer) -> Self {
96 variant as u8 != 0
97 }
98}
99#[doc = "Field `MER` reader - Main flash mass erase for bank0 command bit"]
100pub type MerR = crate::BitReader<Mer>;
101impl MerR {
102 #[doc = "Get enumerated values variant"]
103 #[inline(always)]
104 pub const fn variant(&self) -> Option<Mer> {
105 match self.bits {
106 true => Some(Mer::MassErase),
107 _ => None,
108 }
109 }
110 #[doc = "Erase activated for all user sectors"]
111 #[inline(always)]
112 pub fn is_mass_erase(&self) -> bool {
113 *self == Mer::MassErase
114 }
115}
116#[doc = "Field `MER` writer - Main flash mass erase for bank0 command bit"]
117pub type MerW<'a, REG> = crate::BitWriter<'a, REG, Mer>;
118impl<'a, REG> MerW<'a, REG>
119where
120 REG: crate::Writable + crate::RegisterSpec,
121{
122 #[doc = "Erase activated for all user sectors"]
123 #[inline(always)]
124 pub fn mass_erase(self) -> &'a mut crate::W<REG> {
125 self.variant(Mer::MassErase)
126 }
127}
128#[doc = "Option bytes program command bit\n\nValue on reset: 0"]
129#[derive(Clone, Copy, Debug, PartialEq, Eq)]
130pub enum Obpg {
131 #[doc = "1: Program option byte activated"]
132 OptionByteProgramming = 1,
133}
134impl From<Obpg> for bool {
135 #[inline(always)]
136 fn from(variant: Obpg) -> Self {
137 variant as u8 != 0
138 }
139}
140#[doc = "Field `OBPG` reader - Option bytes program command bit"]
141pub type ObpgR = crate::BitReader<Obpg>;
142impl ObpgR {
143 #[doc = "Get enumerated values variant"]
144 #[inline(always)]
145 pub const fn variant(&self) -> Option<Obpg> {
146 match self.bits {
147 true => Some(Obpg::OptionByteProgramming),
148 _ => None,
149 }
150 }
151 #[doc = "Program option byte activated"]
152 #[inline(always)]
153 pub fn is_option_byte_programming(&self) -> bool {
154 *self == Obpg::OptionByteProgramming
155 }
156}
157#[doc = "Field `OBPG` writer - Option bytes program command bit"]
158pub type ObpgW<'a, REG> = crate::BitWriter<'a, REG, Obpg>;
159impl<'a, REG> ObpgW<'a, REG>
160where
161 REG: crate::Writable + crate::RegisterSpec,
162{
163 #[doc = "Program option byte activated"]
164 #[inline(always)]
165 pub fn option_byte_programming(self) -> &'a mut crate::W<REG> {
166 self.variant(Obpg::OptionByteProgramming)
167 }
168}
169#[doc = "Option bytes erase command bit\n\nValue on reset: 0"]
170#[derive(Clone, Copy, Debug, PartialEq, Eq)]
171pub enum Ober {
172 #[doc = "1: Erase option byte activated"]
173 OptionByteErase = 1,
174}
175impl From<Ober> for bool {
176 #[inline(always)]
177 fn from(variant: Ober) -> Self {
178 variant as u8 != 0
179 }
180}
181#[doc = "Field `OBER` reader - Option bytes erase command bit"]
182pub type OberR = crate::BitReader<Ober>;
183impl OberR {
184 #[doc = "Get enumerated values variant"]
185 #[inline(always)]
186 pub const fn variant(&self) -> Option<Ober> {
187 match self.bits {
188 true => Some(Ober::OptionByteErase),
189 _ => None,
190 }
191 }
192 #[doc = "Erase option byte activated"]
193 #[inline(always)]
194 pub fn is_option_byte_erase(&self) -> bool {
195 *self == Ober::OptionByteErase
196 }
197}
198#[doc = "Field `OBER` writer - Option bytes erase command bit"]
199pub type OberW<'a, REG> = crate::BitWriter<'a, REG, Ober>;
200impl<'a, REG> OberW<'a, REG>
201where
202 REG: crate::Writable + crate::RegisterSpec,
203{
204 #[doc = "Erase option byte activated"]
205 #[inline(always)]
206 pub fn option_byte_erase(self) -> &'a mut crate::W<REG> {
207 self.variant(Ober::OptionByteErase)
208 }
209}
210#[doc = "Send erase command to FMC bit\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq, Eq)]
212pub enum Startw {
213 #[doc = "1: Trigger an erase operation"]
214 Start = 1,
215}
216impl From<Startw> for bool {
217 #[inline(always)]
218 fn from(variant: Startw) -> Self {
219 variant as u8 != 0
220 }
221}
222#[doc = "Field `START` reader - Send erase command to FMC bit"]
223pub type StartR = crate::BitReader<Startw>;
224impl StartR {
225 #[doc = "Get enumerated values variant"]
226 #[inline(always)]
227 pub const fn variant(&self) -> Option<Startw> {
228 match self.bits {
229 true => Some(Startw::Start),
230 _ => None,
231 }
232 }
233 #[doc = "Trigger an erase operation"]
234 #[inline(always)]
235 pub fn is_start(&self) -> bool {
236 *self == Startw::Start
237 }
238}
239#[doc = "Field `START` writer - Send erase command to FMC bit"]
240pub type StartW<'a, REG> = crate::BitWriter<'a, REG, Startw>;
241impl<'a, REG> StartW<'a, REG>
242where
243 REG: crate::Writable + crate::RegisterSpec,
244{
245 #[doc = "Trigger an erase operation"]
246 #[inline(always)]
247 pub fn start(self) -> &'a mut crate::W<REG> {
248 self.variant(Startw::Start)
249 }
250}
251#[doc = "FMC_CTL0 lock bit\n\nValue on reset: 1"]
252#[derive(Clone, Copy, Debug, PartialEq, Eq)]
253pub enum Lkr {
254 #[doc = "0: CTL register is unlocked"]
255 Unlocked = 0,
256 #[doc = "1: CTL register is locked"]
257 Locked = 1,
258}
259impl From<Lkr> for bool {
260 #[inline(always)]
261 fn from(variant: Lkr) -> Self {
262 variant as u8 != 0
263 }
264}
265#[doc = "Field `LK` reader - FMC_CTL0 lock bit"]
266pub type LkR = crate::BitReader<Lkr>;
267impl LkR {
268 #[doc = "Get enumerated values variant"]
269 #[inline(always)]
270 pub const fn variant(&self) -> Lkr {
271 match self.bits {
272 false => Lkr::Unlocked,
273 true => Lkr::Locked,
274 }
275 }
276 #[doc = "CTL register is unlocked"]
277 #[inline(always)]
278 pub fn is_unlocked(&self) -> bool {
279 *self == Lkr::Unlocked
280 }
281 #[doc = "CTL register is locked"]
282 #[inline(always)]
283 pub fn is_locked(&self) -> bool {
284 *self == Lkr::Locked
285 }
286}
287#[doc = "FMC_CTL0 lock bit\n\nValue on reset: 1"]
288#[derive(Clone, Copy, Debug, PartialEq, Eq)]
289pub enum LkwWO {
290 #[doc = "1: Lock CTL register"]
291 Lock = 1,
292}
293impl From<LkwWO> for bool {
294 #[inline(always)]
295 fn from(variant: LkwWO) -> Self {
296 variant as u8 != 0
297 }
298}
299#[doc = "Field `LK` writer - FMC_CTL0 lock bit"]
300pub type LkW<'a, REG> = crate::BitWriter<'a, REG, LkwWO>;
301impl<'a, REG> LkW<'a, REG>
302where
303 REG: crate::Writable + crate::RegisterSpec,
304{
305 #[doc = "Lock CTL register"]
306 #[inline(always)]
307 pub fn lock(self) -> &'a mut crate::W<REG> {
308 self.variant(LkwWO::Lock)
309 }
310}
311#[doc = "Option byte erase/program enable bit\n\nValue on reset: 0"]
312#[derive(Clone, Copy, Debug, PartialEq, Eq)]
313pub enum Obwenr {
314 #[doc = "0: Option byte write disabled"]
315 Disabled = 0,
316 #[doc = "1: Option byte write enabled"]
317 Enabled = 1,
318}
319impl From<Obwenr> for bool {
320 #[inline(always)]
321 fn from(variant: Obwenr) -> Self {
322 variant as u8 != 0
323 }
324}
325#[doc = "Field `OBWEN` reader - Option byte erase/program enable bit"]
326pub type ObwenR = crate::BitReader<Obwenr>;
327impl ObwenR {
328 #[doc = "Get enumerated values variant"]
329 #[inline(always)]
330 pub const fn variant(&self) -> Obwenr {
331 match self.bits {
332 false => Obwenr::Disabled,
333 true => Obwenr::Enabled,
334 }
335 }
336 #[doc = "Option byte write disabled"]
337 #[inline(always)]
338 pub fn is_disabled(&self) -> bool {
339 *self == Obwenr::Disabled
340 }
341 #[doc = "Option byte write enabled"]
342 #[inline(always)]
343 pub fn is_enabled(&self) -> bool {
344 *self == Obwenr::Enabled
345 }
346}
347#[doc = "Option byte erase/program enable bit\n\nValue on reset: 0"]
348#[derive(Clone, Copy, Debug, PartialEq, Eq)]
349pub enum ObwenwWO {
350 #[doc = "0: Disable option byte write"]
351 Disable = 0,
352}
353impl From<ObwenwWO> for bool {
354 #[inline(always)]
355 fn from(variant: ObwenwWO) -> Self {
356 variant as u8 != 0
357 }
358}
359#[doc = "Field `OBWEN` writer - Option byte erase/program enable bit"]
360pub type ObwenW<'a, REG> = crate::BitWriter<'a, REG, ObwenwWO>;
361impl<'a, REG> ObwenW<'a, REG>
362where
363 REG: crate::Writable + crate::RegisterSpec,
364{
365 #[doc = "Disable option byte write"]
366 #[inline(always)]
367 pub fn disable(self) -> &'a mut crate::W<REG> {
368 self.variant(ObwenwWO::Disable)
369 }
370}
371#[doc = "Error interrupt enable bit\n\nValue on reset: 0"]
372#[derive(Clone, Copy, Debug, PartialEq, Eq)]
373pub enum Errie {
374 #[doc = "0: Error interrupt generation disabled"]
375 Disabled = 0,
376 #[doc = "1: Error interrupt generation enabled"]
377 Enabled = 1,
378}
379impl From<Errie> for bool {
380 #[inline(always)]
381 fn from(variant: Errie) -> Self {
382 variant as u8 != 0
383 }
384}
385#[doc = "Field `ERRIE` reader - Error interrupt enable bit"]
386pub type ErrieR = crate::BitReader<Errie>;
387impl ErrieR {
388 #[doc = "Get enumerated values variant"]
389 #[inline(always)]
390 pub const fn variant(&self) -> Errie {
391 match self.bits {
392 false => Errie::Disabled,
393 true => Errie::Enabled,
394 }
395 }
396 #[doc = "Error interrupt generation disabled"]
397 #[inline(always)]
398 pub fn is_disabled(&self) -> bool {
399 *self == Errie::Disabled
400 }
401 #[doc = "Error interrupt generation enabled"]
402 #[inline(always)]
403 pub fn is_enabled(&self) -> bool {
404 *self == Errie::Enabled
405 }
406}
407#[doc = "Field `ERRIE` writer - Error interrupt enable bit"]
408pub type ErrieW<'a, REG> = crate::BitWriter<'a, REG, Errie>;
409impl<'a, REG> ErrieW<'a, REG>
410where
411 REG: crate::Writable + crate::RegisterSpec,
412{
413 #[doc = "Error interrupt generation disabled"]
414 #[inline(always)]
415 pub fn disabled(self) -> &'a mut crate::W<REG> {
416 self.variant(Errie::Disabled)
417 }
418 #[doc = "Error interrupt generation enabled"]
419 #[inline(always)]
420 pub fn enabled(self) -> &'a mut crate::W<REG> {
421 self.variant(Errie::Enabled)
422 }
423}
424#[doc = "End of operation interrupt enable bit\n\nValue on reset: 0"]
425#[derive(Clone, Copy, Debug, PartialEq, Eq)]
426pub enum Endie {
427 #[doc = "0: End of operation interrupt disabled"]
428 Disabled = 0,
429 #[doc = "1: End of operation interrupt enabled"]
430 Enabled = 1,
431}
432impl From<Endie> for bool {
433 #[inline(always)]
434 fn from(variant: Endie) -> Self {
435 variant as u8 != 0
436 }
437}
438#[doc = "Field `ENDIE` reader - End of operation interrupt enable bit"]
439pub type EndieR = crate::BitReader<Endie>;
440impl EndieR {
441 #[doc = "Get enumerated values variant"]
442 #[inline(always)]
443 pub const fn variant(&self) -> Endie {
444 match self.bits {
445 false => Endie::Disabled,
446 true => Endie::Enabled,
447 }
448 }
449 #[doc = "End of operation interrupt disabled"]
450 #[inline(always)]
451 pub fn is_disabled(&self) -> bool {
452 *self == Endie::Disabled
453 }
454 #[doc = "End of operation interrupt enabled"]
455 #[inline(always)]
456 pub fn is_enabled(&self) -> bool {
457 *self == Endie::Enabled
458 }
459}
460#[doc = "Field `ENDIE` writer - End of operation interrupt enable bit"]
461pub type EndieW<'a, REG> = crate::BitWriter<'a, REG, Endie>;
462impl<'a, REG> EndieW<'a, REG>
463where
464 REG: crate::Writable + crate::RegisterSpec,
465{
466 #[doc = "End of operation interrupt disabled"]
467 #[inline(always)]
468 pub fn disabled(self) -> &'a mut crate::W<REG> {
469 self.variant(Endie::Disabled)
470 }
471 #[doc = "End of operation interrupt enabled"]
472 #[inline(always)]
473 pub fn enabled(self) -> &'a mut crate::W<REG> {
474 self.variant(Endie::Enabled)
475 }
476}
477impl R {
478 #[doc = "Bit 0 - Main flash program for bank0 command bit"]
479 #[inline(always)]
480 pub fn pg(&self) -> PgR {
481 PgR::new((self.bits & 1) != 0)
482 }
483 #[doc = "Bit 1 - Main flash page erase for bank0 command bit"]
484 #[inline(always)]
485 pub fn per(&self) -> PerR {
486 PerR::new(((self.bits >> 1) & 1) != 0)
487 }
488 #[doc = "Bit 2 - Main flash mass erase for bank0 command bit"]
489 #[inline(always)]
490 pub fn mer(&self) -> MerR {
491 MerR::new(((self.bits >> 2) & 1) != 0)
492 }
493 #[doc = "Bit 4 - Option bytes program command bit"]
494 #[inline(always)]
495 pub fn obpg(&self) -> ObpgR {
496 ObpgR::new(((self.bits >> 4) & 1) != 0)
497 }
498 #[doc = "Bit 5 - Option bytes erase command bit"]
499 #[inline(always)]
500 pub fn ober(&self) -> OberR {
501 OberR::new(((self.bits >> 5) & 1) != 0)
502 }
503 #[doc = "Bit 6 - Send erase command to FMC bit"]
504 #[inline(always)]
505 pub fn start(&self) -> StartR {
506 StartR::new(((self.bits >> 6) & 1) != 0)
507 }
508 #[doc = "Bit 7 - FMC_CTL0 lock bit"]
509 #[inline(always)]
510 pub fn lk(&self) -> LkR {
511 LkR::new(((self.bits >> 7) & 1) != 0)
512 }
513 #[doc = "Bit 9 - Option byte erase/program enable bit"]
514 #[inline(always)]
515 pub fn obwen(&self) -> ObwenR {
516 ObwenR::new(((self.bits >> 9) & 1) != 0)
517 }
518 #[doc = "Bit 10 - Error interrupt enable bit"]
519 #[inline(always)]
520 pub fn errie(&self) -> ErrieR {
521 ErrieR::new(((self.bits >> 10) & 1) != 0)
522 }
523 #[doc = "Bit 12 - End of operation interrupt enable bit"]
524 #[inline(always)]
525 pub fn endie(&self) -> EndieR {
526 EndieR::new(((self.bits >> 12) & 1) != 0)
527 }
528}
529impl W {
530 #[doc = "Bit 0 - Main flash program for bank0 command bit"]
531 #[inline(always)]
532 #[must_use]
533 pub fn pg(&mut self) -> PgW<CtlSpec> {
534 PgW::new(self, 0)
535 }
536 #[doc = "Bit 1 - Main flash page erase for bank0 command bit"]
537 #[inline(always)]
538 #[must_use]
539 pub fn per(&mut self) -> PerW<CtlSpec> {
540 PerW::new(self, 1)
541 }
542 #[doc = "Bit 2 - Main flash mass erase for bank0 command bit"]
543 #[inline(always)]
544 #[must_use]
545 pub fn mer(&mut self) -> MerW<CtlSpec> {
546 MerW::new(self, 2)
547 }
548 #[doc = "Bit 4 - Option bytes program command bit"]
549 #[inline(always)]
550 #[must_use]
551 pub fn obpg(&mut self) -> ObpgW<CtlSpec> {
552 ObpgW::new(self, 4)
553 }
554 #[doc = "Bit 5 - Option bytes erase command bit"]
555 #[inline(always)]
556 #[must_use]
557 pub fn ober(&mut self) -> OberW<CtlSpec> {
558 OberW::new(self, 5)
559 }
560 #[doc = "Bit 6 - Send erase command to FMC bit"]
561 #[inline(always)]
562 #[must_use]
563 pub fn start(&mut self) -> StartW<CtlSpec> {
564 StartW::new(self, 6)
565 }
566 #[doc = "Bit 7 - FMC_CTL0 lock bit"]
567 #[inline(always)]
568 #[must_use]
569 pub fn lk(&mut self) -> LkW<CtlSpec> {
570 LkW::new(self, 7)
571 }
572 #[doc = "Bit 9 - Option byte erase/program enable bit"]
573 #[inline(always)]
574 #[must_use]
575 pub fn obwen(&mut self) -> ObwenW<CtlSpec> {
576 ObwenW::new(self, 9)
577 }
578 #[doc = "Bit 10 - Error interrupt enable bit"]
579 #[inline(always)]
580 #[must_use]
581 pub fn errie(&mut self) -> ErrieW<CtlSpec> {
582 ErrieW::new(self, 10)
583 }
584 #[doc = "Bit 12 - End of operation interrupt enable bit"]
585 #[inline(always)]
586 #[must_use]
587 pub fn endie(&mut self) -> EndieW<CtlSpec> {
588 EndieW::new(self, 12)
589 }
590}
591#[doc = "Control register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ctl::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
592pub struct CtlSpec;
593impl crate::RegisterSpec for CtlSpec {
594 type Ux = u32;
595}
596#[doc = "`read()` method returns [`ctl::R`](R) reader structure"]
597impl crate::Readable for CtlSpec {}
598#[doc = "`write(|w| ..)` method takes [`ctl::W`](W) writer structure"]
599impl crate::Writable for CtlSpec {
600 type Safety = crate::Unsafe;
601 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
602 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
603}
604#[doc = "`reset()` method sets CTL to value 0x80"]
605impl crate::Resettable for CtlSpec {
606 const RESET_VALUE: u32 = 0x80;
607}