efm32g_pac/efm32g890/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}
128impl From<BIAS_A> for u8 {
129 #[inline(always)]
130 fn from(variant: BIAS_A) -> Self {
131 variant as _
132 }
133}
134impl BIAS_R {
135 #[doc = "Get enumerated values variant"]
136 #[inline(always)]
137 pub fn variant(&self) -> Option<BIAS_A> {
138 match self.bits {
139 0 => Some(BIAS_A::STATIC),
140 1 => Some(BIAS_A::ONEHALF),
141 2 => Some(BIAS_A::ONETHIRD),
142 _ => None,
143 }
144 }
145 #[doc = "Checks if the value of the field is `STATIC`"]
146 #[inline(always)]
147 pub fn is_static(&self) -> bool {
148 *self == BIAS_A::STATIC
149 }
150 #[doc = "Checks if the value of the field is `ONEHALF`"]
151 #[inline(always)]
152 pub fn is_onehalf(&self) -> bool {
153 *self == BIAS_A::ONEHALF
154 }
155 #[doc = "Checks if the value of the field is `ONETHIRD`"]
156 #[inline(always)]
157 pub fn is_onethird(&self) -> bool {
158 *self == BIAS_A::ONETHIRD
159 }
160}
161#[doc = "Field `BIAS` writer - Bias Configuration"]
162pub type BIAS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, BIAS_A, 2, O>;
163impl<'a, const O: u8> BIAS_W<'a, O> {
164 #[doc = "Static"]
165 #[inline(always)]
166 pub fn static_(self) -> &'a mut W {
167 self.variant(BIAS_A::STATIC)
168 }
169 #[doc = "1/2 Bias"]
170 #[inline(always)]
171 pub fn onehalf(self) -> &'a mut W {
172 self.variant(BIAS_A::ONEHALF)
173 }
174 #[doc = "1/3 Bias"]
175 #[inline(always)]
176 pub fn onethird(self) -> &'a mut W {
177 self.variant(BIAS_A::ONETHIRD)
178 }
179}
180#[doc = "Field `WAVE` reader - Waveform Selection"]
181pub type WAVE_R = crate::BitReader<bool>;
182#[doc = "Field `WAVE` writer - Waveform Selection"]
183pub type WAVE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
184#[doc = "Field `CONLEV` reader - Contrast Level"]
185pub type CONLEV_R = crate::FieldReader<u8, CONLEV_A>;
186#[doc = "Contrast Level\n\nValue on reset: 31"]
187#[derive(Clone, Copy, Debug, PartialEq, Eq)]
188#[repr(u8)]
189pub enum CONLEV_A {
190 #[doc = "0: Minimum contrast"]
191 MIN = 0,
192 #[doc = "31: Maximum contrast"]
193 MAX = 31,
194}
195impl From<CONLEV_A> for u8 {
196 #[inline(always)]
197 fn from(variant: CONLEV_A) -> Self {
198 variant as _
199 }
200}
201impl CONLEV_R {
202 #[doc = "Get enumerated values variant"]
203 #[inline(always)]
204 pub fn variant(&self) -> Option<CONLEV_A> {
205 match self.bits {
206 0 => Some(CONLEV_A::MIN),
207 31 => Some(CONLEV_A::MAX),
208 _ => None,
209 }
210 }
211 #[doc = "Checks if the value of the field is `MIN`"]
212 #[inline(always)]
213 pub fn is_min(&self) -> bool {
214 *self == CONLEV_A::MIN
215 }
216 #[doc = "Checks if the value of the field is `MAX`"]
217 #[inline(always)]
218 pub fn is_max(&self) -> bool {
219 *self == CONLEV_A::MAX
220 }
221}
222#[doc = "Field `CONLEV` writer - Contrast Level"]
223pub type CONLEV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, CONLEV_A, 5, O>;
224impl<'a, const O: u8> CONLEV_W<'a, O> {
225 #[doc = "Minimum contrast"]
226 #[inline(always)]
227 pub fn min(self) -> &'a mut W {
228 self.variant(CONLEV_A::MIN)
229 }
230 #[doc = "Maximum contrast"]
231 #[inline(always)]
232 pub fn max(self) -> &'a mut W {
233 self.variant(CONLEV_A::MAX)
234 }
235}
236#[doc = "Field `CONCONF` reader - Contrast Configuration"]
237pub type CONCONF_R = crate::BitReader<bool>;
238#[doc = "Field `CONCONF` writer - Contrast Configuration"]
239pub type CONCONF_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
240#[doc = "Field `VLCDSEL` reader - VLCD Selection"]
241pub type VLCDSEL_R = crate::BitReader<bool>;
242#[doc = "Field `VLCDSEL` writer - VLCD Selection"]
243pub type VLCDSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, O>;
244#[doc = "Field `VBLEV` reader - Voltage Boost Level"]
245pub type VBLEV_R = crate::FieldReader<u8, VBLEV_A>;
246#[doc = "Voltage Boost Level\n\nValue on reset: 3"]
247#[derive(Clone, Copy, Debug, PartialEq, Eq)]
248#[repr(u8)]
249pub enum VBLEV_A {
250 #[doc = "0: Minimum boost level"]
251 LEVEL0 = 0,
252 #[doc = "1: `1`"]
253 LEVEL1 = 1,
254 #[doc = "2: `10`"]
255 LEVEL2 = 2,
256 #[doc = "3: `11`"]
257 LEVEL3 = 3,
258 #[doc = "4: `100`"]
259 LEVEL4 = 4,
260 #[doc = "5: `101`"]
261 LEVEL5 = 5,
262 #[doc = "6: `110`"]
263 LEVEL6 = 6,
264 #[doc = "7: Maximum boost level"]
265 LEVEL7 = 7,
266}
267impl From<VBLEV_A> for u8 {
268 #[inline(always)]
269 fn from(variant: VBLEV_A) -> Self {
270 variant as _
271 }
272}
273impl VBLEV_R {
274 #[doc = "Get enumerated values variant"]
275 #[inline(always)]
276 pub fn variant(&self) -> VBLEV_A {
277 match self.bits {
278 0 => VBLEV_A::LEVEL0,
279 1 => VBLEV_A::LEVEL1,
280 2 => VBLEV_A::LEVEL2,
281 3 => VBLEV_A::LEVEL3,
282 4 => VBLEV_A::LEVEL4,
283 5 => VBLEV_A::LEVEL5,
284 6 => VBLEV_A::LEVEL6,
285 7 => VBLEV_A::LEVEL7,
286 _ => unreachable!(),
287 }
288 }
289 #[doc = "Checks if the value of the field is `LEVEL0`"]
290 #[inline(always)]
291 pub fn is_level0(&self) -> bool {
292 *self == VBLEV_A::LEVEL0
293 }
294 #[doc = "Checks if the value of the field is `LEVEL1`"]
295 #[inline(always)]
296 pub fn is_level1(&self) -> bool {
297 *self == VBLEV_A::LEVEL1
298 }
299 #[doc = "Checks if the value of the field is `LEVEL2`"]
300 #[inline(always)]
301 pub fn is_level2(&self) -> bool {
302 *self == VBLEV_A::LEVEL2
303 }
304 #[doc = "Checks if the value of the field is `LEVEL3`"]
305 #[inline(always)]
306 pub fn is_level3(&self) -> bool {
307 *self == VBLEV_A::LEVEL3
308 }
309 #[doc = "Checks if the value of the field is `LEVEL4`"]
310 #[inline(always)]
311 pub fn is_level4(&self) -> bool {
312 *self == VBLEV_A::LEVEL4
313 }
314 #[doc = "Checks if the value of the field is `LEVEL5`"]
315 #[inline(always)]
316 pub fn is_level5(&self) -> bool {
317 *self == VBLEV_A::LEVEL5
318 }
319 #[doc = "Checks if the value of the field is `LEVEL6`"]
320 #[inline(always)]
321 pub fn is_level6(&self) -> bool {
322 *self == VBLEV_A::LEVEL6
323 }
324 #[doc = "Checks if the value of the field is `LEVEL7`"]
325 #[inline(always)]
326 pub fn is_level7(&self) -> bool {
327 *self == VBLEV_A::LEVEL7
328 }
329}
330#[doc = "Field `VBLEV` writer - Voltage Boost Level"]
331pub type VBLEV_W<'a, const O: u8> =
332 crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, VBLEV_A, 3, O>;
333impl<'a, const O: u8> VBLEV_W<'a, O> {
334 #[doc = "Minimum boost level"]
335 #[inline(always)]
336 pub fn level0(self) -> &'a mut W {
337 self.variant(VBLEV_A::LEVEL0)
338 }
339 #[doc = "`1`"]
340 #[inline(always)]
341 pub fn level1(self) -> &'a mut W {
342 self.variant(VBLEV_A::LEVEL1)
343 }
344 #[doc = "`10`"]
345 #[inline(always)]
346 pub fn level2(self) -> &'a mut W {
347 self.variant(VBLEV_A::LEVEL2)
348 }
349 #[doc = "`11`"]
350 #[inline(always)]
351 pub fn level3(self) -> &'a mut W {
352 self.variant(VBLEV_A::LEVEL3)
353 }
354 #[doc = "`100`"]
355 #[inline(always)]
356 pub fn level4(self) -> &'a mut W {
357 self.variant(VBLEV_A::LEVEL4)
358 }
359 #[doc = "`101`"]
360 #[inline(always)]
361 pub fn level5(self) -> &'a mut W {
362 self.variant(VBLEV_A::LEVEL5)
363 }
364 #[doc = "`110`"]
365 #[inline(always)]
366 pub fn level6(self) -> &'a mut W {
367 self.variant(VBLEV_A::LEVEL6)
368 }
369 #[doc = "Maximum boost level"]
370 #[inline(always)]
371 pub fn level7(self) -> &'a mut W {
372 self.variant(VBLEV_A::LEVEL7)
373 }
374}
375impl R {
376 #[doc = "Bits 0:1 - Mux Configuration"]
377 #[inline(always)]
378 pub fn mux(&self) -> MUX_R {
379 MUX_R::new((self.bits & 3) as u8)
380 }
381 #[doc = "Bits 2:3 - Bias Configuration"]
382 #[inline(always)]
383 pub fn bias(&self) -> BIAS_R {
384 BIAS_R::new(((self.bits >> 2) & 3) as u8)
385 }
386 #[doc = "Bit 4 - Waveform Selection"]
387 #[inline(always)]
388 pub fn wave(&self) -> WAVE_R {
389 WAVE_R::new(((self.bits >> 4) & 1) != 0)
390 }
391 #[doc = "Bits 8:12 - Contrast Level"]
392 #[inline(always)]
393 pub fn conlev(&self) -> CONLEV_R {
394 CONLEV_R::new(((self.bits >> 8) & 0x1f) as u8)
395 }
396 #[doc = "Bit 15 - Contrast Configuration"]
397 #[inline(always)]
398 pub fn conconf(&self) -> CONCONF_R {
399 CONCONF_R::new(((self.bits >> 15) & 1) != 0)
400 }
401 #[doc = "Bit 16 - VLCD Selection"]
402 #[inline(always)]
403 pub fn vlcdsel(&self) -> VLCDSEL_R {
404 VLCDSEL_R::new(((self.bits >> 16) & 1) != 0)
405 }
406 #[doc = "Bits 18:20 - Voltage Boost Level"]
407 #[inline(always)]
408 pub fn vblev(&self) -> VBLEV_R {
409 VBLEV_R::new(((self.bits >> 18) & 7) as u8)
410 }
411}
412impl W {
413 #[doc = "Bits 0:1 - Mux Configuration"]
414 #[inline(always)]
415 #[must_use]
416 pub fn mux(&mut self) -> MUX_W<0> {
417 MUX_W::new(self)
418 }
419 #[doc = "Bits 2:3 - Bias Configuration"]
420 #[inline(always)]
421 #[must_use]
422 pub fn bias(&mut self) -> BIAS_W<2> {
423 BIAS_W::new(self)
424 }
425 #[doc = "Bit 4 - Waveform Selection"]
426 #[inline(always)]
427 #[must_use]
428 pub fn wave(&mut self) -> WAVE_W<4> {
429 WAVE_W::new(self)
430 }
431 #[doc = "Bits 8:12 - Contrast Level"]
432 #[inline(always)]
433 #[must_use]
434 pub fn conlev(&mut self) -> CONLEV_W<8> {
435 CONLEV_W::new(self)
436 }
437 #[doc = "Bit 15 - Contrast Configuration"]
438 #[inline(always)]
439 #[must_use]
440 pub fn conconf(&mut self) -> CONCONF_W<15> {
441 CONCONF_W::new(self)
442 }
443 #[doc = "Bit 16 - VLCD Selection"]
444 #[inline(always)]
445 #[must_use]
446 pub fn vlcdsel(&mut self) -> VLCDSEL_W<16> {
447 VLCDSEL_W::new(self)
448 }
449 #[doc = "Bits 18:20 - Voltage Boost Level"]
450 #[inline(always)]
451 #[must_use]
452 pub fn vblev(&mut self) -> VBLEV_W<18> {
453 VBLEV_W::new(self)
454 }
455 #[doc = "Writes raw bits to the register."]
456 #[inline(always)]
457 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
458 self.0.bits(bits);
459 self
460 }
461}
462#[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"]
463pub struct DISPCTRL_SPEC;
464impl crate::RegisterSpec for DISPCTRL_SPEC {
465 type Ux = u32;
466}
467#[doc = "`read()` method returns [dispctrl::R](R) reader structure"]
468impl crate::Readable for DISPCTRL_SPEC {
469 type Reader = R;
470}
471#[doc = "`write(|w| ..)` method takes [dispctrl::W](W) writer structure"]
472impl crate::Writable for DISPCTRL_SPEC {
473 type Writer = W;
474 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
475 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
476}
477#[doc = "`reset()` method sets DISPCTRL to value 0x000c_1f00"]
478impl crate::Resettable for DISPCTRL_SPEC {
479 const RESET_VALUE: Self::Ux = 0x000c_1f00;
480}