esp32p4/mipi_dsi_bridge/
yuv_cfg.rs

1#[doc = "Register `YUV_CFG` reader"]
2pub type R = crate::R<YUV_CFG_SPEC>;
3#[doc = "Register `YUV_CFG` writer"]
4pub type W = crate::W<YUV_CFG_SPEC>;
5#[doc = "Field `PROTOCAL` reader - this bit configures yuv protoocl, 0: bt.601, 1: bt.709"]
6pub type PROTOCAL_R = crate::BitReader;
7#[doc = "Field `PROTOCAL` writer - this bit configures yuv protoocl, 0: bt.601, 1: bt.709"]
8pub type PROTOCAL_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `YUV_PIX_ENDIAN` reader - this bit configures yuv pixel endian, 0: y0u0y1v1y2u2y3v3, 1: y3u3y2v2y1u1y0v0"]
10pub type YUV_PIX_ENDIAN_R = crate::BitReader;
11#[doc = "Field `YUV_PIX_ENDIAN` writer - this bit configures yuv pixel endian, 0: y0u0y1v1y2u2y3v3, 1: y3u3y2v2y1u1y0v0"]
12pub type YUV_PIX_ENDIAN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `YUV422_FORMAT` reader - this field configures yuv422 store format, 0: yuyv, 1: yvyu, 2: uyvy, 3: vyuy"]
14pub type YUV422_FORMAT_R = crate::FieldReader;
15#[doc = "Field `YUV422_FORMAT` writer - this field configures yuv422 store format, 0: yuyv, 1: yvyu, 2: uyvy, 3: vyuy"]
16pub type YUV422_FORMAT_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17impl R {
18    #[doc = "Bit 0 - this bit configures yuv protoocl, 0: bt.601, 1: bt.709"]
19    #[inline(always)]
20    pub fn protocal(&self) -> PROTOCAL_R {
21        PROTOCAL_R::new((self.bits & 1) != 0)
22    }
23    #[doc = "Bit 1 - this bit configures yuv pixel endian, 0: y0u0y1v1y2u2y3v3, 1: y3u3y2v2y1u1y0v0"]
24    #[inline(always)]
25    pub fn yuv_pix_endian(&self) -> YUV_PIX_ENDIAN_R {
26        YUV_PIX_ENDIAN_R::new(((self.bits >> 1) & 1) != 0)
27    }
28    #[doc = "Bits 2:3 - this field configures yuv422 store format, 0: yuyv, 1: yvyu, 2: uyvy, 3: vyuy"]
29    #[inline(always)]
30    pub fn yuv422_format(&self) -> YUV422_FORMAT_R {
31        YUV422_FORMAT_R::new(((self.bits >> 2) & 3) as u8)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("YUV_CFG")
38            .field("protocal", &format_args!("{}", self.protocal().bit()))
39            .field(
40                "yuv_pix_endian",
41                &format_args!("{}", self.yuv_pix_endian().bit()),
42            )
43            .field(
44                "yuv422_format",
45                &format_args!("{}", self.yuv422_format().bits()),
46            )
47            .finish()
48    }
49}
50#[cfg(feature = "impl-register-debug")]
51impl core::fmt::Debug for crate::generic::Reg<YUV_CFG_SPEC> {
52    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
53        core::fmt::Debug::fmt(&self.read(), f)
54    }
55}
56impl W {
57    #[doc = "Bit 0 - this bit configures yuv protoocl, 0: bt.601, 1: bt.709"]
58    #[inline(always)]
59    #[must_use]
60    pub fn protocal(&mut self) -> PROTOCAL_W<YUV_CFG_SPEC> {
61        PROTOCAL_W::new(self, 0)
62    }
63    #[doc = "Bit 1 - this bit configures yuv pixel endian, 0: y0u0y1v1y2u2y3v3, 1: y3u3y2v2y1u1y0v0"]
64    #[inline(always)]
65    #[must_use]
66    pub fn yuv_pix_endian(&mut self) -> YUV_PIX_ENDIAN_W<YUV_CFG_SPEC> {
67        YUV_PIX_ENDIAN_W::new(self, 1)
68    }
69    #[doc = "Bits 2:3 - this field configures yuv422 store format, 0: yuyv, 1: yvyu, 2: uyvy, 3: vyuy"]
70    #[inline(always)]
71    #[must_use]
72    pub fn yuv422_format(&mut self) -> YUV422_FORMAT_W<YUV_CFG_SPEC> {
73        YUV422_FORMAT_W::new(self, 2)
74    }
75}
76#[doc = "dsi_bridge yuv format config register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`yuv_cfg::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`yuv_cfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
77pub struct YUV_CFG_SPEC;
78impl crate::RegisterSpec for YUV_CFG_SPEC {
79    type Ux = u32;
80}
81#[doc = "`read()` method returns [`yuv_cfg::R`](R) reader structure"]
82impl crate::Readable for YUV_CFG_SPEC {}
83#[doc = "`write(|w| ..)` method takes [`yuv_cfg::W`](W) writer structure"]
84impl crate::Writable for YUV_CFG_SPEC {
85    type Safety = crate::Unsafe;
86    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
87    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
88}
89#[doc = "`reset()` method sets YUV_CFG to value 0"]
90impl crate::Resettable for YUV_CFG_SPEC {
91    const RESET_VALUE: u32 = 0;
92}