efm32tg11b_pac/efm32tg11b120/emu/
vmonbuvddctrl.rs

1#[doc = "Register `VMONBUVDDCTRL` reader"]
2pub struct R(crate::R<VMONBUVDDCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<VMONBUVDDCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<VMONBUVDDCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<VMONBUVDDCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `VMONBUVDDCTRL` writer"]
17pub struct W(crate::W<VMONBUVDDCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<VMONBUVDDCTRL_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<VMONBUVDDCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<VMONBUVDDCTRL_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, VMONBUVDDCTRL_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, VMONBUVDDCTRL_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, VMONBUVDDCTRL_SPEC, bool, O>;
49#[doc = "Field `THRESFINE` reader - Threshold Fine Adjust"]
50pub type THRESFINE_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `THRESFINE` writer - Threshold Fine Adjust"]
52pub type THRESFINE_W<'a, const O: u8> =
53    crate::FieldWriter<'a, u32, VMONBUVDDCTRL_SPEC, u8, u8, 4, O>;
54#[doc = "Field `THRESCOARSE` reader - Threshold Coarse Adjust"]
55pub type THRESCOARSE_R = crate::FieldReader<u8, u8>;
56#[doc = "Field `THRESCOARSE` writer - Threshold Coarse Adjust"]
57pub type THRESCOARSE_W<'a, const O: u8> =
58    crate::FieldWriter<'a, u32, VMONBUVDDCTRL_SPEC, u8, u8, 4, O>;
59impl R {
60    #[doc = "Bit 0 - Enable"]
61    #[inline(always)]
62    pub fn en(&self) -> EN_R {
63        EN_R::new((self.bits & 1) != 0)
64    }
65    #[doc = "Bit 2 - Rise Wakeup"]
66    #[inline(always)]
67    pub fn risewu(&self) -> RISEWU_R {
68        RISEWU_R::new(((self.bits >> 2) & 1) != 0)
69    }
70    #[doc = "Bit 3 - Fall Wakeup"]
71    #[inline(always)]
72    pub fn fallwu(&self) -> FALLWU_R {
73        FALLWU_R::new(((self.bits >> 3) & 1) != 0)
74    }
75    #[doc = "Bits 8:11 - Threshold Fine Adjust"]
76    #[inline(always)]
77    pub fn thresfine(&self) -> THRESFINE_R {
78        THRESFINE_R::new(((self.bits >> 8) & 0x0f) as u8)
79    }
80    #[doc = "Bits 12:15 - Threshold Coarse Adjust"]
81    #[inline(always)]
82    pub fn threscoarse(&self) -> THRESCOARSE_R {
83        THRESCOARSE_R::new(((self.bits >> 12) & 0x0f) as u8)
84    }
85}
86impl W {
87    #[doc = "Bit 0 - Enable"]
88    #[inline(always)]
89    #[must_use]
90    pub fn en(&mut self) -> EN_W<0> {
91        EN_W::new(self)
92    }
93    #[doc = "Bit 2 - Rise Wakeup"]
94    #[inline(always)]
95    #[must_use]
96    pub fn risewu(&mut self) -> RISEWU_W<2> {
97        RISEWU_W::new(self)
98    }
99    #[doc = "Bit 3 - Fall Wakeup"]
100    #[inline(always)]
101    #[must_use]
102    pub fn fallwu(&mut self) -> FALLWU_W<3> {
103        FALLWU_W::new(self)
104    }
105    #[doc = "Bits 8:11 - Threshold Fine Adjust"]
106    #[inline(always)]
107    #[must_use]
108    pub fn thresfine(&mut self) -> THRESFINE_W<8> {
109        THRESFINE_W::new(self)
110    }
111    #[doc = "Bits 12:15 - Threshold Coarse Adjust"]
112    #[inline(always)]
113    #[must_use]
114    pub fn threscoarse(&mut self) -> THRESCOARSE_W<12> {
115        THRESCOARSE_W::new(self)
116    }
117    #[doc = "Writes raw bits to the register."]
118    #[inline(always)]
119    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
120        self.0.bits(bits);
121        self
122    }
123}
124#[doc = "VMON BUVDD 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 [vmonbuvddctrl](index.html) module"]
125pub struct VMONBUVDDCTRL_SPEC;
126impl crate::RegisterSpec for VMONBUVDDCTRL_SPEC {
127    type Ux = u32;
128}
129#[doc = "`read()` method returns [vmonbuvddctrl::R](R) reader structure"]
130impl crate::Readable for VMONBUVDDCTRL_SPEC {
131    type Reader = R;
132}
133#[doc = "`write(|w| ..)` method takes [vmonbuvddctrl::W](W) writer structure"]
134impl crate::Writable for VMONBUVDDCTRL_SPEC {
135    type Writer = W;
136    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
137    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138}
139#[doc = "`reset()` method sets VMONBUVDDCTRL to value 0"]
140impl crate::Resettable for VMONBUVDDCTRL_SPEC {
141    const RESET_VALUE: Self::Ux = 0;
142}