stm32g0_staging/stm32g0c1/flash/
cr.rs

1///Register `CR` reader
2pub type R = crate::R<CRrs>;
3///Register `CR` writer
4pub type W = crate::W<CRrs>;
5///Field `PG` reader - Programming
6pub type PG_R = crate::BitReader;
7///Field `PG` writer - Programming
8pub type PG_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `PER` reader - Page erase
10pub type PER_R = crate::BitReader;
11///Field `PER` writer - Page erase
12pub type PER_W<'a, REG> = crate::BitWriter<'a, REG>;
13///Field `MER1` reader - Mass erase
14pub type MER1_R = crate::BitReader;
15///Field `MER1` writer - Mass erase
16pub type MER1_W<'a, REG> = crate::BitWriter<'a, REG>;
17///Field `PNB` reader - Page number
18pub type PNB_R = crate::FieldReader<u16>;
19///Field `PNB` writer - Page number
20pub type PNB_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
21///Field `STRT` reader - Start
22pub type STRT_R = crate::BitReader;
23///Field `STRT` writer - Start
24pub type STRT_W<'a, REG> = crate::BitWriter<'a, REG>;
25///Field `OPTSTRT` reader - Options modification start
26pub type OPTSTRT_R = crate::BitReader;
27///Field `OPTSTRT` writer - Options modification start
28pub type OPTSTRT_W<'a, REG> = crate::BitWriter<'a, REG>;
29///Field `FSTPG` reader - Fast programming
30pub type FSTPG_R = crate::BitReader;
31///Field `FSTPG` writer - Fast programming
32pub type FSTPG_W<'a, REG> = crate::BitWriter<'a, REG>;
33///Field `EOPIE` reader - End of operation interrupt enable
34pub type EOPIE_R = crate::BitReader;
35///Field `EOPIE` writer - End of operation interrupt enable
36pub type EOPIE_W<'a, REG> = crate::BitWriter<'a, REG>;
37///Field `ERRIE` reader - Error interrupt enable
38pub type ERRIE_R = crate::BitReader;
39///Field `ERRIE` writer - Error interrupt enable
40pub type ERRIE_W<'a, REG> = crate::BitWriter<'a, REG>;
41///Field `RDERRIE` reader - PCROP read error interrupt enable
42pub type RDERRIE_R = crate::BitReader;
43///Field `RDERRIE` writer - PCROP read error interrupt enable
44pub type RDERRIE_W<'a, REG> = crate::BitWriter<'a, REG>;
45///Field `OBL_LAUNCH` reader - Force the option byte loading
46pub type OBL_LAUNCH_R = crate::BitReader;
47///Field `OBL_LAUNCH` writer - Force the option byte loading
48pub type OBL_LAUNCH_W<'a, REG> = crate::BitWriter<'a, REG>;
49///Field `SEC_PROT` reader - Securable memory area protection enable
50pub type SEC_PROT_R = crate::BitReader;
51///Field `SEC_PROT` writer - Securable memory area protection enable
52pub type SEC_PROT_W<'a, REG> = crate::BitWriter<'a, REG>;
53///Field `SEC_PROT2` reader - Securable memory area protection enable, Bank 2
54pub type SEC_PROT2_R = crate::BitReader;
55///Field `SEC_PROT2` writer - Securable memory area protection enable, Bank 2
56pub type SEC_PROT2_W<'a, REG> = crate::BitWriter<'a, REG>;
57///Field `OPTLOCK` reader - Options Lock
58pub type OPTLOCK_R = crate::BitReader;
59///Field `OPTLOCK` writer - Options Lock
60pub type OPTLOCK_W<'a, REG> = crate::BitWriter<'a, REG>;
61///Field `LOCK` reader - FLASH_CR Lock
62pub type LOCK_R = crate::BitReader;
63///Field `LOCK` writer - FLASH_CR Lock
64pub type LOCK_W<'a, REG> = crate::BitWriter<'a, REG>;
65impl R {
66    ///Bit 0 - Programming
67    #[inline(always)]
68    pub fn pg(&self) -> PG_R {
69        PG_R::new((self.bits & 1) != 0)
70    }
71    ///Bit 1 - Page erase
72    #[inline(always)]
73    pub fn per(&self) -> PER_R {
74        PER_R::new(((self.bits >> 1) & 1) != 0)
75    }
76    ///Bit 2 - Mass erase
77    #[inline(always)]
78    pub fn mer1(&self) -> MER1_R {
79        MER1_R::new(((self.bits >> 2) & 1) != 0)
80    }
81    ///Bits 3:12 - Page number
82    #[inline(always)]
83    pub fn pnb(&self) -> PNB_R {
84        PNB_R::new(((self.bits >> 3) & 0x03ff) as u16)
85    }
86    ///Bit 16 - Start
87    #[inline(always)]
88    pub fn strt(&self) -> STRT_R {
89        STRT_R::new(((self.bits >> 16) & 1) != 0)
90    }
91    ///Bit 17 - Options modification start
92    #[inline(always)]
93    pub fn optstrt(&self) -> OPTSTRT_R {
94        OPTSTRT_R::new(((self.bits >> 17) & 1) != 0)
95    }
96    ///Bit 18 - Fast programming
97    #[inline(always)]
98    pub fn fstpg(&self) -> FSTPG_R {
99        FSTPG_R::new(((self.bits >> 18) & 1) != 0)
100    }
101    ///Bit 24 - End of operation interrupt enable
102    #[inline(always)]
103    pub fn eopie(&self) -> EOPIE_R {
104        EOPIE_R::new(((self.bits >> 24) & 1) != 0)
105    }
106    ///Bit 25 - Error interrupt enable
107    #[inline(always)]
108    pub fn errie(&self) -> ERRIE_R {
109        ERRIE_R::new(((self.bits >> 25) & 1) != 0)
110    }
111    ///Bit 26 - PCROP read error interrupt enable
112    #[inline(always)]
113    pub fn rderrie(&self) -> RDERRIE_R {
114        RDERRIE_R::new(((self.bits >> 26) & 1) != 0)
115    }
116    ///Bit 27 - Force the option byte loading
117    #[inline(always)]
118    pub fn obl_launch(&self) -> OBL_LAUNCH_R {
119        OBL_LAUNCH_R::new(((self.bits >> 27) & 1) != 0)
120    }
121    ///Bit 28 - Securable memory area protection enable
122    #[inline(always)]
123    pub fn sec_prot(&self) -> SEC_PROT_R {
124        SEC_PROT_R::new(((self.bits >> 28) & 1) != 0)
125    }
126    ///Bit 29 - Securable memory area protection enable, Bank 2
127    #[inline(always)]
128    pub fn sec_prot2(&self) -> SEC_PROT2_R {
129        SEC_PROT2_R::new(((self.bits >> 29) & 1) != 0)
130    }
131    ///Bit 30 - Options Lock
132    #[inline(always)]
133    pub fn optlock(&self) -> OPTLOCK_R {
134        OPTLOCK_R::new(((self.bits >> 30) & 1) != 0)
135    }
136    ///Bit 31 - FLASH_CR Lock
137    #[inline(always)]
138    pub fn lock(&self) -> LOCK_R {
139        LOCK_R::new(((self.bits >> 31) & 1) != 0)
140    }
141}
142impl core::fmt::Debug for R {
143    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
144        f.debug_struct("CR")
145            .field("pg", &self.pg())
146            .field("per", &self.per())
147            .field("mer1", &self.mer1())
148            .field("pnb", &self.pnb())
149            .field("strt", &self.strt())
150            .field("optstrt", &self.optstrt())
151            .field("fstpg", &self.fstpg())
152            .field("eopie", &self.eopie())
153            .field("errie", &self.errie())
154            .field("rderrie", &self.rderrie())
155            .field("obl_launch", &self.obl_launch())
156            .field("sec_prot", &self.sec_prot())
157            .field("sec_prot2", &self.sec_prot2())
158            .field("optlock", &self.optlock())
159            .field("lock", &self.lock())
160            .finish()
161    }
162}
163impl W {
164    ///Bit 0 - Programming
165    #[inline(always)]
166    pub fn pg(&mut self) -> PG_W<CRrs> {
167        PG_W::new(self, 0)
168    }
169    ///Bit 1 - Page erase
170    #[inline(always)]
171    pub fn per(&mut self) -> PER_W<CRrs> {
172        PER_W::new(self, 1)
173    }
174    ///Bit 2 - Mass erase
175    #[inline(always)]
176    pub fn mer1(&mut self) -> MER1_W<CRrs> {
177        MER1_W::new(self, 2)
178    }
179    ///Bits 3:12 - Page number
180    #[inline(always)]
181    pub fn pnb(&mut self) -> PNB_W<CRrs> {
182        PNB_W::new(self, 3)
183    }
184    ///Bit 16 - Start
185    #[inline(always)]
186    pub fn strt(&mut self) -> STRT_W<CRrs> {
187        STRT_W::new(self, 16)
188    }
189    ///Bit 17 - Options modification start
190    #[inline(always)]
191    pub fn optstrt(&mut self) -> OPTSTRT_W<CRrs> {
192        OPTSTRT_W::new(self, 17)
193    }
194    ///Bit 18 - Fast programming
195    #[inline(always)]
196    pub fn fstpg(&mut self) -> FSTPG_W<CRrs> {
197        FSTPG_W::new(self, 18)
198    }
199    ///Bit 24 - End of operation interrupt enable
200    #[inline(always)]
201    pub fn eopie(&mut self) -> EOPIE_W<CRrs> {
202        EOPIE_W::new(self, 24)
203    }
204    ///Bit 25 - Error interrupt enable
205    #[inline(always)]
206    pub fn errie(&mut self) -> ERRIE_W<CRrs> {
207        ERRIE_W::new(self, 25)
208    }
209    ///Bit 26 - PCROP read error interrupt enable
210    #[inline(always)]
211    pub fn rderrie(&mut self) -> RDERRIE_W<CRrs> {
212        RDERRIE_W::new(self, 26)
213    }
214    ///Bit 27 - Force the option byte loading
215    #[inline(always)]
216    pub fn obl_launch(&mut self) -> OBL_LAUNCH_W<CRrs> {
217        OBL_LAUNCH_W::new(self, 27)
218    }
219    ///Bit 28 - Securable memory area protection enable
220    #[inline(always)]
221    pub fn sec_prot(&mut self) -> SEC_PROT_W<CRrs> {
222        SEC_PROT_W::new(self, 28)
223    }
224    ///Bit 29 - Securable memory area protection enable, Bank 2
225    #[inline(always)]
226    pub fn sec_prot2(&mut self) -> SEC_PROT2_W<CRrs> {
227        SEC_PROT2_W::new(self, 29)
228    }
229    ///Bit 30 - Options Lock
230    #[inline(always)]
231    pub fn optlock(&mut self) -> OPTLOCK_W<CRrs> {
232        OPTLOCK_W::new(self, 30)
233    }
234    ///Bit 31 - FLASH_CR Lock
235    #[inline(always)]
236    pub fn lock(&mut self) -> LOCK_W<CRrs> {
237        LOCK_W::new(self, 31)
238    }
239}
240/**Flash control register
241
242You 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).
243
244See register [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#FLASH:CR)*/
245pub struct CRrs;
246impl crate::RegisterSpec for CRrs {
247    type Ux = u32;
248}
249///`read()` method returns [`cr::R`](R) reader structure
250impl crate::Readable for CRrs {}
251///`write(|w| ..)` method takes [`cr::W`](W) writer structure
252impl crate::Writable for CRrs {
253    type Safety = crate::Unsafe;
254    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
255    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
256}
257///`reset()` method sets CR to value 0xc000_0000
258impl crate::Resettable for CRrs {
259    const RESET_VALUE: u32 = 0xc000_0000;
260}