stm32f1_staging/stm32f107/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}
81pub type HLFCYA_R = crate::BitReader;
83pub type HLFCYA_W<'a, REG> = crate::BitWriter<'a, REG>;
85pub type PRFTBE_R = crate::BitReader;
87pub type PRFTBE_W<'a, REG> = crate::BitWriter<'a, REG>;
89pub type PRFTBS_R = crate::BitReader;
91impl R {
92 #[inline(always)]
94 pub fn latency(&self) -> LATENCY_R {
95 LATENCY_R::new((self.bits & 7) as u8)
96 }
97 #[inline(always)]
99 pub fn hlfcya(&self) -> HLFCYA_R {
100 HLFCYA_R::new(((self.bits >> 3) & 1) != 0)
101 }
102 #[inline(always)]
104 pub fn prftbe(&self) -> PRFTBE_R {
105 PRFTBE_R::new(((self.bits >> 4) & 1) != 0)
106 }
107 #[inline(always)]
109 pub fn prftbs(&self) -> PRFTBS_R {
110 PRFTBS_R::new(((self.bits >> 5) & 1) != 0)
111 }
112}
113impl core::fmt::Debug for R {
114 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
115 f.debug_struct("ACR")
116 .field("latency", &self.latency())
117 .field("hlfcya", &self.hlfcya())
118 .field("prftbe", &self.prftbe())
119 .field("prftbs", &self.prftbs())
120 .finish()
121 }
122}
123impl W {
124 #[inline(always)]
126 pub fn latency(&mut self) -> LATENCY_W<ACRrs> {
127 LATENCY_W::new(self, 0)
128 }
129 #[inline(always)]
131 pub fn hlfcya(&mut self) -> HLFCYA_W<ACRrs> {
132 HLFCYA_W::new(self, 3)
133 }
134 #[inline(always)]
136 pub fn prftbe(&mut self) -> PRFTBE_W<ACRrs> {
137 PRFTBE_W::new(self, 4)
138 }
139}
140pub struct ACRrs;
146impl crate::RegisterSpec for ACRrs {
147 type Ux = u32;
148}
149impl crate::Readable for ACRrs {}
151impl crate::Writable for ACRrs {
153 type Safety = crate::Unsafe;
154}
155impl crate::Resettable for ACRrs {
157 const RESET_VALUE: u32 = 0x30;
158}