1#[doc = "Register `MR` reader"]
2pub type R = crate::R<MrSpec>;
3#[doc = "Register `MR` writer"]
4pub type W = crate::W<MrSpec>;
5#[doc = "Brownout Detector Reset Enable\n\nValue on reset: 1"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Bodrsten {
8 #[doc = "0: the core reset signal \"vddcore_nreset\" is not affected when a brownout detection occurs."]
9 NotEnable = 0,
10 #[doc = "1: the core reset signal, vddcore_nreset is asserted when a brownout detection occurs."]
11 Enable = 1,
12}
13impl From<Bodrsten> for bool {
14 #[inline(always)]
15 fn from(variant: Bodrsten) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `BODRSTEN` reader - Brownout Detector Reset Enable"]
20pub type BodrstenR = crate::BitReader<Bodrsten>;
21impl BodrstenR {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> Bodrsten {
25 match self.bits {
26 false => Bodrsten::NotEnable,
27 true => Bodrsten::Enable,
28 }
29 }
30 #[doc = "the core reset signal \"vddcore_nreset\" is not affected when a brownout detection occurs."]
31 #[inline(always)]
32 pub fn is_not_enable(&self) -> bool {
33 *self == Bodrsten::NotEnable
34 }
35 #[doc = "the core reset signal, vddcore_nreset is asserted when a brownout detection occurs."]
36 #[inline(always)]
37 pub fn is_enable(&self) -> bool {
38 *self == Bodrsten::Enable
39 }
40}
41#[doc = "Field `BODRSTEN` writer - Brownout Detector Reset Enable"]
42pub type BodrstenW<'a, REG> = crate::BitWriter<'a, REG, Bodrsten>;
43impl<'a, REG> BodrstenW<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "the core reset signal \"vddcore_nreset\" is not affected when a brownout detection occurs."]
48 #[inline(always)]
49 pub fn not_enable(self) -> &'a mut crate::W<REG> {
50 self.variant(Bodrsten::NotEnable)
51 }
52 #[doc = "the core reset signal, vddcore_nreset is asserted when a brownout detection occurs."]
53 #[inline(always)]
54 pub fn enable(self) -> &'a mut crate::W<REG> {
55 self.variant(Bodrsten::Enable)
56 }
57}
58#[doc = "Brownout Detector Disable\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum Boddis {
61 #[doc = "0: the core brownout detector is enabled."]
62 Enable = 0,
63 #[doc = "1: the core brownout detector is disabled."]
64 Disable = 1,
65}
66impl From<Boddis> for bool {
67 #[inline(always)]
68 fn from(variant: Boddis) -> Self {
69 variant as u8 != 0
70 }
71}
72#[doc = "Field `BODDIS` reader - Brownout Detector Disable"]
73pub type BoddisR = crate::BitReader<Boddis>;
74impl BoddisR {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub const fn variant(&self) -> Boddis {
78 match self.bits {
79 false => Boddis::Enable,
80 true => Boddis::Disable,
81 }
82 }
83 #[doc = "the core brownout detector is enabled."]
84 #[inline(always)]
85 pub fn is_enable(&self) -> bool {
86 *self == Boddis::Enable
87 }
88 #[doc = "the core brownout detector is disabled."]
89 #[inline(always)]
90 pub fn is_disable(&self) -> bool {
91 *self == Boddis::Disable
92 }
93}
94#[doc = "Field `BODDIS` writer - Brownout Detector Disable"]
95pub type BoddisW<'a, REG> = crate::BitWriter<'a, REG, Boddis>;
96impl<'a, REG> BoddisW<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99{
100 #[doc = "the core brownout detector is enabled."]
101 #[inline(always)]
102 pub fn enable(self) -> &'a mut crate::W<REG> {
103 self.variant(Boddis::Enable)
104 }
105 #[doc = "the core brownout detector is disabled."]
106 #[inline(always)]
107 pub fn disable(self) -> &'a mut crate::W<REG> {
108 self.variant(Boddis::Disable)
109 }
110}
111#[doc = "Voltage Regulator enable\n\nValue on reset: 1"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum Onreg {
114 #[doc = "0: Internal voltage regulator is not used (external power supply is used)"]
115 OnregUnused = 0,
116 #[doc = "1: internal voltage regulator is used"]
117 OnregUsed = 1,
118}
119impl From<Onreg> for bool {
120 #[inline(always)]
121 fn from(variant: Onreg) -> Self {
122 variant as u8 != 0
123 }
124}
125#[doc = "Field `ONREG` reader - Voltage Regulator enable"]
126pub type OnregR = crate::BitReader<Onreg>;
127impl OnregR {
128 #[doc = "Get enumerated values variant"]
129 #[inline(always)]
130 pub const fn variant(&self) -> Onreg {
131 match self.bits {
132 false => Onreg::OnregUnused,
133 true => Onreg::OnregUsed,
134 }
135 }
136 #[doc = "Internal voltage regulator is not used (external power supply is used)"]
137 #[inline(always)]
138 pub fn is_onreg_unused(&self) -> bool {
139 *self == Onreg::OnregUnused
140 }
141 #[doc = "internal voltage regulator is used"]
142 #[inline(always)]
143 pub fn is_onreg_used(&self) -> bool {
144 *self == Onreg::OnregUsed
145 }
146}
147#[doc = "Field `ONREG` writer - Voltage Regulator enable"]
148pub type OnregW<'a, REG> = crate::BitWriter<'a, REG, Onreg>;
149impl<'a, REG> OnregW<'a, REG>
150where
151 REG: crate::Writable + crate::RegisterSpec,
152{
153 #[doc = "Internal voltage regulator is not used (external power supply is used)"]
154 #[inline(always)]
155 pub fn onreg_unused(self) -> &'a mut crate::W<REG> {
156 self.variant(Onreg::OnregUnused)
157 }
158 #[doc = "internal voltage regulator is used"]
159 #[inline(always)]
160 pub fn onreg_used(self) -> &'a mut crate::W<REG> {
161 self.variant(Onreg::OnregUsed)
162 }
163}
164#[doc = "Oscillator Bypass\n\nValue on reset: 0"]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum Oscbypass {
167 #[doc = "0: no effect. Clock selection depends on XTALSEL value."]
168 NoEffect = 0,
169 #[doc = "1: the 32-KHz XTAL oscillator is selected and is put in bypass mode."]
170 Bypass = 1,
171}
172impl From<Oscbypass> for bool {
173 #[inline(always)]
174 fn from(variant: Oscbypass) -> Self {
175 variant as u8 != 0
176 }
177}
178#[doc = "Field `OSCBYPASS` reader - Oscillator Bypass"]
179pub type OscbypassR = crate::BitReader<Oscbypass>;
180impl OscbypassR {
181 #[doc = "Get enumerated values variant"]
182 #[inline(always)]
183 pub const fn variant(&self) -> Oscbypass {
184 match self.bits {
185 false => Oscbypass::NoEffect,
186 true => Oscbypass::Bypass,
187 }
188 }
189 #[doc = "no effect. Clock selection depends on XTALSEL value."]
190 #[inline(always)]
191 pub fn is_no_effect(&self) -> bool {
192 *self == Oscbypass::NoEffect
193 }
194 #[doc = "the 32-KHz XTAL oscillator is selected and is put in bypass mode."]
195 #[inline(always)]
196 pub fn is_bypass(&self) -> bool {
197 *self == Oscbypass::Bypass
198 }
199}
200#[doc = "Field `OSCBYPASS` writer - Oscillator Bypass"]
201pub type OscbypassW<'a, REG> = crate::BitWriter<'a, REG, Oscbypass>;
202impl<'a, REG> OscbypassW<'a, REG>
203where
204 REG: crate::Writable + crate::RegisterSpec,
205{
206 #[doc = "no effect. Clock selection depends on XTALSEL value."]
207 #[inline(always)]
208 pub fn no_effect(self) -> &'a mut crate::W<REG> {
209 self.variant(Oscbypass::NoEffect)
210 }
211 #[doc = "the 32-KHz XTAL oscillator is selected and is put in bypass mode."]
212 #[inline(always)]
213 pub fn bypass(self) -> &'a mut crate::W<REG> {
214 self.variant(Oscbypass::Bypass)
215 }
216}
217#[doc = "Password Key\n\nValue on reset: 0"]
218#[derive(Clone, Copy, Debug, PartialEq, Eq)]
219#[repr(u8)]
220pub enum Key {
221 #[doc = "165: Writing any other value in this field aborts the write operation."]
222 Passwd = 165,
223}
224impl From<Key> for u8 {
225 #[inline(always)]
226 fn from(variant: Key) -> Self {
227 variant as _
228 }
229}
230impl crate::FieldSpec for Key {
231 type Ux = u8;
232}
233impl crate::IsEnum for Key {}
234#[doc = "Field `KEY` reader - Password Key"]
235pub type KeyR = crate::FieldReader<Key>;
236impl KeyR {
237 #[doc = "Get enumerated values variant"]
238 #[inline(always)]
239 pub const fn variant(&self) -> Option<Key> {
240 match self.bits {
241 165 => Some(Key::Passwd),
242 _ => None,
243 }
244 }
245 #[doc = "Writing any other value in this field aborts the write operation."]
246 #[inline(always)]
247 pub fn is_passwd(&self) -> bool {
248 *self == Key::Passwd
249 }
250}
251#[doc = "Field `KEY` writer - Password Key"]
252pub type KeyW<'a, REG> = crate::FieldWriter<'a, REG, 8, Key>;
253impl<'a, REG> KeyW<'a, REG>
254where
255 REG: crate::Writable + crate::RegisterSpec,
256 REG::Ux: From<u8>,
257{
258 #[doc = "Writing any other value in this field aborts the write operation."]
259 #[inline(always)]
260 pub fn passwd(self) -> &'a mut crate::W<REG> {
261 self.variant(Key::Passwd)
262 }
263}
264impl R {
265 #[doc = "Bit 12 - Brownout Detector Reset Enable"]
266 #[inline(always)]
267 pub fn bodrsten(&self) -> BodrstenR {
268 BodrstenR::new(((self.bits >> 12) & 1) != 0)
269 }
270 #[doc = "Bit 13 - Brownout Detector Disable"]
271 #[inline(always)]
272 pub fn boddis(&self) -> BoddisR {
273 BoddisR::new(((self.bits >> 13) & 1) != 0)
274 }
275 #[doc = "Bit 14 - Voltage Regulator enable"]
276 #[inline(always)]
277 pub fn onreg(&self) -> OnregR {
278 OnregR::new(((self.bits >> 14) & 1) != 0)
279 }
280 #[doc = "Bit 20 - Oscillator Bypass"]
281 #[inline(always)]
282 pub fn oscbypass(&self) -> OscbypassR {
283 OscbypassR::new(((self.bits >> 20) & 1) != 0)
284 }
285 #[doc = "Bits 24:31 - Password Key"]
286 #[inline(always)]
287 pub fn key(&self) -> KeyR {
288 KeyR::new(((self.bits >> 24) & 0xff) as u8)
289 }
290}
291impl W {
292 #[doc = "Bit 12 - Brownout Detector Reset Enable"]
293 #[inline(always)]
294 #[must_use]
295 pub fn bodrsten(&mut self) -> BodrstenW<MrSpec> {
296 BodrstenW::new(self, 12)
297 }
298 #[doc = "Bit 13 - Brownout Detector Disable"]
299 #[inline(always)]
300 #[must_use]
301 pub fn boddis(&mut self) -> BoddisW<MrSpec> {
302 BoddisW::new(self, 13)
303 }
304 #[doc = "Bit 14 - Voltage Regulator enable"]
305 #[inline(always)]
306 #[must_use]
307 pub fn onreg(&mut self) -> OnregW<MrSpec> {
308 OnregW::new(self, 14)
309 }
310 #[doc = "Bit 20 - Oscillator Bypass"]
311 #[inline(always)]
312 #[must_use]
313 pub fn oscbypass(&mut self) -> OscbypassW<MrSpec> {
314 OscbypassW::new(self, 20)
315 }
316 #[doc = "Bits 24:31 - Password Key"]
317 #[inline(always)]
318 #[must_use]
319 pub fn key(&mut self) -> KeyW<MrSpec> {
320 KeyW::new(self, 24)
321 }
322}
323#[doc = "Supply Controller Mode Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
324pub struct MrSpec;
325impl crate::RegisterSpec for MrSpec {
326 type Ux = u32;
327}
328#[doc = "`read()` method returns [`mr::R`](R) reader structure"]
329impl crate::Readable for MrSpec {}
330#[doc = "`write(|w| ..)` method takes [`mr::W`](W) writer structure"]
331impl crate::Writable for MrSpec {
332 type Safety = crate::Unsafe;
333 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
334 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
335}
336#[doc = "`reset()` method sets MR to value 0x5a00"]
337impl crate::Resettable for MrSpec {
338 const RESET_VALUE: u32 = 0x5a00;
339}