efm32gg_pac/efm32gg995/lcd/
bactrl.rs1#[doc = "Register `BACTRL` reader"]
2pub struct R(crate::R<BACTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BACTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BACTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BACTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BACTRL` writer"]
17pub struct W(crate::W<BACTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BACTRL_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<BACTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BACTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `BLINKEN` reader - Blink Enable"]
38pub type BLINKEN_R = crate::BitReader<bool>;
39#[doc = "Field `BLINKEN` writer - Blink Enable"]
40pub type BLINKEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
41#[doc = "Field `BLANK` reader - Blank Display"]
42pub type BLANK_R = crate::BitReader<bool>;
43#[doc = "Field `BLANK` writer - Blank Display"]
44pub type BLANK_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
45#[doc = "Field `AEN` reader - Animation Enable"]
46pub type AEN_R = crate::BitReader<bool>;
47#[doc = "Field `AEN` writer - Animation Enable"]
48pub type AEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
49#[doc = "Field `AREGASC` reader - Animate Register A Shift Control"]
50pub type AREGASC_R = crate::FieldReader<u8, AREGASC_A>;
51#[doc = "Animate Register A Shift Control\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum AREGASC_A {
55 #[doc = "0: No Shift operation on Animation Register A"]
56 NOSHIFT = 0,
57 #[doc = "1: Animation Register A is shifted left"]
58 SHIFTLEFT = 1,
59 #[doc = "2: Animation Register A is shifted right"]
60 SHIFTRIGHT = 2,
61}
62impl From<AREGASC_A> for u8 {
63 #[inline(always)]
64 fn from(variant: AREGASC_A) -> Self {
65 variant as _
66 }
67}
68impl AREGASC_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> Option<AREGASC_A> {
72 match self.bits {
73 0 => Some(AREGASC_A::NOSHIFT),
74 1 => Some(AREGASC_A::SHIFTLEFT),
75 2 => Some(AREGASC_A::SHIFTRIGHT),
76 _ => None,
77 }
78 }
79 #[doc = "Checks if the value of the field is `NOSHIFT`"]
80 #[inline(always)]
81 pub fn is_noshift(&self) -> bool {
82 *self == AREGASC_A::NOSHIFT
83 }
84 #[doc = "Checks if the value of the field is `SHIFTLEFT`"]
85 #[inline(always)]
86 pub fn is_shiftleft(&self) -> bool {
87 *self == AREGASC_A::SHIFTLEFT
88 }
89 #[doc = "Checks if the value of the field is `SHIFTRIGHT`"]
90 #[inline(always)]
91 pub fn is_shiftright(&self) -> bool {
92 *self == AREGASC_A::SHIFTRIGHT
93 }
94}
95#[doc = "Field `AREGASC` writer - Animate Register A Shift Control"]
96pub type AREGASC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, AREGASC_A, 2, O>;
97impl<'a, const O: u8> AREGASC_W<'a, O> {
98 #[doc = "No Shift operation on Animation Register A"]
99 #[inline(always)]
100 pub fn noshift(self) -> &'a mut W {
101 self.variant(AREGASC_A::NOSHIFT)
102 }
103 #[doc = "Animation Register A is shifted left"]
104 #[inline(always)]
105 pub fn shiftleft(self) -> &'a mut W {
106 self.variant(AREGASC_A::SHIFTLEFT)
107 }
108 #[doc = "Animation Register A is shifted right"]
109 #[inline(always)]
110 pub fn shiftright(self) -> &'a mut W {
111 self.variant(AREGASC_A::SHIFTRIGHT)
112 }
113}
114#[doc = "Field `AREGBSC` reader - Animate Register B Shift Control"]
115pub type AREGBSC_R = crate::FieldReader<u8, AREGBSC_A>;
116#[doc = "Animate Register B Shift Control\n\nValue on reset: 0"]
117#[derive(Clone, Copy, Debug, PartialEq, Eq)]
118#[repr(u8)]
119pub enum AREGBSC_A {
120 #[doc = "0: No Shift operation on Animation Register B"]
121 NOSHIFT = 0,
122 #[doc = "1: Animation Register B is shifted left"]
123 SHIFTLEFT = 1,
124 #[doc = "2: Animation Register B is shifted right"]
125 SHIFTRIGHT = 2,
126}
127impl From<AREGBSC_A> for u8 {
128 #[inline(always)]
129 fn from(variant: AREGBSC_A) -> Self {
130 variant as _
131 }
132}
133impl AREGBSC_R {
134 #[doc = "Get enumerated values variant"]
135 #[inline(always)]
136 pub fn variant(&self) -> Option<AREGBSC_A> {
137 match self.bits {
138 0 => Some(AREGBSC_A::NOSHIFT),
139 1 => Some(AREGBSC_A::SHIFTLEFT),
140 2 => Some(AREGBSC_A::SHIFTRIGHT),
141 _ => None,
142 }
143 }
144 #[doc = "Checks if the value of the field is `NOSHIFT`"]
145 #[inline(always)]
146 pub fn is_noshift(&self) -> bool {
147 *self == AREGBSC_A::NOSHIFT
148 }
149 #[doc = "Checks if the value of the field is `SHIFTLEFT`"]
150 #[inline(always)]
151 pub fn is_shiftleft(&self) -> bool {
152 *self == AREGBSC_A::SHIFTLEFT
153 }
154 #[doc = "Checks if the value of the field is `SHIFTRIGHT`"]
155 #[inline(always)]
156 pub fn is_shiftright(&self) -> bool {
157 *self == AREGBSC_A::SHIFTRIGHT
158 }
159}
160#[doc = "Field `AREGBSC` writer - Animate Register B Shift Control"]
161pub type AREGBSC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, AREGBSC_A, 2, O>;
162impl<'a, const O: u8> AREGBSC_W<'a, O> {
163 #[doc = "No Shift operation on Animation Register B"]
164 #[inline(always)]
165 pub fn noshift(self) -> &'a mut W {
166 self.variant(AREGBSC_A::NOSHIFT)
167 }
168 #[doc = "Animation Register B is shifted left"]
169 #[inline(always)]
170 pub fn shiftleft(self) -> &'a mut W {
171 self.variant(AREGBSC_A::SHIFTLEFT)
172 }
173 #[doc = "Animation Register B is shifted right"]
174 #[inline(always)]
175 pub fn shiftright(self) -> &'a mut W {
176 self.variant(AREGBSC_A::SHIFTRIGHT)
177 }
178}
179#[doc = "Field `ALOGSEL` reader - Animate Logic Function Select"]
180pub type ALOGSEL_R = crate::BitReader<bool>;
181#[doc = "Field `ALOGSEL` writer - Animate Logic Function Select"]
182pub type ALOGSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
183#[doc = "Field `FCEN` reader - Frame Counter Enable"]
184pub type FCEN_R = crate::BitReader<bool>;
185#[doc = "Field `FCEN` writer - Frame Counter Enable"]
186pub type FCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
187#[doc = "Field `FCPRESC` reader - Frame Counter Prescaler"]
188pub type FCPRESC_R = crate::FieldReader<u8, FCPRESC_A>;
189#[doc = "Frame Counter Prescaler\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191#[repr(u8)]
192pub enum FCPRESC_A {
193 #[doc = "0: CLKFC = CLKFRAME / 1"]
194 DIV1 = 0,
195 #[doc = "1: CLKFC = CLKFRAME / 2"]
196 DIV2 = 1,
197 #[doc = "2: CLKFC = CLKFRAME / 4"]
198 DIV4 = 2,
199 #[doc = "3: CLKFC = CLKFRAME / 8"]
200 DIV8 = 3,
201}
202impl From<FCPRESC_A> for u8 {
203 #[inline(always)]
204 fn from(variant: FCPRESC_A) -> Self {
205 variant as _
206 }
207}
208impl FCPRESC_R {
209 #[doc = "Get enumerated values variant"]
210 #[inline(always)]
211 pub fn variant(&self) -> FCPRESC_A {
212 match self.bits {
213 0 => FCPRESC_A::DIV1,
214 1 => FCPRESC_A::DIV2,
215 2 => FCPRESC_A::DIV4,
216 3 => FCPRESC_A::DIV8,
217 _ => unreachable!(),
218 }
219 }
220 #[doc = "Checks if the value of the field is `DIV1`"]
221 #[inline(always)]
222 pub fn is_div1(&self) -> bool {
223 *self == FCPRESC_A::DIV1
224 }
225 #[doc = "Checks if the value of the field is `DIV2`"]
226 #[inline(always)]
227 pub fn is_div2(&self) -> bool {
228 *self == FCPRESC_A::DIV2
229 }
230 #[doc = "Checks if the value of the field is `DIV4`"]
231 #[inline(always)]
232 pub fn is_div4(&self) -> bool {
233 *self == FCPRESC_A::DIV4
234 }
235 #[doc = "Checks if the value of the field is `DIV8`"]
236 #[inline(always)]
237 pub fn is_div8(&self) -> bool {
238 *self == FCPRESC_A::DIV8
239 }
240}
241#[doc = "Field `FCPRESC` writer - Frame Counter Prescaler"]
242pub type FCPRESC_W<'a, const O: u8> =
243 crate::FieldWriterSafe<'a, u32, BACTRL_SPEC, u8, FCPRESC_A, 2, O>;
244impl<'a, const O: u8> FCPRESC_W<'a, O> {
245 #[doc = "CLKFC = CLKFRAME / 1"]
246 #[inline(always)]
247 pub fn div1(self) -> &'a mut W {
248 self.variant(FCPRESC_A::DIV1)
249 }
250 #[doc = "CLKFC = CLKFRAME / 2"]
251 #[inline(always)]
252 pub fn div2(self) -> &'a mut W {
253 self.variant(FCPRESC_A::DIV2)
254 }
255 #[doc = "CLKFC = CLKFRAME / 4"]
256 #[inline(always)]
257 pub fn div4(self) -> &'a mut W {
258 self.variant(FCPRESC_A::DIV4)
259 }
260 #[doc = "CLKFC = CLKFRAME / 8"]
261 #[inline(always)]
262 pub fn div8(self) -> &'a mut W {
263 self.variant(FCPRESC_A::DIV8)
264 }
265}
266#[doc = "Field `FCTOP` reader - Frame Counter Top Value"]
267pub type FCTOP_R = crate::FieldReader<u8, u8>;
268#[doc = "Field `FCTOP` writer - Frame Counter Top Value"]
269pub type FCTOP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, u8, 6, O>;
270#[doc = "Field `ALOC` reader - Animation Location"]
271pub type ALOC_R = crate::BitReader<bool>;
272#[doc = "Field `ALOC` writer - Animation Location"]
273pub type ALOC_W<'a, const O: u8> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, O>;
274impl R {
275 #[doc = "Bit 0 - Blink Enable"]
276 #[inline(always)]
277 pub fn blinken(&self) -> BLINKEN_R {
278 BLINKEN_R::new((self.bits & 1) != 0)
279 }
280 #[doc = "Bit 1 - Blank Display"]
281 #[inline(always)]
282 pub fn blank(&self) -> BLANK_R {
283 BLANK_R::new(((self.bits >> 1) & 1) != 0)
284 }
285 #[doc = "Bit 2 - Animation Enable"]
286 #[inline(always)]
287 pub fn aen(&self) -> AEN_R {
288 AEN_R::new(((self.bits >> 2) & 1) != 0)
289 }
290 #[doc = "Bits 3:4 - Animate Register A Shift Control"]
291 #[inline(always)]
292 pub fn aregasc(&self) -> AREGASC_R {
293 AREGASC_R::new(((self.bits >> 3) & 3) as u8)
294 }
295 #[doc = "Bits 5:6 - Animate Register B Shift Control"]
296 #[inline(always)]
297 pub fn aregbsc(&self) -> AREGBSC_R {
298 AREGBSC_R::new(((self.bits >> 5) & 3) as u8)
299 }
300 #[doc = "Bit 7 - Animate Logic Function Select"]
301 #[inline(always)]
302 pub fn alogsel(&self) -> ALOGSEL_R {
303 ALOGSEL_R::new(((self.bits >> 7) & 1) != 0)
304 }
305 #[doc = "Bit 8 - Frame Counter Enable"]
306 #[inline(always)]
307 pub fn fcen(&self) -> FCEN_R {
308 FCEN_R::new(((self.bits >> 8) & 1) != 0)
309 }
310 #[doc = "Bits 16:17 - Frame Counter Prescaler"]
311 #[inline(always)]
312 pub fn fcpresc(&self) -> FCPRESC_R {
313 FCPRESC_R::new(((self.bits >> 16) & 3) as u8)
314 }
315 #[doc = "Bits 18:23 - Frame Counter Top Value"]
316 #[inline(always)]
317 pub fn fctop(&self) -> FCTOP_R {
318 FCTOP_R::new(((self.bits >> 18) & 0x3f) as u8)
319 }
320 #[doc = "Bit 28 - Animation Location"]
321 #[inline(always)]
322 pub fn aloc(&self) -> ALOC_R {
323 ALOC_R::new(((self.bits >> 28) & 1) != 0)
324 }
325}
326impl W {
327 #[doc = "Bit 0 - Blink Enable"]
328 #[inline(always)]
329 #[must_use]
330 pub fn blinken(&mut self) -> BLINKEN_W<0> {
331 BLINKEN_W::new(self)
332 }
333 #[doc = "Bit 1 - Blank Display"]
334 #[inline(always)]
335 #[must_use]
336 pub fn blank(&mut self) -> BLANK_W<1> {
337 BLANK_W::new(self)
338 }
339 #[doc = "Bit 2 - Animation Enable"]
340 #[inline(always)]
341 #[must_use]
342 pub fn aen(&mut self) -> AEN_W<2> {
343 AEN_W::new(self)
344 }
345 #[doc = "Bits 3:4 - Animate Register A Shift Control"]
346 #[inline(always)]
347 #[must_use]
348 pub fn aregasc(&mut self) -> AREGASC_W<3> {
349 AREGASC_W::new(self)
350 }
351 #[doc = "Bits 5:6 - Animate Register B Shift Control"]
352 #[inline(always)]
353 #[must_use]
354 pub fn aregbsc(&mut self) -> AREGBSC_W<5> {
355 AREGBSC_W::new(self)
356 }
357 #[doc = "Bit 7 - Animate Logic Function Select"]
358 #[inline(always)]
359 #[must_use]
360 pub fn alogsel(&mut self) -> ALOGSEL_W<7> {
361 ALOGSEL_W::new(self)
362 }
363 #[doc = "Bit 8 - Frame Counter Enable"]
364 #[inline(always)]
365 #[must_use]
366 pub fn fcen(&mut self) -> FCEN_W<8> {
367 FCEN_W::new(self)
368 }
369 #[doc = "Bits 16:17 - Frame Counter Prescaler"]
370 #[inline(always)]
371 #[must_use]
372 pub fn fcpresc(&mut self) -> FCPRESC_W<16> {
373 FCPRESC_W::new(self)
374 }
375 #[doc = "Bits 18:23 - Frame Counter Top Value"]
376 #[inline(always)]
377 #[must_use]
378 pub fn fctop(&mut self) -> FCTOP_W<18> {
379 FCTOP_W::new(self)
380 }
381 #[doc = "Bit 28 - Animation Location"]
382 #[inline(always)]
383 #[must_use]
384 pub fn aloc(&mut self) -> ALOC_W<28> {
385 ALOC_W::new(self)
386 }
387 #[doc = "Writes raw bits to the register."]
388 #[inline(always)]
389 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
390 self.0.bits(bits);
391 self
392 }
393}
394#[doc = "Blink and Animation 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 [bactrl](index.html) module"]
395pub struct BACTRL_SPEC;
396impl crate::RegisterSpec for BACTRL_SPEC {
397 type Ux = u32;
398}
399#[doc = "`read()` method returns [bactrl::R](R) reader structure"]
400impl crate::Readable for BACTRL_SPEC {
401 type Reader = R;
402}
403#[doc = "`write(|w| ..)` method takes [bactrl::W](W) writer structure"]
404impl crate::Writable for BACTRL_SPEC {
405 type Writer = W;
406 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
407 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
408}
409#[doc = "`reset()` method sets BACTRL to value 0"]
410impl crate::Resettable for BACTRL_SPEC {
411 const RESET_VALUE: Self::Ux = 0;
412}