1#[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> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 0>;
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> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 1>;
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> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 2>;
49#[doc = "Animate Register A Shift Control\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51#[repr(u8)]
52pub enum AREGASC_A {
53 #[doc = "0: No Shift operation on Animation Register A"]
54 NOSHIFT = 0,
55 #[doc = "1: Animation Register A is shifted left"]
56 SHIFTLEFT = 1,
57 #[doc = "2: Animation Register A is shifted right"]
58 SHIFTRIGHT = 2,
59}
60impl From<AREGASC_A> for u8 {
61 #[inline(always)]
62 fn from(variant: AREGASC_A) -> Self {
63 variant as _
64 }
65}
66#[doc = "Field `AREGASC` reader - Animate Register A Shift Control"]
67pub type AREGASC_R = crate::FieldReader<u8, AREGASC_A>;
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> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, AREGASC_A, 2, 3>;
97impl<'a> AREGASC_W<'a> {
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 = "Animate Register B Shift Control\n\nValue on reset: 0"]
115#[derive(Clone, Copy, Debug, PartialEq)]
116#[repr(u8)]
117pub enum AREGBSC_A {
118 #[doc = "0: No Shift operation on Animation Register B"]
119 NOSHIFT = 0,
120 #[doc = "1: Animation Register B is shifted left"]
121 SHIFTLEFT = 1,
122 #[doc = "2: Animation Register B is shifted right"]
123 SHIFTRIGHT = 2,
124}
125impl From<AREGBSC_A> for u8 {
126 #[inline(always)]
127 fn from(variant: AREGBSC_A) -> Self {
128 variant as _
129 }
130}
131#[doc = "Field `AREGBSC` reader - Animate Register B Shift Control"]
132pub type AREGBSC_R = crate::FieldReader<u8, AREGBSC_A>;
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> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, AREGBSC_A, 2, 5>;
162impl<'a> AREGBSC_W<'a> {
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> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 7>;
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> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 8>;
187#[doc = "Frame Counter Prescaler\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189#[repr(u8)]
190pub enum FCPRESC_A {
191 #[doc = "0: CLKFC = CLKFRAME / 1"]
192 DIV1 = 0,
193 #[doc = "1: CLKFC = CLKFRAME / 2"]
194 DIV2 = 1,
195 #[doc = "2: CLKFC = CLKFRAME / 4"]
196 DIV4 = 2,
197 #[doc = "3: CLKFC = CLKFRAME / 8"]
198 DIV8 = 3,
199}
200impl From<FCPRESC_A> for u8 {
201 #[inline(always)]
202 fn from(variant: FCPRESC_A) -> Self {
203 variant as _
204 }
205}
206#[doc = "Field `FCPRESC` reader - Frame Counter Prescaler"]
207pub type FCPRESC_R = crate::FieldReader<u8, FCPRESC_A>;
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> = crate::FieldWriterSafe<'a, u32, BACTRL_SPEC, u8, FCPRESC_A, 2, 16>;
243impl<'a> FCPRESC_W<'a> {
244 #[doc = "CLKFC = CLKFRAME / 1"]
245 #[inline(always)]
246 pub fn div1(self) -> &'a mut W {
247 self.variant(FCPRESC_A::DIV1)
248 }
249 #[doc = "CLKFC = CLKFRAME / 2"]
250 #[inline(always)]
251 pub fn div2(self) -> &'a mut W {
252 self.variant(FCPRESC_A::DIV2)
253 }
254 #[doc = "CLKFC = CLKFRAME / 4"]
255 #[inline(always)]
256 pub fn div4(self) -> &'a mut W {
257 self.variant(FCPRESC_A::DIV4)
258 }
259 #[doc = "CLKFC = CLKFRAME / 8"]
260 #[inline(always)]
261 pub fn div8(self) -> &'a mut W {
262 self.variant(FCPRESC_A::DIV8)
263 }
264}
265#[doc = "Field `FCTOP` reader - Frame Counter Top Value"]
266pub type FCTOP_R = crate::FieldReader<u8, u8>;
267#[doc = "Field `FCTOP` writer - Frame Counter Top Value"]
268pub type FCTOP_W<'a> = crate::FieldWriter<'a, u32, BACTRL_SPEC, u8, u8, 6, 18>;
269#[doc = "Field `ALOC` reader - Animation Location"]
270pub type ALOC_R = crate::BitReader<bool>;
271#[doc = "Field `ALOC` writer - Animation Location"]
272pub type ALOC_W<'a> = crate::BitWriter<'a, u32, BACTRL_SPEC, bool, 28>;
273impl R {
274 #[doc = "Bit 0 - Blink Enable"]
275 #[inline(always)]
276 pub fn blinken(&self) -> BLINKEN_R {
277 BLINKEN_R::new((self.bits & 1) != 0)
278 }
279 #[doc = "Bit 1 - Blank Display"]
280 #[inline(always)]
281 pub fn blank(&self) -> BLANK_R {
282 BLANK_R::new(((self.bits >> 1) & 1) != 0)
283 }
284 #[doc = "Bit 2 - Animation Enable"]
285 #[inline(always)]
286 pub fn aen(&self) -> AEN_R {
287 AEN_R::new(((self.bits >> 2) & 1) != 0)
288 }
289 #[doc = "Bits 3:4 - Animate Register A Shift Control"]
290 #[inline(always)]
291 pub fn aregasc(&self) -> AREGASC_R {
292 AREGASC_R::new(((self.bits >> 3) & 3) as u8)
293 }
294 #[doc = "Bits 5:6 - Animate Register B Shift Control"]
295 #[inline(always)]
296 pub fn aregbsc(&self) -> AREGBSC_R {
297 AREGBSC_R::new(((self.bits >> 5) & 3) as u8)
298 }
299 #[doc = "Bit 7 - Animate Logic Function Select"]
300 #[inline(always)]
301 pub fn alogsel(&self) -> ALOGSEL_R {
302 ALOGSEL_R::new(((self.bits >> 7) & 1) != 0)
303 }
304 #[doc = "Bit 8 - Frame Counter Enable"]
305 #[inline(always)]
306 pub fn fcen(&self) -> FCEN_R {
307 FCEN_R::new(((self.bits >> 8) & 1) != 0)
308 }
309 #[doc = "Bits 16:17 - Frame Counter Prescaler"]
310 #[inline(always)]
311 pub fn fcpresc(&self) -> FCPRESC_R {
312 FCPRESC_R::new(((self.bits >> 16) & 3) as u8)
313 }
314 #[doc = "Bits 18:23 - Frame Counter Top Value"]
315 #[inline(always)]
316 pub fn fctop(&self) -> FCTOP_R {
317 FCTOP_R::new(((self.bits >> 18) & 0x3f) as u8)
318 }
319 #[doc = "Bit 28 - Animation Location"]
320 #[inline(always)]
321 pub fn aloc(&self) -> ALOC_R {
322 ALOC_R::new(((self.bits >> 28) & 1) != 0)
323 }
324}
325impl W {
326 #[doc = "Bit 0 - Blink Enable"]
327 #[inline(always)]
328 pub fn blinken(&mut self) -> BLINKEN_W {
329 BLINKEN_W::new(self)
330 }
331 #[doc = "Bit 1 - Blank Display"]
332 #[inline(always)]
333 pub fn blank(&mut self) -> BLANK_W {
334 BLANK_W::new(self)
335 }
336 #[doc = "Bit 2 - Animation Enable"]
337 #[inline(always)]
338 pub fn aen(&mut self) -> AEN_W {
339 AEN_W::new(self)
340 }
341 #[doc = "Bits 3:4 - Animate Register A Shift Control"]
342 #[inline(always)]
343 pub fn aregasc(&mut self) -> AREGASC_W {
344 AREGASC_W::new(self)
345 }
346 #[doc = "Bits 5:6 - Animate Register B Shift Control"]
347 #[inline(always)]
348 pub fn aregbsc(&mut self) -> AREGBSC_W {
349 AREGBSC_W::new(self)
350 }
351 #[doc = "Bit 7 - Animate Logic Function Select"]
352 #[inline(always)]
353 pub fn alogsel(&mut self) -> ALOGSEL_W {
354 ALOGSEL_W::new(self)
355 }
356 #[doc = "Bit 8 - Frame Counter Enable"]
357 #[inline(always)]
358 pub fn fcen(&mut self) -> FCEN_W {
359 FCEN_W::new(self)
360 }
361 #[doc = "Bits 16:17 - Frame Counter Prescaler"]
362 #[inline(always)]
363 pub fn fcpresc(&mut self) -> FCPRESC_W {
364 FCPRESC_W::new(self)
365 }
366 #[doc = "Bits 18:23 - Frame Counter Top Value"]
367 #[inline(always)]
368 pub fn fctop(&mut self) -> FCTOP_W {
369 FCTOP_W::new(self)
370 }
371 #[doc = "Bit 28 - Animation Location"]
372 #[inline(always)]
373 pub fn aloc(&mut self) -> ALOC_W {
374 ALOC_W::new(self)
375 }
376 #[doc = "Writes raw bits to the register."]
377 #[inline(always)]
378 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
379 self.0.bits(bits);
380 self
381 }
382}
383#[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"]
384pub struct BACTRL_SPEC;
385impl crate::RegisterSpec for BACTRL_SPEC {
386 type Ux = u32;
387}
388#[doc = "`read()` method returns [bactrl::R](R) reader structure"]
389impl crate::Readable for BACTRL_SPEC {
390 type Reader = R;
391}
392#[doc = "`write(|w| ..)` method takes [bactrl::W](W) writer structure"]
393impl crate::Writable for BACTRL_SPEC {
394 type Writer = W;
395}
396#[doc = "`reset()` method sets BACTRL to value 0"]
397impl crate::Resettable for BACTRL_SPEC {
398 #[inline(always)]
399 fn reset_value() -> Self::Ux {
400 0
401 }
402}