stm32l4x2_pac/lcd/
sr.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::SR {
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 FCRSFR {
47    bits: bool,
48}
49impl FCRSFR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct RDYR {
68    bits: bool,
69}
70impl RDYR {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Value of the field"]
88pub struct UDDR {
89    bits: bool,
90}
91impl UDDR {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct SOFR {
110    bits: bool,
111}
112impl SOFR {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct ENSR {
131    bits: bool,
132}
133impl ENSR {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Proxy"]
151pub struct _UDRW<'a> {
152    w: &'a mut W,
153}
154impl<'a> _UDRW<'a> {
155    #[doc = r" Sets the field bit"]
156    pub fn set_bit(self) -> &'a mut W {
157        self.bit(true)
158    }
159    #[doc = r" Clears the field bit"]
160    pub fn clear_bit(self) -> &'a mut W {
161        self.bit(false)
162    }
163    #[doc = r" Writes raw bits to the field"]
164    #[inline]
165    pub fn bit(self, value: bool) -> &'a mut W {
166        const MASK: bool = true;
167        const OFFSET: u8 = 2;
168        self.w.bits &= !((MASK as u32) << OFFSET);
169        self.w.bits |= ((value & MASK) as u32) << OFFSET;
170        self.w
171    }
172}
173impl R {
174    #[doc = r" Value of the register as raw bits"]
175    #[inline]
176    pub fn bits(&self) -> u32 {
177        self.bits
178    }
179    #[doc = "Bit 5 - LCD Frame Control Register Synchronization flag"]
180    #[inline]
181    pub fn fcrsf(&self) -> FCRSFR {
182        let bits = {
183            const MASK: bool = true;
184            const OFFSET: u8 = 5;
185            ((self.bits >> OFFSET) & MASK as u32) != 0
186        };
187        FCRSFR { bits }
188    }
189    #[doc = "Bit 4 - Ready flag"]
190    #[inline]
191    pub fn rdy(&self) -> RDYR {
192        let bits = {
193            const MASK: bool = true;
194            const OFFSET: u8 = 4;
195            ((self.bits >> OFFSET) & MASK as u32) != 0
196        };
197        RDYR { bits }
198    }
199    #[doc = "Bit 3 - Update Display Done"]
200    #[inline]
201    pub fn udd(&self) -> UDDR {
202        let bits = {
203            const MASK: bool = true;
204            const OFFSET: u8 = 3;
205            ((self.bits >> OFFSET) & MASK as u32) != 0
206        };
207        UDDR { bits }
208    }
209    #[doc = "Bit 1 - Start of frame flag"]
210    #[inline]
211    pub fn sof(&self) -> SOFR {
212        let bits = {
213            const MASK: bool = true;
214            const OFFSET: u8 = 1;
215            ((self.bits >> OFFSET) & MASK as u32) != 0
216        };
217        SOFR { bits }
218    }
219    #[doc = "Bit 0 - ENS"]
220    #[inline]
221    pub fn ens(&self) -> ENSR {
222        let bits = {
223            const MASK: bool = true;
224            const OFFSET: u8 = 0;
225            ((self.bits >> OFFSET) & MASK as u32) != 0
226        };
227        ENSR { bits }
228    }
229}
230impl W {
231    #[doc = r" Reset value of the register"]
232    #[inline]
233    pub fn reset_value() -> W {
234        W { bits: 32 }
235    }
236    #[doc = r" Writes raw bits to the register"]
237    #[inline]
238    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
239        self.bits = bits;
240        self
241    }
242    #[doc = "Bit 2 - Update display request"]
243    #[inline]
244    pub fn udr(&mut self) -> _UDRW {
245        _UDRW { w: self }
246    }
247}