efm32wg995_pac/lcd/
dispctrl.rs

1#[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 = "Mux Configuration\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum MUX_A {
41    #[doc = "0: Static"]
42    STATIC = 0,
43    #[doc = "1: Duplex"]
44    DUPLEX = 1,
45    #[doc = "2: Triplex"]
46    TRIPLEX = 2,
47    #[doc = "3: Quadruplex"]
48    QUADRUPLEX = 3,
49}
50impl From<MUX_A> for u8 {
51    #[inline(always)]
52    fn from(variant: MUX_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `MUX` reader - Mux Configuration"]
57pub type MUX_R = crate::FieldReader<u8, MUX_A>;
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> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, MUX_A, 2, 0>;
93impl<'a> MUX_W<'a> {
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 = "Bias Configuration\n\nValue on reset: 0"]
116#[derive(Clone, Copy, Debug, PartialEq)]
117#[repr(u8)]
118pub enum BIAS_A {
119    #[doc = "0: Static"]
120    STATIC = 0,
121    #[doc = "1: 1/2 Bias"]
122    ONEHALF = 1,
123    #[doc = "2: 1/3 Bias"]
124    ONETHIRD = 2,
125    #[doc = "3: 1/4 Bias"]
126    ONEFOURTH = 3,
127}
128impl From<BIAS_A> for u8 {
129    #[inline(always)]
130    fn from(variant: BIAS_A) -> Self {
131        variant as _
132    }
133}
134#[doc = "Field `BIAS` reader - Bias Configuration"]
135pub type BIAS_R = crate::FieldReader<u8, BIAS_A>;
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> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, BIAS_A, 2, 2>;
171impl<'a> BIAS_W<'a> {
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 4>;
197#[doc = "Contrast Level\n\nValue on reset: 31"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199#[repr(u8)]
200pub enum CONLEV_A {
201    #[doc = "0: Minimum contrast"]
202    MIN = 0,
203    #[doc = "31: Maximum contrast"]
204    MAX = 31,
205}
206impl From<CONLEV_A> for u8 {
207    #[inline(always)]
208    fn from(variant: CONLEV_A) -> Self {
209        variant as _
210    }
211}
212#[doc = "Field `CONLEV` reader - Contrast Level"]
213pub type CONLEV_R = crate::FieldReader<u8, CONLEV_A>;
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> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, CONLEV_A, 5, 8>;
237impl<'a> CONLEV_W<'a> {
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 15>;
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 16>;
257#[doc = "Voltage Boost Level\n\nValue on reset: 3"]
258#[derive(Clone, Copy, Debug, PartialEq)]
259#[repr(u8)]
260pub enum VBLEV_A {
261    #[doc = "0: Minimum boost level"]
262    LEVEL0 = 0,
263    #[doc = "1: `1`"]
264    LEVEL1 = 1,
265    #[doc = "2: `10`"]
266    LEVEL2 = 2,
267    #[doc = "3: `11`"]
268    LEVEL3 = 3,
269    #[doc = "4: `100`"]
270    LEVEL4 = 4,
271    #[doc = "5: `101`"]
272    LEVEL5 = 5,
273    #[doc = "6: `110`"]
274    LEVEL6 = 6,
275    #[doc = "7: Maximum boost level"]
276    LEVEL7 = 7,
277}
278impl From<VBLEV_A> for u8 {
279    #[inline(always)]
280    fn from(variant: VBLEV_A) -> Self {
281        variant as _
282    }
283}
284#[doc = "Field `VBLEV` reader - Voltage Boost Level"]
285pub type VBLEV_R = crate::FieldReader<u8, VBLEV_A>;
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> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, VBLEV_A, 3, 18>;
345impl<'a> VBLEV_W<'a> {
346    #[doc = "Minimum boost level"]
347    #[inline(always)]
348    pub fn level0(self) -> &'a mut W {
349        self.variant(VBLEV_A::LEVEL0)
350    }
351    #[doc = "`1`"]
352    #[inline(always)]
353    pub fn level1(self) -> &'a mut W {
354        self.variant(VBLEV_A::LEVEL1)
355    }
356    #[doc = "`10`"]
357    #[inline(always)]
358    pub fn level2(self) -> &'a mut W {
359        self.variant(VBLEV_A::LEVEL2)
360    }
361    #[doc = "`11`"]
362    #[inline(always)]
363    pub fn level3(self) -> &'a mut W {
364        self.variant(VBLEV_A::LEVEL3)
365    }
366    #[doc = "`100`"]
367    #[inline(always)]
368    pub fn level4(self) -> &'a mut W {
369        self.variant(VBLEV_A::LEVEL4)
370    }
371    #[doc = "`101`"]
372    #[inline(always)]
373    pub fn level5(self) -> &'a mut W {
374        self.variant(VBLEV_A::LEVEL5)
375    }
376    #[doc = "`110`"]
377    #[inline(always)]
378    pub fn level6(self) -> &'a mut W {
379        self.variant(VBLEV_A::LEVEL6)
380    }
381    #[doc = "Maximum boost level"]
382    #[inline(always)]
383    pub fn level7(self) -> &'a mut W {
384        self.variant(VBLEV_A::LEVEL7)
385    }
386}
387#[doc = "Field `MUXE` reader - Extended Mux Configuration"]
388pub type MUXE_R = crate::BitReader<bool>;
389#[doc = "Field `MUXE` writer - Extended Mux Configuration"]
390pub type MUXE_W<'a> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 22>;
391impl R {
392    #[doc = "Bits 0:1 - Mux Configuration"]
393    #[inline(always)]
394    pub fn mux(&self) -> MUX_R {
395        MUX_R::new((self.bits & 3) as u8)
396    }
397    #[doc = "Bits 2:3 - Bias Configuration"]
398    #[inline(always)]
399    pub fn bias(&self) -> BIAS_R {
400        BIAS_R::new(((self.bits >> 2) & 3) as u8)
401    }
402    #[doc = "Bit 4 - Waveform Selection"]
403    #[inline(always)]
404    pub fn wave(&self) -> WAVE_R {
405        WAVE_R::new(((self.bits >> 4) & 1) != 0)
406    }
407    #[doc = "Bits 8:12 - Contrast Level"]
408    #[inline(always)]
409    pub fn conlev(&self) -> CONLEV_R {
410        CONLEV_R::new(((self.bits >> 8) & 0x1f) as u8)
411    }
412    #[doc = "Bit 15 - Contrast Configuration"]
413    #[inline(always)]
414    pub fn conconf(&self) -> CONCONF_R {
415        CONCONF_R::new(((self.bits >> 15) & 1) != 0)
416    }
417    #[doc = "Bit 16 - VLCD Selection"]
418    #[inline(always)]
419    pub fn vlcdsel(&self) -> VLCDSEL_R {
420        VLCDSEL_R::new(((self.bits >> 16) & 1) != 0)
421    }
422    #[doc = "Bits 18:20 - Voltage Boost Level"]
423    #[inline(always)]
424    pub fn vblev(&self) -> VBLEV_R {
425        VBLEV_R::new(((self.bits >> 18) & 7) as u8)
426    }
427    #[doc = "Bit 22 - Extended Mux Configuration"]
428    #[inline(always)]
429    pub fn muxe(&self) -> MUXE_R {
430        MUXE_R::new(((self.bits >> 22) & 1) != 0)
431    }
432}
433impl W {
434    #[doc = "Bits 0:1 - Mux Configuration"]
435    #[inline(always)]
436    pub fn mux(&mut self) -> MUX_W {
437        MUX_W::new(self)
438    }
439    #[doc = "Bits 2:3 - Bias Configuration"]
440    #[inline(always)]
441    pub fn bias(&mut self) -> BIAS_W {
442        BIAS_W::new(self)
443    }
444    #[doc = "Bit 4 - Waveform Selection"]
445    #[inline(always)]
446    pub fn wave(&mut self) -> WAVE_W {
447        WAVE_W::new(self)
448    }
449    #[doc = "Bits 8:12 - Contrast Level"]
450    #[inline(always)]
451    pub fn conlev(&mut self) -> CONLEV_W {
452        CONLEV_W::new(self)
453    }
454    #[doc = "Bit 15 - Contrast Configuration"]
455    #[inline(always)]
456    pub fn conconf(&mut self) -> CONCONF_W {
457        CONCONF_W::new(self)
458    }
459    #[doc = "Bit 16 - VLCD Selection"]
460    #[inline(always)]
461    pub fn vlcdsel(&mut self) -> VLCDSEL_W {
462        VLCDSEL_W::new(self)
463    }
464    #[doc = "Bits 18:20 - Voltage Boost Level"]
465    #[inline(always)]
466    pub fn vblev(&mut self) -> VBLEV_W {
467        VBLEV_W::new(self)
468    }
469    #[doc = "Bit 22 - Extended Mux Configuration"]
470    #[inline(always)]
471    pub fn muxe(&mut self) -> MUXE_W {
472        MUXE_W::new(self)
473    }
474    #[doc = "Writes raw bits to the register."]
475    #[inline(always)]
476    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
477        self.0.bits(bits);
478        self
479    }
480}
481#[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"]
482pub struct DISPCTRL_SPEC;
483impl crate::RegisterSpec for DISPCTRL_SPEC {
484    type Ux = u32;
485}
486#[doc = "`read()` method returns [dispctrl::R](R) reader structure"]
487impl crate::Readable for DISPCTRL_SPEC {
488    type Reader = R;
489}
490#[doc = "`write(|w| ..)` method takes [dispctrl::W](W) writer structure"]
491impl crate::Writable for DISPCTRL_SPEC {
492    type Writer = W;
493}
494#[doc = "`reset()` method sets DISPCTRL to value 0x000c_1f00"]
495impl crate::Resettable for DISPCTRL_SPEC {
496    #[inline(always)]
497    fn reset_value() -> Self::Ux {
498        0x000c_1f00
499    }
500}