efm32gg_pac/efm32gg995/lcd/
dispctrl.rs1#[doc = "Register `DISPCTRL` reader"]
2pub struct R(crate::R<DISPCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DISPCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DISPCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DISPCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DISPCTRL` writer"]
17pub struct W(crate::W<DISPCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DISPCTRL_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<DISPCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DISPCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MUX` reader - Mux Configuration"]
38pub type MUX_R = crate::FieldReader<u8, MUX_A>;
39#[doc = "Mux Configuration\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum MUX_A {
43 #[doc = "0: Static"]
44 STATIC = 0,
45 #[doc = "1: Duplex"]
46 DUPLEX = 1,
47 #[doc = "2: Triplex"]
48 TRIPLEX = 2,
49 #[doc = "3: Quadruplex"]
50 QUADRUPLEX = 3,
51}
52impl From<MUX_A> for u8 {
53 #[inline(always)]
54 fn from(variant: MUX_A) -> Self {
55 variant as _
56 }
57}
58impl MUX_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> MUX_A {
62 match self.bits {
63 0 => MUX_A::STATIC,
64 1 => MUX_A::DUPLEX,
65 2 => MUX_A::TRIPLEX,
66 3 => MUX_A::QUADRUPLEX,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `STATIC`"]
71 #[inline(always)]
72 pub fn is_static(&self) -> bool {
73 *self == MUX_A::STATIC
74 }
75 #[doc = "Checks if the value of the field is `DUPLEX`"]
76 #[inline(always)]
77 pub fn is_duplex(&self) -> bool {
78 *self == MUX_A::DUPLEX
79 }
80 #[doc = "Checks if the value of the field is `TRIPLEX`"]
81 #[inline(always)]
82 pub fn is_triplex(&self) -> bool {
83 *self == MUX_A::TRIPLEX
84 }
85 #[doc = "Checks if the value of the field is `QUADRUPLEX`"]
86 #[inline(always)]
87 pub fn is_quadruplex(&self) -> bool {
88 *self == MUX_A::QUADRUPLEX
89 }
90}
91#[doc = "Field `MUX` writer - Mux Configuration"]
92pub type MUX_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, MUX_A, 2, O>;
93impl<'a, const O: u8> MUX_W<'a, O> {
94 #[doc = "Static"]
95 #[inline(always)]
96 pub fn static_(self) -> &'a mut W {
97 self.variant(MUX_A::STATIC)
98 }
99 #[doc = "Duplex"]
100 #[inline(always)]
101 pub fn duplex(self) -> &'a mut W {
102 self.variant(MUX_A::DUPLEX)
103 }
104 #[doc = "Triplex"]
105 #[inline(always)]
106 pub fn triplex(self) -> &'a mut W {
107 self.variant(MUX_A::TRIPLEX)
108 }
109 #[doc = "Quadruplex"]
110 #[inline(always)]
111 pub fn quadruplex(self) -> &'a mut W {
112 self.variant(MUX_A::QUADRUPLEX)
113 }
114}
115#[doc = "Field `BIAS` reader - Bias Configuration"]
116pub type BIAS_R = crate::FieldReader<u8, BIAS_A>;
117#[doc = "Bias Configuration\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum BIAS_A {
121 #[doc = "0: Static"]
122 STATIC = 0,
123 #[doc = "1: 1/2 Bias"]
124 ONEHALF = 1,
125 #[doc = "2: 1/3 Bias"]
126 ONETHIRD = 2,
127 #[doc = "3: 1/4 Bias"]
128 ONEFOURTH = 3,
129}
130impl From<BIAS_A> for u8 {
131 #[inline(always)]
132 fn from(variant: BIAS_A) -> Self {
133 variant as _
134 }
135}
136impl BIAS_R {
137 #[doc = "Get enumerated values variant"]
138 #[inline(always)]
139 pub fn variant(&self) -> BIAS_A {
140 match self.bits {
141 0 => BIAS_A::STATIC,
142 1 => BIAS_A::ONEHALF,
143 2 => BIAS_A::ONETHIRD,
144 3 => BIAS_A::ONEFOURTH,
145 _ => unreachable!(),
146 }
147 }
148 #[doc = "Checks if the value of the field is `STATIC`"]
149 #[inline(always)]
150 pub fn is_static(&self) -> bool {
151 *self == BIAS_A::STATIC
152 }
153 #[doc = "Checks if the value of the field is `ONEHALF`"]
154 #[inline(always)]
155 pub fn is_onehalf(&self) -> bool {
156 *self == BIAS_A::ONEHALF
157 }
158 #[doc = "Checks if the value of the field is `ONETHIRD`"]
159 #[inline(always)]
160 pub fn is_onethird(&self) -> bool {
161 *self == BIAS_A::ONETHIRD
162 }
163 #[doc = "Checks if the value of the field is `ONEFOURTH`"]
164 #[inline(always)]
165 pub fn is_onefourth(&self) -> bool {
166 *self == BIAS_A::ONEFOURTH
167 }
168}
169#[doc = "Field `BIAS` writer - Bias Configuration"]
170pub type BIAS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, BIAS_A, 2, O>;
171impl<'a, const O: u8> BIAS_W<'a, O> {
172 #[doc = "Static"]
173 #[inline(always)]
174 pub fn static_(self) -> &'a mut W {
175 self.variant(BIAS_A::STATIC)
176 }
177 #[doc = "1/2 Bias"]
178 #[inline(always)]
179 pub fn onehalf(self) -> &'a mut W {
180 self.variant(BIAS_A::ONEHALF)
181 }
182 #[doc = "1/3 Bias"]
183 #[inline(always)]
184 pub fn onethird(self) -> &'a mut W {
185 self.variant(BIAS_A::ONETHIRD)
186 }
187 #[doc = "1/4 Bias"]
188 #[inline(always)]
189 pub fn onefourth(self) -> &'a mut W {
190 self.variant(BIAS_A::ONEFOURTH)
191 }
192}
193#[doc = "Field `WAVE` reader - Waveform Selection"]
194pub type WAVE_R = crate::BitReader<bool>;
195#[doc = "Field `WAVE` writer - Waveform Selection"]
196pub type WAVE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
197#[doc = "Field `CONLEV` reader - Contrast Level"]
198pub type CONLEV_R = crate::FieldReader<u8, CONLEV_A>;
199#[doc = "Contrast Level\n\nValue on reset: 31"]
200#[derive(Clone, Copy, Debug, PartialEq, Eq)]
201#[repr(u8)]
202pub enum CONLEV_A {
203 #[doc = "0: Minimum contrast"]
204 MIN = 0,
205 #[doc = "31: Maximum contrast"]
206 MAX = 31,
207}
208impl From<CONLEV_A> for u8 {
209 #[inline(always)]
210 fn from(variant: CONLEV_A) -> Self {
211 variant as _
212 }
213}
214impl CONLEV_R {
215 #[doc = "Get enumerated values variant"]
216 #[inline(always)]
217 pub fn variant(&self) -> Option<CONLEV_A> {
218 match self.bits {
219 0 => Some(CONLEV_A::MIN),
220 31 => Some(CONLEV_A::MAX),
221 _ => None,
222 }
223 }
224 #[doc = "Checks if the value of the field is `MIN`"]
225 #[inline(always)]
226 pub fn is_min(&self) -> bool {
227 *self == CONLEV_A::MIN
228 }
229 #[doc = "Checks if the value of the field is `MAX`"]
230 #[inline(always)]
231 pub fn is_max(&self) -> bool {
232 *self == CONLEV_A::MAX
233 }
234}
235#[doc = "Field `CONLEV` writer - Contrast Level"]
236pub type CONLEV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, CONLEV_A, 5, O>;
237impl<'a, const O: u8> CONLEV_W<'a, O> {
238 #[doc = "Minimum contrast"]
239 #[inline(always)]
240 pub fn min(self) -> &'a mut W {
241 self.variant(CONLEV_A::MIN)
242 }
243 #[doc = "Maximum contrast"]
244 #[inline(always)]
245 pub fn max(self) -> &'a mut W {
246 self.variant(CONLEV_A::MAX)
247 }
248}
249#[doc = "Field `CONCONF` reader - Contrast Configuration"]
250pub type CONCONF_R = crate::BitReader<bool>;
251#[doc = "Field `CONCONF` writer - Contrast Configuration"]
252pub type CONCONF_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
253#[doc = "Field `VLCDSEL` reader - VLCD Selection"]
254pub type VLCDSEL_R = crate::BitReader<bool>;
255#[doc = "Field `VLCDSEL` writer - VLCD Selection"]
256pub type VLCDSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
257#[doc = "Field `VBLEV` reader - Voltage Boost Level"]
258pub type VBLEV_R = crate::FieldReader<u8, VBLEV_A>;
259#[doc = "Voltage Boost Level\n\nValue on reset: 3"]
260#[derive(Clone, Copy, Debug, PartialEq, Eq)]
261#[repr(u8)]
262pub enum VBLEV_A {
263 #[doc = "0: Minimum boost level"]
264 LEVEL0 = 0,
265 #[doc = "1: `1`"]
266 LEVEL1 = 1,
267 #[doc = "2: `10`"]
268 LEVEL2 = 2,
269 #[doc = "3: `11`"]
270 LEVEL3 = 3,
271 #[doc = "4: `100`"]
272 LEVEL4 = 4,
273 #[doc = "5: `101`"]
274 LEVEL5 = 5,
275 #[doc = "6: `110`"]
276 LEVEL6 = 6,
277 #[doc = "7: Maximum boost level"]
278 LEVEL7 = 7,
279}
280impl From<VBLEV_A> for u8 {
281 #[inline(always)]
282 fn from(variant: VBLEV_A) -> Self {
283 variant as _
284 }
285}
286impl VBLEV_R {
287 #[doc = "Get enumerated values variant"]
288 #[inline(always)]
289 pub fn variant(&self) -> VBLEV_A {
290 match self.bits {
291 0 => VBLEV_A::LEVEL0,
292 1 => VBLEV_A::LEVEL1,
293 2 => VBLEV_A::LEVEL2,
294 3 => VBLEV_A::LEVEL3,
295 4 => VBLEV_A::LEVEL4,
296 5 => VBLEV_A::LEVEL5,
297 6 => VBLEV_A::LEVEL6,
298 7 => VBLEV_A::LEVEL7,
299 _ => unreachable!(),
300 }
301 }
302 #[doc = "Checks if the value of the field is `LEVEL0`"]
303 #[inline(always)]
304 pub fn is_level0(&self) -> bool {
305 *self == VBLEV_A::LEVEL0
306 }
307 #[doc = "Checks if the value of the field is `LEVEL1`"]
308 #[inline(always)]
309 pub fn is_level1(&self) -> bool {
310 *self == VBLEV_A::LEVEL1
311 }
312 #[doc = "Checks if the value of the field is `LEVEL2`"]
313 #[inline(always)]
314 pub fn is_level2(&self) -> bool {
315 *self == VBLEV_A::LEVEL2
316 }
317 #[doc = "Checks if the value of the field is `LEVEL3`"]
318 #[inline(always)]
319 pub fn is_level3(&self) -> bool {
320 *self == VBLEV_A::LEVEL3
321 }
322 #[doc = "Checks if the value of the field is `LEVEL4`"]
323 #[inline(always)]
324 pub fn is_level4(&self) -> bool {
325 *self == VBLEV_A::LEVEL4
326 }
327 #[doc = "Checks if the value of the field is `LEVEL5`"]
328 #[inline(always)]
329 pub fn is_level5(&self) -> bool {
330 *self == VBLEV_A::LEVEL5
331 }
332 #[doc = "Checks if the value of the field is `LEVEL6`"]
333 #[inline(always)]
334 pub fn is_level6(&self) -> bool {
335 *self == VBLEV_A::LEVEL6
336 }
337 #[doc = "Checks if the value of the field is `LEVEL7`"]
338 #[inline(always)]
339 pub fn is_level7(&self) -> bool {
340 *self == VBLEV_A::LEVEL7
341 }
342}
343#[doc = "Field `VBLEV` writer - Voltage Boost Level"]
344pub type VBLEV_W<'a, const O: u8> =
345 crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, VBLEV_A, 3, O>;
346impl<'a, const O: u8> VBLEV_W<'a, O> {
347 #[doc = "Minimum boost level"]
348 #[inline(always)]
349 pub fn level0(self) -> &'a mut W {
350 self.variant(VBLEV_A::LEVEL0)
351 }
352 #[doc = "`1`"]
353 #[inline(always)]
354 pub fn level1(self) -> &'a mut W {
355 self.variant(VBLEV_A::LEVEL1)
356 }
357 #[doc = "`10`"]
358 #[inline(always)]
359 pub fn level2(self) -> &'a mut W {
360 self.variant(VBLEV_A::LEVEL2)
361 }
362 #[doc = "`11`"]
363 #[inline(always)]
364 pub fn level3(self) -> &'a mut W {
365 self.variant(VBLEV_A::LEVEL3)
366 }
367 #[doc = "`100`"]
368 #[inline(always)]
369 pub fn level4(self) -> &'a mut W {
370 self.variant(VBLEV_A::LEVEL4)
371 }
372 #[doc = "`101`"]
373 #[inline(always)]
374 pub fn level5(self) -> &'a mut W {
375 self.variant(VBLEV_A::LEVEL5)
376 }
377 #[doc = "`110`"]
378 #[inline(always)]
379 pub fn level6(self) -> &'a mut W {
380 self.variant(VBLEV_A::LEVEL6)
381 }
382 #[doc = "Maximum boost level"]
383 #[inline(always)]
384 pub fn level7(self) -> &'a mut W {
385 self.variant(VBLEV_A::LEVEL7)
386 }
387}
388#[doc = "Field `MUXE` reader - Extended Mux Configuration"]
389pub type MUXE_R = crate::BitReader<bool>;
390#[doc = "Field `MUXE` writer - Extended Mux Configuration"]
391pub type MUXE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
392impl R {
393 #[doc = "Bits 0:1 - Mux Configuration"]
394 #[inline(always)]
395 pub fn mux(&self) -> MUX_R {
396 MUX_R::new((self.bits & 3) as u8)
397 }
398 #[doc = "Bits 2:3 - Bias Configuration"]
399 #[inline(always)]
400 pub fn bias(&self) -> BIAS_R {
401 BIAS_R::new(((self.bits >> 2) & 3) as u8)
402 }
403 #[doc = "Bit 4 - Waveform Selection"]
404 #[inline(always)]
405 pub fn wave(&self) -> WAVE_R {
406 WAVE_R::new(((self.bits >> 4) & 1) != 0)
407 }
408 #[doc = "Bits 8:12 - Contrast Level"]
409 #[inline(always)]
410 pub fn conlev(&self) -> CONLEV_R {
411 CONLEV_R::new(((self.bits >> 8) & 0x1f) as u8)
412 }
413 #[doc = "Bit 15 - Contrast Configuration"]
414 #[inline(always)]
415 pub fn conconf(&self) -> CONCONF_R {
416 CONCONF_R::new(((self.bits >> 15) & 1) != 0)
417 }
418 #[doc = "Bit 16 - VLCD Selection"]
419 #[inline(always)]
420 pub fn vlcdsel(&self) -> VLCDSEL_R {
421 VLCDSEL_R::new(((self.bits >> 16) & 1) != 0)
422 }
423 #[doc = "Bits 18:20 - Voltage Boost Level"]
424 #[inline(always)]
425 pub fn vblev(&self) -> VBLEV_R {
426 VBLEV_R::new(((self.bits >> 18) & 7) as u8)
427 }
428 #[doc = "Bit 22 - Extended Mux Configuration"]
429 #[inline(always)]
430 pub fn muxe(&self) -> MUXE_R {
431 MUXE_R::new(((self.bits >> 22) & 1) != 0)
432 }
433}
434impl W {
435 #[doc = "Bits 0:1 - Mux Configuration"]
436 #[inline(always)]
437 #[must_use]
438 pub fn mux(&mut self) -> MUX_W<0> {
439 MUX_W::new(self)
440 }
441 #[doc = "Bits 2:3 - Bias Configuration"]
442 #[inline(always)]
443 #[must_use]
444 pub fn bias(&mut self) -> BIAS_W<2> {
445 BIAS_W::new(self)
446 }
447 #[doc = "Bit 4 - Waveform Selection"]
448 #[inline(always)]
449 #[must_use]
450 pub fn wave(&mut self) -> WAVE_W<4> {
451 WAVE_W::new(self)
452 }
453 #[doc = "Bits 8:12 - Contrast Level"]
454 #[inline(always)]
455 #[must_use]
456 pub fn conlev(&mut self) -> CONLEV_W<8> {
457 CONLEV_W::new(self)
458 }
459 #[doc = "Bit 15 - Contrast Configuration"]
460 #[inline(always)]
461 #[must_use]
462 pub fn conconf(&mut self) -> CONCONF_W<15> {
463 CONCONF_W::new(self)
464 }
465 #[doc = "Bit 16 - VLCD Selection"]
466 #[inline(always)]
467 #[must_use]
468 pub fn vlcdsel(&mut self) -> VLCDSEL_W<16> {
469 VLCDSEL_W::new(self)
470 }
471 #[doc = "Bits 18:20 - Voltage Boost Level"]
472 #[inline(always)]
473 #[must_use]
474 pub fn vblev(&mut self) -> VBLEV_W<18> {
475 VBLEV_W::new(self)
476 }
477 #[doc = "Bit 22 - Extended Mux Configuration"]
478 #[inline(always)]
479 #[must_use]
480 pub fn muxe(&mut self) -> MUXE_W<22> {
481 MUXE_W::new(self)
482 }
483 #[doc = "Writes raw bits to the register."]
484 #[inline(always)]
485 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
486 self.0.bits(bits);
487 self
488 }
489}
490#[doc = "Display 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 [dispctrl](index.html) module"]
491pub struct DISPCTRL_SPEC;
492impl crate::RegisterSpec for DISPCTRL_SPEC {
493 type Ux = u32;
494}
495#[doc = "`read()` method returns [dispctrl::R](R) reader structure"]
496impl crate::Readable for DISPCTRL_SPEC {
497 type Reader = R;
498}
499#[doc = "`write(|w| ..)` method takes [dispctrl::W](W) writer structure"]
500impl crate::Writable for DISPCTRL_SPEC {
501 type Writer = W;
502 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
503 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
504}
505#[doc = "`reset()` method sets DISPCTRL to value 0x000c_1f00"]
506impl crate::Resettable for DISPCTRL_SPEC {
507 const RESET_VALUE: Self::Ux = 0x000c_1f00;
508}