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}
126impl From<BIAS_A> for u8 {
127 #[inline(always)]
128 fn from(variant: BIAS_A) -> Self {
129 variant as _
130 }
131}
132#[doc = "Field `BIAS` reader - Bias Configuration"]
133pub type BIAS_R = crate::FieldReader<u8, BIAS_A>;
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> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, BIAS_A, 2, 2>;
163impl<'a> BIAS_W<'a> {
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 4>;
184#[doc = "Contrast Level\n\nValue on reset: 31"]
185#[derive(Clone, Copy, Debug, PartialEq)]
186#[repr(u8)]
187pub enum CONLEV_A {
188 #[doc = "0: Minimum contrast"]
189 MIN = 0,
190 #[doc = "31: Maximum contrast"]
191 MAX = 31,
192}
193impl From<CONLEV_A> for u8 {
194 #[inline(always)]
195 fn from(variant: CONLEV_A) -> Self {
196 variant as _
197 }
198}
199#[doc = "Field `CONLEV` reader - Contrast Level"]
200pub type CONLEV_R = crate::FieldReader<u8, CONLEV_A>;
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> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, CONLEV_A, 5, 8>;
224impl<'a> CONLEV_W<'a> {
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 15>;
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> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 16>;
244#[doc = "Voltage Boost Level\n\nValue on reset: 3"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246#[repr(u8)]
247pub enum VBLEV_A {
248 #[doc = "0: Minimum boost level"]
249 LEVEL0 = 0,
250 #[doc = "1: `1`"]
251 LEVEL1 = 1,
252 #[doc = "2: `10`"]
253 LEVEL2 = 2,
254 #[doc = "3: `11`"]
255 LEVEL3 = 3,
256 #[doc = "4: `100`"]
257 LEVEL4 = 4,
258 #[doc = "5: `101`"]
259 LEVEL5 = 5,
260 #[doc = "6: `110`"]
261 LEVEL6 = 6,
262 #[doc = "7: Maximum boost level"]
263 LEVEL7 = 7,
264}
265impl From<VBLEV_A> for u8 {
266 #[inline(always)]
267 fn from(variant: VBLEV_A) -> Self {
268 variant as _
269 }
270}
271#[doc = "Field `VBLEV` reader - Voltage Boost Level"]
272pub type VBLEV_R = crate::FieldReader<u8, VBLEV_A>;
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> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, VBLEV_A, 3, 18>;
332impl<'a> VBLEV_W<'a> {
333 #[doc = "Minimum boost level"]
334 #[inline(always)]
335 pub fn level0(self) -> &'a mut W {
336 self.variant(VBLEV_A::LEVEL0)
337 }
338 #[doc = "`1`"]
339 #[inline(always)]
340 pub fn level1(self) -> &'a mut W {
341 self.variant(VBLEV_A::LEVEL1)
342 }
343 #[doc = "`10`"]
344 #[inline(always)]
345 pub fn level2(self) -> &'a mut W {
346 self.variant(VBLEV_A::LEVEL2)
347 }
348 #[doc = "`11`"]
349 #[inline(always)]
350 pub fn level3(self) -> &'a mut W {
351 self.variant(VBLEV_A::LEVEL3)
352 }
353 #[doc = "`100`"]
354 #[inline(always)]
355 pub fn level4(self) -> &'a mut W {
356 self.variant(VBLEV_A::LEVEL4)
357 }
358 #[doc = "`101`"]
359 #[inline(always)]
360 pub fn level5(self) -> &'a mut W {
361 self.variant(VBLEV_A::LEVEL5)
362 }
363 #[doc = "`110`"]
364 #[inline(always)]
365 pub fn level6(self) -> &'a mut W {
366 self.variant(VBLEV_A::LEVEL6)
367 }
368 #[doc = "Maximum boost level"]
369 #[inline(always)]
370 pub fn level7(self) -> &'a mut W {
371 self.variant(VBLEV_A::LEVEL7)
372 }
373}
374impl R {
375 #[doc = "Bits 0:1 - Mux Configuration"]
376 #[inline(always)]
377 pub fn mux(&self) -> MUX_R {
378 MUX_R::new((self.bits & 3) as u8)
379 }
380 #[doc = "Bits 2:3 - Bias Configuration"]
381 #[inline(always)]
382 pub fn bias(&self) -> BIAS_R {
383 BIAS_R::new(((self.bits >> 2) & 3) as u8)
384 }
385 #[doc = "Bit 4 - Waveform Selection"]
386 #[inline(always)]
387 pub fn wave(&self) -> WAVE_R {
388 WAVE_R::new(((self.bits >> 4) & 1) != 0)
389 }
390 #[doc = "Bits 8:12 - Contrast Level"]
391 #[inline(always)]
392 pub fn conlev(&self) -> CONLEV_R {
393 CONLEV_R::new(((self.bits >> 8) & 0x1f) as u8)
394 }
395 #[doc = "Bit 15 - Contrast Configuration"]
396 #[inline(always)]
397 pub fn conconf(&self) -> CONCONF_R {
398 CONCONF_R::new(((self.bits >> 15) & 1) != 0)
399 }
400 #[doc = "Bit 16 - VLCD Selection"]
401 #[inline(always)]
402 pub fn vlcdsel(&self) -> VLCDSEL_R {
403 VLCDSEL_R::new(((self.bits >> 16) & 1) != 0)
404 }
405 #[doc = "Bits 18:20 - Voltage Boost Level"]
406 #[inline(always)]
407 pub fn vblev(&self) -> VBLEV_R {
408 VBLEV_R::new(((self.bits >> 18) & 7) as u8)
409 }
410}
411impl W {
412 #[doc = "Bits 0:1 - Mux Configuration"]
413 #[inline(always)]
414 pub fn mux(&mut self) -> MUX_W {
415 MUX_W::new(self)
416 }
417 #[doc = "Bits 2:3 - Bias Configuration"]
418 #[inline(always)]
419 pub fn bias(&mut self) -> BIAS_W {
420 BIAS_W::new(self)
421 }
422 #[doc = "Bit 4 - Waveform Selection"]
423 #[inline(always)]
424 pub fn wave(&mut self) -> WAVE_W {
425 WAVE_W::new(self)
426 }
427 #[doc = "Bits 8:12 - Contrast Level"]
428 #[inline(always)]
429 pub fn conlev(&mut self) -> CONLEV_W {
430 CONLEV_W::new(self)
431 }
432 #[doc = "Bit 15 - Contrast Configuration"]
433 #[inline(always)]
434 pub fn conconf(&mut self) -> CONCONF_W {
435 CONCONF_W::new(self)
436 }
437 #[doc = "Bit 16 - VLCD Selection"]
438 #[inline(always)]
439 pub fn vlcdsel(&mut self) -> VLCDSEL_W {
440 VLCDSEL_W::new(self)
441 }
442 #[doc = "Bits 18:20 - Voltage Boost Level"]
443 #[inline(always)]
444 pub fn vblev(&mut self) -> VBLEV_W {
445 VBLEV_W::new(self)
446 }
447 #[doc = "Writes raw bits to the register."]
448 #[inline(always)]
449 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
450 self.0.bits(bits);
451 self
452 }
453}
454#[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"]
455pub struct DISPCTRL_SPEC;
456impl crate::RegisterSpec for DISPCTRL_SPEC {
457 type Ux = u32;
458}
459#[doc = "`read()` method returns [dispctrl::R](R) reader structure"]
460impl crate::Readable for DISPCTRL_SPEC {
461 type Reader = R;
462}
463#[doc = "`write(|w| ..)` method takes [dispctrl::W](W) writer structure"]
464impl crate::Writable for DISPCTRL_SPEC {
465 type Writer = W;
466}
467#[doc = "`reset()` method sets DISPCTRL to value 0x000c_1f00"]
468impl crate::Resettable for DISPCTRL_SPEC {
469 #[inline(always)]
470 fn reset_value() -> Self::Ux {
471 0x000c_1f00
472 }
473}