1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
#[doc = "Reader of register PS_CTRL_TOG"]
pub type R = crate::R<u32, super::PS_CTRL_TOG>;
#[doc = "Writer for register PS_CTRL_TOG"]
pub type W = crate::W<u32, super::PS_CTRL_TOG>;
#[doc = "Register PS_CTRL_TOG `reset()`'s with value 0"]
impl crate::ResetValue for super::PS_CTRL_TOG {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "PS buffer format. To select between YUV and YCbCr formats, see bit 31 of the CSC1_COEF0 register.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum FORMAT_A {
    #[doc = "4: 32-bit pixels (unpacked 24-bit format)"]
    RGB888 = 4,
    #[doc = "12: 16-bit pixels"]
    RGB555 = 12,
    #[doc = "13: 16-bit pixels"]
    RGB444 = 13,
    #[doc = "14: 16-bit pixels"]
    RGB565 = 14,
    #[doc = "16: 32-bit pixels (1-plane XYUV unpacked)"]
    YUV1P444 = 16,
    #[doc = "18: 16-bit pixels (1-plane U0,Y0,V0,Y1 interleaved bytes)"]
    UYVY1P422 = 18,
    #[doc = "19: 16-bit pixels (1-plane V0,Y0,U0,Y1 interleaved bytes)"]
    VYUY1P422 = 19,
    #[doc = "20: 8-bit monochrome pixels (1-plane Y luma output)"]
    Y8 = 20,
    #[doc = "21: 4-bit monochrome pixels (1-plane Y luma, 4 bit truncation)"]
    Y4 = 21,
    #[doc = "24: 16-bit pixels (2-plane UV interleaved bytes)"]
    YUV2P422 = 24,
    #[doc = "25: 16-bit pixels (2-plane UV)"]
    YUV2P420 = 25,
    #[doc = "26: 16-bit pixels (2-plane VU interleaved bytes)"]
    YVU2P422 = 26,
    #[doc = "27: 16-bit pixels (2-plane VU)"]
    YVU2P420 = 27,
    #[doc = "30: 16-bit pixels (3-plane format)"]
    YUV422 = 30,
    #[doc = "31: 16-bit pixels (3-plane format)"]
    YUV420 = 31,
}
impl From<FORMAT_A> for u8 {
    #[inline(always)]
    fn from(variant: FORMAT_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `FORMAT`"]
pub type FORMAT_R = crate::R<u8, FORMAT_A>;
impl FORMAT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, FORMAT_A> {
        use crate::Variant::*;
        match self.bits {
            4 => Val(FORMAT_A::RGB888),
            12 => Val(FORMAT_A::RGB555),
            13 => Val(FORMAT_A::RGB444),
            14 => Val(FORMAT_A::RGB565),
            16 => Val(FORMAT_A::YUV1P444),
            18 => Val(FORMAT_A::UYVY1P422),
            19 => Val(FORMAT_A::VYUY1P422),
            20 => Val(FORMAT_A::Y8),
            21 => Val(FORMAT_A::Y4),
            24 => Val(FORMAT_A::YUV2P422),
            25 => Val(FORMAT_A::YUV2P420),
            26 => Val(FORMAT_A::YVU2P422),
            27 => Val(FORMAT_A::YVU2P420),
            30 => Val(FORMAT_A::YUV422),
            31 => Val(FORMAT_A::YUV420),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `RGB888`"]
    #[inline(always)]
    pub fn is_rgb888(&self) -> bool {
        *self == FORMAT_A::RGB888
    }
    #[doc = "Checks if the value of the field is `RGB555`"]
    #[inline(always)]
    pub fn is_rgb555(&self) -> bool {
        *self == FORMAT_A::RGB555
    }
    #[doc = "Checks if the value of the field is `RGB444`"]
    #[inline(always)]
    pub fn is_rgb444(&self) -> bool {
        *self == FORMAT_A::RGB444
    }
    #[doc = "Checks if the value of the field is `RGB565`"]
    #[inline(always)]
    pub fn is_rgb565(&self) -> bool {
        *self == FORMAT_A::RGB565
    }
    #[doc = "Checks if the value of the field is `YUV1P444`"]
    #[inline(always)]
    pub fn is_yuv1p444(&self) -> bool {
        *self == FORMAT_A::YUV1P444
    }
    #[doc = "Checks if the value of the field is `UYVY1P422`"]
    #[inline(always)]
    pub fn is_uyvy1p422(&self) -> bool {
        *self == FORMAT_A::UYVY1P422
    }
    #[doc = "Checks if the value of the field is `VYUY1P422`"]
    #[inline(always)]
    pub fn is_vyuy1p422(&self) -> bool {
        *self == FORMAT_A::VYUY1P422
    }
    #[doc = "Checks if the value of the field is `Y8`"]
    #[inline(always)]
    pub fn is_y8(&self) -> bool {
        *self == FORMAT_A::Y8
    }
    #[doc = "Checks if the value of the field is `Y4`"]
    #[inline(always)]
    pub fn is_y4(&self) -> bool {
        *self == FORMAT_A::Y4
    }
    #[doc = "Checks if the value of the field is `YUV2P422`"]
    #[inline(always)]
    pub fn is_yuv2p422(&self) -> bool {
        *self == FORMAT_A::YUV2P422
    }
    #[doc = "Checks if the value of the field is `YUV2P420`"]
    #[inline(always)]
    pub fn is_yuv2p420(&self) -> bool {
        *self == FORMAT_A::YUV2P420
    }
    #[doc = "Checks if the value of the field is `YVU2P422`"]
    #[inline(always)]
    pub fn is_yvu2p422(&self) -> bool {
        *self == FORMAT_A::YVU2P422
    }
    #[doc = "Checks if the value of the field is `YVU2P420`"]
    #[inline(always)]
    pub fn is_yvu2p420(&self) -> bool {
        *self == FORMAT_A::YVU2P420
    }
    #[doc = "Checks if the value of the field is `YUV422`"]
    #[inline(always)]
    pub fn is_yuv422(&self) -> bool {
        *self == FORMAT_A::YUV422
    }
    #[doc = "Checks if the value of the field is `YUV420`"]
    #[inline(always)]
    pub fn is_yuv420(&self) -> bool {
        *self == FORMAT_A::YUV420
    }
}
#[doc = "Write proxy for field `FORMAT`"]
pub struct FORMAT_W<'a> {
    w: &'a mut W,
}
impl<'a> FORMAT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FORMAT_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "32-bit pixels (unpacked 24-bit format)"]
    #[inline(always)]
    pub fn rgb888(self) -> &'a mut W {
        self.variant(FORMAT_A::RGB888)
    }
    #[doc = "16-bit pixels"]
    #[inline(always)]
    pub fn rgb555(self) -> &'a mut W {
        self.variant(FORMAT_A::RGB555)
    }
    #[doc = "16-bit pixels"]
    #[inline(always)]
    pub fn rgb444(self) -> &'a mut W {
        self.variant(FORMAT_A::RGB444)
    }
    #[doc = "16-bit pixels"]
    #[inline(always)]
    pub fn rgb565(self) -> &'a mut W {
        self.variant(FORMAT_A::RGB565)
    }
    #[doc = "32-bit pixels (1-plane XYUV unpacked)"]
    #[inline(always)]
    pub fn yuv1p444(self) -> &'a mut W {
        self.variant(FORMAT_A::YUV1P444)
    }
    #[doc = "16-bit pixels (1-plane U0,Y0,V0,Y1 interleaved bytes)"]
    #[inline(always)]
    pub fn uyvy1p422(self) -> &'a mut W {
        self.variant(FORMAT_A::UYVY1P422)
    }
    #[doc = "16-bit pixels (1-plane V0,Y0,U0,Y1 interleaved bytes)"]
    #[inline(always)]
    pub fn vyuy1p422(self) -> &'a mut W {
        self.variant(FORMAT_A::VYUY1P422)
    }
    #[doc = "8-bit monochrome pixels (1-plane Y luma output)"]
    #[inline(always)]
    pub fn y8(self) -> &'a mut W {
        self.variant(FORMAT_A::Y8)
    }
    #[doc = "4-bit monochrome pixels (1-plane Y luma, 4 bit truncation)"]
    #[inline(always)]
    pub fn y4(self) -> &'a mut W {
        self.variant(FORMAT_A::Y4)
    }
    #[doc = "16-bit pixels (2-plane UV interleaved bytes)"]
    #[inline(always)]
    pub fn yuv2p422(self) -> &'a mut W {
        self.variant(FORMAT_A::YUV2P422)
    }
    #[doc = "16-bit pixels (2-plane UV)"]
    #[inline(always)]
    pub fn yuv2p420(self) -> &'a mut W {
        self.variant(FORMAT_A::YUV2P420)
    }
    #[doc = "16-bit pixels (2-plane VU interleaved bytes)"]
    #[inline(always)]
    pub fn yvu2p422(self) -> &'a mut W {
        self.variant(FORMAT_A::YVU2P422)
    }
    #[doc = "16-bit pixels (2-plane VU)"]
    #[inline(always)]
    pub fn yvu2p420(self) -> &'a mut W {
        self.variant(FORMAT_A::YVU2P420)
    }
    #[doc = "16-bit pixels (3-plane format)"]
    #[inline(always)]
    pub fn yuv422(self) -> &'a mut W {
        self.variant(FORMAT_A::YUV422)
    }
    #[doc = "16-bit pixels (3-plane format)"]
    #[inline(always)]
    pub fn yuv420(self) -> &'a mut W {
        self.variant(FORMAT_A::YUV420)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x1f) | ((value as u32) & 0x1f);
        self.w
    }
}
#[doc = "Reader of field `WB_SWAP`"]
pub type WB_SWAP_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `WB_SWAP`"]
pub struct WB_SWAP_W<'a> {
    w: &'a mut W,
}
impl<'a> WB_SWAP_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
        self.w
    }
}
#[doc = "Reader of field `RSVD0`"]
pub type RSVD0_R = crate::R<u8, u8>;
#[doc = "Verticle pre decimation filter control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DECY_A {
    #[doc = "0: Disable pre-decimation filter."]
    DISABLE = 0,
    #[doc = "1: Decimate PS by 2."]
    DECY2 = 1,
    #[doc = "2: Decimate PS by 4."]
    DECY4 = 2,
    #[doc = "3: Decimate PS by 8."]
    DECY8 = 3,
}
impl From<DECY_A> for u8 {
    #[inline(always)]
    fn from(variant: DECY_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `DECY`"]
pub type DECY_R = crate::R<u8, DECY_A>;
impl DECY_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DECY_A {
        match self.bits {
            0 => DECY_A::DISABLE,
            1 => DECY_A::DECY2,
            2 => DECY_A::DECY4,
            3 => DECY_A::DECY8,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == DECY_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `DECY2`"]
    #[inline(always)]
    pub fn is_decy2(&self) -> bool {
        *self == DECY_A::DECY2
    }
    #[doc = "Checks if the value of the field is `DECY4`"]
    #[inline(always)]
    pub fn is_decy4(&self) -> bool {
        *self == DECY_A::DECY4
    }
    #[doc = "Checks if the value of the field is `DECY8`"]
    #[inline(always)]
    pub fn is_decy8(&self) -> bool {
        *self == DECY_A::DECY8
    }
}
#[doc = "Write proxy for field `DECY`"]
pub struct DECY_W<'a> {
    w: &'a mut W,
}
impl<'a> DECY_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DECY_A) -> &'a mut W {
        {
            self.bits(variant.into())
        }
    }
    #[doc = "Disable pre-decimation filter."]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(DECY_A::DISABLE)
    }
    #[doc = "Decimate PS by 2."]
    #[inline(always)]
    pub fn decy2(self) -> &'a mut W {
        self.variant(DECY_A::DECY2)
    }
    #[doc = "Decimate PS by 4."]
    #[inline(always)]
    pub fn decy4(self) -> &'a mut W {
        self.variant(DECY_A::DECY4)
    }
    #[doc = "Decimate PS by 8."]
    #[inline(always)]
    pub fn decy8(self) -> &'a mut W {
        self.variant(DECY_A::DECY8)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
        self.w
    }
}
#[doc = "Horizontal pre decimation filter control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DECX_A {
    #[doc = "0: Disable pre-decimation filter."]
    DISABLE = 0,
    #[doc = "1: Decimate PS by 2."]
    DECX2 = 1,
    #[doc = "2: Decimate PS by 4."]
    DECX4 = 2,
    #[doc = "3: Decimate PS by 8."]
    DECX8 = 3,
}
impl From<DECX_A> for u8 {
    #[inline(always)]
    fn from(variant: DECX_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `DECX`"]
pub type DECX_R = crate::R<u8, DECX_A>;
impl DECX_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DECX_A {
        match self.bits {
            0 => DECX_A::DISABLE,
            1 => DECX_A::DECX2,
            2 => DECX_A::DECX4,
            3 => DECX_A::DECX8,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == DECX_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `DECX2`"]
    #[inline(always)]
    pub fn is_decx2(&self) -> bool {
        *self == DECX_A::DECX2
    }
    #[doc = "Checks if the value of the field is `DECX4`"]
    #[inline(always)]
    pub fn is_decx4(&self) -> bool {
        *self == DECX_A::DECX4
    }
    #[doc = "Checks if the value of the field is `DECX8`"]
    #[inline(always)]
    pub fn is_decx8(&self) -> bool {
        *self == DECX_A::DECX8
    }
}
#[doc = "Write proxy for field `DECX`"]
pub struct DECX_W<'a> {
    w: &'a mut W,
}
impl<'a> DECX_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DECX_A) -> &'a mut W {
        {
            self.bits(variant.into())
        }
    }
    #[doc = "Disable pre-decimation filter."]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(DECX_A::DISABLE)
    }
    #[doc = "Decimate PS by 2."]
    #[inline(always)]
    pub fn decx2(self) -> &'a mut W {
        self.variant(DECX_A::DECX2)
    }
    #[doc = "Decimate PS by 4."]
    #[inline(always)]
    pub fn decx4(self) -> &'a mut W {
        self.variant(DECX_A::DECX4)
    }
    #[doc = "Decimate PS by 8."]
    #[inline(always)]
    pub fn decx8(self) -> &'a mut W {
        self.variant(DECX_A::DECX8)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
        self.w
    }
}
#[doc = "Reader of field `RSVD1`"]
pub type RSVD1_R = crate::R<u32, u32>;
impl R {
    #[doc = "Bits 0:4 - PS buffer format. To select between YUV and YCbCr formats, see bit 31 of the CSC1_COEF0 register."]
    #[inline(always)]
    pub fn format(&self) -> FORMAT_R {
        FORMAT_R::new((self.bits & 0x1f) as u8)
    }
    #[doc = "Bit 5 - Swap bytes in words. For each 16 bit word, the two bytes will be swapped."]
    #[inline(always)]
    pub fn wb_swap(&self) -> WB_SWAP_R {
        WB_SWAP_R::new(((self.bits >> 5) & 0x01) != 0)
    }
    #[doc = "Bits 6:7 - Reserved, always set to zero."]
    #[inline(always)]
    pub fn rsvd0(&self) -> RSVD0_R {
        RSVD0_R::new(((self.bits >> 6) & 0x03) as u8)
    }
    #[doc = "Bits 8:9 - Verticle pre decimation filter control."]
    #[inline(always)]
    pub fn decy(&self) -> DECY_R {
        DECY_R::new(((self.bits >> 8) & 0x03) as u8)
    }
    #[doc = "Bits 10:11 - Horizontal pre decimation filter control."]
    #[inline(always)]
    pub fn decx(&self) -> DECX_R {
        DECX_R::new(((self.bits >> 10) & 0x03) as u8)
    }
    #[doc = "Bits 12:31 - Reserved, always set to zero."]
    #[inline(always)]
    pub fn rsvd1(&self) -> RSVD1_R {
        RSVD1_R::new(((self.bits >> 12) & 0x000f_ffff) as u32)
    }
}
impl W {
    #[doc = "Bits 0:4 - PS buffer format. To select between YUV and YCbCr formats, see bit 31 of the CSC1_COEF0 register."]
    #[inline(always)]
    pub fn format(&mut self) -> FORMAT_W {
        FORMAT_W { w: self }
    }
    #[doc = "Bit 5 - Swap bytes in words. For each 16 bit word, the two bytes will be swapped."]
    #[inline(always)]
    pub fn wb_swap(&mut self) -> WB_SWAP_W {
        WB_SWAP_W { w: self }
    }
    #[doc = "Bits 8:9 - Verticle pre decimation filter control."]
    #[inline(always)]
    pub fn decy(&mut self) -> DECY_W {
        DECY_W { w: self }
    }
    #[doc = "Bits 10:11 - Horizontal pre decimation filter control."]
    #[inline(always)]
    pub fn decx(&mut self) -> DECX_W {
        DECX_W { w: self }
    }
}