1 | #![allow (clippy::missing_safety_doc)] |
2 | #![allow (clippy::identity_op)] |
3 | #![allow (clippy::unnecessary_cast)] |
4 | #![allow (clippy::erasing_op)] |
5 | |
6 | #[doc = "Cluster LAYER%s, containing L?CR, L?WHPCR, L?WVPCR, L?CKCR, L?PFCR, L?CACR, L?DCCR, L?BFCR, L?CFBAR, L?CFBLR, L?CFBLNR, L?CLUTWR" ] |
7 | #[derive (Copy, Clone, Eq, PartialEq)] |
8 | pub struct Layer { |
9 | ptr: *mut u8, |
10 | } |
11 | unsafe impl Send for Layer {} |
12 | unsafe impl Sync for Layer {} |
13 | impl Layer { |
14 | #[inline (always)] |
15 | pub const unsafe fn from_ptr(ptr: *mut ()) -> Self { |
16 | Self { ptr: ptr as _ } |
17 | } |
18 | #[inline (always)] |
19 | pub const fn as_ptr(&self) -> *mut () { |
20 | self.ptr as _ |
21 | } |
22 | #[doc = "Layerx Control Register" ] |
23 | #[inline (always)] |
24 | pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::RW> { |
25 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) } |
26 | } |
27 | #[doc = "Layerx Window Horizontal Position Configuration Register" ] |
28 | #[inline (always)] |
29 | pub const fn whpcr(self) -> crate::common::Reg<regs::Whpcr, crate::common::RW> { |
30 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) } |
31 | } |
32 | #[doc = "Layerx Window Vertical Position Configuration Register" ] |
33 | #[inline (always)] |
34 | pub const fn wvpcr(self) -> crate::common::Reg<regs::Wvpcr, crate::common::RW> { |
35 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) } |
36 | } |
37 | #[doc = "Layerx Color Keying Configuration Register" ] |
38 | #[inline (always)] |
39 | pub const fn ckcr(self) -> crate::common::Reg<regs::Ckcr, crate::common::RW> { |
40 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) } |
41 | } |
42 | #[doc = "Layerx Pixel Format Configuration Register" ] |
43 | #[inline (always)] |
44 | pub const fn pfcr(self) -> crate::common::Reg<regs::Pfcr, crate::common::RW> { |
45 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) } |
46 | } |
47 | #[doc = "Layerx Constant Alpha Configuration Register" ] |
48 | #[inline (always)] |
49 | pub const fn cacr(self) -> crate::common::Reg<regs::Cacr, crate::common::RW> { |
50 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) } |
51 | } |
52 | #[doc = "Layerx Default Color Configuration Register" ] |
53 | #[inline (always)] |
54 | pub const fn dccr(self) -> crate::common::Reg<regs::Dccr, crate::common::RW> { |
55 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) } |
56 | } |
57 | #[doc = "Layerx Blending Factors Configuration Register" ] |
58 | #[inline (always)] |
59 | pub const fn bfcr(self) -> crate::common::Reg<regs::Bfcr, crate::common::RW> { |
60 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) } |
61 | } |
62 | #[doc = "Layerx Color Frame Buffer Address Register" ] |
63 | #[inline (always)] |
64 | pub const fn cfbar(self) -> crate::common::Reg<regs::Cfbar, crate::common::RW> { |
65 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) } |
66 | } |
67 | #[doc = "Layerx Color Frame Buffer Length Register" ] |
68 | #[inline (always)] |
69 | pub const fn cfblr(self) -> crate::common::Reg<regs::Cfblr, crate::common::RW> { |
70 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x2cusize) as _) } |
71 | } |
72 | #[doc = "Layerx ColorFrame Buffer Line Number Register" ] |
73 | #[inline (always)] |
74 | pub const fn cfblnr(self) -> crate::common::Reg<regs::Cfblnr, crate::common::RW> { |
75 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x30usize) as _) } |
76 | } |
77 | #[doc = "Layerx CLUT Write Register" ] |
78 | #[inline (always)] |
79 | pub const fn clutwr(self) -> crate::common::Reg<regs::Clutwr, crate::common::W> { |
80 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize) as _) } |
81 | } |
82 | } |
83 | #[doc = "LCD-TFT Controller" ] |
84 | #[derive (Copy, Clone, Eq, PartialEq)] |
85 | pub struct Ltdc { |
86 | ptr: *mut u8, |
87 | } |
88 | unsafe impl Send for Ltdc {} |
89 | unsafe impl Sync for Ltdc {} |
90 | impl Ltdc { |
91 | #[inline (always)] |
92 | pub const unsafe fn from_ptr(ptr: *mut ()) -> Self { |
93 | Self { ptr: ptr as _ } |
94 | } |
95 | #[inline (always)] |
96 | pub const fn as_ptr(&self) -> *mut () { |
97 | self.ptr as _ |
98 | } |
99 | #[doc = "Synchronization Size Configuration Register" ] |
100 | #[inline (always)] |
101 | pub const fn sscr(self) -> crate::common::Reg<regs::Sscr, crate::common::RW> { |
102 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) } |
103 | } |
104 | #[doc = "Back Porch Configuration Register" ] |
105 | #[inline (always)] |
106 | pub const fn bpcr(self) -> crate::common::Reg<regs::Bpcr, crate::common::RW> { |
107 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) } |
108 | } |
109 | #[doc = "Active Width Configuration Register" ] |
110 | #[inline (always)] |
111 | pub const fn awcr(self) -> crate::common::Reg<regs::Awcr, crate::common::RW> { |
112 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) } |
113 | } |
114 | #[doc = "Total Width Configuration Register" ] |
115 | #[inline (always)] |
116 | pub const fn twcr(self) -> crate::common::Reg<regs::Twcr, crate::common::RW> { |
117 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) } |
118 | } |
119 | #[doc = "Global Control Register" ] |
120 | #[inline (always)] |
121 | pub const fn gcr(self) -> crate::common::Reg<regs::Gcr, crate::common::RW> { |
122 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) } |
123 | } |
124 | #[doc = "Shadow Reload Configuration Register" ] |
125 | #[inline (always)] |
126 | pub const fn srcr(self) -> crate::common::Reg<regs::Srcr, crate::common::RW> { |
127 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) } |
128 | } |
129 | #[doc = "Background Color Configuration Register" ] |
130 | #[inline (always)] |
131 | pub const fn bccr(self) -> crate::common::Reg<regs::Bccr, crate::common::RW> { |
132 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x2cusize) as _) } |
133 | } |
134 | #[doc = "Interrupt Enable Register" ] |
135 | #[inline (always)] |
136 | pub const fn ier(self) -> crate::common::Reg<regs::Ier, crate::common::RW> { |
137 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x34usize) as _) } |
138 | } |
139 | #[doc = "Interrupt Status Register" ] |
140 | #[inline (always)] |
141 | pub const fn isr(self) -> crate::common::Reg<regs::Isr, crate::common::R> { |
142 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) } |
143 | } |
144 | #[doc = "Interrupt Clear Register" ] |
145 | #[inline (always)] |
146 | pub const fn icr(self) -> crate::common::Reg<regs::Icr, crate::common::W> { |
147 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x3cusize) as _) } |
148 | } |
149 | #[doc = "Line Interrupt Position Configuration Register" ] |
150 | #[inline (always)] |
151 | pub const fn lipcr(self) -> crate::common::Reg<regs::Lipcr, crate::common::RW> { |
152 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize) as _) } |
153 | } |
154 | #[doc = "Current Position Status Register" ] |
155 | #[inline (always)] |
156 | pub const fn cpsr(self) -> crate::common::Reg<regs::Cpsr, crate::common::R> { |
157 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x44usize) as _) } |
158 | } |
159 | #[doc = "Current Display Status Register" ] |
160 | #[inline (always)] |
161 | pub const fn cdsr(self) -> crate::common::Reg<regs::Cdsr, crate::common::R> { |
162 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x48usize) as _) } |
163 | } |
164 | #[doc = "Cluster LAYER%s, containing L?CR, L?WHPCR, L?WVPCR, L?CKCR, L?PFCR, L?CACR, L?DCCR, L?BFCR, L?CFBAR, L?CFBLR, L?CFBLNR, L?CLUTWR" ] |
165 | #[inline (always)] |
166 | pub const fn layer(self, n: usize) -> Layer { |
167 | assert!(n < 2usize); |
168 | unsafe { Layer::from_ptr(self.ptr.add(0x84usize + n * 128usize) as _) } |
169 | } |
170 | } |
171 | pub mod regs { |
172 | #[doc = "Active Width Configuration Register" ] |
173 | #[repr (transparent)] |
174 | #[derive (Copy, Clone, Eq, PartialEq)] |
175 | pub struct Awcr(pub u32); |
176 | impl Awcr { |
177 | #[doc = "Accumulated Active Height (in units of horizontal scan line)" ] |
178 | #[inline (always)] |
179 | pub const fn aah(&self) -> u16 { |
180 | let val = (self.0 >> 0usize) & 0x07ff; |
181 | val as u16 |
182 | } |
183 | #[doc = "Accumulated Active Height (in units of horizontal scan line)" ] |
184 | #[inline (always)] |
185 | pub fn set_aah(&mut self, val: u16) { |
186 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
187 | } |
188 | #[doc = "Accumulated Active Width (in units of pixel clock period)" ] |
189 | #[inline (always)] |
190 | pub const fn aaw(&self) -> u16 { |
191 | let val = (self.0 >> 16usize) & 0x0fff; |
192 | val as u16 |
193 | } |
194 | #[doc = "Accumulated Active Width (in units of pixel clock period)" ] |
195 | #[inline (always)] |
196 | pub fn set_aaw(&mut self, val: u16) { |
197 | self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize); |
198 | } |
199 | } |
200 | impl Default for Awcr { |
201 | #[inline (always)] |
202 | fn default() -> Awcr { |
203 | Awcr(0) |
204 | } |
205 | } |
206 | impl core::fmt::Debug for Awcr { |
207 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
208 | f.debug_struct("Awcr" ) |
209 | .field("aah" , &self.aah()) |
210 | .field("aaw" , &self.aaw()) |
211 | .finish() |
212 | } |
213 | } |
214 | #[cfg (feature = "defmt" )] |
215 | impl defmt::Format for Awcr { |
216 | fn format(&self, f: defmt::Formatter) { |
217 | #[derive (defmt :: Format)] |
218 | struct Awcr { |
219 | aah: u16, |
220 | aaw: u16, |
221 | } |
222 | let proxy = Awcr { |
223 | aah: self.aah(), |
224 | aaw: self.aaw(), |
225 | }; |
226 | defmt::write!(f, "{}" , proxy) |
227 | } |
228 | } |
229 | #[doc = "Background Color Configuration Register" ] |
230 | #[repr (transparent)] |
231 | #[derive (Copy, Clone, Eq, PartialEq)] |
232 | pub struct Bccr(pub u32); |
233 | impl Bccr { |
234 | #[doc = "Background color blue value" ] |
235 | #[inline (always)] |
236 | pub const fn bcblue(&self) -> u8 { |
237 | let val = (self.0 >> 0usize) & 0xff; |
238 | val as u8 |
239 | } |
240 | #[doc = "Background color blue value" ] |
241 | #[inline (always)] |
242 | pub fn set_bcblue(&mut self, val: u8) { |
243 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
244 | } |
245 | #[doc = "Background color green value" ] |
246 | #[inline (always)] |
247 | pub const fn bcgreen(&self) -> u8 { |
248 | let val = (self.0 >> 8usize) & 0xff; |
249 | val as u8 |
250 | } |
251 | #[doc = "Background color green value" ] |
252 | #[inline (always)] |
253 | pub fn set_bcgreen(&mut self, val: u8) { |
254 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
255 | } |
256 | #[doc = "Background color red value" ] |
257 | #[inline (always)] |
258 | pub const fn bcred(&self) -> u8 { |
259 | let val = (self.0 >> 16usize) & 0xff; |
260 | val as u8 |
261 | } |
262 | #[doc = "Background color red value" ] |
263 | #[inline (always)] |
264 | pub fn set_bcred(&mut self, val: u8) { |
265 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
266 | } |
267 | } |
268 | impl Default for Bccr { |
269 | #[inline (always)] |
270 | fn default() -> Bccr { |
271 | Bccr(0) |
272 | } |
273 | } |
274 | impl core::fmt::Debug for Bccr { |
275 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
276 | f.debug_struct("Bccr" ) |
277 | .field("bcblue" , &self.bcblue()) |
278 | .field("bcgreen" , &self.bcgreen()) |
279 | .field("bcred" , &self.bcred()) |
280 | .finish() |
281 | } |
282 | } |
283 | #[cfg (feature = "defmt" )] |
284 | impl defmt::Format for Bccr { |
285 | fn format(&self, f: defmt::Formatter) { |
286 | #[derive (defmt :: Format)] |
287 | struct Bccr { |
288 | bcblue: u8, |
289 | bcgreen: u8, |
290 | bcred: u8, |
291 | } |
292 | let proxy = Bccr { |
293 | bcblue: self.bcblue(), |
294 | bcgreen: self.bcgreen(), |
295 | bcred: self.bcred(), |
296 | }; |
297 | defmt::write!(f, "{}" , proxy) |
298 | } |
299 | } |
300 | #[doc = "Layerx Blending Factors Configuration Register" ] |
301 | #[repr (transparent)] |
302 | #[derive (Copy, Clone, Eq, PartialEq)] |
303 | pub struct Bfcr(pub u32); |
304 | impl Bfcr { |
305 | #[doc = "Blending Factor 2" ] |
306 | #[inline (always)] |
307 | pub const fn bf2(&self) -> super::vals::Bf2 { |
308 | let val = (self.0 >> 0usize) & 0x07; |
309 | super::vals::Bf2::from_bits(val as u8) |
310 | } |
311 | #[doc = "Blending Factor 2" ] |
312 | #[inline (always)] |
313 | pub fn set_bf2(&mut self, val: super::vals::Bf2) { |
314 | self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize); |
315 | } |
316 | #[doc = "Blending Factor 1" ] |
317 | #[inline (always)] |
318 | pub const fn bf1(&self) -> super::vals::Bf1 { |
319 | let val = (self.0 >> 8usize) & 0x07; |
320 | super::vals::Bf1::from_bits(val as u8) |
321 | } |
322 | #[doc = "Blending Factor 1" ] |
323 | #[inline (always)] |
324 | pub fn set_bf1(&mut self, val: super::vals::Bf1) { |
325 | self.0 = (self.0 & !(0x07 << 8usize)) | (((val.to_bits() as u32) & 0x07) << 8usize); |
326 | } |
327 | } |
328 | impl Default for Bfcr { |
329 | #[inline (always)] |
330 | fn default() -> Bfcr { |
331 | Bfcr(0) |
332 | } |
333 | } |
334 | impl core::fmt::Debug for Bfcr { |
335 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
336 | f.debug_struct("Bfcr" ) |
337 | .field("bf2" , &self.bf2()) |
338 | .field("bf1" , &self.bf1()) |
339 | .finish() |
340 | } |
341 | } |
342 | #[cfg (feature = "defmt" )] |
343 | impl defmt::Format for Bfcr { |
344 | fn format(&self, f: defmt::Formatter) { |
345 | #[derive (defmt :: Format)] |
346 | struct Bfcr { |
347 | bf2: super::vals::Bf2, |
348 | bf1: super::vals::Bf1, |
349 | } |
350 | let proxy = Bfcr { |
351 | bf2: self.bf2(), |
352 | bf1: self.bf1(), |
353 | }; |
354 | defmt::write!(f, "{}" , proxy) |
355 | } |
356 | } |
357 | #[doc = "Back Porch Configuration Register" ] |
358 | #[repr (transparent)] |
359 | #[derive (Copy, Clone, Eq, PartialEq)] |
360 | pub struct Bpcr(pub u32); |
361 | impl Bpcr { |
362 | #[doc = "Accumulated Vertical back porch (in units of horizontal scan line)" ] |
363 | #[inline (always)] |
364 | pub const fn avbp(&self) -> u16 { |
365 | let val = (self.0 >> 0usize) & 0x07ff; |
366 | val as u16 |
367 | } |
368 | #[doc = "Accumulated Vertical back porch (in units of horizontal scan line)" ] |
369 | #[inline (always)] |
370 | pub fn set_avbp(&mut self, val: u16) { |
371 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
372 | } |
373 | #[doc = "Accumulated Horizontal back porch (in units of pixel clock period)" ] |
374 | #[inline (always)] |
375 | pub const fn ahbp(&self) -> u16 { |
376 | let val = (self.0 >> 16usize) & 0x0fff; |
377 | val as u16 |
378 | } |
379 | #[doc = "Accumulated Horizontal back porch (in units of pixel clock period)" ] |
380 | #[inline (always)] |
381 | pub fn set_ahbp(&mut self, val: u16) { |
382 | self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize); |
383 | } |
384 | } |
385 | impl Default for Bpcr { |
386 | #[inline (always)] |
387 | fn default() -> Bpcr { |
388 | Bpcr(0) |
389 | } |
390 | } |
391 | impl core::fmt::Debug for Bpcr { |
392 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
393 | f.debug_struct("Bpcr" ) |
394 | .field("avbp" , &self.avbp()) |
395 | .field("ahbp" , &self.ahbp()) |
396 | .finish() |
397 | } |
398 | } |
399 | #[cfg (feature = "defmt" )] |
400 | impl defmt::Format for Bpcr { |
401 | fn format(&self, f: defmt::Formatter) { |
402 | #[derive (defmt :: Format)] |
403 | struct Bpcr { |
404 | avbp: u16, |
405 | ahbp: u16, |
406 | } |
407 | let proxy = Bpcr { |
408 | avbp: self.avbp(), |
409 | ahbp: self.ahbp(), |
410 | }; |
411 | defmt::write!(f, "{}" , proxy) |
412 | } |
413 | } |
414 | #[doc = "Layerx Constant Alpha Configuration Register" ] |
415 | #[repr (transparent)] |
416 | #[derive (Copy, Clone, Eq, PartialEq)] |
417 | pub struct Cacr(pub u32); |
418 | impl Cacr { |
419 | #[doc = "Constant Alpha" ] |
420 | #[inline (always)] |
421 | pub const fn consta(&self) -> u8 { |
422 | let val = (self.0 >> 0usize) & 0xff; |
423 | val as u8 |
424 | } |
425 | #[doc = "Constant Alpha" ] |
426 | #[inline (always)] |
427 | pub fn set_consta(&mut self, val: u8) { |
428 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
429 | } |
430 | } |
431 | impl Default for Cacr { |
432 | #[inline (always)] |
433 | fn default() -> Cacr { |
434 | Cacr(0) |
435 | } |
436 | } |
437 | impl core::fmt::Debug for Cacr { |
438 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
439 | f.debug_struct("Cacr" ).field("consta" , &self.consta()).finish() |
440 | } |
441 | } |
442 | #[cfg (feature = "defmt" )] |
443 | impl defmt::Format for Cacr { |
444 | fn format(&self, f: defmt::Formatter) { |
445 | #[derive (defmt :: Format)] |
446 | struct Cacr { |
447 | consta: u8, |
448 | } |
449 | let proxy = Cacr { consta: self.consta() }; |
450 | defmt::write!(f, "{}" , proxy) |
451 | } |
452 | } |
453 | #[doc = "Current Display Status Register" ] |
454 | #[repr (transparent)] |
455 | #[derive (Copy, Clone, Eq, PartialEq)] |
456 | pub struct Cdsr(pub u32); |
457 | impl Cdsr { |
458 | #[doc = "Vertical Data Enable display Status" ] |
459 | #[inline (always)] |
460 | pub const fn vdes(&self) -> bool { |
461 | let val = (self.0 >> 0usize) & 0x01; |
462 | val != 0 |
463 | } |
464 | #[doc = "Vertical Data Enable display Status" ] |
465 | #[inline (always)] |
466 | pub fn set_vdes(&mut self, val: bool) { |
467 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
468 | } |
469 | #[doc = "Horizontal Data Enable display Status" ] |
470 | #[inline (always)] |
471 | pub const fn hdes(&self) -> bool { |
472 | let val = (self.0 >> 1usize) & 0x01; |
473 | val != 0 |
474 | } |
475 | #[doc = "Horizontal Data Enable display Status" ] |
476 | #[inline (always)] |
477 | pub fn set_hdes(&mut self, val: bool) { |
478 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
479 | } |
480 | #[doc = "Vertical Synchronization display Status" ] |
481 | #[inline (always)] |
482 | pub const fn vsyncs(&self) -> bool { |
483 | let val = (self.0 >> 2usize) & 0x01; |
484 | val != 0 |
485 | } |
486 | #[doc = "Vertical Synchronization display Status" ] |
487 | #[inline (always)] |
488 | pub fn set_vsyncs(&mut self, val: bool) { |
489 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
490 | } |
491 | #[doc = "Horizontal Synchronization display Status" ] |
492 | #[inline (always)] |
493 | pub const fn hsyncs(&self) -> bool { |
494 | let val = (self.0 >> 3usize) & 0x01; |
495 | val != 0 |
496 | } |
497 | #[doc = "Horizontal Synchronization display Status" ] |
498 | #[inline (always)] |
499 | pub fn set_hsyncs(&mut self, val: bool) { |
500 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
501 | } |
502 | } |
503 | impl Default for Cdsr { |
504 | #[inline (always)] |
505 | fn default() -> Cdsr { |
506 | Cdsr(0) |
507 | } |
508 | } |
509 | impl core::fmt::Debug for Cdsr { |
510 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
511 | f.debug_struct("Cdsr" ) |
512 | .field("vdes" , &self.vdes()) |
513 | .field("hdes" , &self.hdes()) |
514 | .field("vsyncs" , &self.vsyncs()) |
515 | .field("hsyncs" , &self.hsyncs()) |
516 | .finish() |
517 | } |
518 | } |
519 | #[cfg (feature = "defmt" )] |
520 | impl defmt::Format for Cdsr { |
521 | fn format(&self, f: defmt::Formatter) { |
522 | #[derive (defmt :: Format)] |
523 | struct Cdsr { |
524 | vdes: bool, |
525 | hdes: bool, |
526 | vsyncs: bool, |
527 | hsyncs: bool, |
528 | } |
529 | let proxy = Cdsr { |
530 | vdes: self.vdes(), |
531 | hdes: self.hdes(), |
532 | vsyncs: self.vsyncs(), |
533 | hsyncs: self.hsyncs(), |
534 | }; |
535 | defmt::write!(f, "{}" , proxy) |
536 | } |
537 | } |
538 | #[doc = "Layerx Color Frame Buffer Address Register" ] |
539 | #[repr (transparent)] |
540 | #[derive (Copy, Clone, Eq, PartialEq)] |
541 | pub struct Cfbar(pub u32); |
542 | impl Cfbar { |
543 | #[doc = "Color Frame Buffer Start Address" ] |
544 | #[inline (always)] |
545 | pub const fn cfbadd(&self) -> u32 { |
546 | let val = (self.0 >> 0usize) & 0xffff_ffff; |
547 | val as u32 |
548 | } |
549 | #[doc = "Color Frame Buffer Start Address" ] |
550 | #[inline (always)] |
551 | pub fn set_cfbadd(&mut self, val: u32) { |
552 | self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize); |
553 | } |
554 | } |
555 | impl Default for Cfbar { |
556 | #[inline (always)] |
557 | fn default() -> Cfbar { |
558 | Cfbar(0) |
559 | } |
560 | } |
561 | impl core::fmt::Debug for Cfbar { |
562 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
563 | f.debug_struct("Cfbar" ).field("cfbadd" , &self.cfbadd()).finish() |
564 | } |
565 | } |
566 | #[cfg (feature = "defmt" )] |
567 | impl defmt::Format for Cfbar { |
568 | fn format(&self, f: defmt::Formatter) { |
569 | #[derive (defmt :: Format)] |
570 | struct Cfbar { |
571 | cfbadd: u32, |
572 | } |
573 | let proxy = Cfbar { cfbadd: self.cfbadd() }; |
574 | defmt::write!(f, "{}" , proxy) |
575 | } |
576 | } |
577 | #[doc = "Layerx ColorFrame Buffer Line Number Register" ] |
578 | #[repr (transparent)] |
579 | #[derive (Copy, Clone, Eq, PartialEq)] |
580 | pub struct Cfblnr(pub u32); |
581 | impl Cfblnr { |
582 | #[doc = "Frame Buffer Line Number" ] |
583 | #[inline (always)] |
584 | pub const fn cfblnbr(&self) -> u16 { |
585 | let val = (self.0 >> 0usize) & 0x07ff; |
586 | val as u16 |
587 | } |
588 | #[doc = "Frame Buffer Line Number" ] |
589 | #[inline (always)] |
590 | pub fn set_cfblnbr(&mut self, val: u16) { |
591 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
592 | } |
593 | } |
594 | impl Default for Cfblnr { |
595 | #[inline (always)] |
596 | fn default() -> Cfblnr { |
597 | Cfblnr(0) |
598 | } |
599 | } |
600 | impl core::fmt::Debug for Cfblnr { |
601 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
602 | f.debug_struct("Cfblnr" ).field("cfblnbr" , &self.cfblnbr()).finish() |
603 | } |
604 | } |
605 | #[cfg (feature = "defmt" )] |
606 | impl defmt::Format for Cfblnr { |
607 | fn format(&self, f: defmt::Formatter) { |
608 | #[derive (defmt :: Format)] |
609 | struct Cfblnr { |
610 | cfblnbr: u16, |
611 | } |
612 | let proxy = Cfblnr { |
613 | cfblnbr: self.cfblnbr(), |
614 | }; |
615 | defmt::write!(f, "{}" , proxy) |
616 | } |
617 | } |
618 | #[doc = "Layerx Color Frame Buffer Length Register" ] |
619 | #[repr (transparent)] |
620 | #[derive (Copy, Clone, Eq, PartialEq)] |
621 | pub struct Cfblr(pub u32); |
622 | impl Cfblr { |
623 | #[doc = "Color Frame Buffer Line Length" ] |
624 | #[inline (always)] |
625 | pub const fn cfbll(&self) -> u16 { |
626 | let val = (self.0 >> 0usize) & 0x1fff; |
627 | val as u16 |
628 | } |
629 | #[doc = "Color Frame Buffer Line Length" ] |
630 | #[inline (always)] |
631 | pub fn set_cfbll(&mut self, val: u16) { |
632 | self.0 = (self.0 & !(0x1fff << 0usize)) | (((val as u32) & 0x1fff) << 0usize); |
633 | } |
634 | #[doc = "Color Frame Buffer Pitch in bytes" ] |
635 | #[inline (always)] |
636 | pub const fn cfbp(&self) -> u16 { |
637 | let val = (self.0 >> 16usize) & 0x1fff; |
638 | val as u16 |
639 | } |
640 | #[doc = "Color Frame Buffer Pitch in bytes" ] |
641 | #[inline (always)] |
642 | pub fn set_cfbp(&mut self, val: u16) { |
643 | self.0 = (self.0 & !(0x1fff << 16usize)) | (((val as u32) & 0x1fff) << 16usize); |
644 | } |
645 | } |
646 | impl Default for Cfblr { |
647 | #[inline (always)] |
648 | fn default() -> Cfblr { |
649 | Cfblr(0) |
650 | } |
651 | } |
652 | impl core::fmt::Debug for Cfblr { |
653 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
654 | f.debug_struct("Cfblr" ) |
655 | .field("cfbll" , &self.cfbll()) |
656 | .field("cfbp" , &self.cfbp()) |
657 | .finish() |
658 | } |
659 | } |
660 | #[cfg (feature = "defmt" )] |
661 | impl defmt::Format for Cfblr { |
662 | fn format(&self, f: defmt::Formatter) { |
663 | #[derive (defmt :: Format)] |
664 | struct Cfblr { |
665 | cfbll: u16, |
666 | cfbp: u16, |
667 | } |
668 | let proxy = Cfblr { |
669 | cfbll: self.cfbll(), |
670 | cfbp: self.cfbp(), |
671 | }; |
672 | defmt::write!(f, "{}" , proxy) |
673 | } |
674 | } |
675 | #[doc = "Layerx Color Keying Configuration Register" ] |
676 | #[repr (transparent)] |
677 | #[derive (Copy, Clone, Eq, PartialEq)] |
678 | pub struct Ckcr(pub u32); |
679 | impl Ckcr { |
680 | #[doc = "Color Key Blue value" ] |
681 | #[inline (always)] |
682 | pub const fn ckblue(&self) -> u8 { |
683 | let val = (self.0 >> 0usize) & 0xff; |
684 | val as u8 |
685 | } |
686 | #[doc = "Color Key Blue value" ] |
687 | #[inline (always)] |
688 | pub fn set_ckblue(&mut self, val: u8) { |
689 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
690 | } |
691 | #[doc = "Color Key Green value" ] |
692 | #[inline (always)] |
693 | pub const fn ckgreen(&self) -> u8 { |
694 | let val = (self.0 >> 8usize) & 0xff; |
695 | val as u8 |
696 | } |
697 | #[doc = "Color Key Green value" ] |
698 | #[inline (always)] |
699 | pub fn set_ckgreen(&mut self, val: u8) { |
700 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
701 | } |
702 | #[doc = "Color Key Red value" ] |
703 | #[inline (always)] |
704 | pub const fn ckred(&self) -> u8 { |
705 | let val = (self.0 >> 16usize) & 0xff; |
706 | val as u8 |
707 | } |
708 | #[doc = "Color Key Red value" ] |
709 | #[inline (always)] |
710 | pub fn set_ckred(&mut self, val: u8) { |
711 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
712 | } |
713 | } |
714 | impl Default for Ckcr { |
715 | #[inline (always)] |
716 | fn default() -> Ckcr { |
717 | Ckcr(0) |
718 | } |
719 | } |
720 | impl core::fmt::Debug for Ckcr { |
721 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
722 | f.debug_struct("Ckcr" ) |
723 | .field("ckblue" , &self.ckblue()) |
724 | .field("ckgreen" , &self.ckgreen()) |
725 | .field("ckred" , &self.ckred()) |
726 | .finish() |
727 | } |
728 | } |
729 | #[cfg (feature = "defmt" )] |
730 | impl defmt::Format for Ckcr { |
731 | fn format(&self, f: defmt::Formatter) { |
732 | #[derive (defmt :: Format)] |
733 | struct Ckcr { |
734 | ckblue: u8, |
735 | ckgreen: u8, |
736 | ckred: u8, |
737 | } |
738 | let proxy = Ckcr { |
739 | ckblue: self.ckblue(), |
740 | ckgreen: self.ckgreen(), |
741 | ckred: self.ckred(), |
742 | }; |
743 | defmt::write!(f, "{}" , proxy) |
744 | } |
745 | } |
746 | #[doc = "Layerx CLUT Write Register" ] |
747 | #[repr (transparent)] |
748 | #[derive (Copy, Clone, Eq, PartialEq)] |
749 | pub struct Clutwr(pub u32); |
750 | impl Clutwr { |
751 | #[doc = "Blue value" ] |
752 | #[inline (always)] |
753 | pub const fn blue(&self) -> u8 { |
754 | let val = (self.0 >> 0usize) & 0xff; |
755 | val as u8 |
756 | } |
757 | #[doc = "Blue value" ] |
758 | #[inline (always)] |
759 | pub fn set_blue(&mut self, val: u8) { |
760 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
761 | } |
762 | #[doc = "Green value" ] |
763 | #[inline (always)] |
764 | pub const fn green(&self) -> u8 { |
765 | let val = (self.0 >> 8usize) & 0xff; |
766 | val as u8 |
767 | } |
768 | #[doc = "Green value" ] |
769 | #[inline (always)] |
770 | pub fn set_green(&mut self, val: u8) { |
771 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
772 | } |
773 | #[doc = "Red value" ] |
774 | #[inline (always)] |
775 | pub const fn red(&self) -> u8 { |
776 | let val = (self.0 >> 16usize) & 0xff; |
777 | val as u8 |
778 | } |
779 | #[doc = "Red value" ] |
780 | #[inline (always)] |
781 | pub fn set_red(&mut self, val: u8) { |
782 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
783 | } |
784 | #[doc = "CLUT Address" ] |
785 | #[inline (always)] |
786 | pub const fn clutadd(&self) -> u8 { |
787 | let val = (self.0 >> 24usize) & 0xff; |
788 | val as u8 |
789 | } |
790 | #[doc = "CLUT Address" ] |
791 | #[inline (always)] |
792 | pub fn set_clutadd(&mut self, val: u8) { |
793 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
794 | } |
795 | } |
796 | impl Default for Clutwr { |
797 | #[inline (always)] |
798 | fn default() -> Clutwr { |
799 | Clutwr(0) |
800 | } |
801 | } |
802 | impl core::fmt::Debug for Clutwr { |
803 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
804 | f.debug_struct("Clutwr" ) |
805 | .field("blue" , &self.blue()) |
806 | .field("green" , &self.green()) |
807 | .field("red" , &self.red()) |
808 | .field("clutadd" , &self.clutadd()) |
809 | .finish() |
810 | } |
811 | } |
812 | #[cfg (feature = "defmt" )] |
813 | impl defmt::Format for Clutwr { |
814 | fn format(&self, f: defmt::Formatter) { |
815 | #[derive (defmt :: Format)] |
816 | struct Clutwr { |
817 | blue: u8, |
818 | green: u8, |
819 | red: u8, |
820 | clutadd: u8, |
821 | } |
822 | let proxy = Clutwr { |
823 | blue: self.blue(), |
824 | green: self.green(), |
825 | red: self.red(), |
826 | clutadd: self.clutadd(), |
827 | }; |
828 | defmt::write!(f, "{}" , proxy) |
829 | } |
830 | } |
831 | #[doc = "Current Position Status Register" ] |
832 | #[repr (transparent)] |
833 | #[derive (Copy, Clone, Eq, PartialEq)] |
834 | pub struct Cpsr(pub u32); |
835 | impl Cpsr { |
836 | #[doc = "Current Y Position" ] |
837 | #[inline (always)] |
838 | pub const fn cypos(&self) -> u16 { |
839 | let val = (self.0 >> 0usize) & 0xffff; |
840 | val as u16 |
841 | } |
842 | #[doc = "Current Y Position" ] |
843 | #[inline (always)] |
844 | pub fn set_cypos(&mut self, val: u16) { |
845 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
846 | } |
847 | #[doc = "Current X Position" ] |
848 | #[inline (always)] |
849 | pub const fn cxpos(&self) -> u16 { |
850 | let val = (self.0 >> 16usize) & 0xffff; |
851 | val as u16 |
852 | } |
853 | #[doc = "Current X Position" ] |
854 | #[inline (always)] |
855 | pub fn set_cxpos(&mut self, val: u16) { |
856 | self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize); |
857 | } |
858 | } |
859 | impl Default for Cpsr { |
860 | #[inline (always)] |
861 | fn default() -> Cpsr { |
862 | Cpsr(0) |
863 | } |
864 | } |
865 | impl core::fmt::Debug for Cpsr { |
866 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
867 | f.debug_struct("Cpsr" ) |
868 | .field("cypos" , &self.cypos()) |
869 | .field("cxpos" , &self.cxpos()) |
870 | .finish() |
871 | } |
872 | } |
873 | #[cfg (feature = "defmt" )] |
874 | impl defmt::Format for Cpsr { |
875 | fn format(&self, f: defmt::Formatter) { |
876 | #[derive (defmt :: Format)] |
877 | struct Cpsr { |
878 | cypos: u16, |
879 | cxpos: u16, |
880 | } |
881 | let proxy = Cpsr { |
882 | cypos: self.cypos(), |
883 | cxpos: self.cxpos(), |
884 | }; |
885 | defmt::write!(f, "{}" , proxy) |
886 | } |
887 | } |
888 | #[doc = "Layerx Control Register" ] |
889 | #[repr (transparent)] |
890 | #[derive (Copy, Clone, Eq, PartialEq)] |
891 | pub struct Cr(pub u32); |
892 | impl Cr { |
893 | #[doc = "Layer Enable" ] |
894 | #[inline (always)] |
895 | pub const fn len(&self) -> bool { |
896 | let val = (self.0 >> 0usize) & 0x01; |
897 | val != 0 |
898 | } |
899 | #[doc = "Layer Enable" ] |
900 | #[inline (always)] |
901 | pub fn set_len(&mut self, val: bool) { |
902 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
903 | } |
904 | #[doc = "Color Keying Enable" ] |
905 | #[inline (always)] |
906 | pub const fn colken(&self) -> bool { |
907 | let val = (self.0 >> 1usize) & 0x01; |
908 | val != 0 |
909 | } |
910 | #[doc = "Color Keying Enable" ] |
911 | #[inline (always)] |
912 | pub fn set_colken(&mut self, val: bool) { |
913 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
914 | } |
915 | #[doc = "Color Look-Up Table Enable" ] |
916 | #[inline (always)] |
917 | pub const fn cluten(&self) -> bool { |
918 | let val = (self.0 >> 4usize) & 0x01; |
919 | val != 0 |
920 | } |
921 | #[doc = "Color Look-Up Table Enable" ] |
922 | #[inline (always)] |
923 | pub fn set_cluten(&mut self, val: bool) { |
924 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
925 | } |
926 | } |
927 | impl Default for Cr { |
928 | #[inline (always)] |
929 | fn default() -> Cr { |
930 | Cr(0) |
931 | } |
932 | } |
933 | impl core::fmt::Debug for Cr { |
934 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
935 | f.debug_struct("Cr" ) |
936 | .field("len" , &self.len()) |
937 | .field("colken" , &self.colken()) |
938 | .field("cluten" , &self.cluten()) |
939 | .finish() |
940 | } |
941 | } |
942 | #[cfg (feature = "defmt" )] |
943 | impl defmt::Format for Cr { |
944 | fn format(&self, f: defmt::Formatter) { |
945 | #[derive (defmt :: Format)] |
946 | struct Cr { |
947 | len: bool, |
948 | colken: bool, |
949 | cluten: bool, |
950 | } |
951 | let proxy = Cr { |
952 | len: self.len(), |
953 | colken: self.colken(), |
954 | cluten: self.cluten(), |
955 | }; |
956 | defmt::write!(f, "{}" , proxy) |
957 | } |
958 | } |
959 | #[doc = "Layerx Default Color Configuration Register" ] |
960 | #[repr (transparent)] |
961 | #[derive (Copy, Clone, Eq, PartialEq)] |
962 | pub struct Dccr(pub u32); |
963 | impl Dccr { |
964 | #[doc = "Default Color Blue" ] |
965 | #[inline (always)] |
966 | pub const fn dcblue(&self) -> u8 { |
967 | let val = (self.0 >> 0usize) & 0xff; |
968 | val as u8 |
969 | } |
970 | #[doc = "Default Color Blue" ] |
971 | #[inline (always)] |
972 | pub fn set_dcblue(&mut self, val: u8) { |
973 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
974 | } |
975 | #[doc = "Default Color Green" ] |
976 | #[inline (always)] |
977 | pub const fn dcgreen(&self) -> u8 { |
978 | let val = (self.0 >> 8usize) & 0xff; |
979 | val as u8 |
980 | } |
981 | #[doc = "Default Color Green" ] |
982 | #[inline (always)] |
983 | pub fn set_dcgreen(&mut self, val: u8) { |
984 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
985 | } |
986 | #[doc = "Default Color Red" ] |
987 | #[inline (always)] |
988 | pub const fn dcred(&self) -> u8 { |
989 | let val = (self.0 >> 16usize) & 0xff; |
990 | val as u8 |
991 | } |
992 | #[doc = "Default Color Red" ] |
993 | #[inline (always)] |
994 | pub fn set_dcred(&mut self, val: u8) { |
995 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
996 | } |
997 | #[doc = "Default Color Alpha" ] |
998 | #[inline (always)] |
999 | pub const fn dcalpha(&self) -> u8 { |
1000 | let val = (self.0 >> 24usize) & 0xff; |
1001 | val as u8 |
1002 | } |
1003 | #[doc = "Default Color Alpha" ] |
1004 | #[inline (always)] |
1005 | pub fn set_dcalpha(&mut self, val: u8) { |
1006 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
1007 | } |
1008 | } |
1009 | impl Default for Dccr { |
1010 | #[inline (always)] |
1011 | fn default() -> Dccr { |
1012 | Dccr(0) |
1013 | } |
1014 | } |
1015 | impl core::fmt::Debug for Dccr { |
1016 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1017 | f.debug_struct("Dccr" ) |
1018 | .field("dcblue" , &self.dcblue()) |
1019 | .field("dcgreen" , &self.dcgreen()) |
1020 | .field("dcred" , &self.dcred()) |
1021 | .field("dcalpha" , &self.dcalpha()) |
1022 | .finish() |
1023 | } |
1024 | } |
1025 | #[cfg (feature = "defmt" )] |
1026 | impl defmt::Format for Dccr { |
1027 | fn format(&self, f: defmt::Formatter) { |
1028 | #[derive (defmt :: Format)] |
1029 | struct Dccr { |
1030 | dcblue: u8, |
1031 | dcgreen: u8, |
1032 | dcred: u8, |
1033 | dcalpha: u8, |
1034 | } |
1035 | let proxy = Dccr { |
1036 | dcblue: self.dcblue(), |
1037 | dcgreen: self.dcgreen(), |
1038 | dcred: self.dcred(), |
1039 | dcalpha: self.dcalpha(), |
1040 | }; |
1041 | defmt::write!(f, "{}" , proxy) |
1042 | } |
1043 | } |
1044 | #[doc = "Global Control Register" ] |
1045 | #[repr (transparent)] |
1046 | #[derive (Copy, Clone, Eq, PartialEq)] |
1047 | pub struct Gcr(pub u32); |
1048 | impl Gcr { |
1049 | #[doc = "LCD-TFT controller enable bit" ] |
1050 | #[inline (always)] |
1051 | pub const fn ltdcen(&self) -> bool { |
1052 | let val = (self.0 >> 0usize) & 0x01; |
1053 | val != 0 |
1054 | } |
1055 | #[doc = "LCD-TFT controller enable bit" ] |
1056 | #[inline (always)] |
1057 | pub fn set_ltdcen(&mut self, val: bool) { |
1058 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1059 | } |
1060 | #[doc = "Dither Blue Width" ] |
1061 | #[inline (always)] |
1062 | pub const fn dbw(&self) -> u8 { |
1063 | let val = (self.0 >> 4usize) & 0x07; |
1064 | val as u8 |
1065 | } |
1066 | #[doc = "Dither Blue Width" ] |
1067 | #[inline (always)] |
1068 | pub fn set_dbw(&mut self, val: u8) { |
1069 | self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize); |
1070 | } |
1071 | #[doc = "Dither Green Width" ] |
1072 | #[inline (always)] |
1073 | pub const fn dgw(&self) -> u8 { |
1074 | let val = (self.0 >> 8usize) & 0x07; |
1075 | val as u8 |
1076 | } |
1077 | #[doc = "Dither Green Width" ] |
1078 | #[inline (always)] |
1079 | pub fn set_dgw(&mut self, val: u8) { |
1080 | self.0 = (self.0 & !(0x07 << 8usize)) | (((val as u32) & 0x07) << 8usize); |
1081 | } |
1082 | #[doc = "Dither Red Width" ] |
1083 | #[inline (always)] |
1084 | pub const fn drw(&self) -> u8 { |
1085 | let val = (self.0 >> 12usize) & 0x07; |
1086 | val as u8 |
1087 | } |
1088 | #[doc = "Dither Red Width" ] |
1089 | #[inline (always)] |
1090 | pub fn set_drw(&mut self, val: u8) { |
1091 | self.0 = (self.0 & !(0x07 << 12usize)) | (((val as u32) & 0x07) << 12usize); |
1092 | } |
1093 | #[doc = "Dither Enable" ] |
1094 | #[inline (always)] |
1095 | pub const fn den(&self) -> bool { |
1096 | let val = (self.0 >> 16usize) & 0x01; |
1097 | val != 0 |
1098 | } |
1099 | #[doc = "Dither Enable" ] |
1100 | #[inline (always)] |
1101 | pub fn set_den(&mut self, val: bool) { |
1102 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
1103 | } |
1104 | #[doc = "Pixel Clock Polarity" ] |
1105 | #[inline (always)] |
1106 | pub const fn pcpol(&self) -> super::vals::Pcpol { |
1107 | let val = (self.0 >> 28usize) & 0x01; |
1108 | super::vals::Pcpol::from_bits(val as u8) |
1109 | } |
1110 | #[doc = "Pixel Clock Polarity" ] |
1111 | #[inline (always)] |
1112 | pub fn set_pcpol(&mut self, val: super::vals::Pcpol) { |
1113 | self.0 = (self.0 & !(0x01 << 28usize)) | (((val.to_bits() as u32) & 0x01) << 28usize); |
1114 | } |
1115 | #[doc = "Data Enable Polarity" ] |
1116 | #[inline (always)] |
1117 | pub const fn depol(&self) -> super::vals::Depol { |
1118 | let val = (self.0 >> 29usize) & 0x01; |
1119 | super::vals::Depol::from_bits(val as u8) |
1120 | } |
1121 | #[doc = "Data Enable Polarity" ] |
1122 | #[inline (always)] |
1123 | pub fn set_depol(&mut self, val: super::vals::Depol) { |
1124 | self.0 = (self.0 & !(0x01 << 29usize)) | (((val.to_bits() as u32) & 0x01) << 29usize); |
1125 | } |
1126 | #[doc = "Vertical Synchronization Polarity" ] |
1127 | #[inline (always)] |
1128 | pub const fn vspol(&self) -> super::vals::Vspol { |
1129 | let val = (self.0 >> 30usize) & 0x01; |
1130 | super::vals::Vspol::from_bits(val as u8) |
1131 | } |
1132 | #[doc = "Vertical Synchronization Polarity" ] |
1133 | #[inline (always)] |
1134 | pub fn set_vspol(&mut self, val: super::vals::Vspol) { |
1135 | self.0 = (self.0 & !(0x01 << 30usize)) | (((val.to_bits() as u32) & 0x01) << 30usize); |
1136 | } |
1137 | #[doc = "Horizontal Synchronization Polarity" ] |
1138 | #[inline (always)] |
1139 | pub const fn hspol(&self) -> super::vals::Hspol { |
1140 | let val = (self.0 >> 31usize) & 0x01; |
1141 | super::vals::Hspol::from_bits(val as u8) |
1142 | } |
1143 | #[doc = "Horizontal Synchronization Polarity" ] |
1144 | #[inline (always)] |
1145 | pub fn set_hspol(&mut self, val: super::vals::Hspol) { |
1146 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize); |
1147 | } |
1148 | } |
1149 | impl Default for Gcr { |
1150 | #[inline (always)] |
1151 | fn default() -> Gcr { |
1152 | Gcr(0) |
1153 | } |
1154 | } |
1155 | impl core::fmt::Debug for Gcr { |
1156 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1157 | f.debug_struct("Gcr" ) |
1158 | .field("ltdcen" , &self.ltdcen()) |
1159 | .field("dbw" , &self.dbw()) |
1160 | .field("dgw" , &self.dgw()) |
1161 | .field("drw" , &self.drw()) |
1162 | .field("den" , &self.den()) |
1163 | .field("pcpol" , &self.pcpol()) |
1164 | .field("depol" , &self.depol()) |
1165 | .field("vspol" , &self.vspol()) |
1166 | .field("hspol" , &self.hspol()) |
1167 | .finish() |
1168 | } |
1169 | } |
1170 | #[cfg (feature = "defmt" )] |
1171 | impl defmt::Format for Gcr { |
1172 | fn format(&self, f: defmt::Formatter) { |
1173 | #[derive (defmt :: Format)] |
1174 | struct Gcr { |
1175 | ltdcen: bool, |
1176 | dbw: u8, |
1177 | dgw: u8, |
1178 | drw: u8, |
1179 | den: bool, |
1180 | pcpol: super::vals::Pcpol, |
1181 | depol: super::vals::Depol, |
1182 | vspol: super::vals::Vspol, |
1183 | hspol: super::vals::Hspol, |
1184 | } |
1185 | let proxy = Gcr { |
1186 | ltdcen: self.ltdcen(), |
1187 | dbw: self.dbw(), |
1188 | dgw: self.dgw(), |
1189 | drw: self.drw(), |
1190 | den: self.den(), |
1191 | pcpol: self.pcpol(), |
1192 | depol: self.depol(), |
1193 | vspol: self.vspol(), |
1194 | hspol: self.hspol(), |
1195 | }; |
1196 | defmt::write!(f, "{}" , proxy) |
1197 | } |
1198 | } |
1199 | #[doc = "Interrupt Clear Register" ] |
1200 | #[repr (transparent)] |
1201 | #[derive (Copy, Clone, Eq, PartialEq)] |
1202 | pub struct Icr(pub u32); |
1203 | impl Icr { |
1204 | #[doc = "Clears the Line Interrupt Flag" ] |
1205 | #[inline (always)] |
1206 | pub const fn clif(&self) -> super::vals::Clif { |
1207 | let val = (self.0 >> 0usize) & 0x01; |
1208 | super::vals::Clif::from_bits(val as u8) |
1209 | } |
1210 | #[doc = "Clears the Line Interrupt Flag" ] |
1211 | #[inline (always)] |
1212 | pub fn set_clif(&mut self, val: super::vals::Clif) { |
1213 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize); |
1214 | } |
1215 | #[doc = "Clears the FIFO Underrun Interrupt flag" ] |
1216 | #[inline (always)] |
1217 | pub const fn cfuif(&self) -> super::vals::Cfuif { |
1218 | let val = (self.0 >> 1usize) & 0x01; |
1219 | super::vals::Cfuif::from_bits(val as u8) |
1220 | } |
1221 | #[doc = "Clears the FIFO Underrun Interrupt flag" ] |
1222 | #[inline (always)] |
1223 | pub fn set_cfuif(&mut self, val: super::vals::Cfuif) { |
1224 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize); |
1225 | } |
1226 | #[doc = "Clears the Transfer Error Interrupt Flag" ] |
1227 | #[inline (always)] |
1228 | pub const fn cterrif(&self) -> super::vals::Cterrif { |
1229 | let val = (self.0 >> 2usize) & 0x01; |
1230 | super::vals::Cterrif::from_bits(val as u8) |
1231 | } |
1232 | #[doc = "Clears the Transfer Error Interrupt Flag" ] |
1233 | #[inline (always)] |
1234 | pub fn set_cterrif(&mut self, val: super::vals::Cterrif) { |
1235 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize); |
1236 | } |
1237 | #[doc = "Clears Register Reload Interrupt Flag" ] |
1238 | #[inline (always)] |
1239 | pub const fn crrif(&self) -> super::vals::Crrif { |
1240 | let val = (self.0 >> 3usize) & 0x01; |
1241 | super::vals::Crrif::from_bits(val as u8) |
1242 | } |
1243 | #[doc = "Clears Register Reload Interrupt Flag" ] |
1244 | #[inline (always)] |
1245 | pub fn set_crrif(&mut self, val: super::vals::Crrif) { |
1246 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize); |
1247 | } |
1248 | } |
1249 | impl Default for Icr { |
1250 | #[inline (always)] |
1251 | fn default() -> Icr { |
1252 | Icr(0) |
1253 | } |
1254 | } |
1255 | impl core::fmt::Debug for Icr { |
1256 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1257 | f.debug_struct("Icr" ) |
1258 | .field("clif" , &self.clif()) |
1259 | .field("cfuif" , &self.cfuif()) |
1260 | .field("cterrif" , &self.cterrif()) |
1261 | .field("crrif" , &self.crrif()) |
1262 | .finish() |
1263 | } |
1264 | } |
1265 | #[cfg (feature = "defmt" )] |
1266 | impl defmt::Format for Icr { |
1267 | fn format(&self, f: defmt::Formatter) { |
1268 | #[derive (defmt :: Format)] |
1269 | struct Icr { |
1270 | clif: super::vals::Clif, |
1271 | cfuif: super::vals::Cfuif, |
1272 | cterrif: super::vals::Cterrif, |
1273 | crrif: super::vals::Crrif, |
1274 | } |
1275 | let proxy = Icr { |
1276 | clif: self.clif(), |
1277 | cfuif: self.cfuif(), |
1278 | cterrif: self.cterrif(), |
1279 | crrif: self.crrif(), |
1280 | }; |
1281 | defmt::write!(f, "{}" , proxy) |
1282 | } |
1283 | } |
1284 | #[doc = "Interrupt Enable Register" ] |
1285 | #[repr (transparent)] |
1286 | #[derive (Copy, Clone, Eq, PartialEq)] |
1287 | pub struct Ier(pub u32); |
1288 | impl Ier { |
1289 | #[doc = "Line Interrupt Enable" ] |
1290 | #[inline (always)] |
1291 | pub const fn lie(&self) -> bool { |
1292 | let val = (self.0 >> 0usize) & 0x01; |
1293 | val != 0 |
1294 | } |
1295 | #[doc = "Line Interrupt Enable" ] |
1296 | #[inline (always)] |
1297 | pub fn set_lie(&mut self, val: bool) { |
1298 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1299 | } |
1300 | #[doc = "FIFO Underrun Interrupt Enable" ] |
1301 | #[inline (always)] |
1302 | pub const fn fuie(&self) -> bool { |
1303 | let val = (self.0 >> 1usize) & 0x01; |
1304 | val != 0 |
1305 | } |
1306 | #[doc = "FIFO Underrun Interrupt Enable" ] |
1307 | #[inline (always)] |
1308 | pub fn set_fuie(&mut self, val: bool) { |
1309 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1310 | } |
1311 | #[doc = "Transfer Error Interrupt Enable" ] |
1312 | #[inline (always)] |
1313 | pub const fn terrie(&self) -> bool { |
1314 | let val = (self.0 >> 2usize) & 0x01; |
1315 | val != 0 |
1316 | } |
1317 | #[doc = "Transfer Error Interrupt Enable" ] |
1318 | #[inline (always)] |
1319 | pub fn set_terrie(&mut self, val: bool) { |
1320 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
1321 | } |
1322 | #[doc = "Register Reload interrupt enable" ] |
1323 | #[inline (always)] |
1324 | pub const fn rrie(&self) -> bool { |
1325 | let val = (self.0 >> 3usize) & 0x01; |
1326 | val != 0 |
1327 | } |
1328 | #[doc = "Register Reload interrupt enable" ] |
1329 | #[inline (always)] |
1330 | pub fn set_rrie(&mut self, val: bool) { |
1331 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1332 | } |
1333 | } |
1334 | impl Default for Ier { |
1335 | #[inline (always)] |
1336 | fn default() -> Ier { |
1337 | Ier(0) |
1338 | } |
1339 | } |
1340 | impl core::fmt::Debug for Ier { |
1341 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1342 | f.debug_struct("Ier" ) |
1343 | .field("lie" , &self.lie()) |
1344 | .field("fuie" , &self.fuie()) |
1345 | .field("terrie" , &self.terrie()) |
1346 | .field("rrie" , &self.rrie()) |
1347 | .finish() |
1348 | } |
1349 | } |
1350 | #[cfg (feature = "defmt" )] |
1351 | impl defmt::Format for Ier { |
1352 | fn format(&self, f: defmt::Formatter) { |
1353 | #[derive (defmt :: Format)] |
1354 | struct Ier { |
1355 | lie: bool, |
1356 | fuie: bool, |
1357 | terrie: bool, |
1358 | rrie: bool, |
1359 | } |
1360 | let proxy = Ier { |
1361 | lie: self.lie(), |
1362 | fuie: self.fuie(), |
1363 | terrie: self.terrie(), |
1364 | rrie: self.rrie(), |
1365 | }; |
1366 | defmt::write!(f, "{}" , proxy) |
1367 | } |
1368 | } |
1369 | #[doc = "Interrupt Status Register" ] |
1370 | #[repr (transparent)] |
1371 | #[derive (Copy, Clone, Eq, PartialEq)] |
1372 | pub struct Isr(pub u32); |
1373 | impl Isr { |
1374 | #[doc = "Line Interrupt flag" ] |
1375 | #[inline (always)] |
1376 | pub const fn lif(&self) -> bool { |
1377 | let val = (self.0 >> 0usize) & 0x01; |
1378 | val != 0 |
1379 | } |
1380 | #[doc = "Line Interrupt flag" ] |
1381 | #[inline (always)] |
1382 | pub fn set_lif(&mut self, val: bool) { |
1383 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1384 | } |
1385 | #[doc = "FIFO Underrun Interrupt flag" ] |
1386 | #[inline (always)] |
1387 | pub const fn fuif(&self) -> bool { |
1388 | let val = (self.0 >> 1usize) & 0x01; |
1389 | val != 0 |
1390 | } |
1391 | #[doc = "FIFO Underrun Interrupt flag" ] |
1392 | #[inline (always)] |
1393 | pub fn set_fuif(&mut self, val: bool) { |
1394 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1395 | } |
1396 | #[doc = "Transfer Error interrupt flag" ] |
1397 | #[inline (always)] |
1398 | pub const fn terrif(&self) -> bool { |
1399 | let val = (self.0 >> 2usize) & 0x01; |
1400 | val != 0 |
1401 | } |
1402 | #[doc = "Transfer Error interrupt flag" ] |
1403 | #[inline (always)] |
1404 | pub fn set_terrif(&mut self, val: bool) { |
1405 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
1406 | } |
1407 | #[doc = "Register Reload Interrupt Flag" ] |
1408 | #[inline (always)] |
1409 | pub const fn rrif(&self) -> bool { |
1410 | let val = (self.0 >> 3usize) & 0x01; |
1411 | val != 0 |
1412 | } |
1413 | #[doc = "Register Reload Interrupt Flag" ] |
1414 | #[inline (always)] |
1415 | pub fn set_rrif(&mut self, val: bool) { |
1416 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
1417 | } |
1418 | } |
1419 | impl Default for Isr { |
1420 | #[inline (always)] |
1421 | fn default() -> Isr { |
1422 | Isr(0) |
1423 | } |
1424 | } |
1425 | impl core::fmt::Debug for Isr { |
1426 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1427 | f.debug_struct("Isr" ) |
1428 | .field("lif" , &self.lif()) |
1429 | .field("fuif" , &self.fuif()) |
1430 | .field("terrif" , &self.terrif()) |
1431 | .field("rrif" , &self.rrif()) |
1432 | .finish() |
1433 | } |
1434 | } |
1435 | #[cfg (feature = "defmt" )] |
1436 | impl defmt::Format for Isr { |
1437 | fn format(&self, f: defmt::Formatter) { |
1438 | #[derive (defmt :: Format)] |
1439 | struct Isr { |
1440 | lif: bool, |
1441 | fuif: bool, |
1442 | terrif: bool, |
1443 | rrif: bool, |
1444 | } |
1445 | let proxy = Isr { |
1446 | lif: self.lif(), |
1447 | fuif: self.fuif(), |
1448 | terrif: self.terrif(), |
1449 | rrif: self.rrif(), |
1450 | }; |
1451 | defmt::write!(f, "{}" , proxy) |
1452 | } |
1453 | } |
1454 | #[doc = "Line Interrupt Position Configuration Register" ] |
1455 | #[repr (transparent)] |
1456 | #[derive (Copy, Clone, Eq, PartialEq)] |
1457 | pub struct Lipcr(pub u32); |
1458 | impl Lipcr { |
1459 | #[doc = "Line Interrupt Position" ] |
1460 | #[inline (always)] |
1461 | pub const fn lipos(&self) -> u16 { |
1462 | let val = (self.0 >> 0usize) & 0x07ff; |
1463 | val as u16 |
1464 | } |
1465 | #[doc = "Line Interrupt Position" ] |
1466 | #[inline (always)] |
1467 | pub fn set_lipos(&mut self, val: u16) { |
1468 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
1469 | } |
1470 | } |
1471 | impl Default for Lipcr { |
1472 | #[inline (always)] |
1473 | fn default() -> Lipcr { |
1474 | Lipcr(0) |
1475 | } |
1476 | } |
1477 | impl core::fmt::Debug for Lipcr { |
1478 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1479 | f.debug_struct("Lipcr" ).field("lipos" , &self.lipos()).finish() |
1480 | } |
1481 | } |
1482 | #[cfg (feature = "defmt" )] |
1483 | impl defmt::Format for Lipcr { |
1484 | fn format(&self, f: defmt::Formatter) { |
1485 | #[derive (defmt :: Format)] |
1486 | struct Lipcr { |
1487 | lipos: u16, |
1488 | } |
1489 | let proxy = Lipcr { lipos: self.lipos() }; |
1490 | defmt::write!(f, "{}" , proxy) |
1491 | } |
1492 | } |
1493 | #[doc = "Layerx Pixel Format Configuration Register" ] |
1494 | #[repr (transparent)] |
1495 | #[derive (Copy, Clone, Eq, PartialEq)] |
1496 | pub struct Pfcr(pub u32); |
1497 | impl Pfcr { |
1498 | #[doc = "Pixel Format" ] |
1499 | #[inline (always)] |
1500 | pub const fn pf(&self) -> super::vals::Pf { |
1501 | let val = (self.0 >> 0usize) & 0x07; |
1502 | super::vals::Pf::from_bits(val as u8) |
1503 | } |
1504 | #[doc = "Pixel Format" ] |
1505 | #[inline (always)] |
1506 | pub fn set_pf(&mut self, val: super::vals::Pf) { |
1507 | self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize); |
1508 | } |
1509 | } |
1510 | impl Default for Pfcr { |
1511 | #[inline (always)] |
1512 | fn default() -> Pfcr { |
1513 | Pfcr(0) |
1514 | } |
1515 | } |
1516 | impl core::fmt::Debug for Pfcr { |
1517 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1518 | f.debug_struct("Pfcr" ).field("pf" , &self.pf()).finish() |
1519 | } |
1520 | } |
1521 | #[cfg (feature = "defmt" )] |
1522 | impl defmt::Format for Pfcr { |
1523 | fn format(&self, f: defmt::Formatter) { |
1524 | #[derive (defmt :: Format)] |
1525 | struct Pfcr { |
1526 | pf: super::vals::Pf, |
1527 | } |
1528 | let proxy = Pfcr { pf: self.pf() }; |
1529 | defmt::write!(f, "{}" , proxy) |
1530 | } |
1531 | } |
1532 | #[doc = "Shadow Reload Configuration Register" ] |
1533 | #[repr (transparent)] |
1534 | #[derive (Copy, Clone, Eq, PartialEq)] |
1535 | pub struct Srcr(pub u32); |
1536 | impl Srcr { |
1537 | #[doc = "Immediate Reload" ] |
1538 | #[inline (always)] |
1539 | pub const fn imr(&self) -> super::vals::Imr { |
1540 | let val = (self.0 >> 0usize) & 0x01; |
1541 | super::vals::Imr::from_bits(val as u8) |
1542 | } |
1543 | #[doc = "Immediate Reload" ] |
1544 | #[inline (always)] |
1545 | pub fn set_imr(&mut self, val: super::vals::Imr) { |
1546 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize); |
1547 | } |
1548 | #[doc = "Vertical Blanking Reload" ] |
1549 | #[inline (always)] |
1550 | pub const fn vbr(&self) -> super::vals::Vbr { |
1551 | let val = (self.0 >> 1usize) & 0x01; |
1552 | super::vals::Vbr::from_bits(val as u8) |
1553 | } |
1554 | #[doc = "Vertical Blanking Reload" ] |
1555 | #[inline (always)] |
1556 | pub fn set_vbr(&mut self, val: super::vals::Vbr) { |
1557 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize); |
1558 | } |
1559 | } |
1560 | impl Default for Srcr { |
1561 | #[inline (always)] |
1562 | fn default() -> Srcr { |
1563 | Srcr(0) |
1564 | } |
1565 | } |
1566 | impl core::fmt::Debug for Srcr { |
1567 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1568 | f.debug_struct("Srcr" ) |
1569 | .field("imr" , &self.imr()) |
1570 | .field("vbr" , &self.vbr()) |
1571 | .finish() |
1572 | } |
1573 | } |
1574 | #[cfg (feature = "defmt" )] |
1575 | impl defmt::Format for Srcr { |
1576 | fn format(&self, f: defmt::Formatter) { |
1577 | #[derive (defmt :: Format)] |
1578 | struct Srcr { |
1579 | imr: super::vals::Imr, |
1580 | vbr: super::vals::Vbr, |
1581 | } |
1582 | let proxy = Srcr { |
1583 | imr: self.imr(), |
1584 | vbr: self.vbr(), |
1585 | }; |
1586 | defmt::write!(f, "{}" , proxy) |
1587 | } |
1588 | } |
1589 | #[doc = "Synchronization Size Configuration Register" ] |
1590 | #[repr (transparent)] |
1591 | #[derive (Copy, Clone, Eq, PartialEq)] |
1592 | pub struct Sscr(pub u32); |
1593 | impl Sscr { |
1594 | #[doc = "Vertical Synchronization Height (in units of horizontal scan line)" ] |
1595 | #[inline (always)] |
1596 | pub const fn vsh(&self) -> u16 { |
1597 | let val = (self.0 >> 0usize) & 0x07ff; |
1598 | val as u16 |
1599 | } |
1600 | #[doc = "Vertical Synchronization Height (in units of horizontal scan line)" ] |
1601 | #[inline (always)] |
1602 | pub fn set_vsh(&mut self, val: u16) { |
1603 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
1604 | } |
1605 | #[doc = "Horizontal Synchronization Width (in units of pixel clock period)" ] |
1606 | #[inline (always)] |
1607 | pub const fn hsw(&self) -> u16 { |
1608 | let val = (self.0 >> 16usize) & 0x0fff; |
1609 | val as u16 |
1610 | } |
1611 | #[doc = "Horizontal Synchronization Width (in units of pixel clock period)" ] |
1612 | #[inline (always)] |
1613 | pub fn set_hsw(&mut self, val: u16) { |
1614 | self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize); |
1615 | } |
1616 | } |
1617 | impl Default for Sscr { |
1618 | #[inline (always)] |
1619 | fn default() -> Sscr { |
1620 | Sscr(0) |
1621 | } |
1622 | } |
1623 | impl core::fmt::Debug for Sscr { |
1624 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1625 | f.debug_struct("Sscr" ) |
1626 | .field("vsh" , &self.vsh()) |
1627 | .field("hsw" , &self.hsw()) |
1628 | .finish() |
1629 | } |
1630 | } |
1631 | #[cfg (feature = "defmt" )] |
1632 | impl defmt::Format for Sscr { |
1633 | fn format(&self, f: defmt::Formatter) { |
1634 | #[derive (defmt :: Format)] |
1635 | struct Sscr { |
1636 | vsh: u16, |
1637 | hsw: u16, |
1638 | } |
1639 | let proxy = Sscr { |
1640 | vsh: self.vsh(), |
1641 | hsw: self.hsw(), |
1642 | }; |
1643 | defmt::write!(f, "{}" , proxy) |
1644 | } |
1645 | } |
1646 | #[doc = "Total Width Configuration Register" ] |
1647 | #[repr (transparent)] |
1648 | #[derive (Copy, Clone, Eq, PartialEq)] |
1649 | pub struct Twcr(pub u32); |
1650 | impl Twcr { |
1651 | #[doc = "Total Height (in units of horizontal scan line)" ] |
1652 | #[inline (always)] |
1653 | pub const fn totalh(&self) -> u16 { |
1654 | let val = (self.0 >> 0usize) & 0x07ff; |
1655 | val as u16 |
1656 | } |
1657 | #[doc = "Total Height (in units of horizontal scan line)" ] |
1658 | #[inline (always)] |
1659 | pub fn set_totalh(&mut self, val: u16) { |
1660 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
1661 | } |
1662 | #[doc = "Total Width (in units of pixel clock period)" ] |
1663 | #[inline (always)] |
1664 | pub const fn totalw(&self) -> u16 { |
1665 | let val = (self.0 >> 16usize) & 0x0fff; |
1666 | val as u16 |
1667 | } |
1668 | #[doc = "Total Width (in units of pixel clock period)" ] |
1669 | #[inline (always)] |
1670 | pub fn set_totalw(&mut self, val: u16) { |
1671 | self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize); |
1672 | } |
1673 | } |
1674 | impl Default for Twcr { |
1675 | #[inline (always)] |
1676 | fn default() -> Twcr { |
1677 | Twcr(0) |
1678 | } |
1679 | } |
1680 | impl core::fmt::Debug for Twcr { |
1681 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1682 | f.debug_struct("Twcr" ) |
1683 | .field("totalh" , &self.totalh()) |
1684 | .field("totalw" , &self.totalw()) |
1685 | .finish() |
1686 | } |
1687 | } |
1688 | #[cfg (feature = "defmt" )] |
1689 | impl defmt::Format for Twcr { |
1690 | fn format(&self, f: defmt::Formatter) { |
1691 | #[derive (defmt :: Format)] |
1692 | struct Twcr { |
1693 | totalh: u16, |
1694 | totalw: u16, |
1695 | } |
1696 | let proxy = Twcr { |
1697 | totalh: self.totalh(), |
1698 | totalw: self.totalw(), |
1699 | }; |
1700 | defmt::write!(f, "{}" , proxy) |
1701 | } |
1702 | } |
1703 | #[doc = "Layerx Window Horizontal Position Configuration Register" ] |
1704 | #[repr (transparent)] |
1705 | #[derive (Copy, Clone, Eq, PartialEq)] |
1706 | pub struct Whpcr(pub u32); |
1707 | impl Whpcr { |
1708 | #[doc = "Window Horizontal Start Position" ] |
1709 | #[inline (always)] |
1710 | pub const fn whstpos(&self) -> u16 { |
1711 | let val = (self.0 >> 0usize) & 0x0fff; |
1712 | val as u16 |
1713 | } |
1714 | #[doc = "Window Horizontal Start Position" ] |
1715 | #[inline (always)] |
1716 | pub fn set_whstpos(&mut self, val: u16) { |
1717 | self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize); |
1718 | } |
1719 | #[doc = "Window Horizontal Stop Position" ] |
1720 | #[inline (always)] |
1721 | pub const fn whsppos(&self) -> u16 { |
1722 | let val = (self.0 >> 16usize) & 0x0fff; |
1723 | val as u16 |
1724 | } |
1725 | #[doc = "Window Horizontal Stop Position" ] |
1726 | #[inline (always)] |
1727 | pub fn set_whsppos(&mut self, val: u16) { |
1728 | self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize); |
1729 | } |
1730 | } |
1731 | impl Default for Whpcr { |
1732 | #[inline (always)] |
1733 | fn default() -> Whpcr { |
1734 | Whpcr(0) |
1735 | } |
1736 | } |
1737 | impl core::fmt::Debug for Whpcr { |
1738 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1739 | f.debug_struct("Whpcr" ) |
1740 | .field("whstpos" , &self.whstpos()) |
1741 | .field("whsppos" , &self.whsppos()) |
1742 | .finish() |
1743 | } |
1744 | } |
1745 | #[cfg (feature = "defmt" )] |
1746 | impl defmt::Format for Whpcr { |
1747 | fn format(&self, f: defmt::Formatter) { |
1748 | #[derive (defmt :: Format)] |
1749 | struct Whpcr { |
1750 | whstpos: u16, |
1751 | whsppos: u16, |
1752 | } |
1753 | let proxy = Whpcr { |
1754 | whstpos: self.whstpos(), |
1755 | whsppos: self.whsppos(), |
1756 | }; |
1757 | defmt::write!(f, "{}" , proxy) |
1758 | } |
1759 | } |
1760 | #[doc = "Layerx Window Vertical Position Configuration Register" ] |
1761 | #[repr (transparent)] |
1762 | #[derive (Copy, Clone, Eq, PartialEq)] |
1763 | pub struct Wvpcr(pub u32); |
1764 | impl Wvpcr { |
1765 | #[doc = "Window Vertical Start Position" ] |
1766 | #[inline (always)] |
1767 | pub const fn wvstpos(&self) -> u16 { |
1768 | let val = (self.0 >> 0usize) & 0x07ff; |
1769 | val as u16 |
1770 | } |
1771 | #[doc = "Window Vertical Start Position" ] |
1772 | #[inline (always)] |
1773 | pub fn set_wvstpos(&mut self, val: u16) { |
1774 | self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize); |
1775 | } |
1776 | #[doc = "Window Vertical Stop Position" ] |
1777 | #[inline (always)] |
1778 | pub const fn wvsppos(&self) -> u16 { |
1779 | let val = (self.0 >> 16usize) & 0x07ff; |
1780 | val as u16 |
1781 | } |
1782 | #[doc = "Window Vertical Stop Position" ] |
1783 | #[inline (always)] |
1784 | pub fn set_wvsppos(&mut self, val: u16) { |
1785 | self.0 = (self.0 & !(0x07ff << 16usize)) | (((val as u32) & 0x07ff) << 16usize); |
1786 | } |
1787 | } |
1788 | impl Default for Wvpcr { |
1789 | #[inline (always)] |
1790 | fn default() -> Wvpcr { |
1791 | Wvpcr(0) |
1792 | } |
1793 | } |
1794 | impl core::fmt::Debug for Wvpcr { |
1795 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1796 | f.debug_struct("Wvpcr" ) |
1797 | .field("wvstpos" , &self.wvstpos()) |
1798 | .field("wvsppos" , &self.wvsppos()) |
1799 | .finish() |
1800 | } |
1801 | } |
1802 | #[cfg (feature = "defmt" )] |
1803 | impl defmt::Format for Wvpcr { |
1804 | fn format(&self, f: defmt::Formatter) { |
1805 | #[derive (defmt :: Format)] |
1806 | struct Wvpcr { |
1807 | wvstpos: u16, |
1808 | wvsppos: u16, |
1809 | } |
1810 | let proxy = Wvpcr { |
1811 | wvstpos: self.wvstpos(), |
1812 | wvsppos: self.wvsppos(), |
1813 | }; |
1814 | defmt::write!(f, "{}" , proxy) |
1815 | } |
1816 | } |
1817 | } |
1818 | pub mod vals { |
1819 | #[repr (u8)] |
1820 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1821 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1822 | pub enum Bf1 { |
1823 | _RESERVED_0 = 0x0, |
1824 | _RESERVED_1 = 0x01, |
1825 | _RESERVED_2 = 0x02, |
1826 | _RESERVED_3 = 0x03, |
1827 | #[doc = "BF1 = constant alpha" ] |
1828 | CONSTANT = 0x04, |
1829 | _RESERVED_5 = 0x05, |
1830 | #[doc = "BF1 = pixel alpha * constant alpha" ] |
1831 | PIXEL = 0x06, |
1832 | _RESERVED_7 = 0x07, |
1833 | } |
1834 | impl Bf1 { |
1835 | #[inline (always)] |
1836 | pub const fn from_bits(val: u8) -> Bf1 { |
1837 | unsafe { core::mem::transmute(val & 0x07) } |
1838 | } |
1839 | #[inline (always)] |
1840 | pub const fn to_bits(self) -> u8 { |
1841 | unsafe { core::mem::transmute(self) } |
1842 | } |
1843 | } |
1844 | impl From<u8> for Bf1 { |
1845 | #[inline (always)] |
1846 | fn from(val: u8) -> Bf1 { |
1847 | Bf1::from_bits(val) |
1848 | } |
1849 | } |
1850 | impl From<Bf1> for u8 { |
1851 | #[inline (always)] |
1852 | fn from(val: Bf1) -> u8 { |
1853 | Bf1::to_bits(val) |
1854 | } |
1855 | } |
1856 | #[repr (u8)] |
1857 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1858 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1859 | pub enum Bf2 { |
1860 | _RESERVED_0 = 0x0, |
1861 | _RESERVED_1 = 0x01, |
1862 | _RESERVED_2 = 0x02, |
1863 | _RESERVED_3 = 0x03, |
1864 | _RESERVED_4 = 0x04, |
1865 | #[doc = "BF2 = 1 - constant alpha" ] |
1866 | CONSTANT = 0x05, |
1867 | _RESERVED_6 = 0x06, |
1868 | #[doc = "BF2 = 1 - pixel alpha * constant alpha" ] |
1869 | PIXEL = 0x07, |
1870 | } |
1871 | impl Bf2 { |
1872 | #[inline (always)] |
1873 | pub const fn from_bits(val: u8) -> Bf2 { |
1874 | unsafe { core::mem::transmute(val & 0x07) } |
1875 | } |
1876 | #[inline (always)] |
1877 | pub const fn to_bits(self) -> u8 { |
1878 | unsafe { core::mem::transmute(self) } |
1879 | } |
1880 | } |
1881 | impl From<u8> for Bf2 { |
1882 | #[inline (always)] |
1883 | fn from(val: u8) -> Bf2 { |
1884 | Bf2::from_bits(val) |
1885 | } |
1886 | } |
1887 | impl From<Bf2> for u8 { |
1888 | #[inline (always)] |
1889 | fn from(val: Bf2) -> u8 { |
1890 | Bf2::to_bits(val) |
1891 | } |
1892 | } |
1893 | #[repr (u8)] |
1894 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1895 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1896 | pub enum Cfuif { |
1897 | _RESERVED_0 = 0x0, |
1898 | #[doc = "Clears the FUIF flag in the ISR register" ] |
1899 | CLEAR = 0x01, |
1900 | } |
1901 | impl Cfuif { |
1902 | #[inline (always)] |
1903 | pub const fn from_bits(val: u8) -> Cfuif { |
1904 | unsafe { core::mem::transmute(val & 0x01) } |
1905 | } |
1906 | #[inline (always)] |
1907 | pub const fn to_bits(self) -> u8 { |
1908 | unsafe { core::mem::transmute(self) } |
1909 | } |
1910 | } |
1911 | impl From<u8> for Cfuif { |
1912 | #[inline (always)] |
1913 | fn from(val: u8) -> Cfuif { |
1914 | Cfuif::from_bits(val) |
1915 | } |
1916 | } |
1917 | impl From<Cfuif> for u8 { |
1918 | #[inline (always)] |
1919 | fn from(val: Cfuif) -> u8 { |
1920 | Cfuif::to_bits(val) |
1921 | } |
1922 | } |
1923 | #[repr (u8)] |
1924 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1925 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1926 | pub enum Clif { |
1927 | _RESERVED_0 = 0x0, |
1928 | #[doc = "Clears the LIF flag in the ISR register" ] |
1929 | CLEAR = 0x01, |
1930 | } |
1931 | impl Clif { |
1932 | #[inline (always)] |
1933 | pub const fn from_bits(val: u8) -> Clif { |
1934 | unsafe { core::mem::transmute(val & 0x01) } |
1935 | } |
1936 | #[inline (always)] |
1937 | pub const fn to_bits(self) -> u8 { |
1938 | unsafe { core::mem::transmute(self) } |
1939 | } |
1940 | } |
1941 | impl From<u8> for Clif { |
1942 | #[inline (always)] |
1943 | fn from(val: u8) -> Clif { |
1944 | Clif::from_bits(val) |
1945 | } |
1946 | } |
1947 | impl From<Clif> for u8 { |
1948 | #[inline (always)] |
1949 | fn from(val: Clif) -> u8 { |
1950 | Clif::to_bits(val) |
1951 | } |
1952 | } |
1953 | #[repr (u8)] |
1954 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1955 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1956 | pub enum Crrif { |
1957 | _RESERVED_0 = 0x0, |
1958 | #[doc = "Clears the RRIF flag in the ISR register" ] |
1959 | CLEAR = 0x01, |
1960 | } |
1961 | impl Crrif { |
1962 | #[inline (always)] |
1963 | pub const fn from_bits(val: u8) -> Crrif { |
1964 | unsafe { core::mem::transmute(val & 0x01) } |
1965 | } |
1966 | #[inline (always)] |
1967 | pub const fn to_bits(self) -> u8 { |
1968 | unsafe { core::mem::transmute(self) } |
1969 | } |
1970 | } |
1971 | impl From<u8> for Crrif { |
1972 | #[inline (always)] |
1973 | fn from(val: u8) -> Crrif { |
1974 | Crrif::from_bits(val) |
1975 | } |
1976 | } |
1977 | impl From<Crrif> for u8 { |
1978 | #[inline (always)] |
1979 | fn from(val: Crrif) -> u8 { |
1980 | Crrif::to_bits(val) |
1981 | } |
1982 | } |
1983 | #[repr (u8)] |
1984 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
1985 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
1986 | pub enum Cterrif { |
1987 | _RESERVED_0 = 0x0, |
1988 | #[doc = "Clears the TERRIF flag in the ISR register" ] |
1989 | CLEAR = 0x01, |
1990 | } |
1991 | impl Cterrif { |
1992 | #[inline (always)] |
1993 | pub const fn from_bits(val: u8) -> Cterrif { |
1994 | unsafe { core::mem::transmute(val & 0x01) } |
1995 | } |
1996 | #[inline (always)] |
1997 | pub const fn to_bits(self) -> u8 { |
1998 | unsafe { core::mem::transmute(self) } |
1999 | } |
2000 | } |
2001 | impl From<u8> for Cterrif { |
2002 | #[inline (always)] |
2003 | fn from(val: u8) -> Cterrif { |
2004 | Cterrif::from_bits(val) |
2005 | } |
2006 | } |
2007 | impl From<Cterrif> for u8 { |
2008 | #[inline (always)] |
2009 | fn from(val: Cterrif) -> u8 { |
2010 | Cterrif::to_bits(val) |
2011 | } |
2012 | } |
2013 | #[repr (u8)] |
2014 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2015 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2016 | pub enum Depol { |
2017 | #[doc = "Data enable polarity is active low" ] |
2018 | ACTIVE_LOW = 0x0, |
2019 | #[doc = "Data enable polarity is active high" ] |
2020 | ACTIVE_HIGH = 0x01, |
2021 | } |
2022 | impl Depol { |
2023 | #[inline (always)] |
2024 | pub const fn from_bits(val: u8) -> Depol { |
2025 | unsafe { core::mem::transmute(val & 0x01) } |
2026 | } |
2027 | #[inline (always)] |
2028 | pub const fn to_bits(self) -> u8 { |
2029 | unsafe { core::mem::transmute(self) } |
2030 | } |
2031 | } |
2032 | impl From<u8> for Depol { |
2033 | #[inline (always)] |
2034 | fn from(val: u8) -> Depol { |
2035 | Depol::from_bits(val) |
2036 | } |
2037 | } |
2038 | impl From<Depol> for u8 { |
2039 | #[inline (always)] |
2040 | fn from(val: Depol) -> u8 { |
2041 | Depol::to_bits(val) |
2042 | } |
2043 | } |
2044 | #[repr (u8)] |
2045 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2046 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2047 | pub enum Hspol { |
2048 | #[doc = "Horizontal synchronization polarity is active low" ] |
2049 | ACTIVE_LOW = 0x0, |
2050 | #[doc = "Horizontal synchronization polarity is active high" ] |
2051 | ACTIVE_HIGH = 0x01, |
2052 | } |
2053 | impl Hspol { |
2054 | #[inline (always)] |
2055 | pub const fn from_bits(val: u8) -> Hspol { |
2056 | unsafe { core::mem::transmute(val & 0x01) } |
2057 | } |
2058 | #[inline (always)] |
2059 | pub const fn to_bits(self) -> u8 { |
2060 | unsafe { core::mem::transmute(self) } |
2061 | } |
2062 | } |
2063 | impl From<u8> for Hspol { |
2064 | #[inline (always)] |
2065 | fn from(val: u8) -> Hspol { |
2066 | Hspol::from_bits(val) |
2067 | } |
2068 | } |
2069 | impl From<Hspol> for u8 { |
2070 | #[inline (always)] |
2071 | fn from(val: Hspol) -> u8 { |
2072 | Hspol::to_bits(val) |
2073 | } |
2074 | } |
2075 | #[repr (u8)] |
2076 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2077 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2078 | pub enum Imr { |
2079 | #[doc = "This bit is set by software and cleared only by hardware after reload (it cannot be cleared through register write once it is set)" ] |
2080 | NO_EFFECT = 0x0, |
2081 | #[doc = "The shadow registers are reloaded immediately. This bit is set by software and cleared only by hardware after reload" ] |
2082 | RELOAD = 0x01, |
2083 | } |
2084 | impl Imr { |
2085 | #[inline (always)] |
2086 | pub const fn from_bits(val: u8) -> Imr { |
2087 | unsafe { core::mem::transmute(val & 0x01) } |
2088 | } |
2089 | #[inline (always)] |
2090 | pub const fn to_bits(self) -> u8 { |
2091 | unsafe { core::mem::transmute(self) } |
2092 | } |
2093 | } |
2094 | impl From<u8> for Imr { |
2095 | #[inline (always)] |
2096 | fn from(val: u8) -> Imr { |
2097 | Imr::from_bits(val) |
2098 | } |
2099 | } |
2100 | impl From<Imr> for u8 { |
2101 | #[inline (always)] |
2102 | fn from(val: Imr) -> u8 { |
2103 | Imr::to_bits(val) |
2104 | } |
2105 | } |
2106 | #[repr (u8)] |
2107 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2108 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2109 | pub enum Pcpol { |
2110 | #[doc = "Pixel clock on rising edge" ] |
2111 | RISING_EDGE = 0x0, |
2112 | #[doc = "Pixel clock on falling edge" ] |
2113 | FALLING_EDGE = 0x01, |
2114 | } |
2115 | impl Pcpol { |
2116 | #[inline (always)] |
2117 | pub const fn from_bits(val: u8) -> Pcpol { |
2118 | unsafe { core::mem::transmute(val & 0x01) } |
2119 | } |
2120 | #[inline (always)] |
2121 | pub const fn to_bits(self) -> u8 { |
2122 | unsafe { core::mem::transmute(self) } |
2123 | } |
2124 | } |
2125 | impl From<u8> for Pcpol { |
2126 | #[inline (always)] |
2127 | fn from(val: u8) -> Pcpol { |
2128 | Pcpol::from_bits(val) |
2129 | } |
2130 | } |
2131 | impl From<Pcpol> for u8 { |
2132 | #[inline (always)] |
2133 | fn from(val: Pcpol) -> u8 { |
2134 | Pcpol::to_bits(val) |
2135 | } |
2136 | } |
2137 | #[repr (u8)] |
2138 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2139 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2140 | pub enum Pf { |
2141 | #[doc = "ARGB8888" ] |
2142 | ARGB8888 = 0x0, |
2143 | #[doc = "RGB888" ] |
2144 | RGB888 = 0x01, |
2145 | #[doc = "RGB565" ] |
2146 | RGB565 = 0x02, |
2147 | #[doc = "ARGB1555" ] |
2148 | ARGB1555 = 0x03, |
2149 | #[doc = "ARGB4444" ] |
2150 | ARGB4444 = 0x04, |
2151 | #[doc = "L8 (8-bit luminance)" ] |
2152 | L8 = 0x05, |
2153 | #[doc = "AL44 (4-bit alpha, 4-bit luminance)" ] |
2154 | AL44 = 0x06, |
2155 | #[doc = "AL88 (8-bit alpha, 8-bit luminance)" ] |
2156 | AL88 = 0x07, |
2157 | } |
2158 | impl Pf { |
2159 | #[inline (always)] |
2160 | pub const fn from_bits(val: u8) -> Pf { |
2161 | unsafe { core::mem::transmute(val & 0x07) } |
2162 | } |
2163 | #[inline (always)] |
2164 | pub const fn to_bits(self) -> u8 { |
2165 | unsafe { core::mem::transmute(self) } |
2166 | } |
2167 | } |
2168 | impl From<u8> for Pf { |
2169 | #[inline (always)] |
2170 | fn from(val: u8) -> Pf { |
2171 | Pf::from_bits(val) |
2172 | } |
2173 | } |
2174 | impl From<Pf> for u8 { |
2175 | #[inline (always)] |
2176 | fn from(val: Pf) -> u8 { |
2177 | Pf::to_bits(val) |
2178 | } |
2179 | } |
2180 | #[repr (u8)] |
2181 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2182 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2183 | pub enum Vbr { |
2184 | #[doc = "This bit is set by software and cleared only by hardware after reload (it cannot be cleared through register write once it is set)" ] |
2185 | NO_EFFECT = 0x0, |
2186 | #[doc = "The shadow registers are reloaded during the vertical blanking period (at the beginning of the first line after the active display area)." ] |
2187 | RELOAD = 0x01, |
2188 | } |
2189 | impl Vbr { |
2190 | #[inline (always)] |
2191 | pub const fn from_bits(val: u8) -> Vbr { |
2192 | unsafe { core::mem::transmute(val & 0x01) } |
2193 | } |
2194 | #[inline (always)] |
2195 | pub const fn to_bits(self) -> u8 { |
2196 | unsafe { core::mem::transmute(self) } |
2197 | } |
2198 | } |
2199 | impl From<u8> for Vbr { |
2200 | #[inline (always)] |
2201 | fn from(val: u8) -> Vbr { |
2202 | Vbr::from_bits(val) |
2203 | } |
2204 | } |
2205 | impl From<Vbr> for u8 { |
2206 | #[inline (always)] |
2207 | fn from(val: Vbr) -> u8 { |
2208 | Vbr::to_bits(val) |
2209 | } |
2210 | } |
2211 | #[repr (u8)] |
2212 | #[derive (Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] |
2213 | #[cfg_attr (feature = "defmt" , derive(defmt::Format))] |
2214 | pub enum Vspol { |
2215 | #[doc = "Vertical synchronization polarity is active low" ] |
2216 | ACTIVE_LOW = 0x0, |
2217 | #[doc = "Vertical synchronization polarity is active high" ] |
2218 | ACTIVE_HIGH = 0x01, |
2219 | } |
2220 | impl Vspol { |
2221 | #[inline (always)] |
2222 | pub const fn from_bits(val: u8) -> Vspol { |
2223 | unsafe { core::mem::transmute(val & 0x01) } |
2224 | } |
2225 | #[inline (always)] |
2226 | pub const fn to_bits(self) -> u8 { |
2227 | unsafe { core::mem::transmute(self) } |
2228 | } |
2229 | } |
2230 | impl From<u8> for Vspol { |
2231 | #[inline (always)] |
2232 | fn from(val: u8) -> Vspol { |
2233 | Vspol::from_bits(val) |
2234 | } |
2235 | } |
2236 | impl From<Vspol> for u8 { |
2237 | #[inline (always)] |
2238 | fn from(val: Vspol) -> u8 { |
2239 | Vspol::to_bits(val) |
2240 | } |
2241 | } |
2242 | } |
2243 | |