1#[doc = "Register `BOD33` reader"]
2pub struct R(crate::R<BOD33_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BOD33_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BOD33_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BOD33_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BOD33` writer"]
17pub struct W(crate::W<BOD33_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BOD33_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<BOD33_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BOD33_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ENABLE` reader - Enable"]
38pub type ENABLE_R = crate::BitReader<bool>;
39#[doc = "Field `ENABLE` writer - Enable"]
40pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
41#[doc = "Field `HYST` reader - Hysteresis Enable"]
42pub type HYST_R = crate::BitReader<bool>;
43#[doc = "Field `HYST` writer - Hysteresis Enable"]
44pub type HYST_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
45#[doc = "Field `ACTION` reader - Action when Threshold Crossed"]
46pub type ACTION_R = crate::FieldReader<u8, ACTIONSELECT_A>;
47#[doc = "Action when Threshold Crossed\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49#[repr(u8)]
50pub enum ACTIONSELECT_A {
51 #[doc = "0: No action"]
52 NONE = 0,
53 #[doc = "1: The BOD33 generates a reset"]
54 RESET = 1,
55 #[doc = "2: The BOD33 generates an interrupt"]
56 INT = 2,
57 #[doc = "3: The BOD33 puts the device in backup sleep mode if VMON=0"]
58 BKUP = 3,
59}
60impl From<ACTIONSELECT_A> for u8 {
61 #[inline(always)]
62 fn from(variant: ACTIONSELECT_A) -> Self {
63 variant as _
64 }
65}
66impl ACTION_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> ACTIONSELECT_A {
70 match self.bits {
71 0 => ACTIONSELECT_A::NONE,
72 1 => ACTIONSELECT_A::RESET,
73 2 => ACTIONSELECT_A::INT,
74 3 => ACTIONSELECT_A::BKUP,
75 _ => unreachable!(),
76 }
77 }
78 #[doc = "Checks if the value of the field is `NONE`"]
79 #[inline(always)]
80 pub fn is_none(&self) -> bool {
81 *self == ACTIONSELECT_A::NONE
82 }
83 #[doc = "Checks if the value of the field is `RESET`"]
84 #[inline(always)]
85 pub fn is_reset(&self) -> bool {
86 *self == ACTIONSELECT_A::RESET
87 }
88 #[doc = "Checks if the value of the field is `INT`"]
89 #[inline(always)]
90 pub fn is_int(&self) -> bool {
91 *self == ACTIONSELECT_A::INT
92 }
93 #[doc = "Checks if the value of the field is `BKUP`"]
94 #[inline(always)]
95 pub fn is_bkup(&self) -> bool {
96 *self == ACTIONSELECT_A::BKUP
97 }
98}
99#[doc = "Field `ACTION` writer - Action when Threshold Crossed"]
100pub type ACTION_W<'a, const O: u8> =
101 crate::FieldWriterSafe<'a, u32, BOD33_SPEC, u8, ACTIONSELECT_A, 2, O>;
102impl<'a, const O: u8> ACTION_W<'a, O> {
103 #[doc = "No action"]
104 #[inline(always)]
105 pub fn none(self) -> &'a mut W {
106 self.variant(ACTIONSELECT_A::NONE)
107 }
108 #[doc = "The BOD33 generates a reset"]
109 #[inline(always)]
110 pub fn reset(self) -> &'a mut W {
111 self.variant(ACTIONSELECT_A::RESET)
112 }
113 #[doc = "The BOD33 generates an interrupt"]
114 #[inline(always)]
115 pub fn int(self) -> &'a mut W {
116 self.variant(ACTIONSELECT_A::INT)
117 }
118 #[doc = "The BOD33 puts the device in backup sleep mode if VMON=0"]
119 #[inline(always)]
120 pub fn bkup(self) -> &'a mut W {
121 self.variant(ACTIONSELECT_A::BKUP)
122 }
123}
124#[doc = "Field `STDBYCFG` reader - Configuration in Standby mode"]
125pub type STDBYCFG_R = crate::BitReader<bool>;
126#[doc = "Field `STDBYCFG` writer - Configuration in Standby mode"]
127pub type STDBYCFG_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
128#[doc = "Field `RUNSTDBY` reader - Run during Standby"]
129pub type RUNSTDBY_R = crate::BitReader<bool>;
130#[doc = "Field `RUNSTDBY` writer - Run during Standby"]
131pub type RUNSTDBY_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
132#[doc = "Field `RUNBKUP` reader - Configuration in Backup mode"]
133pub type RUNBKUP_R = crate::BitReader<bool>;
134#[doc = "Field `RUNBKUP` writer - Configuration in Backup mode"]
135pub type RUNBKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
136#[doc = "Field `ACTCFG` reader - Configuration in Active mode"]
137pub type ACTCFG_R = crate::BitReader<bool>;
138#[doc = "Field `ACTCFG` writer - Configuration in Active mode"]
139pub type ACTCFG_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
140#[doc = "Field `VMON` reader - Voltage Monitored in active and standby mode"]
141pub type VMON_R = crate::BitReader<bool>;
142#[doc = "Field `VMON` writer - Voltage Monitored in active and standby mode"]
143pub type VMON_W<'a, const O: u8> = crate::BitWriter<'a, u32, BOD33_SPEC, bool, O>;
144#[doc = "Field `PSEL` reader - Prescaler Select"]
145pub type PSEL_R = crate::FieldReader<u8, PSELSELECT_A>;
146#[doc = "Prescaler Select\n\nValue on reset: 0"]
147#[derive(Clone, Copy, Debug, PartialEq, Eq)]
148#[repr(u8)]
149pub enum PSELSELECT_A {
150 #[doc = "0: Divide clock by 2"]
151 DIV2 = 0,
152 #[doc = "1: Divide clock by 4"]
153 DIV4 = 1,
154 #[doc = "2: Divide clock by 8"]
155 DIV8 = 2,
156 #[doc = "3: Divide clock by 16"]
157 DIV16 = 3,
158 #[doc = "4: Divide clock by 32"]
159 DIV32 = 4,
160 #[doc = "5: Divide clock by 64"]
161 DIV64 = 5,
162 #[doc = "6: Divide clock by 128"]
163 DIV128 = 6,
164 #[doc = "7: Divide clock by 256"]
165 DIV256 = 7,
166 #[doc = "8: Divide clock by 512"]
167 DIV512 = 8,
168 #[doc = "9: Divide clock by 1024"]
169 DIV1024 = 9,
170 #[doc = "10: Divide clock by 2048"]
171 DIV2048 = 10,
172 #[doc = "11: Divide clock by 4096"]
173 DIV4096 = 11,
174 #[doc = "12: Divide clock by 8192"]
175 DIV8192 = 12,
176 #[doc = "13: Divide clock by 16384"]
177 DIV16384 = 13,
178 #[doc = "14: Divide clock by 32768"]
179 DIV32768 = 14,
180 #[doc = "15: Divide clock by 65536"]
181 DIV65536 = 15,
182}
183impl From<PSELSELECT_A> for u8 {
184 #[inline(always)]
185 fn from(variant: PSELSELECT_A) -> Self {
186 variant as _
187 }
188}
189impl PSEL_R {
190 #[doc = "Get enumerated values variant"]
191 #[inline(always)]
192 pub fn variant(&self) -> PSELSELECT_A {
193 match self.bits {
194 0 => PSELSELECT_A::DIV2,
195 1 => PSELSELECT_A::DIV4,
196 2 => PSELSELECT_A::DIV8,
197 3 => PSELSELECT_A::DIV16,
198 4 => PSELSELECT_A::DIV32,
199 5 => PSELSELECT_A::DIV64,
200 6 => PSELSELECT_A::DIV128,
201 7 => PSELSELECT_A::DIV256,
202 8 => PSELSELECT_A::DIV512,
203 9 => PSELSELECT_A::DIV1024,
204 10 => PSELSELECT_A::DIV2048,
205 11 => PSELSELECT_A::DIV4096,
206 12 => PSELSELECT_A::DIV8192,
207 13 => PSELSELECT_A::DIV16384,
208 14 => PSELSELECT_A::DIV32768,
209 15 => PSELSELECT_A::DIV65536,
210 _ => unreachable!(),
211 }
212 }
213 #[doc = "Checks if the value of the field is `DIV2`"]
214 #[inline(always)]
215 pub fn is_div2(&self) -> bool {
216 *self == PSELSELECT_A::DIV2
217 }
218 #[doc = "Checks if the value of the field is `DIV4`"]
219 #[inline(always)]
220 pub fn is_div4(&self) -> bool {
221 *self == PSELSELECT_A::DIV4
222 }
223 #[doc = "Checks if the value of the field is `DIV8`"]
224 #[inline(always)]
225 pub fn is_div8(&self) -> bool {
226 *self == PSELSELECT_A::DIV8
227 }
228 #[doc = "Checks if the value of the field is `DIV16`"]
229 #[inline(always)]
230 pub fn is_div16(&self) -> bool {
231 *self == PSELSELECT_A::DIV16
232 }
233 #[doc = "Checks if the value of the field is `DIV32`"]
234 #[inline(always)]
235 pub fn is_div32(&self) -> bool {
236 *self == PSELSELECT_A::DIV32
237 }
238 #[doc = "Checks if the value of the field is `DIV64`"]
239 #[inline(always)]
240 pub fn is_div64(&self) -> bool {
241 *self == PSELSELECT_A::DIV64
242 }
243 #[doc = "Checks if the value of the field is `DIV128`"]
244 #[inline(always)]
245 pub fn is_div128(&self) -> bool {
246 *self == PSELSELECT_A::DIV128
247 }
248 #[doc = "Checks if the value of the field is `DIV256`"]
249 #[inline(always)]
250 pub fn is_div256(&self) -> bool {
251 *self == PSELSELECT_A::DIV256
252 }
253 #[doc = "Checks if the value of the field is `DIV512`"]
254 #[inline(always)]
255 pub fn is_div512(&self) -> bool {
256 *self == PSELSELECT_A::DIV512
257 }
258 #[doc = "Checks if the value of the field is `DIV1024`"]
259 #[inline(always)]
260 pub fn is_div1024(&self) -> bool {
261 *self == PSELSELECT_A::DIV1024
262 }
263 #[doc = "Checks if the value of the field is `DIV2048`"]
264 #[inline(always)]
265 pub fn is_div2048(&self) -> bool {
266 *self == PSELSELECT_A::DIV2048
267 }
268 #[doc = "Checks if the value of the field is `DIV4096`"]
269 #[inline(always)]
270 pub fn is_div4096(&self) -> bool {
271 *self == PSELSELECT_A::DIV4096
272 }
273 #[doc = "Checks if the value of the field is `DIV8192`"]
274 #[inline(always)]
275 pub fn is_div8192(&self) -> bool {
276 *self == PSELSELECT_A::DIV8192
277 }
278 #[doc = "Checks if the value of the field is `DIV16384`"]
279 #[inline(always)]
280 pub fn is_div16384(&self) -> bool {
281 *self == PSELSELECT_A::DIV16384
282 }
283 #[doc = "Checks if the value of the field is `DIV32768`"]
284 #[inline(always)]
285 pub fn is_div32768(&self) -> bool {
286 *self == PSELSELECT_A::DIV32768
287 }
288 #[doc = "Checks if the value of the field is `DIV65536`"]
289 #[inline(always)]
290 pub fn is_div65536(&self) -> bool {
291 *self == PSELSELECT_A::DIV65536
292 }
293}
294#[doc = "Field `PSEL` writer - Prescaler Select"]
295pub type PSEL_W<'a, const O: u8> =
296 crate::FieldWriterSafe<'a, u32, BOD33_SPEC, u8, PSELSELECT_A, 4, O>;
297impl<'a, const O: u8> PSEL_W<'a, O> {
298 #[doc = "Divide clock by 2"]
299 #[inline(always)]
300 pub fn div2(self) -> &'a mut W {
301 self.variant(PSELSELECT_A::DIV2)
302 }
303 #[doc = "Divide clock by 4"]
304 #[inline(always)]
305 pub fn div4(self) -> &'a mut W {
306 self.variant(PSELSELECT_A::DIV4)
307 }
308 #[doc = "Divide clock by 8"]
309 #[inline(always)]
310 pub fn div8(self) -> &'a mut W {
311 self.variant(PSELSELECT_A::DIV8)
312 }
313 #[doc = "Divide clock by 16"]
314 #[inline(always)]
315 pub fn div16(self) -> &'a mut W {
316 self.variant(PSELSELECT_A::DIV16)
317 }
318 #[doc = "Divide clock by 32"]
319 #[inline(always)]
320 pub fn div32(self) -> &'a mut W {
321 self.variant(PSELSELECT_A::DIV32)
322 }
323 #[doc = "Divide clock by 64"]
324 #[inline(always)]
325 pub fn div64(self) -> &'a mut W {
326 self.variant(PSELSELECT_A::DIV64)
327 }
328 #[doc = "Divide clock by 128"]
329 #[inline(always)]
330 pub fn div128(self) -> &'a mut W {
331 self.variant(PSELSELECT_A::DIV128)
332 }
333 #[doc = "Divide clock by 256"]
334 #[inline(always)]
335 pub fn div256(self) -> &'a mut W {
336 self.variant(PSELSELECT_A::DIV256)
337 }
338 #[doc = "Divide clock by 512"]
339 #[inline(always)]
340 pub fn div512(self) -> &'a mut W {
341 self.variant(PSELSELECT_A::DIV512)
342 }
343 #[doc = "Divide clock by 1024"]
344 #[inline(always)]
345 pub fn div1024(self) -> &'a mut W {
346 self.variant(PSELSELECT_A::DIV1024)
347 }
348 #[doc = "Divide clock by 2048"]
349 #[inline(always)]
350 pub fn div2048(self) -> &'a mut W {
351 self.variant(PSELSELECT_A::DIV2048)
352 }
353 #[doc = "Divide clock by 4096"]
354 #[inline(always)]
355 pub fn div4096(self) -> &'a mut W {
356 self.variant(PSELSELECT_A::DIV4096)
357 }
358 #[doc = "Divide clock by 8192"]
359 #[inline(always)]
360 pub fn div8192(self) -> &'a mut W {
361 self.variant(PSELSELECT_A::DIV8192)
362 }
363 #[doc = "Divide clock by 16384"]
364 #[inline(always)]
365 pub fn div16384(self) -> &'a mut W {
366 self.variant(PSELSELECT_A::DIV16384)
367 }
368 #[doc = "Divide clock by 32768"]
369 #[inline(always)]
370 pub fn div32768(self) -> &'a mut W {
371 self.variant(PSELSELECT_A::DIV32768)
372 }
373 #[doc = "Divide clock by 65536"]
374 #[inline(always)]
375 pub fn div65536(self) -> &'a mut W {
376 self.variant(PSELSELECT_A::DIV65536)
377 }
378}
379#[doc = "Field `LEVEL` reader - Threshold Level for VDD"]
380pub type LEVEL_R = crate::FieldReader<u8, u8>;
381#[doc = "Field `LEVEL` writer - Threshold Level for VDD"]
382pub type LEVEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BOD33_SPEC, u8, u8, 6, O>;
383#[doc = "Field `BKUPLEVEL` reader - Threshold Level in backup sleep mode or for VBAT"]
384pub type BKUPLEVEL_R = crate::FieldReader<u8, u8>;
385#[doc = "Field `BKUPLEVEL` writer - Threshold Level in backup sleep mode or for VBAT"]
386pub type BKUPLEVEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BOD33_SPEC, u8, u8, 6, O>;
387impl R {
388 #[doc = "Bit 1 - Enable"]
389 #[inline(always)]
390 pub fn enable(&self) -> ENABLE_R {
391 ENABLE_R::new(((self.bits >> 1) & 1) != 0)
392 }
393 #[doc = "Bit 2 - Hysteresis Enable"]
394 #[inline(always)]
395 pub fn hyst(&self) -> HYST_R {
396 HYST_R::new(((self.bits >> 2) & 1) != 0)
397 }
398 #[doc = "Bits 3:4 - Action when Threshold Crossed"]
399 #[inline(always)]
400 pub fn action(&self) -> ACTION_R {
401 ACTION_R::new(((self.bits >> 3) & 3) as u8)
402 }
403 #[doc = "Bit 5 - Configuration in Standby mode"]
404 #[inline(always)]
405 pub fn stdbycfg(&self) -> STDBYCFG_R {
406 STDBYCFG_R::new(((self.bits >> 5) & 1) != 0)
407 }
408 #[doc = "Bit 6 - Run during Standby"]
409 #[inline(always)]
410 pub fn runstdby(&self) -> RUNSTDBY_R {
411 RUNSTDBY_R::new(((self.bits >> 6) & 1) != 0)
412 }
413 #[doc = "Bit 7 - Configuration in Backup mode"]
414 #[inline(always)]
415 pub fn runbkup(&self) -> RUNBKUP_R {
416 RUNBKUP_R::new(((self.bits >> 7) & 1) != 0)
417 }
418 #[doc = "Bit 8 - Configuration in Active mode"]
419 #[inline(always)]
420 pub fn actcfg(&self) -> ACTCFG_R {
421 ACTCFG_R::new(((self.bits >> 8) & 1) != 0)
422 }
423 #[doc = "Bit 10 - Voltage Monitored in active and standby mode"]
424 #[inline(always)]
425 pub fn vmon(&self) -> VMON_R {
426 VMON_R::new(((self.bits >> 10) & 1) != 0)
427 }
428 #[doc = "Bits 12:15 - Prescaler Select"]
429 #[inline(always)]
430 pub fn psel(&self) -> PSEL_R {
431 PSEL_R::new(((self.bits >> 12) & 0x0f) as u8)
432 }
433 #[doc = "Bits 16:21 - Threshold Level for VDD"]
434 #[inline(always)]
435 pub fn level(&self) -> LEVEL_R {
436 LEVEL_R::new(((self.bits >> 16) & 0x3f) as u8)
437 }
438 #[doc = "Bits 24:29 - Threshold Level in backup sleep mode or for VBAT"]
439 #[inline(always)]
440 pub fn bkuplevel(&self) -> BKUPLEVEL_R {
441 BKUPLEVEL_R::new(((self.bits >> 24) & 0x3f) as u8)
442 }
443}
444impl W {
445 #[doc = "Bit 1 - Enable"]
446 #[inline(always)]
447 #[must_use]
448 pub fn enable(&mut self) -> ENABLE_W<1> {
449 ENABLE_W::new(self)
450 }
451 #[doc = "Bit 2 - Hysteresis Enable"]
452 #[inline(always)]
453 #[must_use]
454 pub fn hyst(&mut self) -> HYST_W<2> {
455 HYST_W::new(self)
456 }
457 #[doc = "Bits 3:4 - Action when Threshold Crossed"]
458 #[inline(always)]
459 #[must_use]
460 pub fn action(&mut self) -> ACTION_W<3> {
461 ACTION_W::new(self)
462 }
463 #[doc = "Bit 5 - Configuration in Standby mode"]
464 #[inline(always)]
465 #[must_use]
466 pub fn stdbycfg(&mut self) -> STDBYCFG_W<5> {
467 STDBYCFG_W::new(self)
468 }
469 #[doc = "Bit 6 - Run during Standby"]
470 #[inline(always)]
471 #[must_use]
472 pub fn runstdby(&mut self) -> RUNSTDBY_W<6> {
473 RUNSTDBY_W::new(self)
474 }
475 #[doc = "Bit 7 - Configuration in Backup mode"]
476 #[inline(always)]
477 #[must_use]
478 pub fn runbkup(&mut self) -> RUNBKUP_W<7> {
479 RUNBKUP_W::new(self)
480 }
481 #[doc = "Bit 8 - Configuration in Active mode"]
482 #[inline(always)]
483 #[must_use]
484 pub fn actcfg(&mut self) -> ACTCFG_W<8> {
485 ACTCFG_W::new(self)
486 }
487 #[doc = "Bit 10 - Voltage Monitored in active and standby mode"]
488 #[inline(always)]
489 #[must_use]
490 pub fn vmon(&mut self) -> VMON_W<10> {
491 VMON_W::new(self)
492 }
493 #[doc = "Bits 12:15 - Prescaler Select"]
494 #[inline(always)]
495 #[must_use]
496 pub fn psel(&mut self) -> PSEL_W<12> {
497 PSEL_W::new(self)
498 }
499 #[doc = "Bits 16:21 - Threshold Level for VDD"]
500 #[inline(always)]
501 #[must_use]
502 pub fn level(&mut self) -> LEVEL_W<16> {
503 LEVEL_W::new(self)
504 }
505 #[doc = "Bits 24:29 - Threshold Level in backup sleep mode or for VBAT"]
506 #[inline(always)]
507 #[must_use]
508 pub fn bkuplevel(&mut self) -> BKUPLEVEL_W<24> {
509 BKUPLEVEL_W::new(self)
510 }
511 #[doc = "Writes raw bits to the register."]
512 #[inline(always)]
513 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
514 self.0.bits(bits);
515 self
516 }
517}
518#[doc = "BOD33 Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [bod33](index.html) module"]
519pub struct BOD33_SPEC;
520impl crate::RegisterSpec for BOD33_SPEC {
521 type Ux = u32;
522}
523#[doc = "`read()` method returns [bod33::R](R) reader structure"]
524impl crate::Readable for BOD33_SPEC {
525 type Reader = R;
526}
527#[doc = "`write(|w| ..)` method takes [bod33::W](W) writer structure"]
528impl crate::Writable for BOD33_SPEC {
529 type Writer = W;
530 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
531 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
532}
533#[doc = "`reset()` method sets BOD33 to value 0"]
534impl crate::Resettable for BOD33_SPEC {
535 const RESET_VALUE: Self::Ux = 0;
536}