stm32l476/flash/
cr.rs

1#[doc = "Register `CR` reader"]
2pub type R = crate::R<CrSpec>;
3#[doc = "Register `CR` writer"]
4pub type W = crate::W<CrSpec>;
5#[doc = "Field `PG` reader - Programming"]
6pub type PgR = crate::BitReader;
7#[doc = "Field `PG` writer - Programming"]
8pub type PgW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `PER` reader - Page erase"]
10pub type PerR = crate::BitReader;
11#[doc = "Field `PER` writer - Page erase"]
12pub type PerW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `MER1` reader - Bank 1 Mass erase"]
14pub type Mer1R = crate::BitReader;
15#[doc = "Field `MER1` writer - Bank 1 Mass erase"]
16pub type Mer1W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `PNB` reader - Page number"]
18pub type PnbR = crate::FieldReader;
19#[doc = "Field `PNB` writer - Page number"]
20pub type PnbW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
21#[doc = "Field `BKER` reader - Bank erase"]
22pub type BkerR = crate::BitReader;
23#[doc = "Field `BKER` writer - Bank erase"]
24pub type BkerW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `MER2` reader - Bank 2 Mass erase"]
26pub type Mer2R = crate::BitReader;
27#[doc = "Field `MER2` writer - Bank 2 Mass erase"]
28pub type Mer2W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `START` reader - Start"]
30pub type StartR = crate::BitReader;
31#[doc = "Field `START` writer - Start"]
32pub type StartW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `OPTSTRT` reader - Options modification start"]
34pub type OptstrtR = crate::BitReader;
35#[doc = "Field `OPTSTRT` writer - Options modification start"]
36pub type OptstrtW<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `FSTPG` reader - Fast programming"]
38pub type FstpgR = crate::BitReader;
39#[doc = "Field `FSTPG` writer - Fast programming"]
40pub type FstpgW<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `EOPIE` reader - End of operation interrupt enable"]
42pub type EopieR = crate::BitReader;
43#[doc = "Field `EOPIE` writer - End of operation interrupt enable"]
44pub type EopieW<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `ERRIE` reader - Error interrupt enable"]
46pub type ErrieR = crate::BitReader;
47#[doc = "Field `ERRIE` writer - Error interrupt enable"]
48pub type ErrieW<'a, REG> = crate::BitWriter<'a, REG>;
49#[doc = "Field `RDERRIE` reader - PCROP read error interrupt enable"]
50pub type RderrieR = crate::BitReader;
51#[doc = "Field `RDERRIE` writer - PCROP read error interrupt enable"]
52pub type RderrieW<'a, REG> = crate::BitWriter<'a, REG>;
53#[doc = "Field `OBL_LAUNCH` reader - Force the option byte loading"]
54pub type OblLaunchR = crate::BitReader;
55#[doc = "Field `OBL_LAUNCH` writer - Force the option byte loading"]
56pub type OblLaunchW<'a, REG> = crate::BitWriter<'a, REG>;
57#[doc = "Field `OPTLOCK` reader - Options Lock"]
58pub type OptlockR = crate::BitReader;
59#[doc = "Field `OPTLOCK` writer - Options Lock"]
60pub type OptlockW<'a, REG> = crate::BitWriter<'a, REG>;
61#[doc = "Field `LOCK` reader - FLASH_CR Lock"]
62pub type LockR = crate::BitReader;
63#[doc = "Field `LOCK` writer - FLASH_CR Lock"]
64pub type LockW<'a, REG> = crate::BitWriter<'a, REG>;
65impl R {
66    #[doc = "Bit 0 - Programming"]
67    #[inline(always)]
68    pub fn pg(&self) -> PgR {
69        PgR::new((self.bits & 1) != 0)
70    }
71    #[doc = "Bit 1 - Page erase"]
72    #[inline(always)]
73    pub fn per(&self) -> PerR {
74        PerR::new(((self.bits >> 1) & 1) != 0)
75    }
76    #[doc = "Bit 2 - Bank 1 Mass erase"]
77    #[inline(always)]
78    pub fn mer1(&self) -> Mer1R {
79        Mer1R::new(((self.bits >> 2) & 1) != 0)
80    }
81    #[doc = "Bits 3:10 - Page number"]
82    #[inline(always)]
83    pub fn pnb(&self) -> PnbR {
84        PnbR::new(((self.bits >> 3) & 0xff) as u8)
85    }
86    #[doc = "Bit 11 - Bank erase"]
87    #[inline(always)]
88    pub fn bker(&self) -> BkerR {
89        BkerR::new(((self.bits >> 11) & 1) != 0)
90    }
91    #[doc = "Bit 15 - Bank 2 Mass erase"]
92    #[inline(always)]
93    pub fn mer2(&self) -> Mer2R {
94        Mer2R::new(((self.bits >> 15) & 1) != 0)
95    }
96    #[doc = "Bit 16 - Start"]
97    #[inline(always)]
98    pub fn start(&self) -> StartR {
99        StartR::new(((self.bits >> 16) & 1) != 0)
100    }
101    #[doc = "Bit 17 - Options modification start"]
102    #[inline(always)]
103    pub fn optstrt(&self) -> OptstrtR {
104        OptstrtR::new(((self.bits >> 17) & 1) != 0)
105    }
106    #[doc = "Bit 18 - Fast programming"]
107    #[inline(always)]
108    pub fn fstpg(&self) -> FstpgR {
109        FstpgR::new(((self.bits >> 18) & 1) != 0)
110    }
111    #[doc = "Bit 24 - End of operation interrupt enable"]
112    #[inline(always)]
113    pub fn eopie(&self) -> EopieR {
114        EopieR::new(((self.bits >> 24) & 1) != 0)
115    }
116    #[doc = "Bit 25 - Error interrupt enable"]
117    #[inline(always)]
118    pub fn errie(&self) -> ErrieR {
119        ErrieR::new(((self.bits >> 25) & 1) != 0)
120    }
121    #[doc = "Bit 26 - PCROP read error interrupt enable"]
122    #[inline(always)]
123    pub fn rderrie(&self) -> RderrieR {
124        RderrieR::new(((self.bits >> 26) & 1) != 0)
125    }
126    #[doc = "Bit 27 - Force the option byte loading"]
127    #[inline(always)]
128    pub fn obl_launch(&self) -> OblLaunchR {
129        OblLaunchR::new(((self.bits >> 27) & 1) != 0)
130    }
131    #[doc = "Bit 30 - Options Lock"]
132    #[inline(always)]
133    pub fn optlock(&self) -> OptlockR {
134        OptlockR::new(((self.bits >> 30) & 1) != 0)
135    }
136    #[doc = "Bit 31 - FLASH_CR Lock"]
137    #[inline(always)]
138    pub fn lock(&self) -> LockR {
139        LockR::new(((self.bits >> 31) & 1) != 0)
140    }
141}
142impl W {
143    #[doc = "Bit 0 - Programming"]
144    #[inline(always)]
145    pub fn pg(&mut self) -> PgW<CrSpec> {
146        PgW::new(self, 0)
147    }
148    #[doc = "Bit 1 - Page erase"]
149    #[inline(always)]
150    pub fn per(&mut self) -> PerW<CrSpec> {
151        PerW::new(self, 1)
152    }
153    #[doc = "Bit 2 - Bank 1 Mass erase"]
154    #[inline(always)]
155    pub fn mer1(&mut self) -> Mer1W<CrSpec> {
156        Mer1W::new(self, 2)
157    }
158    #[doc = "Bits 3:10 - Page number"]
159    #[inline(always)]
160    pub fn pnb(&mut self) -> PnbW<CrSpec> {
161        PnbW::new(self, 3)
162    }
163    #[doc = "Bit 11 - Bank erase"]
164    #[inline(always)]
165    pub fn bker(&mut self) -> BkerW<CrSpec> {
166        BkerW::new(self, 11)
167    }
168    #[doc = "Bit 15 - Bank 2 Mass erase"]
169    #[inline(always)]
170    pub fn mer2(&mut self) -> Mer2W<CrSpec> {
171        Mer2W::new(self, 15)
172    }
173    #[doc = "Bit 16 - Start"]
174    #[inline(always)]
175    pub fn start(&mut self) -> StartW<CrSpec> {
176        StartW::new(self, 16)
177    }
178    #[doc = "Bit 17 - Options modification start"]
179    #[inline(always)]
180    pub fn optstrt(&mut self) -> OptstrtW<CrSpec> {
181        OptstrtW::new(self, 17)
182    }
183    #[doc = "Bit 18 - Fast programming"]
184    #[inline(always)]
185    pub fn fstpg(&mut self) -> FstpgW<CrSpec> {
186        FstpgW::new(self, 18)
187    }
188    #[doc = "Bit 24 - End of operation interrupt enable"]
189    #[inline(always)]
190    pub fn eopie(&mut self) -> EopieW<CrSpec> {
191        EopieW::new(self, 24)
192    }
193    #[doc = "Bit 25 - Error interrupt enable"]
194    #[inline(always)]
195    pub fn errie(&mut self) -> ErrieW<CrSpec> {
196        ErrieW::new(self, 25)
197    }
198    #[doc = "Bit 26 - PCROP read error interrupt enable"]
199    #[inline(always)]
200    pub fn rderrie(&mut self) -> RderrieW<CrSpec> {
201        RderrieW::new(self, 26)
202    }
203    #[doc = "Bit 27 - Force the option byte loading"]
204    #[inline(always)]
205    pub fn obl_launch(&mut self) -> OblLaunchW<CrSpec> {
206        OblLaunchW::new(self, 27)
207    }
208    #[doc = "Bit 30 - Options Lock"]
209    #[inline(always)]
210    pub fn optlock(&mut self) -> OptlockW<CrSpec> {
211        OptlockW::new(self, 30)
212    }
213    #[doc = "Bit 31 - FLASH_CR Lock"]
214    #[inline(always)]
215    pub fn lock(&mut self) -> LockW<CrSpec> {
216        LockW::new(self, 31)
217    }
218}
219#[doc = "Flash control register\n\nYou can [`read`](crate::Reg::read) this register and get [`cr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
220pub struct CrSpec;
221impl crate::RegisterSpec for CrSpec {
222    type Ux = u32;
223}
224#[doc = "`read()` method returns [`cr::R`](R) reader structure"]
225impl crate::Readable for CrSpec {}
226#[doc = "`write(|w| ..)` method takes [`cr::W`](W) writer structure"]
227impl crate::Writable for CrSpec {
228    type Safety = crate::Unsafe;
229}
230#[doc = "`reset()` method sets CR to value 0xc000_0000"]
231impl crate::Resettable for CrSpec {
232    const RESET_VALUE: u32 = 0xc000_0000;
233}