efm32pg12_pac/emu/
vmonavddctrl.rs

1#[doc = "Reader of register VMONAVDDCTRL"]
2pub type R = crate::R<u32, super::VMONAVDDCTRL>;
3#[doc = "Writer for register VMONAVDDCTRL"]
4pub type W = crate::W<u32, super::VMONAVDDCTRL>;
5#[doc = "Register VMONAVDDCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::VMONAVDDCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `EN`"]
14pub type EN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `EN`"]
16pub struct EN_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> EN_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34        self.w
35    }
36}
37#[doc = "Reader of field `RISEWU`"]
38pub type RISEWU_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `RISEWU`"]
40pub struct RISEWU_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> RISEWU_W<'a> {
44    #[doc = r"Sets the field bit"]
45    #[inline(always)]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r"Clears the field bit"]
50    #[inline(always)]
51    pub fn clear_bit(self) -> &'a mut W {
52        self.bit(false)
53    }
54    #[doc = r"Writes raw bits to the field"]
55    #[inline(always)]
56    pub fn bit(self, value: bool) -> &'a mut W {
57        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
58        self.w
59    }
60}
61#[doc = "Reader of field `FALLWU`"]
62pub type FALLWU_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `FALLWU`"]
64pub struct FALLWU_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> FALLWU_W<'a> {
68    #[doc = r"Sets the field bit"]
69    #[inline(always)]
70    pub fn set_bit(self) -> &'a mut W {
71        self.bit(true)
72    }
73    #[doc = r"Clears the field bit"]
74    #[inline(always)]
75    pub fn clear_bit(self) -> &'a mut W {
76        self.bit(false)
77    }
78    #[doc = r"Writes raw bits to the field"]
79    #[inline(always)]
80    pub fn bit(self, value: bool) -> &'a mut W {
81        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
82        self.w
83    }
84}
85#[doc = "Reader of field `FALLTHRESFINE`"]
86pub type FALLTHRESFINE_R = crate::R<u8, u8>;
87#[doc = "Write proxy for field `FALLTHRESFINE`"]
88pub struct FALLTHRESFINE_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> FALLTHRESFINE_W<'a> {
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub unsafe fn bits(self, value: u8) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
96        self.w
97    }
98}
99#[doc = "Reader of field `FALLTHRESCOARSE`"]
100pub type FALLTHRESCOARSE_R = crate::R<u8, u8>;
101#[doc = "Write proxy for field `FALLTHRESCOARSE`"]
102pub struct FALLTHRESCOARSE_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> FALLTHRESCOARSE_W<'a> {
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub unsafe fn bits(self, value: u8) -> &'a mut W {
109        self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
110        self.w
111    }
112}
113#[doc = "Reader of field `RISETHRESFINE`"]
114pub type RISETHRESFINE_R = crate::R<u8, u8>;
115#[doc = "Write proxy for field `RISETHRESFINE`"]
116pub struct RISETHRESFINE_W<'a> {
117    w: &'a mut W,
118}
119impl<'a> RISETHRESFINE_W<'a> {
120    #[doc = r"Writes raw bits to the field"]
121    #[inline(always)]
122    pub unsafe fn bits(self, value: u8) -> &'a mut W {
123        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
124        self.w
125    }
126}
127#[doc = "Reader of field `RISETHRESCOARSE`"]
128pub type RISETHRESCOARSE_R = crate::R<u8, u8>;
129#[doc = "Write proxy for field `RISETHRESCOARSE`"]
130pub struct RISETHRESCOARSE_W<'a> {
131    w: &'a mut W,
132}
133impl<'a> RISETHRESCOARSE_W<'a> {
134    #[doc = r"Writes raw bits to the field"]
135    #[inline(always)]
136    pub unsafe fn bits(self, value: u8) -> &'a mut W {
137        self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
138        self.w
139    }
140}
141impl R {
142    #[doc = "Bit 0 - Enable"]
143    #[inline(always)]
144    pub fn en(&self) -> EN_R {
145        EN_R::new((self.bits & 0x01) != 0)
146    }
147    #[doc = "Bit 2 - Rise Wakeup"]
148    #[inline(always)]
149    pub fn risewu(&self) -> RISEWU_R {
150        RISEWU_R::new(((self.bits >> 2) & 0x01) != 0)
151    }
152    #[doc = "Bit 3 - Fall Wakeup"]
153    #[inline(always)]
154    pub fn fallwu(&self) -> FALLWU_R {
155        FALLWU_R::new(((self.bits >> 3) & 0x01) != 0)
156    }
157    #[doc = "Bits 8:11 - Falling Threshold Fine Adjust"]
158    #[inline(always)]
159    pub fn fallthresfine(&self) -> FALLTHRESFINE_R {
160        FALLTHRESFINE_R::new(((self.bits >> 8) & 0x0f) as u8)
161    }
162    #[doc = "Bits 12:15 - Falling Threshold Coarse Adjust"]
163    #[inline(always)]
164    pub fn fallthrescoarse(&self) -> FALLTHRESCOARSE_R {
165        FALLTHRESCOARSE_R::new(((self.bits >> 12) & 0x0f) as u8)
166    }
167    #[doc = "Bits 16:19 - Rising Threshold Fine Adjust"]
168    #[inline(always)]
169    pub fn risethresfine(&self) -> RISETHRESFINE_R {
170        RISETHRESFINE_R::new(((self.bits >> 16) & 0x0f) as u8)
171    }
172    #[doc = "Bits 20:23 - Rising Threshold Coarse Adjust"]
173    #[inline(always)]
174    pub fn risethrescoarse(&self) -> RISETHRESCOARSE_R {
175        RISETHRESCOARSE_R::new(((self.bits >> 20) & 0x0f) as u8)
176    }
177}
178impl W {
179    #[doc = "Bit 0 - Enable"]
180    #[inline(always)]
181    pub fn en(&mut self) -> EN_W {
182        EN_W { w: self }
183    }
184    #[doc = "Bit 2 - Rise Wakeup"]
185    #[inline(always)]
186    pub fn risewu(&mut self) -> RISEWU_W {
187        RISEWU_W { w: self }
188    }
189    #[doc = "Bit 3 - Fall Wakeup"]
190    #[inline(always)]
191    pub fn fallwu(&mut self) -> FALLWU_W {
192        FALLWU_W { w: self }
193    }
194    #[doc = "Bits 8:11 - Falling Threshold Fine Adjust"]
195    #[inline(always)]
196    pub fn fallthresfine(&mut self) -> FALLTHRESFINE_W {
197        FALLTHRESFINE_W { w: self }
198    }
199    #[doc = "Bits 12:15 - Falling Threshold Coarse Adjust"]
200    #[inline(always)]
201    pub fn fallthrescoarse(&mut self) -> FALLTHRESCOARSE_W {
202        FALLTHRESCOARSE_W { w: self }
203    }
204    #[doc = "Bits 16:19 - Rising Threshold Fine Adjust"]
205    #[inline(always)]
206    pub fn risethresfine(&mut self) -> RISETHRESFINE_W {
207        RISETHRESFINE_W { w: self }
208    }
209    #[doc = "Bits 20:23 - Rising Threshold Coarse Adjust"]
210    #[inline(always)]
211    pub fn risethrescoarse(&mut self) -> RISETHRESCOARSE_W {
212        RISETHRESCOARSE_W { w: self }
213    }
214}