efm32gg11b320_pac/emu/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EM2BLOCK` reader - Energy Mode 2 Block"]
38pub type EM2BLOCK_R = crate::BitReader<bool>;
39#[doc = "Field `EM2BLOCK` writer - Energy Mode 2 Block"]
40pub type EM2BLOCK_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 1>;
41#[doc = "Field `EM2BODDIS` reader - Disable BOD in EM2"]
42pub type EM2BODDIS_R = crate::BitReader<bool>;
43#[doc = "Field `EM2BODDIS` writer - Disable BOD in EM2"]
44pub type EM2BODDIS_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 2>;
45#[doc = "Field `EM01LD` reader - Reserved for internal use. Do not change."]
46pub type EM01LD_R = crate::BitReader<bool>;
47#[doc = "Field `EM01LD` writer - Reserved for internal use. Do not change."]
48pub type EM01LD_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 3>;
49#[doc = "Field `EM23VSCALEAUTOWSEN` reader - Automatically Configures Flash and Frequency to Wakeup From EM2 or EM3 at Low Voltage"]
50pub type EM23VSCALEAUTOWSEN_R = crate::BitReader<bool>;
51#[doc = "Field `EM23VSCALEAUTOWSEN` writer - Automatically Configures Flash and Frequency to Wakeup From EM2 or EM3 at Low Voltage"]
52pub type EM23VSCALEAUTOWSEN_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 4>;
53#[doc = "EM23 Voltage Scale\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum EM23VSCALE_A {
57 #[doc = "0: Voltage Scale Level 2"]
58 VSCALE2 = 0,
59 #[doc = "2: Voltage Scale Level 0"]
60 VSCALE0 = 2,
61 #[doc = "3: RESV"]
62 RESV = 3,
63}
64impl From<EM23VSCALE_A> for u8 {
65 #[inline(always)]
66 fn from(variant: EM23VSCALE_A) -> Self {
67 variant as _
68 }
69}
70#[doc = "Field `EM23VSCALE` reader - EM23 Voltage Scale"]
71pub type EM23VSCALE_R = crate::FieldReader<u8, EM23VSCALE_A>;
72impl EM23VSCALE_R {
73 #[doc = "Get enumerated values variant"]
74 #[inline(always)]
75 pub fn variant(&self) -> Option<EM23VSCALE_A> {
76 match self.bits {
77 0 => Some(EM23VSCALE_A::VSCALE2),
78 2 => Some(EM23VSCALE_A::VSCALE0),
79 3 => Some(EM23VSCALE_A::RESV),
80 _ => None,
81 }
82 }
83 #[doc = "Checks if the value of the field is `VSCALE2`"]
84 #[inline(always)]
85 pub fn is_vscale2(&self) -> bool {
86 *self == EM23VSCALE_A::VSCALE2
87 }
88 #[doc = "Checks if the value of the field is `VSCALE0`"]
89 #[inline(always)]
90 pub fn is_vscale0(&self) -> bool {
91 *self == EM23VSCALE_A::VSCALE0
92 }
93 #[doc = "Checks if the value of the field is `RESV`"]
94 #[inline(always)]
95 pub fn is_resv(&self) -> bool {
96 *self == EM23VSCALE_A::RESV
97 }
98}
99#[doc = "Field `EM23VSCALE` writer - EM23 Voltage Scale"]
100pub type EM23VSCALE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, EM23VSCALE_A, 2, 8>;
101impl<'a> EM23VSCALE_W<'a> {
102 #[doc = "Voltage Scale Level 2"]
103 #[inline(always)]
104 pub fn vscale2(self) -> &'a mut W {
105 self.variant(EM23VSCALE_A::VSCALE2)
106 }
107 #[doc = "Voltage Scale Level 0"]
108 #[inline(always)]
109 pub fn vscale0(self) -> &'a mut W {
110 self.variant(EM23VSCALE_A::VSCALE0)
111 }
112 #[doc = "RESV"]
113 #[inline(always)]
114 pub fn resv(self) -> &'a mut W {
115 self.variant(EM23VSCALE_A::RESV)
116 }
117}
118#[doc = "EM4H Voltage Scale\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq)]
120#[repr(u8)]
121pub enum EM4HVSCALE_A {
122 #[doc = "0: Voltage Scale Level 2"]
123 VSCALE2 = 0,
124 #[doc = "2: Voltage Scale Level 0"]
125 VSCALE0 = 2,
126 #[doc = "3: RESV"]
127 RESV = 3,
128}
129impl From<EM4HVSCALE_A> for u8 {
130 #[inline(always)]
131 fn from(variant: EM4HVSCALE_A) -> Self {
132 variant as _
133 }
134}
135#[doc = "Field `EM4HVSCALE` reader - EM4H Voltage Scale"]
136pub type EM4HVSCALE_R = crate::FieldReader<u8, EM4HVSCALE_A>;
137impl EM4HVSCALE_R {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub fn variant(&self) -> Option<EM4HVSCALE_A> {
141 match self.bits {
142 0 => Some(EM4HVSCALE_A::VSCALE2),
143 2 => Some(EM4HVSCALE_A::VSCALE0),
144 3 => Some(EM4HVSCALE_A::RESV),
145 _ => None,
146 }
147 }
148 #[doc = "Checks if the value of the field is `VSCALE2`"]
149 #[inline(always)]
150 pub fn is_vscale2(&self) -> bool {
151 *self == EM4HVSCALE_A::VSCALE2
152 }
153 #[doc = "Checks if the value of the field is `VSCALE0`"]
154 #[inline(always)]
155 pub fn is_vscale0(&self) -> bool {
156 *self == EM4HVSCALE_A::VSCALE0
157 }
158 #[doc = "Checks if the value of the field is `RESV`"]
159 #[inline(always)]
160 pub fn is_resv(&self) -> bool {
161 *self == EM4HVSCALE_A::RESV
162 }
163}
164#[doc = "Field `EM4HVSCALE` writer - EM4H Voltage Scale"]
165pub type EM4HVSCALE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, EM4HVSCALE_A, 2, 16>;
166impl<'a> EM4HVSCALE_W<'a> {
167 #[doc = "Voltage Scale Level 2"]
168 #[inline(always)]
169 pub fn vscale2(self) -> &'a mut W {
170 self.variant(EM4HVSCALE_A::VSCALE2)
171 }
172 #[doc = "Voltage Scale Level 0"]
173 #[inline(always)]
174 pub fn vscale0(self) -> &'a mut W {
175 self.variant(EM4HVSCALE_A::VSCALE0)
176 }
177 #[doc = "RESV"]
178 #[inline(always)]
179 pub fn resv(self) -> &'a mut W {
180 self.variant(EM4HVSCALE_A::RESV)
181 }
182}
183impl R {
184 #[doc = "Bit 1 - Energy Mode 2 Block"]
185 #[inline(always)]
186 pub fn em2block(&self) -> EM2BLOCK_R {
187 EM2BLOCK_R::new(((self.bits >> 1) & 1) != 0)
188 }
189 #[doc = "Bit 2 - Disable BOD in EM2"]
190 #[inline(always)]
191 pub fn em2boddis(&self) -> EM2BODDIS_R {
192 EM2BODDIS_R::new(((self.bits >> 2) & 1) != 0)
193 }
194 #[doc = "Bit 3 - Reserved for internal use. Do not change."]
195 #[inline(always)]
196 pub fn em01ld(&self) -> EM01LD_R {
197 EM01LD_R::new(((self.bits >> 3) & 1) != 0)
198 }
199 #[doc = "Bit 4 - Automatically Configures Flash and Frequency to Wakeup From EM2 or EM3 at Low Voltage"]
200 #[inline(always)]
201 pub fn em23vscaleautowsen(&self) -> EM23VSCALEAUTOWSEN_R {
202 EM23VSCALEAUTOWSEN_R::new(((self.bits >> 4) & 1) != 0)
203 }
204 #[doc = "Bits 8:9 - EM23 Voltage Scale"]
205 #[inline(always)]
206 pub fn em23vscale(&self) -> EM23VSCALE_R {
207 EM23VSCALE_R::new(((self.bits >> 8) & 3) as u8)
208 }
209 #[doc = "Bits 16:17 - EM4H Voltage Scale"]
210 #[inline(always)]
211 pub fn em4hvscale(&self) -> EM4HVSCALE_R {
212 EM4HVSCALE_R::new(((self.bits >> 16) & 3) as u8)
213 }
214}
215impl W {
216 #[doc = "Bit 1 - Energy Mode 2 Block"]
217 #[inline(always)]
218 pub fn em2block(&mut self) -> EM2BLOCK_W {
219 EM2BLOCK_W::new(self)
220 }
221 #[doc = "Bit 2 - Disable BOD in EM2"]
222 #[inline(always)]
223 pub fn em2boddis(&mut self) -> EM2BODDIS_W {
224 EM2BODDIS_W::new(self)
225 }
226 #[doc = "Bit 3 - Reserved for internal use. Do not change."]
227 #[inline(always)]
228 pub fn em01ld(&mut self) -> EM01LD_W {
229 EM01LD_W::new(self)
230 }
231 #[doc = "Bit 4 - Automatically Configures Flash and Frequency to Wakeup From EM2 or EM3 at Low Voltage"]
232 #[inline(always)]
233 pub fn em23vscaleautowsen(&mut self) -> EM23VSCALEAUTOWSEN_W {
234 EM23VSCALEAUTOWSEN_W::new(self)
235 }
236 #[doc = "Bits 8:9 - EM23 Voltage Scale"]
237 #[inline(always)]
238 pub fn em23vscale(&mut self) -> EM23VSCALE_W {
239 EM23VSCALE_W::new(self)
240 }
241 #[doc = "Bits 16:17 - EM4H Voltage Scale"]
242 #[inline(always)]
243 pub fn em4hvscale(&mut self) -> EM4HVSCALE_W {
244 EM4HVSCALE_W::new(self)
245 }
246 #[doc = "Writes raw bits to the register."]
247 #[inline(always)]
248 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
249 self.0.bits(bits);
250 self
251 }
252}
253#[doc = "Control Register\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 [ctrl](index.html) module"]
254pub struct CTRL_SPEC;
255impl crate::RegisterSpec for CTRL_SPEC {
256 type Ux = u32;
257}
258#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
259impl crate::Readable for CTRL_SPEC {
260 type Reader = R;
261}
262#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
263impl crate::Writable for CTRL_SPEC {
264 type Writer = W;
265}
266#[doc = "`reset()` method sets CTRL to value 0"]
267impl crate::Resettable for CTRL_SPEC {
268 #[inline(always)]
269 fn reset_value() -> Self::Ux {
270 0
271 }
272}