stm32wb_pac/lcd/
fcr.rs

1#[doc = "Reader of register FCR"]
2pub type R = crate::R<u32, super::FCR>;
3#[doc = "Writer for register FCR"]
4pub type W = crate::W<u32, super::FCR>;
5#[doc = "Register FCR `reset()`'s with value 0"]
6impl crate::ResetValue for super::FCR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `PS`"]
14pub type PS_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `PS`"]
16pub struct PS_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> PS_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x0f << 22)) | (((value as u32) & 0x0f) << 22);
24        self.w
25    }
26}
27#[doc = "Reader of field `DIV`"]
28pub type DIV_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `DIV`"]
30pub struct DIV_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> DIV_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x0f << 18)) | (((value as u32) & 0x0f) << 18);
38        self.w
39    }
40}
41#[doc = "Reader of field `BLINK`"]
42pub type BLINK_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `BLINK`"]
44pub struct BLINK_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> BLINK_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
52        self.w
53    }
54}
55#[doc = "Reader of field `BLINKF`"]
56pub type BLINKF_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `BLINKF`"]
58pub struct BLINKF_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> BLINKF_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x07 << 13)) | (((value as u32) & 0x07) << 13);
66        self.w
67    }
68}
69#[doc = "Reader of field `CC`"]
70pub type CC_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `CC`"]
72pub struct CC_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> CC_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x07 << 10)) | (((value as u32) & 0x07) << 10);
80        self.w
81    }
82}
83#[doc = "Reader of field `DEAD`"]
84pub type DEAD_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `DEAD`"]
86pub struct DEAD_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> DEAD_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x07 << 7)) | (((value as u32) & 0x07) << 7);
94        self.w
95    }
96}
97#[doc = "Reader of field `PON`"]
98pub type PON_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `PON`"]
100pub struct PON_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> PON_W<'a> {
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub unsafe fn bits(self, value: u8) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
108        self.w
109    }
110}
111#[doc = "Reader of field `UDDIE`"]
112pub type UDDIE_R = crate::R<bool, bool>;
113#[doc = "Write proxy for field `UDDIE`"]
114pub struct UDDIE_W<'a> {
115    w: &'a mut W,
116}
117impl<'a> UDDIE_W<'a> {
118    #[doc = r"Sets the field bit"]
119    #[inline(always)]
120    pub fn set_bit(self) -> &'a mut W {
121        self.bit(true)
122    }
123    #[doc = r"Clears the field bit"]
124    #[inline(always)]
125    pub fn clear_bit(self) -> &'a mut W {
126        self.bit(false)
127    }
128    #[doc = r"Writes raw bits to the field"]
129    #[inline(always)]
130    pub fn bit(self, value: bool) -> &'a mut W {
131        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
132        self.w
133    }
134}
135#[doc = "Reader of field `SOFIE`"]
136pub type SOFIE_R = crate::R<bool, bool>;
137#[doc = "Write proxy for field `SOFIE`"]
138pub struct SOFIE_W<'a> {
139    w: &'a mut W,
140}
141impl<'a> SOFIE_W<'a> {
142    #[doc = r"Sets the field bit"]
143    #[inline(always)]
144    pub fn set_bit(self) -> &'a mut W {
145        self.bit(true)
146    }
147    #[doc = r"Clears the field bit"]
148    #[inline(always)]
149    pub fn clear_bit(self) -> &'a mut W {
150        self.bit(false)
151    }
152    #[doc = r"Writes raw bits to the field"]
153    #[inline(always)]
154    pub fn bit(self, value: bool) -> &'a mut W {
155        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
156        self.w
157    }
158}
159#[doc = "Reader of field `HD`"]
160pub type HD_R = crate::R<bool, bool>;
161#[doc = "Write proxy for field `HD`"]
162pub struct HD_W<'a> {
163    w: &'a mut W,
164}
165impl<'a> HD_W<'a> {
166    #[doc = r"Sets the field bit"]
167    #[inline(always)]
168    pub fn set_bit(self) -> &'a mut W {
169        self.bit(true)
170    }
171    #[doc = r"Clears the field bit"]
172    #[inline(always)]
173    pub fn clear_bit(self) -> &'a mut W {
174        self.bit(false)
175    }
176    #[doc = r"Writes raw bits to the field"]
177    #[inline(always)]
178    pub fn bit(self, value: bool) -> &'a mut W {
179        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
180        self.w
181    }
182}
183impl R {
184    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
185    #[inline(always)]
186    pub fn ps(&self) -> PS_R {
187        PS_R::new(((self.bits >> 22) & 0x0f) as u8)
188    }
189    #[doc = "Bits 18:21 - DIV clock divider"]
190    #[inline(always)]
191    pub fn div(&self) -> DIV_R {
192        DIV_R::new(((self.bits >> 18) & 0x0f) as u8)
193    }
194    #[doc = "Bits 16:17 - Blink mode selection"]
195    #[inline(always)]
196    pub fn blink(&self) -> BLINK_R {
197        BLINK_R::new(((self.bits >> 16) & 0x03) as u8)
198    }
199    #[doc = "Bits 13:15 - Blink frequency selection"]
200    #[inline(always)]
201    pub fn blinkf(&self) -> BLINKF_R {
202        BLINKF_R::new(((self.bits >> 13) & 0x07) as u8)
203    }
204    #[doc = "Bits 10:12 - Contrast control"]
205    #[inline(always)]
206    pub fn cc(&self) -> CC_R {
207        CC_R::new(((self.bits >> 10) & 0x07) as u8)
208    }
209    #[doc = "Bits 7:9 - Dead time duration"]
210    #[inline(always)]
211    pub fn dead(&self) -> DEAD_R {
212        DEAD_R::new(((self.bits >> 7) & 0x07) as u8)
213    }
214    #[doc = "Bits 4:6 - Pulse ON duration"]
215    #[inline(always)]
216    pub fn pon(&self) -> PON_R {
217        PON_R::new(((self.bits >> 4) & 0x07) as u8)
218    }
219    #[doc = "Bit 3 - Update display done interrupt enable"]
220    #[inline(always)]
221    pub fn uddie(&self) -> UDDIE_R {
222        UDDIE_R::new(((self.bits >> 3) & 0x01) != 0)
223    }
224    #[doc = "Bit 1 - Start of frame interrupt enable"]
225    #[inline(always)]
226    pub fn sofie(&self) -> SOFIE_R {
227        SOFIE_R::new(((self.bits >> 1) & 0x01) != 0)
228    }
229    #[doc = "Bit 0 - High drive enable"]
230    #[inline(always)]
231    pub fn hd(&self) -> HD_R {
232        HD_R::new((self.bits & 0x01) != 0)
233    }
234}
235impl W {
236    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
237    #[inline(always)]
238    pub fn ps(&mut self) -> PS_W {
239        PS_W { w: self }
240    }
241    #[doc = "Bits 18:21 - DIV clock divider"]
242    #[inline(always)]
243    pub fn div(&mut self) -> DIV_W {
244        DIV_W { w: self }
245    }
246    #[doc = "Bits 16:17 - Blink mode selection"]
247    #[inline(always)]
248    pub fn blink(&mut self) -> BLINK_W {
249        BLINK_W { w: self }
250    }
251    #[doc = "Bits 13:15 - Blink frequency selection"]
252    #[inline(always)]
253    pub fn blinkf(&mut self) -> BLINKF_W {
254        BLINKF_W { w: self }
255    }
256    #[doc = "Bits 10:12 - Contrast control"]
257    #[inline(always)]
258    pub fn cc(&mut self) -> CC_W {
259        CC_W { w: self }
260    }
261    #[doc = "Bits 7:9 - Dead time duration"]
262    #[inline(always)]
263    pub fn dead(&mut self) -> DEAD_W {
264        DEAD_W { w: self }
265    }
266    #[doc = "Bits 4:6 - Pulse ON duration"]
267    #[inline(always)]
268    pub fn pon(&mut self) -> PON_W {
269        PON_W { w: self }
270    }
271    #[doc = "Bit 3 - Update display done interrupt enable"]
272    #[inline(always)]
273    pub fn uddie(&mut self) -> UDDIE_W {
274        UDDIE_W { w: self }
275    }
276    #[doc = "Bit 1 - Start of frame interrupt enable"]
277    #[inline(always)]
278    pub fn sofie(&mut self) -> SOFIE_W {
279        SOFIE_W { w: self }
280    }
281    #[doc = "Bit 0 - High drive enable"]
282    #[inline(always)]
283    pub fn hd(&mut self) -> HD_W {
284        HD_W { w: self }
285    }
286}