1#[doc = "Register `FLASHCR` reader"]
2pub type R = crate::R<FlashcrSpec>;
3#[doc = "Register `FLASHCR` writer"]
4pub type W = crate::W<FlashcrSpec>;
5#[doc = "Flash Disable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Flashdis {
9 #[doc = "0: No effect"]
10 Disabled = 0,
11 #[doc = "1: Flash memory is disabled"]
12 Enabled = 1,
13}
14impl From<Flashdis> for bool {
15 #[inline(always)]
16 fn from(variant: Flashdis) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `FLASHDIS` reader - Flash Disable"]
21pub type FlashdisR = crate::BitReader<Flashdis>;
22impl FlashdisR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Flashdis {
26 match self.bits {
27 false => Flashdis::Disabled,
28 true => Flashdis::Enabled,
29 }
30 }
31 #[doc = "No effect"]
32 #[inline(always)]
33 pub fn is_disabled(&self) -> bool {
34 *self == Flashdis::Disabled
35 }
36 #[doc = "Flash memory is disabled"]
37 #[inline(always)]
38 pub fn is_enabled(&self) -> bool {
39 *self == Flashdis::Enabled
40 }
41}
42#[doc = "Field `FLASHDIS` writer - Flash Disable"]
43pub type FlashdisW<'a, REG> = crate::BitWriter<'a, REG, Flashdis>;
44impl<'a, REG> FlashdisW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "No effect"]
49 #[inline(always)]
50 pub fn disabled(self) -> &'a mut crate::W<REG> {
51 self.variant(Flashdis::Disabled)
52 }
53 #[doc = "Flash memory is disabled"]
54 #[inline(always)]
55 pub fn enabled(self) -> &'a mut crate::W<REG> {
56 self.variant(Flashdis::Enabled)
57 }
58}
59#[doc = "Flash Doze\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Flashdoze {
63 #[doc = "0: No effect"]
64 Disabled = 0,
65 #[doc = "1: Flash memory is disabled when core is sleeping (CKMODE > 0)"]
66 Enabled = 1,
67}
68impl From<Flashdoze> for bool {
69 #[inline(always)]
70 fn from(variant: Flashdoze) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `FLASHDOZE` reader - Flash Doze"]
75pub type FlashdozeR = crate::BitReader<Flashdoze>;
76impl FlashdozeR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Flashdoze {
80 match self.bits {
81 false => Flashdoze::Disabled,
82 true => Flashdoze::Enabled,
83 }
84 }
85 #[doc = "No effect"]
86 #[inline(always)]
87 pub fn is_disabled(&self) -> bool {
88 *self == Flashdoze::Disabled
89 }
90 #[doc = "Flash memory is disabled when core is sleeping (CKMODE > 0)"]
91 #[inline(always)]
92 pub fn is_enabled(&self) -> bool {
93 *self == Flashdoze::Enabled
94 }
95}
96#[doc = "Field `FLASHDOZE` writer - Flash Doze"]
97pub type FlashdozeW<'a, REG> = crate::BitWriter<'a, REG, Flashdoze>;
98impl<'a, REG> FlashdozeW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "No effect"]
103 #[inline(always)]
104 pub fn disabled(self) -> &'a mut crate::W<REG> {
105 self.variant(Flashdoze::Disabled)
106 }
107 #[doc = "Flash memory is disabled when core is sleeping (CKMODE > 0)"]
108 #[inline(always)]
109 pub fn enabled(self) -> &'a mut crate::W<REG> {
110 self.variant(Flashdoze::Enabled)
111 }
112}
113#[doc = "Flash Wake\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Flashwake {
117 #[doc = "0: No effect"]
118 Disabled = 0,
119 #[doc = "1: Flash memory is not disabled during flash memory accesses"]
120 Enabled = 1,
121}
122impl From<Flashwake> for bool {
123 #[inline(always)]
124 fn from(variant: Flashwake) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `FLASHWAKE` reader - Flash Wake"]
129pub type FlashwakeR = crate::BitReader<Flashwake>;
130impl FlashwakeR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Flashwake {
134 match self.bits {
135 false => Flashwake::Disabled,
136 true => Flashwake::Enabled,
137 }
138 }
139 #[doc = "No effect"]
140 #[inline(always)]
141 pub fn is_disabled(&self) -> bool {
142 *self == Flashwake::Disabled
143 }
144 #[doc = "Flash memory is not disabled during flash memory accesses"]
145 #[inline(always)]
146 pub fn is_enabled(&self) -> bool {
147 *self == Flashwake::Enabled
148 }
149}
150#[doc = "Field `FLASHWAKE` writer - Flash Wake"]
151pub type FlashwakeW<'a, REG> = crate::BitWriter<'a, REG, Flashwake>;
152impl<'a, REG> FlashwakeW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "No effect"]
157 #[inline(always)]
158 pub fn disabled(self) -> &'a mut crate::W<REG> {
159 self.variant(Flashwake::Disabled)
160 }
161 #[doc = "Flash memory is not disabled during flash memory accesses"]
162 #[inline(always)]
163 pub fn enabled(self) -> &'a mut crate::W<REG> {
164 self.variant(Flashwake::Enabled)
165 }
166}
167impl R {
168 #[doc = "Bit 0 - Flash Disable"]
169 #[inline(always)]
170 pub fn flashdis(&self) -> FlashdisR {
171 FlashdisR::new((self.bits & 1) != 0)
172 }
173 #[doc = "Bit 1 - Flash Doze"]
174 #[inline(always)]
175 pub fn flashdoze(&self) -> FlashdozeR {
176 FlashdozeR::new(((self.bits >> 1) & 1) != 0)
177 }
178 #[doc = "Bit 2 - Flash Wake"]
179 #[inline(always)]
180 pub fn flashwake(&self) -> FlashwakeR {
181 FlashwakeR::new(((self.bits >> 2) & 1) != 0)
182 }
183}
184#[cfg(feature = "debug")]
185impl core::fmt::Debug for R {
186 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187 f.debug_struct("FLASHCR")
188 .field("flashdis", &self.flashdis())
189 .field("flashdoze", &self.flashdoze())
190 .field("flashwake", &self.flashwake())
191 .finish()
192 }
193}
194impl W {
195 #[doc = "Bit 0 - Flash Disable"]
196 #[inline(always)]
197 pub fn flashdis(&mut self) -> FlashdisW<'_, FlashcrSpec> {
198 FlashdisW::new(self, 0)
199 }
200 #[doc = "Bit 1 - Flash Doze"]
201 #[inline(always)]
202 pub fn flashdoze(&mut self) -> FlashdozeW<'_, FlashcrSpec> {
203 FlashdozeW::new(self, 1)
204 }
205 #[doc = "Bit 2 - Flash Wake"]
206 #[inline(always)]
207 pub fn flashwake(&mut self) -> FlashwakeW<'_, FlashcrSpec> {
208 FlashwakeW::new(self, 2)
209 }
210}
211#[doc = "Flash Control\n\nYou can [`read`](crate::Reg::read) this register and get [`flashcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`flashcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
212pub struct FlashcrSpec;
213impl crate::RegisterSpec for FlashcrSpec {
214 type Ux = u32;
215}
216#[doc = "`read()` method returns [`flashcr::R`](R) reader structure"]
217impl crate::Readable for FlashcrSpec {}
218#[doc = "`write(|w| ..)` method takes [`flashcr::W`](W) writer structure"]
219impl crate::Writable for FlashcrSpec {
220 type Safety = crate::Unsafe;
221}
222#[doc = "`reset()` method sets FLASHCR to value 0"]
223impl crate::Resettable for FlashcrSpec {}