stm32f3/stm32f303/flash/
acr.rs1pub type R = crate::R<ACRrs>;
3pub type W = crate::W<ACRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u8)]
11pub enum LATENCY {
12 Ws0 = 0,
14 Ws1 = 1,
16 Ws2 = 2,
18}
19impl From<LATENCY> for u8 {
20 #[inline(always)]
21 fn from(variant: LATENCY) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for LATENCY {
26 type Ux = u8;
27}
28impl crate::IsEnum for LATENCY {}
29pub type LATENCY_R = crate::FieldReader<LATENCY>;
31impl LATENCY_R {
32 #[inline(always)]
34 pub const fn variant(&self) -> Option<LATENCY> {
35 match self.bits {
36 0 => Some(LATENCY::Ws0),
37 1 => Some(LATENCY::Ws1),
38 2 => Some(LATENCY::Ws2),
39 _ => None,
40 }
41 }
42 #[inline(always)]
44 pub fn is_ws0(&self) -> bool {
45 *self == LATENCY::Ws0
46 }
47 #[inline(always)]
49 pub fn is_ws1(&self) -> bool {
50 *self == LATENCY::Ws1
51 }
52 #[inline(always)]
54 pub fn is_ws2(&self) -> bool {
55 *self == LATENCY::Ws2
56 }
57}
58pub type LATENCY_W<'a, REG> = crate::FieldWriter<'a, REG, 3, LATENCY>;
60impl<'a, REG> LATENCY_W<'a, REG>
61where
62 REG: crate::Writable + crate::RegisterSpec,
63 REG::Ux: From<u8>,
64{
65 #[inline(always)]
67 pub fn ws0(self) -> &'a mut crate::W<REG> {
68 self.variant(LATENCY::Ws0)
69 }
70 #[inline(always)]
72 pub fn ws1(self) -> &'a mut crate::W<REG> {
73 self.variant(LATENCY::Ws1)
74 }
75 #[inline(always)]
77 pub fn ws2(self) -> &'a mut crate::W<REG> {
78 self.variant(LATENCY::Ws2)
79 }
80}
81#[cfg_attr(feature = "defmt", derive(defmt::Format))]
85#[derive(Clone, Copy, Debug, PartialEq, Eq)]
86pub enum HLFCYA {
87 Disabled = 0,
89 Enabled = 1,
91}
92impl From<HLFCYA> for bool {
93 #[inline(always)]
94 fn from(variant: HLFCYA) -> Self {
95 variant as u8 != 0
96 }
97}
98pub type HLFCYA_R = crate::BitReader<HLFCYA>;
100impl HLFCYA_R {
101 #[inline(always)]
103 pub const fn variant(&self) -> HLFCYA {
104 match self.bits {
105 false => HLFCYA::Disabled,
106 true => HLFCYA::Enabled,
107 }
108 }
109 #[inline(always)]
111 pub fn is_disabled(&self) -> bool {
112 *self == HLFCYA::Disabled
113 }
114 #[inline(always)]
116 pub fn is_enabled(&self) -> bool {
117 *self == HLFCYA::Enabled
118 }
119}
120pub type HLFCYA_W<'a, REG> = crate::BitWriter<'a, REG, HLFCYA>;
122impl<'a, REG> HLFCYA_W<'a, REG>
123where
124 REG: crate::Writable + crate::RegisterSpec,
125{
126 #[inline(always)]
128 pub fn disabled(self) -> &'a mut crate::W<REG> {
129 self.variant(HLFCYA::Disabled)
130 }
131 #[inline(always)]
133 pub fn enabled(self) -> &'a mut crate::W<REG> {
134 self.variant(HLFCYA::Enabled)
135 }
136}
137#[cfg_attr(feature = "defmt", derive(defmt::Format))]
141#[derive(Clone, Copy, Debug, PartialEq, Eq)]
142pub enum PRFTBE {
143 Disabled = 0,
145 Enabled = 1,
147}
148impl From<PRFTBE> for bool {
149 #[inline(always)]
150 fn from(variant: PRFTBE) -> Self {
151 variant as u8 != 0
152 }
153}
154pub type PRFTBE_R = crate::BitReader<PRFTBE>;
156impl PRFTBE_R {
157 #[inline(always)]
159 pub const fn variant(&self) -> PRFTBE {
160 match self.bits {
161 false => PRFTBE::Disabled,
162 true => PRFTBE::Enabled,
163 }
164 }
165 #[inline(always)]
167 pub fn is_disabled(&self) -> bool {
168 *self == PRFTBE::Disabled
169 }
170 #[inline(always)]
172 pub fn is_enabled(&self) -> bool {
173 *self == PRFTBE::Enabled
174 }
175}
176pub type PRFTBE_W<'a, REG> = crate::BitWriter<'a, REG, PRFTBE>;
178impl<'a, REG> PRFTBE_W<'a, REG>
179where
180 REG: crate::Writable + crate::RegisterSpec,
181{
182 #[inline(always)]
184 pub fn disabled(self) -> &'a mut crate::W<REG> {
185 self.variant(PRFTBE::Disabled)
186 }
187 #[inline(always)]
189 pub fn enabled(self) -> &'a mut crate::W<REG> {
190 self.variant(PRFTBE::Enabled)
191 }
192}
193#[cfg_attr(feature = "defmt", derive(defmt::Format))]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198pub enum PRFTBS {
199 Disabled = 0,
201 Enabled = 1,
203}
204impl From<PRFTBS> for bool {
205 #[inline(always)]
206 fn from(variant: PRFTBS) -> Self {
207 variant as u8 != 0
208 }
209}
210pub type PRFTBS_R = crate::BitReader<PRFTBS>;
212impl PRFTBS_R {
213 #[inline(always)]
215 pub const fn variant(&self) -> PRFTBS {
216 match self.bits {
217 false => PRFTBS::Disabled,
218 true => PRFTBS::Enabled,
219 }
220 }
221 #[inline(always)]
223 pub fn is_disabled(&self) -> bool {
224 *self == PRFTBS::Disabled
225 }
226 #[inline(always)]
228 pub fn is_enabled(&self) -> bool {
229 *self == PRFTBS::Enabled
230 }
231}
232impl R {
233 #[inline(always)]
235 pub fn latency(&self) -> LATENCY_R {
236 LATENCY_R::new((self.bits & 7) as u8)
237 }
238 #[inline(always)]
240 pub fn hlfcya(&self) -> HLFCYA_R {
241 HLFCYA_R::new(((self.bits >> 3) & 1) != 0)
242 }
243 #[inline(always)]
245 pub fn prftbe(&self) -> PRFTBE_R {
246 PRFTBE_R::new(((self.bits >> 4) & 1) != 0)
247 }
248 #[inline(always)]
250 pub fn prftbs(&self) -> PRFTBS_R {
251 PRFTBS_R::new(((self.bits >> 5) & 1) != 0)
252 }
253}
254impl core::fmt::Debug for R {
255 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
256 f.debug_struct("ACR")
257 .field("latency", &self.latency())
258 .field("prftbe", &self.prftbe())
259 .field("prftbs", &self.prftbs())
260 .field("hlfcya", &self.hlfcya())
261 .finish()
262 }
263}
264impl W {
265 #[inline(always)]
267 pub fn latency(&mut self) -> LATENCY_W<ACRrs> {
268 LATENCY_W::new(self, 0)
269 }
270 #[inline(always)]
272 pub fn hlfcya(&mut self) -> HLFCYA_W<ACRrs> {
273 HLFCYA_W::new(self, 3)
274 }
275 #[inline(always)]
277 pub fn prftbe(&mut self) -> PRFTBE_W<ACRrs> {
278 PRFTBE_W::new(self, 4)
279 }
280}
281pub struct ACRrs;
287impl crate::RegisterSpec for ACRrs {
288 type Ux = u32;
289}
290impl crate::Readable for ACRrs {}
292impl crate::Writable for ACRrs {
294 type Safety = crate::Unsafe;
295}
296impl crate::Resettable for ACRrs {
298 const RESET_VALUE: u32 = 0x30;
299}