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 #[doc = "5: Sextaplex"]
50 SEXTAPLEX = 5,
51 #[doc = "7: Octaplex"]
52 OCTAPLEX = 7,
53}
54impl From<MUX_A> for u8 {
55 #[inline(always)]
56 fn from(variant: MUX_A) -> Self {
57 variant as _
58 }
59}
60#[doc = "Field `MUX` reader - Mux Configuration"]
61pub type MUX_R = crate::FieldReader<u8, MUX_A>;
62impl MUX_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> Option<MUX_A> {
66 match self.bits {
67 0 => Some(MUX_A::STATIC),
68 1 => Some(MUX_A::DUPLEX),
69 2 => Some(MUX_A::TRIPLEX),
70 3 => Some(MUX_A::QUADRUPLEX),
71 5 => Some(MUX_A::SEXTAPLEX),
72 7 => Some(MUX_A::OCTAPLEX),
73 _ => None,
74 }
75 }
76 #[doc = "Checks if the value of the field is `STATIC`"]
77 #[inline(always)]
78 pub fn is_static(&self) -> bool {
79 *self == MUX_A::STATIC
80 }
81 #[doc = "Checks if the value of the field is `DUPLEX`"]
82 #[inline(always)]
83 pub fn is_duplex(&self) -> bool {
84 *self == MUX_A::DUPLEX
85 }
86 #[doc = "Checks if the value of the field is `TRIPLEX`"]
87 #[inline(always)]
88 pub fn is_triplex(&self) -> bool {
89 *self == MUX_A::TRIPLEX
90 }
91 #[doc = "Checks if the value of the field is `QUADRUPLEX`"]
92 #[inline(always)]
93 pub fn is_quadruplex(&self) -> bool {
94 *self == MUX_A::QUADRUPLEX
95 }
96 #[doc = "Checks if the value of the field is `SEXTAPLEX`"]
97 #[inline(always)]
98 pub fn is_sextaplex(&self) -> bool {
99 *self == MUX_A::SEXTAPLEX
100 }
101 #[doc = "Checks if the value of the field is `OCTAPLEX`"]
102 #[inline(always)]
103 pub fn is_octaplex(&self) -> bool {
104 *self == MUX_A::OCTAPLEX
105 }
106}
107#[doc = "Field `MUX` writer - Mux Configuration"]
108pub type MUX_W<'a> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, MUX_A, 3, 0>;
109impl<'a> MUX_W<'a> {
110 #[doc = "Static"]
111 #[inline(always)]
112 pub fn static_(self) -> &'a mut W {
113 self.variant(MUX_A::STATIC)
114 }
115 #[doc = "Duplex"]
116 #[inline(always)]
117 pub fn duplex(self) -> &'a mut W {
118 self.variant(MUX_A::DUPLEX)
119 }
120 #[doc = "Triplex"]
121 #[inline(always)]
122 pub fn triplex(self) -> &'a mut W {
123 self.variant(MUX_A::TRIPLEX)
124 }
125 #[doc = "Quadruplex"]
126 #[inline(always)]
127 pub fn quadruplex(self) -> &'a mut W {
128 self.variant(MUX_A::QUADRUPLEX)
129 }
130 #[doc = "Sextaplex"]
131 #[inline(always)]
132 pub fn sextaplex(self) -> &'a mut W {
133 self.variant(MUX_A::SEXTAPLEX)
134 }
135 #[doc = "Octaplex"]
136 #[inline(always)]
137 pub fn octaplex(self) -> &'a mut W {
138 self.variant(MUX_A::OCTAPLEX)
139 }
140}
141#[doc = "Field `WAVE` reader - Waveform Selection"]
142pub type WAVE_R = crate::BitReader<bool>;
143#[doc = "Field `WAVE` writer - Waveform Selection"]
144pub type WAVE_W<'a> = crate::BitWriter<'a, u32, DISPCTRL_SPEC, bool, 4>;
145#[doc = "Field `CONTRAST` reader - Contrast Control"]
146pub type CONTRAST_R = crate::FieldReader<u8, u8>;
147#[doc = "Field `CONTRAST` writer - Contrast Control"]
148pub type CONTRAST_W<'a> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, u8, 6, 8>;
149#[doc = "Charge Redistribution Cycles\n\nValue on reset: 1"]
150#[derive(Clone, Copy, Debug, PartialEq)]
151#[repr(u8)]
152pub enum CHGRDST_A {
153 #[doc = "0: Disable charge redistribution."]
154 DISABLE = 0,
155 #[doc = "1: Use 1 prescaled low frequency clock cycle for charge redistribution."]
156 ONE = 1,
157 #[doc = "2: Use 2 prescaled low frequency clock cycles for charge redistribution."]
158 TWO = 2,
159 #[doc = "3: Use 3 prescaled low frequency clock cycles for charge redistribution."]
160 THREE = 3,
161 #[doc = "4: Use 4 prescaled low frequency clock cycles for charge redistribution."]
162 FOUR = 4,
163}
164impl From<CHGRDST_A> for u8 {
165 #[inline(always)]
166 fn from(variant: CHGRDST_A) -> Self {
167 variant as _
168 }
169}
170#[doc = "Field `CHGRDST` reader - Charge Redistribution Cycles"]
171pub type CHGRDST_R = crate::FieldReader<u8, CHGRDST_A>;
172impl CHGRDST_R {
173 #[doc = "Get enumerated values variant"]
174 #[inline(always)]
175 pub fn variant(&self) -> Option<CHGRDST_A> {
176 match self.bits {
177 0 => Some(CHGRDST_A::DISABLE),
178 1 => Some(CHGRDST_A::ONE),
179 2 => Some(CHGRDST_A::TWO),
180 3 => Some(CHGRDST_A::THREE),
181 4 => Some(CHGRDST_A::FOUR),
182 _ => None,
183 }
184 }
185 #[doc = "Checks if the value of the field is `DISABLE`"]
186 #[inline(always)]
187 pub fn is_disable(&self) -> bool {
188 *self == CHGRDST_A::DISABLE
189 }
190 #[doc = "Checks if the value of the field is `ONE`"]
191 #[inline(always)]
192 pub fn is_one(&self) -> bool {
193 *self == CHGRDST_A::ONE
194 }
195 #[doc = "Checks if the value of the field is `TWO`"]
196 #[inline(always)]
197 pub fn is_two(&self) -> bool {
198 *self == CHGRDST_A::TWO
199 }
200 #[doc = "Checks if the value of the field is `THREE`"]
201 #[inline(always)]
202 pub fn is_three(&self) -> bool {
203 *self == CHGRDST_A::THREE
204 }
205 #[doc = "Checks if the value of the field is `FOUR`"]
206 #[inline(always)]
207 pub fn is_four(&self) -> bool {
208 *self == CHGRDST_A::FOUR
209 }
210}
211#[doc = "Field `CHGRDST` writer - Charge Redistribution Cycles"]
212pub type CHGRDST_W<'a> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, CHGRDST_A, 3, 20>;
213impl<'a> CHGRDST_W<'a> {
214 #[doc = "Disable charge redistribution."]
215 #[inline(always)]
216 pub fn disable(self) -> &'a mut W {
217 self.variant(CHGRDST_A::DISABLE)
218 }
219 #[doc = "Use 1 prescaled low frequency clock cycle for charge redistribution."]
220 #[inline(always)]
221 pub fn one(self) -> &'a mut W {
222 self.variant(CHGRDST_A::ONE)
223 }
224 #[doc = "Use 2 prescaled low frequency clock cycles for charge redistribution."]
225 #[inline(always)]
226 pub fn two(self) -> &'a mut W {
227 self.variant(CHGRDST_A::TWO)
228 }
229 #[doc = "Use 3 prescaled low frequency clock cycles for charge redistribution."]
230 #[inline(always)]
231 pub fn three(self) -> &'a mut W {
232 self.variant(CHGRDST_A::THREE)
233 }
234 #[doc = "Use 4 prescaled low frequency clock cycles for charge redistribution."]
235 #[inline(always)]
236 pub fn four(self) -> &'a mut W {
237 self.variant(CHGRDST_A::FOUR)
238 }
239}
240#[doc = "Bias Configuration\n\nValue on reset: 0"]
241#[derive(Clone, Copy, Debug, PartialEq)]
242#[repr(u8)]
243pub enum BIAS_A {
244 #[doc = "0: Static"]
245 STATIC = 0,
246 #[doc = "1: 1/2 Bias"]
247 ONEHALF = 1,
248 #[doc = "2: 1/3 Bias"]
249 ONETHIRD = 2,
250 #[doc = "3: 1/4 Bias"]
251 ONEFOURTH = 3,
252}
253impl From<BIAS_A> for u8 {
254 #[inline(always)]
255 fn from(variant: BIAS_A) -> Self {
256 variant as _
257 }
258}
259#[doc = "Field `BIAS` reader - Bias Configuration"]
260pub type BIAS_R = crate::FieldReader<u8, BIAS_A>;
261impl BIAS_R {
262 #[doc = "Get enumerated values variant"]
263 #[inline(always)]
264 pub fn variant(&self) -> BIAS_A {
265 match self.bits {
266 0 => BIAS_A::STATIC,
267 1 => BIAS_A::ONEHALF,
268 2 => BIAS_A::ONETHIRD,
269 3 => BIAS_A::ONEFOURTH,
270 _ => unreachable!(),
271 }
272 }
273 #[doc = "Checks if the value of the field is `STATIC`"]
274 #[inline(always)]
275 pub fn is_static(&self) -> bool {
276 *self == BIAS_A::STATIC
277 }
278 #[doc = "Checks if the value of the field is `ONEHALF`"]
279 #[inline(always)]
280 pub fn is_onehalf(&self) -> bool {
281 *self == BIAS_A::ONEHALF
282 }
283 #[doc = "Checks if the value of the field is `ONETHIRD`"]
284 #[inline(always)]
285 pub fn is_onethird(&self) -> bool {
286 *self == BIAS_A::ONETHIRD
287 }
288 #[doc = "Checks if the value of the field is `ONEFOURTH`"]
289 #[inline(always)]
290 pub fn is_onefourth(&self) -> bool {
291 *self == BIAS_A::ONEFOURTH
292 }
293}
294#[doc = "Field `BIAS` writer - Bias Configuration"]
295pub type BIAS_W<'a> = crate::FieldWriterSafe<'a, u32, DISPCTRL_SPEC, u8, BIAS_A, 2, 24>;
296impl<'a> BIAS_W<'a> {
297 #[doc = "Static"]
298 #[inline(always)]
299 pub fn static_(self) -> &'a mut W {
300 self.variant(BIAS_A::STATIC)
301 }
302 #[doc = "1/2 Bias"]
303 #[inline(always)]
304 pub fn onehalf(self) -> &'a mut W {
305 self.variant(BIAS_A::ONEHALF)
306 }
307 #[doc = "1/3 Bias"]
308 #[inline(always)]
309 pub fn onethird(self) -> &'a mut W {
310 self.variant(BIAS_A::ONETHIRD)
311 }
312 #[doc = "1/4 Bias"]
313 #[inline(always)]
314 pub fn onefourth(self) -> &'a mut W {
315 self.variant(BIAS_A::ONEFOURTH)
316 }
317}
318#[doc = "Mode Setting\n\nValue on reset: 0"]
319#[derive(Clone, Copy, Debug, PartialEq)]
320#[repr(u8)]
321pub enum MODE_A {
322 #[doc = "0: No External Cap. Uses an internal current source to generate VLCD. Use CONTRAST\\[4:0\\]
323to control VLCD."]
324 NOEXTCAP = 0,
325 #[doc = "1: Use step down control with VLCD less than VDD. Use CONTRAST\\[5:0\\]
326to control VLCD level, and use SPEED to adjust VLCD drive strength."]
327 STEPDOWN = 1,
328 #[doc = "2: Charge pump used with internal oscillator. Use CONTRAST\\[5:0\\]
329to control VLCD level, and use SPEED to adjust oscillator frequency."]
330 CPINTOSC = 2,
331}
332impl From<MODE_A> for u8 {
333 #[inline(always)]
334 fn from(variant: MODE_A) -> Self {
335 variant as _
336 }
337}
338#[doc = "Field `MODE` reader - Mode Setting"]
339pub type MODE_R = crate::FieldReader<u8, MODE_A>;
340impl MODE_R {
341 #[doc = "Get enumerated values variant"]
342 #[inline(always)]
343 pub fn variant(&self) -> Option<MODE_A> {
344 match self.bits {
345 0 => Some(MODE_A::NOEXTCAP),
346 1 => Some(MODE_A::STEPDOWN),
347 2 => Some(MODE_A::CPINTOSC),
348 _ => None,
349 }
350 }
351 #[doc = "Checks if the value of the field is `NOEXTCAP`"]
352 #[inline(always)]
353 pub fn is_noextcap(&self) -> bool {
354 *self == MODE_A::NOEXTCAP
355 }
356 #[doc = "Checks if the value of the field is `STEPDOWN`"]
357 #[inline(always)]
358 pub fn is_stepdown(&self) -> bool {
359 *self == MODE_A::STEPDOWN
360 }
361 #[doc = "Checks if the value of the field is `CPINTOSC`"]
362 #[inline(always)]
363 pub fn is_cpintosc(&self) -> bool {
364 *self == MODE_A::CPINTOSC
365 }
366}
367#[doc = "Field `MODE` writer - Mode Setting"]
368pub type MODE_W<'a> = crate::FieldWriter<'a, u32, DISPCTRL_SPEC, u8, MODE_A, 2, 28>;
369impl<'a> MODE_W<'a> {
370 #[doc = "No External Cap. Uses an internal current source to generate VLCD. Use CONTRAST\\[4:0\\]
371to control VLCD."]
372 #[inline(always)]
373 pub fn noextcap(self) -> &'a mut W {
374 self.variant(MODE_A::NOEXTCAP)
375 }
376 #[doc = "Use step down control with VLCD less than VDD. Use CONTRAST\\[5:0\\]
377to control VLCD level, and use SPEED to adjust VLCD drive strength."]
378 #[inline(always)]
379 pub fn stepdown(self) -> &'a mut W {
380 self.variant(MODE_A::STEPDOWN)
381 }
382 #[doc = "Charge pump used with internal oscillator. Use CONTRAST\\[5:0\\]
383to control VLCD level, and use SPEED to adjust oscillator frequency."]
384 #[inline(always)]
385 pub fn cpintosc(self) -> &'a mut W {
386 self.variant(MODE_A::CPINTOSC)
387 }
388}
389impl R {
390 #[doc = "Bits 0:2 - Mux Configuration"]
391 #[inline(always)]
392 pub fn mux(&self) -> MUX_R {
393 MUX_R::new((self.bits & 7) as u8)
394 }
395 #[doc = "Bit 4 - Waveform Selection"]
396 #[inline(always)]
397 pub fn wave(&self) -> WAVE_R {
398 WAVE_R::new(((self.bits >> 4) & 1) != 0)
399 }
400 #[doc = "Bits 8:13 - Contrast Control"]
401 #[inline(always)]
402 pub fn contrast(&self) -> CONTRAST_R {
403 CONTRAST_R::new(((self.bits >> 8) & 0x3f) as u8)
404 }
405 #[doc = "Bits 20:22 - Charge Redistribution Cycles"]
406 #[inline(always)]
407 pub fn chgrdst(&self) -> CHGRDST_R {
408 CHGRDST_R::new(((self.bits >> 20) & 7) as u8)
409 }
410 #[doc = "Bits 24:25 - Bias Configuration"]
411 #[inline(always)]
412 pub fn bias(&self) -> BIAS_R {
413 BIAS_R::new(((self.bits >> 24) & 3) as u8)
414 }
415 #[doc = "Bits 28:29 - Mode Setting"]
416 #[inline(always)]
417 pub fn mode(&self) -> MODE_R {
418 MODE_R::new(((self.bits >> 28) & 3) as u8)
419 }
420}
421impl W {
422 #[doc = "Bits 0:2 - Mux Configuration"]
423 #[inline(always)]
424 pub fn mux(&mut self) -> MUX_W {
425 MUX_W::new(self)
426 }
427 #[doc = "Bit 4 - Waveform Selection"]
428 #[inline(always)]
429 pub fn wave(&mut self) -> WAVE_W {
430 WAVE_W::new(self)
431 }
432 #[doc = "Bits 8:13 - Contrast Control"]
433 #[inline(always)]
434 pub fn contrast(&mut self) -> CONTRAST_W {
435 CONTRAST_W::new(self)
436 }
437 #[doc = "Bits 20:22 - Charge Redistribution Cycles"]
438 #[inline(always)]
439 pub fn chgrdst(&mut self) -> CHGRDST_W {
440 CHGRDST_W::new(self)
441 }
442 #[doc = "Bits 24:25 - Bias Configuration"]
443 #[inline(always)]
444 pub fn bias(&mut self) -> BIAS_W {
445 BIAS_W::new(self)
446 }
447 #[doc = "Bits 28:29 - Mode Setting"]
448 #[inline(always)]
449 pub fn mode(&mut self) -> MODE_W {
450 MODE_W::new(self)
451 }
452 #[doc = "Writes raw bits to the register."]
453 #[inline(always)]
454 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
455 self.0.bits(bits);
456 self
457 }
458}
459#[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"]
460pub struct DISPCTRL_SPEC;
461impl crate::RegisterSpec for DISPCTRL_SPEC {
462 type Ux = u32;
463}
464#[doc = "`read()` method returns [dispctrl::R](R) reader structure"]
465impl crate::Readable for DISPCTRL_SPEC {
466 type Reader = R;
467}
468#[doc = "`write(|w| ..)` method takes [dispctrl::W](W) writer structure"]
469impl crate::Writable for DISPCTRL_SPEC {
470 type Writer = W;
471}
472#[doc = "`reset()` method sets DISPCTRL to value 0x0010_3f00"]
473impl crate::Resettable for DISPCTRL_SPEC {
474 #[inline(always)]
475 fn reset_value() -> Self::Ux {
476 0x0010_3f00
477 }
478}