efm32pg22_pac/efm32pg22c200/emu_s/
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 `EM2DBGEN` reader - Enable debugging in EM2"]
38pub type EM2DBGEN_R = crate::BitReader<bool>;
39#[doc = "Field `EM2DBGEN` writer - Enable debugging in EM2"]
40pub type EM2DBGEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
41#[doc = "Field `TEMPAVGNUM` reader - Averaged Temperature samples num"]
42pub type TEMPAVGNUM_R = crate::BitReader<TEMPAVGNUM_A>;
43#[doc = "Averaged Temperature samples num\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum TEMPAVGNUM_A {
46 #[doc = "0: 16 measurements"]
47 N16 = 0,
48 #[doc = "1: 64 measurements"]
49 N64 = 1,
50}
51impl From<TEMPAVGNUM_A> for bool {
52 #[inline(always)]
53 fn from(variant: TEMPAVGNUM_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl TEMPAVGNUM_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> TEMPAVGNUM_A {
61 match self.bits {
62 false => TEMPAVGNUM_A::N16,
63 true => TEMPAVGNUM_A::N64,
64 }
65 }
66 #[doc = "Checks if the value of the field is `N16`"]
67 #[inline(always)]
68 pub fn is_n16(&self) -> bool {
69 *self == TEMPAVGNUM_A::N16
70 }
71 #[doc = "Checks if the value of the field is `N64`"]
72 #[inline(always)]
73 pub fn is_n64(&self) -> bool {
74 *self == TEMPAVGNUM_A::N64
75 }
76}
77#[doc = "Field `TEMPAVGNUM` writer - Averaged Temperature samples num"]
78pub type TEMPAVGNUM_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, TEMPAVGNUM_A, O>;
79impl<'a, const O: u8> TEMPAVGNUM_W<'a, O> {
80 #[doc = "16 measurements"]
81 #[inline(always)]
82 pub fn n16(self) -> &'a mut W {
83 self.variant(TEMPAVGNUM_A::N16)
84 }
85 #[doc = "64 measurements"]
86 #[inline(always)]
87 pub fn n64(self) -> &'a mut W {
88 self.variant(TEMPAVGNUM_A::N64)
89 }
90}
91#[doc = "Field `EM23VSCALE` reader - EM2/EM3 Vscale"]
92pub type EM23VSCALE_R = crate::FieldReader<u8, EM23VSCALE_A>;
93#[doc = "EM2/EM3 Vscale\n\nValue on reset: 2"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum EM23VSCALE_A {
97 #[doc = "0: VSCALE0. 0.9v"]
98 VSCALE0 = 0,
99 #[doc = "1: VSCALE1. 1.0v"]
100 VSCALE1 = 1,
101 #[doc = "2: VSCALE2. 1.1v"]
102 VSCALE2 = 2,
103}
104impl From<EM23VSCALE_A> for u8 {
105 #[inline(always)]
106 fn from(variant: EM23VSCALE_A) -> Self {
107 variant as _
108 }
109}
110impl EM23VSCALE_R {
111 #[doc = "Get enumerated values variant"]
112 #[inline(always)]
113 pub fn variant(&self) -> Option<EM23VSCALE_A> {
114 match self.bits {
115 0 => Some(EM23VSCALE_A::VSCALE0),
116 1 => Some(EM23VSCALE_A::VSCALE1),
117 2 => Some(EM23VSCALE_A::VSCALE2),
118 _ => None,
119 }
120 }
121 #[doc = "Checks if the value of the field is `VSCALE0`"]
122 #[inline(always)]
123 pub fn is_vscale0(&self) -> bool {
124 *self == EM23VSCALE_A::VSCALE0
125 }
126 #[doc = "Checks if the value of the field is `VSCALE1`"]
127 #[inline(always)]
128 pub fn is_vscale1(&self) -> bool {
129 *self == EM23VSCALE_A::VSCALE1
130 }
131 #[doc = "Checks if the value of the field is `VSCALE2`"]
132 #[inline(always)]
133 pub fn is_vscale2(&self) -> bool {
134 *self == EM23VSCALE_A::VSCALE2
135 }
136}
137#[doc = "Field `EM23VSCALE` writer - EM2/EM3 Vscale"]
138pub type EM23VSCALE_W<'a, const O: u8> =
139 crate::FieldWriter<'a, u32, CTRL_SPEC, u8, EM23VSCALE_A, 2, O>;
140impl<'a, const O: u8> EM23VSCALE_W<'a, O> {
141 #[doc = "VSCALE0. 0.9v"]
142 #[inline(always)]
143 pub fn vscale0(self) -> &'a mut W {
144 self.variant(EM23VSCALE_A::VSCALE0)
145 }
146 #[doc = "VSCALE1. 1.0v"]
147 #[inline(always)]
148 pub fn vscale1(self) -> &'a mut W {
149 self.variant(EM23VSCALE_A::VSCALE1)
150 }
151 #[doc = "VSCALE2. 1.1v"]
152 #[inline(always)]
153 pub fn vscale2(self) -> &'a mut W {
154 self.variant(EM23VSCALE_A::VSCALE2)
155 }
156}
157#[doc = "Field `FLASHPWRUPONDEMAND` reader - Enable flash on demand wakeup"]
158pub type FLASHPWRUPONDEMAND_R = crate::BitReader<bool>;
159#[doc = "Field `FLASHPWRUPONDEMAND` writer - Enable flash on demand wakeup"]
160pub type FLASHPWRUPONDEMAND_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
161#[doc = "Field `EFPDIRECTMODEEN` reader - EFP Direct Mode Enable"]
162pub type EFPDIRECTMODEEN_R = crate::BitReader<bool>;
163#[doc = "Field `EFPDIRECTMODEEN` writer - EFP Direct Mode Enable"]
164pub type EFPDIRECTMODEEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
165#[doc = "Field `EFPDRVDECOUPLE` reader - EFP drives DECOUPLE"]
166pub type EFPDRVDECOUPLE_R = crate::BitReader<bool>;
167#[doc = "Field `EFPDRVDECOUPLE` writer - EFP drives DECOUPLE"]
168pub type EFPDRVDECOUPLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
169#[doc = "Field `EFPDRVDVDD` reader - EFP drives DVDD"]
170pub type EFPDRVDVDD_R = crate::BitReader<bool>;
171#[doc = "Field `EFPDRVDVDD` writer - EFP drives DVDD"]
172pub type EFPDRVDVDD_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
173impl R {
174 #[doc = "Bit 0 - Enable debugging in EM2"]
175 #[inline(always)]
176 pub fn em2dbgen(&self) -> EM2DBGEN_R {
177 EM2DBGEN_R::new((self.bits & 1) != 0)
178 }
179 #[doc = "Bit 3 - Averaged Temperature samples num"]
180 #[inline(always)]
181 pub fn tempavgnum(&self) -> TEMPAVGNUM_R {
182 TEMPAVGNUM_R::new(((self.bits >> 3) & 1) != 0)
183 }
184 #[doc = "Bits 8:9 - EM2/EM3 Vscale"]
185 #[inline(always)]
186 pub fn em23vscale(&self) -> EM23VSCALE_R {
187 EM23VSCALE_R::new(((self.bits >> 8) & 3) as u8)
188 }
189 #[doc = "Bit 16 - Enable flash on demand wakeup"]
190 #[inline(always)]
191 pub fn flashpwrupondemand(&self) -> FLASHPWRUPONDEMAND_R {
192 FLASHPWRUPONDEMAND_R::new(((self.bits >> 16) & 1) != 0)
193 }
194 #[doc = "Bit 29 - EFP Direct Mode Enable"]
195 #[inline(always)]
196 pub fn efpdirectmodeen(&self) -> EFPDIRECTMODEEN_R {
197 EFPDIRECTMODEEN_R::new(((self.bits >> 29) & 1) != 0)
198 }
199 #[doc = "Bit 30 - EFP drives DECOUPLE"]
200 #[inline(always)]
201 pub fn efpdrvdecouple(&self) -> EFPDRVDECOUPLE_R {
202 EFPDRVDECOUPLE_R::new(((self.bits >> 30) & 1) != 0)
203 }
204 #[doc = "Bit 31 - EFP drives DVDD"]
205 #[inline(always)]
206 pub fn efpdrvdvdd(&self) -> EFPDRVDVDD_R {
207 EFPDRVDVDD_R::new(((self.bits >> 31) & 1) != 0)
208 }
209}
210impl W {
211 #[doc = "Bit 0 - Enable debugging in EM2"]
212 #[inline(always)]
213 #[must_use]
214 pub fn em2dbgen(&mut self) -> EM2DBGEN_W<0> {
215 EM2DBGEN_W::new(self)
216 }
217 #[doc = "Bit 3 - Averaged Temperature samples num"]
218 #[inline(always)]
219 #[must_use]
220 pub fn tempavgnum(&mut self) -> TEMPAVGNUM_W<3> {
221 TEMPAVGNUM_W::new(self)
222 }
223 #[doc = "Bits 8:9 - EM2/EM3 Vscale"]
224 #[inline(always)]
225 #[must_use]
226 pub fn em23vscale(&mut self) -> EM23VSCALE_W<8> {
227 EM23VSCALE_W::new(self)
228 }
229 #[doc = "Bit 16 - Enable flash on demand wakeup"]
230 #[inline(always)]
231 #[must_use]
232 pub fn flashpwrupondemand(&mut self) -> FLASHPWRUPONDEMAND_W<16> {
233 FLASHPWRUPONDEMAND_W::new(self)
234 }
235 #[doc = "Bit 29 - EFP Direct Mode Enable"]
236 #[inline(always)]
237 #[must_use]
238 pub fn efpdirectmodeen(&mut self) -> EFPDIRECTMODEEN_W<29> {
239 EFPDIRECTMODEEN_W::new(self)
240 }
241 #[doc = "Bit 30 - EFP drives DECOUPLE"]
242 #[inline(always)]
243 #[must_use]
244 pub fn efpdrvdecouple(&mut self) -> EFPDRVDECOUPLE_W<30> {
245 EFPDRVDECOUPLE_W::new(self)
246 }
247 #[doc = "Bit 31 - EFP drives DVDD"]
248 #[inline(always)]
249 #[must_use]
250 pub fn efpdrvdvdd(&mut self) -> EFPDRVDVDD_W<31> {
251 EFPDRVDVDD_W::new(self)
252 }
253 #[doc = "Writes raw bits to the register."]
254 #[inline(always)]
255 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
256 self.0.bits(bits);
257 self
258 }
259}
260#[doc = "No Description\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"]
261pub struct CTRL_SPEC;
262impl crate::RegisterSpec for CTRL_SPEC {
263 type Ux = u32;
264}
265#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
266impl crate::Readable for CTRL_SPEC {
267 type Reader = R;
268}
269#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
270impl crate::Writable for CTRL_SPEC {
271 type Writer = W;
272 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
273 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
274}
275#[doc = "`reset()` method sets CTRL to value 0x0200"]
276impl crate::Resettable for CTRL_SPEC {
277 const RESET_VALUE: Self::Ux = 0x0200;
278}