efm32tg11b_pac/efm32tg11b120/cmu/
lfrcoctrl.rs1#[doc = "Register `LFRCOCTRL` reader"]
2pub struct R(crate::R<LFRCOCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFRCOCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFRCOCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFRCOCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFRCOCTRL` writer"]
17pub struct W(crate::W<LFRCOCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFRCOCTRL_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<LFRCOCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFRCOCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TUNING` reader - LFRCO Tuning Value"]
38pub type TUNING_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `TUNING` writer - LFRCO Tuning Value"]
40pub type TUNING_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u16, u16, 9, O>;
41#[doc = "Field `ENVREF` reader - Enable Duty Cycling of Vref"]
42pub type ENVREF_R = crate::BitReader<bool>;
43#[doc = "Field `ENVREF` writer - Enable Duty Cycling of Vref"]
44pub type ENVREF_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, O>;
45#[doc = "Field `ENCHOP` reader - Enable Comparator Chopping"]
46pub type ENCHOP_R = crate::BitReader<bool>;
47#[doc = "Field `ENCHOP` writer - Enable Comparator Chopping"]
48pub type ENCHOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, O>;
49#[doc = "Field `ENDEM` reader - Enable Dynamic Element Matching"]
50pub type ENDEM_R = crate::BitReader<bool>;
51#[doc = "Field `ENDEM` writer - Enable Dynamic Element Matching"]
52pub type ENDEM_W<'a, const O: u8> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, O>;
53#[doc = "Field `VREFUPDATE` reader - Control Vref Update Rate"]
54pub type VREFUPDATE_R = crate::FieldReader<u8, VREFUPDATE_A>;
55#[doc = "Control Vref Update Rate\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum VREFUPDATE_A {
59 #[doc = "0: 32 clocks."]
60 _32CYCLES = 0,
61 #[doc = "1: 64 clocks."]
62 _64CYCLES = 1,
63 #[doc = "2: 128 clocks."]
64 _128CYCLES = 2,
65 #[doc = "3: 256 clocks."]
66 _256CYCLES = 3,
67}
68impl From<VREFUPDATE_A> for u8 {
69 #[inline(always)]
70 fn from(variant: VREFUPDATE_A) -> Self {
71 variant as _
72 }
73}
74impl VREFUPDATE_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub fn variant(&self) -> VREFUPDATE_A {
78 match self.bits {
79 0 => VREFUPDATE_A::_32CYCLES,
80 1 => VREFUPDATE_A::_64CYCLES,
81 2 => VREFUPDATE_A::_128CYCLES,
82 3 => VREFUPDATE_A::_256CYCLES,
83 _ => unreachable!(),
84 }
85 }
86 #[doc = "Checks if the value of the field is `_32CYCLES`"]
87 #[inline(always)]
88 pub fn is_32cycles(&self) -> bool {
89 *self == VREFUPDATE_A::_32CYCLES
90 }
91 #[doc = "Checks if the value of the field is `_64CYCLES`"]
92 #[inline(always)]
93 pub fn is_64cycles(&self) -> bool {
94 *self == VREFUPDATE_A::_64CYCLES
95 }
96 #[doc = "Checks if the value of the field is `_128CYCLES`"]
97 #[inline(always)]
98 pub fn is_128cycles(&self) -> bool {
99 *self == VREFUPDATE_A::_128CYCLES
100 }
101 #[doc = "Checks if the value of the field is `_256CYCLES`"]
102 #[inline(always)]
103 pub fn is_256cycles(&self) -> bool {
104 *self == VREFUPDATE_A::_256CYCLES
105 }
106}
107#[doc = "Field `VREFUPDATE` writer - Control Vref Update Rate"]
108pub type VREFUPDATE_W<'a, const O: u8> =
109 crate::FieldWriterSafe<'a, u32, LFRCOCTRL_SPEC, u8, VREFUPDATE_A, 2, O>;
110impl<'a, const O: u8> VREFUPDATE_W<'a, O> {
111 #[doc = "32 clocks."]
112 #[inline(always)]
113 pub fn _32cycles(self) -> &'a mut W {
114 self.variant(VREFUPDATE_A::_32CYCLES)
115 }
116 #[doc = "64 clocks."]
117 #[inline(always)]
118 pub fn _64cycles(self) -> &'a mut W {
119 self.variant(VREFUPDATE_A::_64CYCLES)
120 }
121 #[doc = "128 clocks."]
122 #[inline(always)]
123 pub fn _128cycles(self) -> &'a mut W {
124 self.variant(VREFUPDATE_A::_128CYCLES)
125 }
126 #[doc = "256 clocks."]
127 #[inline(always)]
128 pub fn _256cycles(self) -> &'a mut W {
129 self.variant(VREFUPDATE_A::_256CYCLES)
130 }
131}
132#[doc = "Field `TIMEOUT` reader - LFRCO Timeout"]
133pub type TIMEOUT_R = crate::FieldReader<u8, TIMEOUT_A>;
134#[doc = "LFRCO Timeout\n\nValue on reset: 1"]
135#[derive(Clone, Copy, Debug, PartialEq, Eq)]
136#[repr(u8)]
137pub enum TIMEOUT_A {
138 #[doc = "0: Timeout period of 2 cycles"]
139 _2CYCLES = 0,
140 #[doc = "1: Timeout period of 16 cycles"]
141 _16CYCLES = 1,
142 #[doc = "2: Timeout period of 32 cycles"]
143 _32CYCLES = 2,
144}
145impl From<TIMEOUT_A> for u8 {
146 #[inline(always)]
147 fn from(variant: TIMEOUT_A) -> Self {
148 variant as _
149 }
150}
151impl TIMEOUT_R {
152 #[doc = "Get enumerated values variant"]
153 #[inline(always)]
154 pub fn variant(&self) -> Option<TIMEOUT_A> {
155 match self.bits {
156 0 => Some(TIMEOUT_A::_2CYCLES),
157 1 => Some(TIMEOUT_A::_16CYCLES),
158 2 => Some(TIMEOUT_A::_32CYCLES),
159 _ => None,
160 }
161 }
162 #[doc = "Checks if the value of the field is `_2CYCLES`"]
163 #[inline(always)]
164 pub fn is_2cycles(&self) -> bool {
165 *self == TIMEOUT_A::_2CYCLES
166 }
167 #[doc = "Checks if the value of the field is `_16CYCLES`"]
168 #[inline(always)]
169 pub fn is_16cycles(&self) -> bool {
170 *self == TIMEOUT_A::_16CYCLES
171 }
172 #[doc = "Checks if the value of the field is `_32CYCLES`"]
173 #[inline(always)]
174 pub fn is_32cycles(&self) -> bool {
175 *self == TIMEOUT_A::_32CYCLES
176 }
177}
178#[doc = "Field `TIMEOUT` writer - LFRCO Timeout"]
179pub type TIMEOUT_W<'a, const O: u8> =
180 crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u8, TIMEOUT_A, 2, O>;
181impl<'a, const O: u8> TIMEOUT_W<'a, O> {
182 #[doc = "Timeout period of 2 cycles"]
183 #[inline(always)]
184 pub fn _2cycles(self) -> &'a mut W {
185 self.variant(TIMEOUT_A::_2CYCLES)
186 }
187 #[doc = "Timeout period of 16 cycles"]
188 #[inline(always)]
189 pub fn _16cycles(self) -> &'a mut W {
190 self.variant(TIMEOUT_A::_16CYCLES)
191 }
192 #[doc = "Timeout period of 32 cycles"]
193 #[inline(always)]
194 pub fn _32cycles(self) -> &'a mut W {
195 self.variant(TIMEOUT_A::_32CYCLES)
196 }
197}
198#[doc = "Field `GMCCURTUNE` reader - Tuning of Gmc Current"]
199pub type GMCCURTUNE_R = crate::FieldReader<u8, u8>;
200#[doc = "Field `GMCCURTUNE` writer - Tuning of Gmc Current"]
201pub type GMCCURTUNE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u8, u8, 4, O>;
202impl R {
203 #[doc = "Bits 0:8 - LFRCO Tuning Value"]
204 #[inline(always)]
205 pub fn tuning(&self) -> TUNING_R {
206 TUNING_R::new((self.bits & 0x01ff) as u16)
207 }
208 #[doc = "Bit 16 - Enable Duty Cycling of Vref"]
209 #[inline(always)]
210 pub fn envref(&self) -> ENVREF_R {
211 ENVREF_R::new(((self.bits >> 16) & 1) != 0)
212 }
213 #[doc = "Bit 17 - Enable Comparator Chopping"]
214 #[inline(always)]
215 pub fn enchop(&self) -> ENCHOP_R {
216 ENCHOP_R::new(((self.bits >> 17) & 1) != 0)
217 }
218 #[doc = "Bit 18 - Enable Dynamic Element Matching"]
219 #[inline(always)]
220 pub fn endem(&self) -> ENDEM_R {
221 ENDEM_R::new(((self.bits >> 18) & 1) != 0)
222 }
223 #[doc = "Bits 20:21 - Control Vref Update Rate"]
224 #[inline(always)]
225 pub fn vrefupdate(&self) -> VREFUPDATE_R {
226 VREFUPDATE_R::new(((self.bits >> 20) & 3) as u8)
227 }
228 #[doc = "Bits 24:25 - LFRCO Timeout"]
229 #[inline(always)]
230 pub fn timeout(&self) -> TIMEOUT_R {
231 TIMEOUT_R::new(((self.bits >> 24) & 3) as u8)
232 }
233 #[doc = "Bits 28:31 - Tuning of Gmc Current"]
234 #[inline(always)]
235 pub fn gmccurtune(&self) -> GMCCURTUNE_R {
236 GMCCURTUNE_R::new(((self.bits >> 28) & 0x0f) as u8)
237 }
238}
239impl W {
240 #[doc = "Bits 0:8 - LFRCO Tuning Value"]
241 #[inline(always)]
242 #[must_use]
243 pub fn tuning(&mut self) -> TUNING_W<0> {
244 TUNING_W::new(self)
245 }
246 #[doc = "Bit 16 - Enable Duty Cycling of Vref"]
247 #[inline(always)]
248 #[must_use]
249 pub fn envref(&mut self) -> ENVREF_W<16> {
250 ENVREF_W::new(self)
251 }
252 #[doc = "Bit 17 - Enable Comparator Chopping"]
253 #[inline(always)]
254 #[must_use]
255 pub fn enchop(&mut self) -> ENCHOP_W<17> {
256 ENCHOP_W::new(self)
257 }
258 #[doc = "Bit 18 - Enable Dynamic Element Matching"]
259 #[inline(always)]
260 #[must_use]
261 pub fn endem(&mut self) -> ENDEM_W<18> {
262 ENDEM_W::new(self)
263 }
264 #[doc = "Bits 20:21 - Control Vref Update Rate"]
265 #[inline(always)]
266 #[must_use]
267 pub fn vrefupdate(&mut self) -> VREFUPDATE_W<20> {
268 VREFUPDATE_W::new(self)
269 }
270 #[doc = "Bits 24:25 - LFRCO Timeout"]
271 #[inline(always)]
272 #[must_use]
273 pub fn timeout(&mut self) -> TIMEOUT_W<24> {
274 TIMEOUT_W::new(self)
275 }
276 #[doc = "Bits 28:31 - Tuning of Gmc Current"]
277 #[inline(always)]
278 #[must_use]
279 pub fn gmccurtune(&mut self) -> GMCCURTUNE_W<28> {
280 GMCCURTUNE_W::new(self)
281 }
282 #[doc = "Writes raw bits to the register."]
283 #[inline(always)]
284 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
285 self.0.bits(bits);
286 self
287 }
288}
289#[doc = "LFRCO 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 [lfrcoctrl](index.html) module"]
290pub struct LFRCOCTRL_SPEC;
291impl crate::RegisterSpec for LFRCOCTRL_SPEC {
292 type Ux = u32;
293}
294#[doc = "`read()` method returns [lfrcoctrl::R](R) reader structure"]
295impl crate::Readable for LFRCOCTRL_SPEC {
296 type Reader = R;
297}
298#[doc = "`write(|w| ..)` method takes [lfrcoctrl::W](W) writer structure"]
299impl crate::Writable for LFRCOCTRL_SPEC {
300 type Writer = W;
301 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
302 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
303}
304#[doc = "`reset()` method sets LFRCOCTRL to value 0x8106_0100"]
305impl crate::Resettable for LFRCOCTRL_SPEC {
306 const RESET_VALUE: Self::Ux = 0x8106_0100;
307}