1 | #![allow (clippy::missing_safety_doc)] |
2 | #![allow (clippy::identity_op)] |
3 | #![allow (clippy::unnecessary_cast)] |
4 | #![allow (clippy::erasing_op)] |
5 | |
6 | #[doc = "Digital camera interface" ] |
7 | #[derive (Copy, Clone, Eq, PartialEq)] |
8 | pub struct Dcmi { |
9 | ptr: *mut u8, |
10 | } |
11 | unsafe impl Send for Dcmi {} |
12 | unsafe impl Sync for Dcmi {} |
13 | impl Dcmi { |
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 = "control register 1" ] |
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 = "status register" ] |
28 | #[inline (always)] |
29 | pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> { |
30 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) } |
31 | } |
32 | #[doc = "raw interrupt status register" ] |
33 | #[inline (always)] |
34 | pub const fn ris(self) -> crate::common::Reg<regs::Ris, crate::common::R> { |
35 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) } |
36 | } |
37 | #[doc = "interrupt enable register" ] |
38 | #[inline (always)] |
39 | pub const fn ier(self) -> crate::common::Reg<regs::Ier, crate::common::RW> { |
40 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) } |
41 | } |
42 | #[doc = "masked interrupt status register" ] |
43 | #[inline (always)] |
44 | pub const fn mis(self) -> crate::common::Reg<regs::Mis, crate::common::R> { |
45 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) } |
46 | } |
47 | #[doc = "interrupt clear register" ] |
48 | #[inline (always)] |
49 | pub const fn icr(self) -> crate::common::Reg<regs::Icr, crate::common::W> { |
50 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) } |
51 | } |
52 | #[doc = "embedded synchronization code register" ] |
53 | #[inline (always)] |
54 | pub const fn escr(self) -> crate::common::Reg<regs::Escr, crate::common::RW> { |
55 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) } |
56 | } |
57 | #[doc = "embedded synchronization unmask register" ] |
58 | #[inline (always)] |
59 | pub const fn esur(self) -> crate::common::Reg<regs::Esur, crate::common::RW> { |
60 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) } |
61 | } |
62 | #[doc = "crop window start" ] |
63 | #[inline (always)] |
64 | pub const fn cwstrt(self) -> crate::common::Reg<regs::Cwstrt, crate::common::RW> { |
65 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x20usize) as _) } |
66 | } |
67 | #[doc = "crop window size" ] |
68 | #[inline (always)] |
69 | pub const fn cwsize(self) -> crate::common::Reg<regs::Cwsize, crate::common::RW> { |
70 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) } |
71 | } |
72 | #[doc = "data register" ] |
73 | #[inline (always)] |
74 | pub const fn dr(self) -> crate::common::Reg<regs::Dr, crate::common::R> { |
75 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) } |
76 | } |
77 | } |
78 | pub mod regs { |
79 | #[doc = "control register 1" ] |
80 | #[repr (transparent)] |
81 | #[derive (Copy, Clone, Eq, PartialEq)] |
82 | pub struct Cr(pub u32); |
83 | impl Cr { |
84 | #[doc = "Capture enable" ] |
85 | #[inline (always)] |
86 | pub const fn capture(&self) -> bool { |
87 | let val = (self.0 >> 0usize) & 0x01; |
88 | val != 0 |
89 | } |
90 | #[doc = "Capture enable" ] |
91 | #[inline (always)] |
92 | pub fn set_capture(&mut self, val: bool) { |
93 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
94 | } |
95 | #[doc = "Capture mode" ] |
96 | #[inline (always)] |
97 | pub const fn cm(&self) -> bool { |
98 | let val = (self.0 >> 1usize) & 0x01; |
99 | val != 0 |
100 | } |
101 | #[doc = "Capture mode" ] |
102 | #[inline (always)] |
103 | pub fn set_cm(&mut self, val: bool) { |
104 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
105 | } |
106 | #[doc = "Crop feature" ] |
107 | #[inline (always)] |
108 | pub const fn crop(&self) -> bool { |
109 | let val = (self.0 >> 2usize) & 0x01; |
110 | val != 0 |
111 | } |
112 | #[doc = "Crop feature" ] |
113 | #[inline (always)] |
114 | pub fn set_crop(&mut self, val: bool) { |
115 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
116 | } |
117 | #[doc = "JPEG format" ] |
118 | #[inline (always)] |
119 | pub const fn jpeg(&self) -> bool { |
120 | let val = (self.0 >> 3usize) & 0x01; |
121 | val != 0 |
122 | } |
123 | #[doc = "JPEG format" ] |
124 | #[inline (always)] |
125 | pub fn set_jpeg(&mut self, val: bool) { |
126 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
127 | } |
128 | #[doc = "Embedded synchronization select" ] |
129 | #[inline (always)] |
130 | pub const fn ess(&self) -> bool { |
131 | let val = (self.0 >> 4usize) & 0x01; |
132 | val != 0 |
133 | } |
134 | #[doc = "Embedded synchronization select" ] |
135 | #[inline (always)] |
136 | pub fn set_ess(&mut self, val: bool) { |
137 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
138 | } |
139 | #[doc = "Pixel clock polarity" ] |
140 | #[inline (always)] |
141 | pub const fn pckpol(&self) -> bool { |
142 | let val = (self.0 >> 5usize) & 0x01; |
143 | val != 0 |
144 | } |
145 | #[doc = "Pixel clock polarity" ] |
146 | #[inline (always)] |
147 | pub fn set_pckpol(&mut self, val: bool) { |
148 | self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize); |
149 | } |
150 | #[doc = "Horizontal synchronization polarity" ] |
151 | #[inline (always)] |
152 | pub const fn hspol(&self) -> bool { |
153 | let val = (self.0 >> 6usize) & 0x01; |
154 | val != 0 |
155 | } |
156 | #[doc = "Horizontal synchronization polarity" ] |
157 | #[inline (always)] |
158 | pub fn set_hspol(&mut self, val: bool) { |
159 | self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize); |
160 | } |
161 | #[doc = "Vertical synchronization polarity" ] |
162 | #[inline (always)] |
163 | pub const fn vspol(&self) -> bool { |
164 | let val = (self.0 >> 7usize) & 0x01; |
165 | val != 0 |
166 | } |
167 | #[doc = "Vertical synchronization polarity" ] |
168 | #[inline (always)] |
169 | pub fn set_vspol(&mut self, val: bool) { |
170 | self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize); |
171 | } |
172 | #[doc = "Frame capture rate control" ] |
173 | #[inline (always)] |
174 | pub const fn fcrc(&self) -> u8 { |
175 | let val = (self.0 >> 8usize) & 0x03; |
176 | val as u8 |
177 | } |
178 | #[doc = "Frame capture rate control" ] |
179 | #[inline (always)] |
180 | pub fn set_fcrc(&mut self, val: u8) { |
181 | self.0 = (self.0 & !(0x03 << 8usize)) | (((val as u32) & 0x03) << 8usize); |
182 | } |
183 | #[doc = "Extended data mode" ] |
184 | #[inline (always)] |
185 | pub const fn edm(&self) -> u8 { |
186 | let val = (self.0 >> 10usize) & 0x03; |
187 | val as u8 |
188 | } |
189 | #[doc = "Extended data mode" ] |
190 | #[inline (always)] |
191 | pub fn set_edm(&mut self, val: u8) { |
192 | self.0 = (self.0 & !(0x03 << 10usize)) | (((val as u32) & 0x03) << 10usize); |
193 | } |
194 | #[doc = "DCMI enable" ] |
195 | #[inline (always)] |
196 | pub const fn enable(&self) -> bool { |
197 | let val = (self.0 >> 14usize) & 0x01; |
198 | val != 0 |
199 | } |
200 | #[doc = "DCMI enable" ] |
201 | #[inline (always)] |
202 | pub fn set_enable(&mut self, val: bool) { |
203 | self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize); |
204 | } |
205 | } |
206 | impl Default for Cr { |
207 | #[inline (always)] |
208 | fn default() -> Cr { |
209 | Cr(0) |
210 | } |
211 | } |
212 | impl core::fmt::Debug for Cr { |
213 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
214 | f.debug_struct("Cr" ) |
215 | .field("capture" , &self.capture()) |
216 | .field("cm" , &self.cm()) |
217 | .field("crop" , &self.crop()) |
218 | .field("jpeg" , &self.jpeg()) |
219 | .field("ess" , &self.ess()) |
220 | .field("pckpol" , &self.pckpol()) |
221 | .field("hspol" , &self.hspol()) |
222 | .field("vspol" , &self.vspol()) |
223 | .field("fcrc" , &self.fcrc()) |
224 | .field("edm" , &self.edm()) |
225 | .field("enable" , &self.enable()) |
226 | .finish() |
227 | } |
228 | } |
229 | #[cfg (feature = "defmt" )] |
230 | impl defmt::Format for Cr { |
231 | fn format(&self, f: defmt::Formatter) { |
232 | #[derive (defmt :: Format)] |
233 | struct Cr { |
234 | capture: bool, |
235 | cm: bool, |
236 | crop: bool, |
237 | jpeg: bool, |
238 | ess: bool, |
239 | pckpol: bool, |
240 | hspol: bool, |
241 | vspol: bool, |
242 | fcrc: u8, |
243 | edm: u8, |
244 | enable: bool, |
245 | } |
246 | let proxy = Cr { |
247 | capture: self.capture(), |
248 | cm: self.cm(), |
249 | crop: self.crop(), |
250 | jpeg: self.jpeg(), |
251 | ess: self.ess(), |
252 | pckpol: self.pckpol(), |
253 | hspol: self.hspol(), |
254 | vspol: self.vspol(), |
255 | fcrc: self.fcrc(), |
256 | edm: self.edm(), |
257 | enable: self.enable(), |
258 | }; |
259 | defmt::write!(f, "{}" , proxy) |
260 | } |
261 | } |
262 | #[doc = "crop window size" ] |
263 | #[repr (transparent)] |
264 | #[derive (Copy, Clone, Eq, PartialEq)] |
265 | pub struct Cwsize(pub u32); |
266 | impl Cwsize { |
267 | #[doc = "Capture count" ] |
268 | #[inline (always)] |
269 | pub const fn capcnt(&self) -> u16 { |
270 | let val = (self.0 >> 0usize) & 0x3fff; |
271 | val as u16 |
272 | } |
273 | #[doc = "Capture count" ] |
274 | #[inline (always)] |
275 | pub fn set_capcnt(&mut self, val: u16) { |
276 | self.0 = (self.0 & !(0x3fff << 0usize)) | (((val as u32) & 0x3fff) << 0usize); |
277 | } |
278 | #[doc = "Vertical line count" ] |
279 | #[inline (always)] |
280 | pub const fn vline(&self) -> u16 { |
281 | let val = (self.0 >> 16usize) & 0x3fff; |
282 | val as u16 |
283 | } |
284 | #[doc = "Vertical line count" ] |
285 | #[inline (always)] |
286 | pub fn set_vline(&mut self, val: u16) { |
287 | self.0 = (self.0 & !(0x3fff << 16usize)) | (((val as u32) & 0x3fff) << 16usize); |
288 | } |
289 | } |
290 | impl Default for Cwsize { |
291 | #[inline (always)] |
292 | fn default() -> Cwsize { |
293 | Cwsize(0) |
294 | } |
295 | } |
296 | impl core::fmt::Debug for Cwsize { |
297 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
298 | f.debug_struct("Cwsize" ) |
299 | .field("capcnt" , &self.capcnt()) |
300 | .field("vline" , &self.vline()) |
301 | .finish() |
302 | } |
303 | } |
304 | #[cfg (feature = "defmt" )] |
305 | impl defmt::Format for Cwsize { |
306 | fn format(&self, f: defmt::Formatter) { |
307 | #[derive (defmt :: Format)] |
308 | struct Cwsize { |
309 | capcnt: u16, |
310 | vline: u16, |
311 | } |
312 | let proxy = Cwsize { |
313 | capcnt: self.capcnt(), |
314 | vline: self.vline(), |
315 | }; |
316 | defmt::write!(f, "{}" , proxy) |
317 | } |
318 | } |
319 | #[doc = "crop window start" ] |
320 | #[repr (transparent)] |
321 | #[derive (Copy, Clone, Eq, PartialEq)] |
322 | pub struct Cwstrt(pub u32); |
323 | impl Cwstrt { |
324 | #[doc = "Horizontal offset count" ] |
325 | #[inline (always)] |
326 | pub const fn hoffcnt(&self) -> u16 { |
327 | let val = (self.0 >> 0usize) & 0x3fff; |
328 | val as u16 |
329 | } |
330 | #[doc = "Horizontal offset count" ] |
331 | #[inline (always)] |
332 | pub fn set_hoffcnt(&mut self, val: u16) { |
333 | self.0 = (self.0 & !(0x3fff << 0usize)) | (((val as u32) & 0x3fff) << 0usize); |
334 | } |
335 | #[doc = "Vertical start line count" ] |
336 | #[inline (always)] |
337 | pub const fn vst(&self) -> u16 { |
338 | let val = (self.0 >> 16usize) & 0x1fff; |
339 | val as u16 |
340 | } |
341 | #[doc = "Vertical start line count" ] |
342 | #[inline (always)] |
343 | pub fn set_vst(&mut self, val: u16) { |
344 | self.0 = (self.0 & !(0x1fff << 16usize)) | (((val as u32) & 0x1fff) << 16usize); |
345 | } |
346 | } |
347 | impl Default for Cwstrt { |
348 | #[inline (always)] |
349 | fn default() -> Cwstrt { |
350 | Cwstrt(0) |
351 | } |
352 | } |
353 | impl core::fmt::Debug for Cwstrt { |
354 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
355 | f.debug_struct("Cwstrt" ) |
356 | .field("hoffcnt" , &self.hoffcnt()) |
357 | .field("vst" , &self.vst()) |
358 | .finish() |
359 | } |
360 | } |
361 | #[cfg (feature = "defmt" )] |
362 | impl defmt::Format for Cwstrt { |
363 | fn format(&self, f: defmt::Formatter) { |
364 | #[derive (defmt :: Format)] |
365 | struct Cwstrt { |
366 | hoffcnt: u16, |
367 | vst: u16, |
368 | } |
369 | let proxy = Cwstrt { |
370 | hoffcnt: self.hoffcnt(), |
371 | vst: self.vst(), |
372 | }; |
373 | defmt::write!(f, "{}" , proxy) |
374 | } |
375 | } |
376 | #[doc = "data register" ] |
377 | #[repr (transparent)] |
378 | #[derive (Copy, Clone, Eq, PartialEq)] |
379 | pub struct Dr(pub u32); |
380 | impl Dr { |
381 | #[doc = "Data byte 0" ] |
382 | #[inline (always)] |
383 | pub const fn byte0(&self) -> u8 { |
384 | let val = (self.0 >> 0usize) & 0xff; |
385 | val as u8 |
386 | } |
387 | #[doc = "Data byte 0" ] |
388 | #[inline (always)] |
389 | pub fn set_byte0(&mut self, val: u8) { |
390 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
391 | } |
392 | #[doc = "Data byte 1" ] |
393 | #[inline (always)] |
394 | pub const fn byte1(&self) -> u8 { |
395 | let val = (self.0 >> 8usize) & 0xff; |
396 | val as u8 |
397 | } |
398 | #[doc = "Data byte 1" ] |
399 | #[inline (always)] |
400 | pub fn set_byte1(&mut self, val: u8) { |
401 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
402 | } |
403 | #[doc = "Data byte 2" ] |
404 | #[inline (always)] |
405 | pub const fn byte2(&self) -> u8 { |
406 | let val = (self.0 >> 16usize) & 0xff; |
407 | val as u8 |
408 | } |
409 | #[doc = "Data byte 2" ] |
410 | #[inline (always)] |
411 | pub fn set_byte2(&mut self, val: u8) { |
412 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
413 | } |
414 | #[doc = "Data byte 3" ] |
415 | #[inline (always)] |
416 | pub const fn byte3(&self) -> u8 { |
417 | let val = (self.0 >> 24usize) & 0xff; |
418 | val as u8 |
419 | } |
420 | #[doc = "Data byte 3" ] |
421 | #[inline (always)] |
422 | pub fn set_byte3(&mut self, val: u8) { |
423 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
424 | } |
425 | } |
426 | impl Default for Dr { |
427 | #[inline (always)] |
428 | fn default() -> Dr { |
429 | Dr(0) |
430 | } |
431 | } |
432 | impl core::fmt::Debug for Dr { |
433 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
434 | f.debug_struct("Dr" ) |
435 | .field("byte0" , &self.byte0()) |
436 | .field("byte1" , &self.byte1()) |
437 | .field("byte2" , &self.byte2()) |
438 | .field("byte3" , &self.byte3()) |
439 | .finish() |
440 | } |
441 | } |
442 | #[cfg (feature = "defmt" )] |
443 | impl defmt::Format for Dr { |
444 | fn format(&self, f: defmt::Formatter) { |
445 | #[derive (defmt :: Format)] |
446 | struct Dr { |
447 | byte0: u8, |
448 | byte1: u8, |
449 | byte2: u8, |
450 | byte3: u8, |
451 | } |
452 | let proxy = Dr { |
453 | byte0: self.byte0(), |
454 | byte1: self.byte1(), |
455 | byte2: self.byte2(), |
456 | byte3: self.byte3(), |
457 | }; |
458 | defmt::write!(f, "{}" , proxy) |
459 | } |
460 | } |
461 | #[doc = "embedded synchronization code register" ] |
462 | #[repr (transparent)] |
463 | #[derive (Copy, Clone, Eq, PartialEq)] |
464 | pub struct Escr(pub u32); |
465 | impl Escr { |
466 | #[doc = "Frame start delimiter code" ] |
467 | #[inline (always)] |
468 | pub const fn fsc(&self) -> u8 { |
469 | let val = (self.0 >> 0usize) & 0xff; |
470 | val as u8 |
471 | } |
472 | #[doc = "Frame start delimiter code" ] |
473 | #[inline (always)] |
474 | pub fn set_fsc(&mut self, val: u8) { |
475 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
476 | } |
477 | #[doc = "Line start delimiter code" ] |
478 | #[inline (always)] |
479 | pub const fn lsc(&self) -> u8 { |
480 | let val = (self.0 >> 8usize) & 0xff; |
481 | val as u8 |
482 | } |
483 | #[doc = "Line start delimiter code" ] |
484 | #[inline (always)] |
485 | pub fn set_lsc(&mut self, val: u8) { |
486 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
487 | } |
488 | #[doc = "Line end delimiter code" ] |
489 | #[inline (always)] |
490 | pub const fn lec(&self) -> u8 { |
491 | let val = (self.0 >> 16usize) & 0xff; |
492 | val as u8 |
493 | } |
494 | #[doc = "Line end delimiter code" ] |
495 | #[inline (always)] |
496 | pub fn set_lec(&mut self, val: u8) { |
497 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
498 | } |
499 | #[doc = "Frame end delimiter code" ] |
500 | #[inline (always)] |
501 | pub const fn fec(&self) -> u8 { |
502 | let val = (self.0 >> 24usize) & 0xff; |
503 | val as u8 |
504 | } |
505 | #[doc = "Frame end delimiter code" ] |
506 | #[inline (always)] |
507 | pub fn set_fec(&mut self, val: u8) { |
508 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
509 | } |
510 | } |
511 | impl Default for Escr { |
512 | #[inline (always)] |
513 | fn default() -> Escr { |
514 | Escr(0) |
515 | } |
516 | } |
517 | impl core::fmt::Debug for Escr { |
518 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
519 | f.debug_struct("Escr" ) |
520 | .field("fsc" , &self.fsc()) |
521 | .field("lsc" , &self.lsc()) |
522 | .field("lec" , &self.lec()) |
523 | .field("fec" , &self.fec()) |
524 | .finish() |
525 | } |
526 | } |
527 | #[cfg (feature = "defmt" )] |
528 | impl defmt::Format for Escr { |
529 | fn format(&self, f: defmt::Formatter) { |
530 | #[derive (defmt :: Format)] |
531 | struct Escr { |
532 | fsc: u8, |
533 | lsc: u8, |
534 | lec: u8, |
535 | fec: u8, |
536 | } |
537 | let proxy = Escr { |
538 | fsc: self.fsc(), |
539 | lsc: self.lsc(), |
540 | lec: self.lec(), |
541 | fec: self.fec(), |
542 | }; |
543 | defmt::write!(f, "{}" , proxy) |
544 | } |
545 | } |
546 | #[doc = "embedded synchronization unmask register" ] |
547 | #[repr (transparent)] |
548 | #[derive (Copy, Clone, Eq, PartialEq)] |
549 | pub struct Esur(pub u32); |
550 | impl Esur { |
551 | #[doc = "Frame start delimiter unmask" ] |
552 | #[inline (always)] |
553 | pub const fn fsu(&self) -> u8 { |
554 | let val = (self.0 >> 0usize) & 0xff; |
555 | val as u8 |
556 | } |
557 | #[doc = "Frame start delimiter unmask" ] |
558 | #[inline (always)] |
559 | pub fn set_fsu(&mut self, val: u8) { |
560 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
561 | } |
562 | #[doc = "Line start delimiter unmask" ] |
563 | #[inline (always)] |
564 | pub const fn lsu(&self) -> u8 { |
565 | let val = (self.0 >> 8usize) & 0xff; |
566 | val as u8 |
567 | } |
568 | #[doc = "Line start delimiter unmask" ] |
569 | #[inline (always)] |
570 | pub fn set_lsu(&mut self, val: u8) { |
571 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
572 | } |
573 | #[doc = "Line end delimiter unmask" ] |
574 | #[inline (always)] |
575 | pub const fn leu(&self) -> u8 { |
576 | let val = (self.0 >> 16usize) & 0xff; |
577 | val as u8 |
578 | } |
579 | #[doc = "Line end delimiter unmask" ] |
580 | #[inline (always)] |
581 | pub fn set_leu(&mut self, val: u8) { |
582 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
583 | } |
584 | #[doc = "Frame end delimiter unmask" ] |
585 | #[inline (always)] |
586 | pub const fn feu(&self) -> u8 { |
587 | let val = (self.0 >> 24usize) & 0xff; |
588 | val as u8 |
589 | } |
590 | #[doc = "Frame end delimiter unmask" ] |
591 | #[inline (always)] |
592 | pub fn set_feu(&mut self, val: u8) { |
593 | self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize); |
594 | } |
595 | } |
596 | impl Default for Esur { |
597 | #[inline (always)] |
598 | fn default() -> Esur { |
599 | Esur(0) |
600 | } |
601 | } |
602 | impl core::fmt::Debug for Esur { |
603 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
604 | f.debug_struct("Esur" ) |
605 | .field("fsu" , &self.fsu()) |
606 | .field("lsu" , &self.lsu()) |
607 | .field("leu" , &self.leu()) |
608 | .field("feu" , &self.feu()) |
609 | .finish() |
610 | } |
611 | } |
612 | #[cfg (feature = "defmt" )] |
613 | impl defmt::Format for Esur { |
614 | fn format(&self, f: defmt::Formatter) { |
615 | #[derive (defmt :: Format)] |
616 | struct Esur { |
617 | fsu: u8, |
618 | lsu: u8, |
619 | leu: u8, |
620 | feu: u8, |
621 | } |
622 | let proxy = Esur { |
623 | fsu: self.fsu(), |
624 | lsu: self.lsu(), |
625 | leu: self.leu(), |
626 | feu: self.feu(), |
627 | }; |
628 | defmt::write!(f, "{}" , proxy) |
629 | } |
630 | } |
631 | #[doc = "interrupt clear register" ] |
632 | #[repr (transparent)] |
633 | #[derive (Copy, Clone, Eq, PartialEq)] |
634 | pub struct Icr(pub u32); |
635 | impl Icr { |
636 | #[doc = "Capture complete interrupt status clear" ] |
637 | #[inline (always)] |
638 | pub const fn frame_isc(&self) -> bool { |
639 | let val = (self.0 >> 0usize) & 0x01; |
640 | val != 0 |
641 | } |
642 | #[doc = "Capture complete interrupt status clear" ] |
643 | #[inline (always)] |
644 | pub fn set_frame_isc(&mut self, val: bool) { |
645 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
646 | } |
647 | #[doc = "Overrun interrupt status clear" ] |
648 | #[inline (always)] |
649 | pub const fn ovr_isc(&self) -> bool { |
650 | let val = (self.0 >> 1usize) & 0x01; |
651 | val != 0 |
652 | } |
653 | #[doc = "Overrun interrupt status clear" ] |
654 | #[inline (always)] |
655 | pub fn set_ovr_isc(&mut self, val: bool) { |
656 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
657 | } |
658 | #[doc = "Synchronization error interrupt status clear" ] |
659 | #[inline (always)] |
660 | pub const fn err_isc(&self) -> bool { |
661 | let val = (self.0 >> 2usize) & 0x01; |
662 | val != 0 |
663 | } |
664 | #[doc = "Synchronization error interrupt status clear" ] |
665 | #[inline (always)] |
666 | pub fn set_err_isc(&mut self, val: bool) { |
667 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
668 | } |
669 | #[doc = "Vertical synch interrupt status clear" ] |
670 | #[inline (always)] |
671 | pub const fn vsync_isc(&self) -> bool { |
672 | let val = (self.0 >> 3usize) & 0x01; |
673 | val != 0 |
674 | } |
675 | #[doc = "Vertical synch interrupt status clear" ] |
676 | #[inline (always)] |
677 | pub fn set_vsync_isc(&mut self, val: bool) { |
678 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
679 | } |
680 | #[doc = "line interrupt status clear" ] |
681 | #[inline (always)] |
682 | pub const fn line_isc(&self) -> bool { |
683 | let val = (self.0 >> 4usize) & 0x01; |
684 | val != 0 |
685 | } |
686 | #[doc = "line interrupt status clear" ] |
687 | #[inline (always)] |
688 | pub fn set_line_isc(&mut self, val: bool) { |
689 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
690 | } |
691 | } |
692 | impl Default for Icr { |
693 | #[inline (always)] |
694 | fn default() -> Icr { |
695 | Icr(0) |
696 | } |
697 | } |
698 | impl core::fmt::Debug for Icr { |
699 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
700 | f.debug_struct("Icr" ) |
701 | .field("frame_isc" , &self.frame_isc()) |
702 | .field("ovr_isc" , &self.ovr_isc()) |
703 | .field("err_isc" , &self.err_isc()) |
704 | .field("vsync_isc" , &self.vsync_isc()) |
705 | .field("line_isc" , &self.line_isc()) |
706 | .finish() |
707 | } |
708 | } |
709 | #[cfg (feature = "defmt" )] |
710 | impl defmt::Format for Icr { |
711 | fn format(&self, f: defmt::Formatter) { |
712 | #[derive (defmt :: Format)] |
713 | struct Icr { |
714 | frame_isc: bool, |
715 | ovr_isc: bool, |
716 | err_isc: bool, |
717 | vsync_isc: bool, |
718 | line_isc: bool, |
719 | } |
720 | let proxy = Icr { |
721 | frame_isc: self.frame_isc(), |
722 | ovr_isc: self.ovr_isc(), |
723 | err_isc: self.err_isc(), |
724 | vsync_isc: self.vsync_isc(), |
725 | line_isc: self.line_isc(), |
726 | }; |
727 | defmt::write!(f, "{}" , proxy) |
728 | } |
729 | } |
730 | #[doc = "interrupt enable register" ] |
731 | #[repr (transparent)] |
732 | #[derive (Copy, Clone, Eq, PartialEq)] |
733 | pub struct Ier(pub u32); |
734 | impl Ier { |
735 | #[doc = "Capture complete interrupt enable" ] |
736 | #[inline (always)] |
737 | pub const fn frame_ie(&self) -> bool { |
738 | let val = (self.0 >> 0usize) & 0x01; |
739 | val != 0 |
740 | } |
741 | #[doc = "Capture complete interrupt enable" ] |
742 | #[inline (always)] |
743 | pub fn set_frame_ie(&mut self, val: bool) { |
744 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
745 | } |
746 | #[doc = "Overrun interrupt enable" ] |
747 | #[inline (always)] |
748 | pub const fn ovr_ie(&self) -> bool { |
749 | let val = (self.0 >> 1usize) & 0x01; |
750 | val != 0 |
751 | } |
752 | #[doc = "Overrun interrupt enable" ] |
753 | #[inline (always)] |
754 | pub fn set_ovr_ie(&mut self, val: bool) { |
755 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
756 | } |
757 | #[doc = "Synchronization error interrupt enable" ] |
758 | #[inline (always)] |
759 | pub const fn err_ie(&self) -> bool { |
760 | let val = (self.0 >> 2usize) & 0x01; |
761 | val != 0 |
762 | } |
763 | #[doc = "Synchronization error interrupt enable" ] |
764 | #[inline (always)] |
765 | pub fn set_err_ie(&mut self, val: bool) { |
766 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
767 | } |
768 | #[doc = "VSYNC interrupt enable" ] |
769 | #[inline (always)] |
770 | pub const fn vsync_ie(&self) -> bool { |
771 | let val = (self.0 >> 3usize) & 0x01; |
772 | val != 0 |
773 | } |
774 | #[doc = "VSYNC interrupt enable" ] |
775 | #[inline (always)] |
776 | pub fn set_vsync_ie(&mut self, val: bool) { |
777 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
778 | } |
779 | #[doc = "Line interrupt enable" ] |
780 | #[inline (always)] |
781 | pub const fn line_ie(&self) -> bool { |
782 | let val = (self.0 >> 4usize) & 0x01; |
783 | val != 0 |
784 | } |
785 | #[doc = "Line interrupt enable" ] |
786 | #[inline (always)] |
787 | pub fn set_line_ie(&mut self, val: bool) { |
788 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
789 | } |
790 | } |
791 | impl Default for Ier { |
792 | #[inline (always)] |
793 | fn default() -> Ier { |
794 | Ier(0) |
795 | } |
796 | } |
797 | impl core::fmt::Debug for Ier { |
798 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
799 | f.debug_struct("Ier" ) |
800 | .field("frame_ie" , &self.frame_ie()) |
801 | .field("ovr_ie" , &self.ovr_ie()) |
802 | .field("err_ie" , &self.err_ie()) |
803 | .field("vsync_ie" , &self.vsync_ie()) |
804 | .field("line_ie" , &self.line_ie()) |
805 | .finish() |
806 | } |
807 | } |
808 | #[cfg (feature = "defmt" )] |
809 | impl defmt::Format for Ier { |
810 | fn format(&self, f: defmt::Formatter) { |
811 | #[derive (defmt :: Format)] |
812 | struct Ier { |
813 | frame_ie: bool, |
814 | ovr_ie: bool, |
815 | err_ie: bool, |
816 | vsync_ie: bool, |
817 | line_ie: bool, |
818 | } |
819 | let proxy = Ier { |
820 | frame_ie: self.frame_ie(), |
821 | ovr_ie: self.ovr_ie(), |
822 | err_ie: self.err_ie(), |
823 | vsync_ie: self.vsync_ie(), |
824 | line_ie: self.line_ie(), |
825 | }; |
826 | defmt::write!(f, "{}" , proxy) |
827 | } |
828 | } |
829 | #[doc = "masked interrupt status register" ] |
830 | #[repr (transparent)] |
831 | #[derive (Copy, Clone, Eq, PartialEq)] |
832 | pub struct Mis(pub u32); |
833 | impl Mis { |
834 | #[doc = "Capture complete masked interrupt status" ] |
835 | #[inline (always)] |
836 | pub const fn frame_mis(&self) -> bool { |
837 | let val = (self.0 >> 0usize) & 0x01; |
838 | val != 0 |
839 | } |
840 | #[doc = "Capture complete masked interrupt status" ] |
841 | #[inline (always)] |
842 | pub fn set_frame_mis(&mut self, val: bool) { |
843 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
844 | } |
845 | #[doc = "Overrun masked interrupt status" ] |
846 | #[inline (always)] |
847 | pub const fn ovr_mis(&self) -> bool { |
848 | let val = (self.0 >> 1usize) & 0x01; |
849 | val != 0 |
850 | } |
851 | #[doc = "Overrun masked interrupt status" ] |
852 | #[inline (always)] |
853 | pub fn set_ovr_mis(&mut self, val: bool) { |
854 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
855 | } |
856 | #[doc = "Synchronization error masked interrupt status" ] |
857 | #[inline (always)] |
858 | pub const fn err_mis(&self) -> bool { |
859 | let val = (self.0 >> 2usize) & 0x01; |
860 | val != 0 |
861 | } |
862 | #[doc = "Synchronization error masked interrupt status" ] |
863 | #[inline (always)] |
864 | pub fn set_err_mis(&mut self, val: bool) { |
865 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
866 | } |
867 | #[doc = "VSYNC masked interrupt status" ] |
868 | #[inline (always)] |
869 | pub const fn vsync_mis(&self) -> bool { |
870 | let val = (self.0 >> 3usize) & 0x01; |
871 | val != 0 |
872 | } |
873 | #[doc = "VSYNC masked interrupt status" ] |
874 | #[inline (always)] |
875 | pub fn set_vsync_mis(&mut self, val: bool) { |
876 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
877 | } |
878 | #[doc = "Line masked interrupt status" ] |
879 | #[inline (always)] |
880 | pub const fn line_mis(&self) -> bool { |
881 | let val = (self.0 >> 4usize) & 0x01; |
882 | val != 0 |
883 | } |
884 | #[doc = "Line masked interrupt status" ] |
885 | #[inline (always)] |
886 | pub fn set_line_mis(&mut self, val: bool) { |
887 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
888 | } |
889 | } |
890 | impl Default for Mis { |
891 | #[inline (always)] |
892 | fn default() -> Mis { |
893 | Mis(0) |
894 | } |
895 | } |
896 | impl core::fmt::Debug for Mis { |
897 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
898 | f.debug_struct("Mis" ) |
899 | .field("frame_mis" , &self.frame_mis()) |
900 | .field("ovr_mis" , &self.ovr_mis()) |
901 | .field("err_mis" , &self.err_mis()) |
902 | .field("vsync_mis" , &self.vsync_mis()) |
903 | .field("line_mis" , &self.line_mis()) |
904 | .finish() |
905 | } |
906 | } |
907 | #[cfg (feature = "defmt" )] |
908 | impl defmt::Format for Mis { |
909 | fn format(&self, f: defmt::Formatter) { |
910 | #[derive (defmt :: Format)] |
911 | struct Mis { |
912 | frame_mis: bool, |
913 | ovr_mis: bool, |
914 | err_mis: bool, |
915 | vsync_mis: bool, |
916 | line_mis: bool, |
917 | } |
918 | let proxy = Mis { |
919 | frame_mis: self.frame_mis(), |
920 | ovr_mis: self.ovr_mis(), |
921 | err_mis: self.err_mis(), |
922 | vsync_mis: self.vsync_mis(), |
923 | line_mis: self.line_mis(), |
924 | }; |
925 | defmt::write!(f, "{}" , proxy) |
926 | } |
927 | } |
928 | #[doc = "raw interrupt status register" ] |
929 | #[repr (transparent)] |
930 | #[derive (Copy, Clone, Eq, PartialEq)] |
931 | pub struct Ris(pub u32); |
932 | impl Ris { |
933 | #[doc = "Capture complete raw interrupt status" ] |
934 | #[inline (always)] |
935 | pub const fn frame_ris(&self) -> bool { |
936 | let val = (self.0 >> 0usize) & 0x01; |
937 | val != 0 |
938 | } |
939 | #[doc = "Capture complete raw interrupt status" ] |
940 | #[inline (always)] |
941 | pub fn set_frame_ris(&mut self, val: bool) { |
942 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
943 | } |
944 | #[doc = "Overrun raw interrupt status" ] |
945 | #[inline (always)] |
946 | pub const fn ovr_ris(&self) -> bool { |
947 | let val = (self.0 >> 1usize) & 0x01; |
948 | val != 0 |
949 | } |
950 | #[doc = "Overrun raw interrupt status" ] |
951 | #[inline (always)] |
952 | pub fn set_ovr_ris(&mut self, val: bool) { |
953 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
954 | } |
955 | #[doc = "Synchronization error raw interrupt status" ] |
956 | #[inline (always)] |
957 | pub const fn err_ris(&self) -> bool { |
958 | let val = (self.0 >> 2usize) & 0x01; |
959 | val != 0 |
960 | } |
961 | #[doc = "Synchronization error raw interrupt status" ] |
962 | #[inline (always)] |
963 | pub fn set_err_ris(&mut self, val: bool) { |
964 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
965 | } |
966 | #[doc = "VSYNC raw interrupt status" ] |
967 | #[inline (always)] |
968 | pub const fn vsync_ris(&self) -> bool { |
969 | let val = (self.0 >> 3usize) & 0x01; |
970 | val != 0 |
971 | } |
972 | #[doc = "VSYNC raw interrupt status" ] |
973 | #[inline (always)] |
974 | pub fn set_vsync_ris(&mut self, val: bool) { |
975 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
976 | } |
977 | #[doc = "Line raw interrupt status" ] |
978 | #[inline (always)] |
979 | pub const fn line_ris(&self) -> bool { |
980 | let val = (self.0 >> 4usize) & 0x01; |
981 | val != 0 |
982 | } |
983 | #[doc = "Line raw interrupt status" ] |
984 | #[inline (always)] |
985 | pub fn set_line_ris(&mut self, val: bool) { |
986 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
987 | } |
988 | } |
989 | impl Default for Ris { |
990 | #[inline (always)] |
991 | fn default() -> Ris { |
992 | Ris(0) |
993 | } |
994 | } |
995 | impl core::fmt::Debug for Ris { |
996 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
997 | f.debug_struct("Ris" ) |
998 | .field("frame_ris" , &self.frame_ris()) |
999 | .field("ovr_ris" , &self.ovr_ris()) |
1000 | .field("err_ris" , &self.err_ris()) |
1001 | .field("vsync_ris" , &self.vsync_ris()) |
1002 | .field("line_ris" , &self.line_ris()) |
1003 | .finish() |
1004 | } |
1005 | } |
1006 | #[cfg (feature = "defmt" )] |
1007 | impl defmt::Format for Ris { |
1008 | fn format(&self, f: defmt::Formatter) { |
1009 | #[derive (defmt :: Format)] |
1010 | struct Ris { |
1011 | frame_ris: bool, |
1012 | ovr_ris: bool, |
1013 | err_ris: bool, |
1014 | vsync_ris: bool, |
1015 | line_ris: bool, |
1016 | } |
1017 | let proxy = Ris { |
1018 | frame_ris: self.frame_ris(), |
1019 | ovr_ris: self.ovr_ris(), |
1020 | err_ris: self.err_ris(), |
1021 | vsync_ris: self.vsync_ris(), |
1022 | line_ris: self.line_ris(), |
1023 | }; |
1024 | defmt::write!(f, "{}" , proxy) |
1025 | } |
1026 | } |
1027 | #[doc = "status register" ] |
1028 | #[repr (transparent)] |
1029 | #[derive (Copy, Clone, Eq, PartialEq)] |
1030 | pub struct Sr(pub u32); |
1031 | impl Sr { |
1032 | #[doc = "HSYNC" ] |
1033 | #[inline (always)] |
1034 | pub const fn hsync(&self) -> bool { |
1035 | let val = (self.0 >> 0usize) & 0x01; |
1036 | val != 0 |
1037 | } |
1038 | #[doc = "HSYNC" ] |
1039 | #[inline (always)] |
1040 | pub fn set_hsync(&mut self, val: bool) { |
1041 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
1042 | } |
1043 | #[doc = "VSYNC" ] |
1044 | #[inline (always)] |
1045 | pub const fn vsync(&self) -> bool { |
1046 | let val = (self.0 >> 1usize) & 0x01; |
1047 | val != 0 |
1048 | } |
1049 | #[doc = "VSYNC" ] |
1050 | #[inline (always)] |
1051 | pub fn set_vsync(&mut self, val: bool) { |
1052 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
1053 | } |
1054 | #[doc = "FIFO not empty" ] |
1055 | #[inline (always)] |
1056 | pub const fn fne(&self) -> bool { |
1057 | let val = (self.0 >> 2usize) & 0x01; |
1058 | val != 0 |
1059 | } |
1060 | #[doc = "FIFO not empty" ] |
1061 | #[inline (always)] |
1062 | pub fn set_fne(&mut self, val: bool) { |
1063 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
1064 | } |
1065 | } |
1066 | impl Default for Sr { |
1067 | #[inline (always)] |
1068 | fn default() -> Sr { |
1069 | Sr(0) |
1070 | } |
1071 | } |
1072 | impl core::fmt::Debug for Sr { |
1073 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
1074 | f.debug_struct("Sr" ) |
1075 | .field("hsync" , &self.hsync()) |
1076 | .field("vsync" , &self.vsync()) |
1077 | .field("fne" , &self.fne()) |
1078 | .finish() |
1079 | } |
1080 | } |
1081 | #[cfg (feature = "defmt" )] |
1082 | impl defmt::Format for Sr { |
1083 | fn format(&self, f: defmt::Formatter) { |
1084 | #[derive (defmt :: Format)] |
1085 | struct Sr { |
1086 | hsync: bool, |
1087 | vsync: bool, |
1088 | fne: bool, |
1089 | } |
1090 | let proxy = Sr { |
1091 | hsync: self.hsync(), |
1092 | vsync: self.vsync(), |
1093 | fne: self.fne(), |
1094 | }; |
1095 | defmt::write!(f, "{}" , proxy) |
1096 | } |
1097 | } |
1098 | } |
1099 | |