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