efm32tg11b_pac/efm32tg11b120/emu/
vmonavddctrl.rs

1#[doc = "Register `VMONAVDDCTRL` reader"]
2pub struct R(crate::R<VMONAVDDCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<VMONAVDDCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<VMONAVDDCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<VMONAVDDCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `VMONAVDDCTRL` writer"]
17pub struct W(crate::W<VMONAVDDCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<VMONAVDDCTRL_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<VMONAVDDCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<VMONAVDDCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EN` reader - Enable"]
38pub type EN_R = crate::BitReader<bool>;
39#[doc = "Field `EN` writer - Enable"]
40pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, VMONAVDDCTRL_SPEC, bool, O>;
41#[doc = "Field `RISEWU` reader - Rise Wakeup"]
42pub type RISEWU_R = crate::BitReader<bool>;
43#[doc = "Field `RISEWU` writer - Rise Wakeup"]
44pub type RISEWU_W<'a, const O: u8> = crate::BitWriter<'a, u32, VMONAVDDCTRL_SPEC, bool, O>;
45#[doc = "Field `FALLWU` reader - Fall Wakeup"]
46pub type FALLWU_R = crate::BitReader<bool>;
47#[doc = "Field `FALLWU` writer - Fall Wakeup"]
48pub type FALLWU_W<'a, const O: u8> = crate::BitWriter<'a, u32, VMONAVDDCTRL_SPEC, bool, O>;
49#[doc = "Field `FALLTHRESFINE` reader - Falling Threshold Fine Adjust"]
50pub type FALLTHRESFINE_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `FALLTHRESFINE` writer - Falling Threshold Fine Adjust"]
52pub type FALLTHRESFINE_W<'a, const O: u8> =
53    crate::FieldWriter<'a, u32, VMONAVDDCTRL_SPEC, u8, u8, 4, O>;
54#[doc = "Field `FALLTHRESCOARSE` reader - Falling Threshold Coarse Adjust"]
55pub type FALLTHRESCOARSE_R = crate::FieldReader<u8, u8>;
56#[doc = "Field `FALLTHRESCOARSE` writer - Falling Threshold Coarse Adjust"]
57pub type FALLTHRESCOARSE_W<'a, const O: u8> =
58    crate::FieldWriter<'a, u32, VMONAVDDCTRL_SPEC, u8, u8, 4, O>;
59#[doc = "Field `RISETHRESFINE` reader - Rising Threshold Fine Adjust"]
60pub type RISETHRESFINE_R = crate::FieldReader<u8, u8>;
61#[doc = "Field `RISETHRESFINE` writer - Rising Threshold Fine Adjust"]
62pub type RISETHRESFINE_W<'a, const O: u8> =
63    crate::FieldWriter<'a, u32, VMONAVDDCTRL_SPEC, u8, u8, 4, O>;
64#[doc = "Field `RISETHRESCOARSE` reader - Rising Threshold Coarse Adjust"]
65pub type RISETHRESCOARSE_R = crate::FieldReader<u8, u8>;
66#[doc = "Field `RISETHRESCOARSE` writer - Rising Threshold Coarse Adjust"]
67pub type RISETHRESCOARSE_W<'a, const O: u8> =
68    crate::FieldWriter<'a, u32, VMONAVDDCTRL_SPEC, u8, u8, 4, O>;
69impl R {
70    #[doc = "Bit 0 - Enable"]
71    #[inline(always)]
72    pub fn en(&self) -> EN_R {
73        EN_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 2 - Rise Wakeup"]
76    #[inline(always)]
77    pub fn risewu(&self) -> RISEWU_R {
78        RISEWU_R::new(((self.bits >> 2) & 1) != 0)
79    }
80    #[doc = "Bit 3 - Fall Wakeup"]
81    #[inline(always)]
82    pub fn fallwu(&self) -> FALLWU_R {
83        FALLWU_R::new(((self.bits >> 3) & 1) != 0)
84    }
85    #[doc = "Bits 8:11 - Falling Threshold Fine Adjust"]
86    #[inline(always)]
87    pub fn fallthresfine(&self) -> FALLTHRESFINE_R {
88        FALLTHRESFINE_R::new(((self.bits >> 8) & 0x0f) as u8)
89    }
90    #[doc = "Bits 12:15 - Falling Threshold Coarse Adjust"]
91    #[inline(always)]
92    pub fn fallthrescoarse(&self) -> FALLTHRESCOARSE_R {
93        FALLTHRESCOARSE_R::new(((self.bits >> 12) & 0x0f) as u8)
94    }
95    #[doc = "Bits 16:19 - Rising Threshold Fine Adjust"]
96    #[inline(always)]
97    pub fn risethresfine(&self) -> RISETHRESFINE_R {
98        RISETHRESFINE_R::new(((self.bits >> 16) & 0x0f) as u8)
99    }
100    #[doc = "Bits 20:23 - Rising Threshold Coarse Adjust"]
101    #[inline(always)]
102    pub fn risethrescoarse(&self) -> RISETHRESCOARSE_R {
103        RISETHRESCOARSE_R::new(((self.bits >> 20) & 0x0f) as u8)
104    }
105}
106impl W {
107    #[doc = "Bit 0 - Enable"]
108    #[inline(always)]
109    #[must_use]
110    pub fn en(&mut self) -> EN_W<0> {
111        EN_W::new(self)
112    }
113    #[doc = "Bit 2 - Rise Wakeup"]
114    #[inline(always)]
115    #[must_use]
116    pub fn risewu(&mut self) -> RISEWU_W<2> {
117        RISEWU_W::new(self)
118    }
119    #[doc = "Bit 3 - Fall Wakeup"]
120    #[inline(always)]
121    #[must_use]
122    pub fn fallwu(&mut self) -> FALLWU_W<3> {
123        FALLWU_W::new(self)
124    }
125    #[doc = "Bits 8:11 - Falling Threshold Fine Adjust"]
126    #[inline(always)]
127    #[must_use]
128    pub fn fallthresfine(&mut self) -> FALLTHRESFINE_W<8> {
129        FALLTHRESFINE_W::new(self)
130    }
131    #[doc = "Bits 12:15 - Falling Threshold Coarse Adjust"]
132    #[inline(always)]
133    #[must_use]
134    pub fn fallthrescoarse(&mut self) -> FALLTHRESCOARSE_W<12> {
135        FALLTHRESCOARSE_W::new(self)
136    }
137    #[doc = "Bits 16:19 - Rising Threshold Fine Adjust"]
138    #[inline(always)]
139    #[must_use]
140    pub fn risethresfine(&mut self) -> RISETHRESFINE_W<16> {
141        RISETHRESFINE_W::new(self)
142    }
143    #[doc = "Bits 20:23 - Rising Threshold Coarse Adjust"]
144    #[inline(always)]
145    #[must_use]
146    pub fn risethrescoarse(&mut self) -> RISETHRESCOARSE_W<20> {
147        RISETHRESCOARSE_W::new(self)
148    }
149    #[doc = "Writes raw bits to the register."]
150    #[inline(always)]
151    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
152        self.0.bits(bits);
153        self
154    }
155}
156#[doc = "VMON AVDD Channel 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 [vmonavddctrl](index.html) module"]
157pub struct VMONAVDDCTRL_SPEC;
158impl crate::RegisterSpec for VMONAVDDCTRL_SPEC {
159    type Ux = u32;
160}
161#[doc = "`read()` method returns [vmonavddctrl::R](R) reader structure"]
162impl crate::Readable for VMONAVDDCTRL_SPEC {
163    type Reader = R;
164}
165#[doc = "`write(|w| ..)` method takes [vmonavddctrl::W](W) writer structure"]
166impl crate::Writable for VMONAVDDCTRL_SPEC {
167    type Writer = W;
168    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
169    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
170}
171#[doc = "`reset()` method sets VMONAVDDCTRL to value 0"]
172impl crate::Resettable for VMONAVDDCTRL_SPEC {
173    const RESET_VALUE: Self::Ux = 0;
174}