stm32l4x2_pac/lcd/
fcr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::FCR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct PSR {
47    bits: u8,
48}
49impl PSR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct DIVR {
58    bits: u8,
59}
60impl DIVR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bits(&self) -> u8 {
64        self.bits
65    }
66}
67#[doc = r" Value of the field"]
68pub struct BLINKR {
69    bits: u8,
70}
71impl BLINKR {
72    #[doc = r" Value of the field as raw bits"]
73    #[inline]
74    pub fn bits(&self) -> u8 {
75        self.bits
76    }
77}
78#[doc = r" Value of the field"]
79pub struct BLINKFR {
80    bits: u8,
81}
82impl BLINKFR {
83    #[doc = r" Value of the field as raw bits"]
84    #[inline]
85    pub fn bits(&self) -> u8 {
86        self.bits
87    }
88}
89#[doc = r" Value of the field"]
90pub struct CCR {
91    bits: u8,
92}
93impl CCR {
94    #[doc = r" Value of the field as raw bits"]
95    #[inline]
96    pub fn bits(&self) -> u8 {
97        self.bits
98    }
99}
100#[doc = r" Value of the field"]
101pub struct DEADR {
102    bits: u8,
103}
104impl DEADR {
105    #[doc = r" Value of the field as raw bits"]
106    #[inline]
107    pub fn bits(&self) -> u8 {
108        self.bits
109    }
110}
111#[doc = r" Value of the field"]
112pub struct PONR {
113    bits: u8,
114}
115impl PONR {
116    #[doc = r" Value of the field as raw bits"]
117    #[inline]
118    pub fn bits(&self) -> u8 {
119        self.bits
120    }
121}
122#[doc = r" Value of the field"]
123pub struct UDDIER {
124    bits: bool,
125}
126impl UDDIER {
127    #[doc = r" Value of the field as raw bits"]
128    #[inline]
129    pub fn bit(&self) -> bool {
130        self.bits
131    }
132    #[doc = r" Returns `true` if the bit is clear (0)"]
133    #[inline]
134    pub fn bit_is_clear(&self) -> bool {
135        !self.bit()
136    }
137    #[doc = r" Returns `true` if the bit is set (1)"]
138    #[inline]
139    pub fn bit_is_set(&self) -> bool {
140        self.bit()
141    }
142}
143#[doc = r" Value of the field"]
144pub struct SOFIER {
145    bits: bool,
146}
147impl SOFIER {
148    #[doc = r" Value of the field as raw bits"]
149    #[inline]
150    pub fn bit(&self) -> bool {
151        self.bits
152    }
153    #[doc = r" Returns `true` if the bit is clear (0)"]
154    #[inline]
155    pub fn bit_is_clear(&self) -> bool {
156        !self.bit()
157    }
158    #[doc = r" Returns `true` if the bit is set (1)"]
159    #[inline]
160    pub fn bit_is_set(&self) -> bool {
161        self.bit()
162    }
163}
164#[doc = r" Value of the field"]
165pub struct HDR {
166    bits: bool,
167}
168impl HDR {
169    #[doc = r" Value of the field as raw bits"]
170    #[inline]
171    pub fn bit(&self) -> bool {
172        self.bits
173    }
174    #[doc = r" Returns `true` if the bit is clear (0)"]
175    #[inline]
176    pub fn bit_is_clear(&self) -> bool {
177        !self.bit()
178    }
179    #[doc = r" Returns `true` if the bit is set (1)"]
180    #[inline]
181    pub fn bit_is_set(&self) -> bool {
182        self.bit()
183    }
184}
185#[doc = r" Proxy"]
186pub struct _PSW<'a> {
187    w: &'a mut W,
188}
189impl<'a> _PSW<'a> {
190    #[doc = r" Writes raw bits to the field"]
191    #[inline]
192    pub unsafe fn bits(self, value: u8) -> &'a mut W {
193        const MASK: u8 = 15;
194        const OFFSET: u8 = 22;
195        self.w.bits &= !((MASK as u32) << OFFSET);
196        self.w.bits |= ((value & MASK) as u32) << OFFSET;
197        self.w
198    }
199}
200#[doc = r" Proxy"]
201pub struct _DIVW<'a> {
202    w: &'a mut W,
203}
204impl<'a> _DIVW<'a> {
205    #[doc = r" Writes raw bits to the field"]
206    #[inline]
207    pub unsafe fn bits(self, value: u8) -> &'a mut W {
208        const MASK: u8 = 15;
209        const OFFSET: u8 = 18;
210        self.w.bits &= !((MASK as u32) << OFFSET);
211        self.w.bits |= ((value & MASK) as u32) << OFFSET;
212        self.w
213    }
214}
215#[doc = r" Proxy"]
216pub struct _BLINKW<'a> {
217    w: &'a mut W,
218}
219impl<'a> _BLINKW<'a> {
220    #[doc = r" Writes raw bits to the field"]
221    #[inline]
222    pub unsafe fn bits(self, value: u8) -> &'a mut W {
223        const MASK: u8 = 3;
224        const OFFSET: u8 = 16;
225        self.w.bits &= !((MASK as u32) << OFFSET);
226        self.w.bits |= ((value & MASK) as u32) << OFFSET;
227        self.w
228    }
229}
230#[doc = r" Proxy"]
231pub struct _BLINKFW<'a> {
232    w: &'a mut W,
233}
234impl<'a> _BLINKFW<'a> {
235    #[doc = r" Writes raw bits to the field"]
236    #[inline]
237    pub unsafe fn bits(self, value: u8) -> &'a mut W {
238        const MASK: u8 = 7;
239        const OFFSET: u8 = 13;
240        self.w.bits &= !((MASK as u32) << OFFSET);
241        self.w.bits |= ((value & MASK) as u32) << OFFSET;
242        self.w
243    }
244}
245#[doc = r" Proxy"]
246pub struct _CCW<'a> {
247    w: &'a mut W,
248}
249impl<'a> _CCW<'a> {
250    #[doc = r" Writes raw bits to the field"]
251    #[inline]
252    pub unsafe fn bits(self, value: u8) -> &'a mut W {
253        const MASK: u8 = 7;
254        const OFFSET: u8 = 10;
255        self.w.bits &= !((MASK as u32) << OFFSET);
256        self.w.bits |= ((value & MASK) as u32) << OFFSET;
257        self.w
258    }
259}
260#[doc = r" Proxy"]
261pub struct _DEADW<'a> {
262    w: &'a mut W,
263}
264impl<'a> _DEADW<'a> {
265    #[doc = r" Writes raw bits to the field"]
266    #[inline]
267    pub unsafe fn bits(self, value: u8) -> &'a mut W {
268        const MASK: u8 = 7;
269        const OFFSET: u8 = 7;
270        self.w.bits &= !((MASK as u32) << OFFSET);
271        self.w.bits |= ((value & MASK) as u32) << OFFSET;
272        self.w
273    }
274}
275#[doc = r" Proxy"]
276pub struct _PONW<'a> {
277    w: &'a mut W,
278}
279impl<'a> _PONW<'a> {
280    #[doc = r" Writes raw bits to the field"]
281    #[inline]
282    pub unsafe fn bits(self, value: u8) -> &'a mut W {
283        const MASK: u8 = 7;
284        const OFFSET: u8 = 4;
285        self.w.bits &= !((MASK as u32) << OFFSET);
286        self.w.bits |= ((value & MASK) as u32) << OFFSET;
287        self.w
288    }
289}
290#[doc = r" Proxy"]
291pub struct _UDDIEW<'a> {
292    w: &'a mut W,
293}
294impl<'a> _UDDIEW<'a> {
295    #[doc = r" Sets the field bit"]
296    pub fn set_bit(self) -> &'a mut W {
297        self.bit(true)
298    }
299    #[doc = r" Clears the field bit"]
300    pub fn clear_bit(self) -> &'a mut W {
301        self.bit(false)
302    }
303    #[doc = r" Writes raw bits to the field"]
304    #[inline]
305    pub fn bit(self, value: bool) -> &'a mut W {
306        const MASK: bool = true;
307        const OFFSET: u8 = 3;
308        self.w.bits &= !((MASK as u32) << OFFSET);
309        self.w.bits |= ((value & MASK) as u32) << OFFSET;
310        self.w
311    }
312}
313#[doc = r" Proxy"]
314pub struct _SOFIEW<'a> {
315    w: &'a mut W,
316}
317impl<'a> _SOFIEW<'a> {
318    #[doc = r" Sets the field bit"]
319    pub fn set_bit(self) -> &'a mut W {
320        self.bit(true)
321    }
322    #[doc = r" Clears the field bit"]
323    pub fn clear_bit(self) -> &'a mut W {
324        self.bit(false)
325    }
326    #[doc = r" Writes raw bits to the field"]
327    #[inline]
328    pub fn bit(self, value: bool) -> &'a mut W {
329        const MASK: bool = true;
330        const OFFSET: u8 = 1;
331        self.w.bits &= !((MASK as u32) << OFFSET);
332        self.w.bits |= ((value & MASK) as u32) << OFFSET;
333        self.w
334    }
335}
336#[doc = r" Proxy"]
337pub struct _HDW<'a> {
338    w: &'a mut W,
339}
340impl<'a> _HDW<'a> {
341    #[doc = r" Sets the field bit"]
342    pub fn set_bit(self) -> &'a mut W {
343        self.bit(true)
344    }
345    #[doc = r" Clears the field bit"]
346    pub fn clear_bit(self) -> &'a mut W {
347        self.bit(false)
348    }
349    #[doc = r" Writes raw bits to the field"]
350    #[inline]
351    pub fn bit(self, value: bool) -> &'a mut W {
352        const MASK: bool = true;
353        const OFFSET: u8 = 0;
354        self.w.bits &= !((MASK as u32) << OFFSET);
355        self.w.bits |= ((value & MASK) as u32) << OFFSET;
356        self.w
357    }
358}
359impl R {
360    #[doc = r" Value of the register as raw bits"]
361    #[inline]
362    pub fn bits(&self) -> u32 {
363        self.bits
364    }
365    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
366    #[inline]
367    pub fn ps(&self) -> PSR {
368        let bits = {
369            const MASK: u8 = 15;
370            const OFFSET: u8 = 22;
371            ((self.bits >> OFFSET) & MASK as u32) as u8
372        };
373        PSR { bits }
374    }
375    #[doc = "Bits 18:21 - DIV clock divider"]
376    #[inline]
377    pub fn div(&self) -> DIVR {
378        let bits = {
379            const MASK: u8 = 15;
380            const OFFSET: u8 = 18;
381            ((self.bits >> OFFSET) & MASK as u32) as u8
382        };
383        DIVR { bits }
384    }
385    #[doc = "Bits 16:17 - Blink mode selection"]
386    #[inline]
387    pub fn blink(&self) -> BLINKR {
388        let bits = {
389            const MASK: u8 = 3;
390            const OFFSET: u8 = 16;
391            ((self.bits >> OFFSET) & MASK as u32) as u8
392        };
393        BLINKR { bits }
394    }
395    #[doc = "Bits 13:15 - Blink frequency selection"]
396    #[inline]
397    pub fn blinkf(&self) -> BLINKFR {
398        let bits = {
399            const MASK: u8 = 7;
400            const OFFSET: u8 = 13;
401            ((self.bits >> OFFSET) & MASK as u32) as u8
402        };
403        BLINKFR { bits }
404    }
405    #[doc = "Bits 10:12 - Contrast control"]
406    #[inline]
407    pub fn cc(&self) -> CCR {
408        let bits = {
409            const MASK: u8 = 7;
410            const OFFSET: u8 = 10;
411            ((self.bits >> OFFSET) & MASK as u32) as u8
412        };
413        CCR { bits }
414    }
415    #[doc = "Bits 7:9 - Dead time duration"]
416    #[inline]
417    pub fn dead(&self) -> DEADR {
418        let bits = {
419            const MASK: u8 = 7;
420            const OFFSET: u8 = 7;
421            ((self.bits >> OFFSET) & MASK as u32) as u8
422        };
423        DEADR { bits }
424    }
425    #[doc = "Bits 4:6 - Pulse ON duration"]
426    #[inline]
427    pub fn pon(&self) -> PONR {
428        let bits = {
429            const MASK: u8 = 7;
430            const OFFSET: u8 = 4;
431            ((self.bits >> OFFSET) & MASK as u32) as u8
432        };
433        PONR { bits }
434    }
435    #[doc = "Bit 3 - Update display done interrupt enable"]
436    #[inline]
437    pub fn uddie(&self) -> UDDIER {
438        let bits = {
439            const MASK: bool = true;
440            const OFFSET: u8 = 3;
441            ((self.bits >> OFFSET) & MASK as u32) != 0
442        };
443        UDDIER { bits }
444    }
445    #[doc = "Bit 1 - Start of frame interrupt enable"]
446    #[inline]
447    pub fn sofie(&self) -> SOFIER {
448        let bits = {
449            const MASK: bool = true;
450            const OFFSET: u8 = 1;
451            ((self.bits >> OFFSET) & MASK as u32) != 0
452        };
453        SOFIER { bits }
454    }
455    #[doc = "Bit 0 - High drive enable"]
456    #[inline]
457    pub fn hd(&self) -> HDR {
458        let bits = {
459            const MASK: bool = true;
460            const OFFSET: u8 = 0;
461            ((self.bits >> OFFSET) & MASK as u32) != 0
462        };
463        HDR { bits }
464    }
465}
466impl W {
467    #[doc = r" Reset value of the register"]
468    #[inline]
469    pub fn reset_value() -> W {
470        W { bits: 0 }
471    }
472    #[doc = r" Writes raw bits to the register"]
473    #[inline]
474    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
475        self.bits = bits;
476        self
477    }
478    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
479    #[inline]
480    pub fn ps(&mut self) -> _PSW {
481        _PSW { w: self }
482    }
483    #[doc = "Bits 18:21 - DIV clock divider"]
484    #[inline]
485    pub fn div(&mut self) -> _DIVW {
486        _DIVW { w: self }
487    }
488    #[doc = "Bits 16:17 - Blink mode selection"]
489    #[inline]
490    pub fn blink(&mut self) -> _BLINKW {
491        _BLINKW { w: self }
492    }
493    #[doc = "Bits 13:15 - Blink frequency selection"]
494    #[inline]
495    pub fn blinkf(&mut self) -> _BLINKFW {
496        _BLINKFW { w: self }
497    }
498    #[doc = "Bits 10:12 - Contrast control"]
499    #[inline]
500    pub fn cc(&mut self) -> _CCW {
501        _CCW { w: self }
502    }
503    #[doc = "Bits 7:9 - Dead time duration"]
504    #[inline]
505    pub fn dead(&mut self) -> _DEADW {
506        _DEADW { w: self }
507    }
508    #[doc = "Bits 4:6 - Pulse ON duration"]
509    #[inline]
510    pub fn pon(&mut self) -> _PONW {
511        _PONW { w: self }
512    }
513    #[doc = "Bit 3 - Update display done interrupt enable"]
514    #[inline]
515    pub fn uddie(&mut self) -> _UDDIEW {
516        _UDDIEW { w: self }
517    }
518    #[doc = "Bit 1 - Start of frame interrupt enable"]
519    #[inline]
520    pub fn sofie(&mut self) -> _SOFIEW {
521        _SOFIEW { w: self }
522    }
523    #[doc = "Bit 0 - High drive enable"]
524    #[inline]
525    pub fn hd(&mut self) -> _HDW {
526        _HDW { w: self }
527    }
528}