rp2040_pac/vreg_and_chip_reset/
bod.rs

1#[doc = "Register `BOD` reader"]
2pub type R = crate::R<BOD_SPEC>;
3#[doc = "Register `BOD` writer"]
4pub type W = crate::W<BOD_SPEC>;
5#[doc = "Field `EN` reader - enable  
6 0=not enabled, 1=enabled"]
7pub type EN_R = crate::BitReader;
8#[doc = "Field `EN` writer - enable  
9 0=not enabled, 1=enabled"]
10pub type EN_W<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `VSEL` reader - threshold select  
12 0000 - 0.473V  
13 0001 - 0.516V  
14 0010 - 0.559V  
15 0011 - 0.602V  
16 0100 - 0.645V  
17 0101 - 0.688V  
18 0110 - 0.731V  
19 0111 - 0.774V  
20 1000 - 0.817V  
21 1001 - 0.860V (default)  
22 1010 - 0.903V  
23 1011 - 0.946V  
24 1100 - 0.989V  
25 1101 - 1.032V  
26 1110 - 1.075V  
27 1111 - 1.118V"]
28pub type VSEL_R = crate::FieldReader;
29#[doc = "Field `VSEL` writer - threshold select  
30 0000 - 0.473V  
31 0001 - 0.516V  
32 0010 - 0.559V  
33 0011 - 0.602V  
34 0100 - 0.645V  
35 0101 - 0.688V  
36 0110 - 0.731V  
37 0111 - 0.774V  
38 1000 - 0.817V  
39 1001 - 0.860V (default)  
40 1010 - 0.903V  
41 1011 - 0.946V  
42 1100 - 0.989V  
43 1101 - 1.032V  
44 1110 - 1.075V  
45 1111 - 1.118V"]
46pub type VSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
47impl R {
48    #[doc = "Bit 0 - enable  
49 0=not enabled, 1=enabled"]
50    #[inline(always)]
51    pub fn en(&self) -> EN_R {
52        EN_R::new((self.bits & 1) != 0)
53    }
54    #[doc = "Bits 4:7 - threshold select  
55 0000 - 0.473V  
56 0001 - 0.516V  
57 0010 - 0.559V  
58 0011 - 0.602V  
59 0100 - 0.645V  
60 0101 - 0.688V  
61 0110 - 0.731V  
62 0111 - 0.774V  
63 1000 - 0.817V  
64 1001 - 0.860V (default)  
65 1010 - 0.903V  
66 1011 - 0.946V  
67 1100 - 0.989V  
68 1101 - 1.032V  
69 1110 - 1.075V  
70 1111 - 1.118V"]
71    #[inline(always)]
72    pub fn vsel(&self) -> VSEL_R {
73        VSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
74    }
75}
76impl W {
77    #[doc = "Bit 0 - enable  
78 0=not enabled, 1=enabled"]
79    #[inline(always)]
80    #[must_use]
81    pub fn en(&mut self) -> EN_W<BOD_SPEC> {
82        EN_W::new(self, 0)
83    }
84    #[doc = "Bits 4:7 - threshold select  
85 0000 - 0.473V  
86 0001 - 0.516V  
87 0010 - 0.559V  
88 0011 - 0.602V  
89 0100 - 0.645V  
90 0101 - 0.688V  
91 0110 - 0.731V  
92 0111 - 0.774V  
93 1000 - 0.817V  
94 1001 - 0.860V (default)  
95 1010 - 0.903V  
96 1011 - 0.946V  
97 1100 - 0.989V  
98 1101 - 1.032V  
99 1110 - 1.075V  
100 1111 - 1.118V"]
101    #[inline(always)]
102    #[must_use]
103    pub fn vsel(&mut self) -> VSEL_W<BOD_SPEC> {
104        VSEL_W::new(self, 4)
105    }
106    #[doc = r" Writes raw bits to the register."]
107    #[doc = r""]
108    #[doc = r" # Safety"]
109    #[doc = r""]
110    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
111    #[inline(always)]
112    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
113        self.bits = bits;
114        self
115    }
116}
117#[doc = "brown-out detection control  
118
119You can [`read`](crate::generic::Reg::read) this register and get [`bod::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 [`bod::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
120pub struct BOD_SPEC;
121impl crate::RegisterSpec for BOD_SPEC {
122    type Ux = u32;
123}
124#[doc = "`read()` method returns [`bod::R`](R) reader structure"]
125impl crate::Readable for BOD_SPEC {}
126#[doc = "`write(|w| ..)` method takes [`bod::W`](W) writer structure"]
127impl crate::Writable for BOD_SPEC {
128    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
129    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
130}
131#[doc = "`reset()` method sets BOD to value 0x91"]
132impl crate::Resettable for BOD_SPEC {
133    const RESET_VALUE: u32 = 0x91;
134}