esp32p4/ppa/
blend_fix_alpha.rs

1#[doc = "Register `BLEND_FIX_ALPHA` reader"]
2pub type R = crate::R<BLEND_FIX_ALPHA_SPEC>;
3#[doc = "Register `BLEND_FIX_ALPHA` writer"]
4pub type W = crate::W<BLEND_FIX_ALPHA_SPEC>;
5#[doc = "Field `BLEND0_RX_FIX_ALPHA` reader - The value would replace the alpha value in received pixel for background plane of blender when PPA_BLEND0_RX_ALPHA_CONF_EN is enabled."]
6pub type BLEND0_RX_FIX_ALPHA_R = crate::FieldReader;
7#[doc = "Field `BLEND0_RX_FIX_ALPHA` writer - The value would replace the alpha value in received pixel for background plane of blender when PPA_BLEND0_RX_ALPHA_CONF_EN is enabled."]
8pub type BLEND0_RX_FIX_ALPHA_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `BLEND1_RX_FIX_ALPHA` reader - The value would replace the alpha value in received pixel for foreground plane of blender when PPA_BLEND1_RX_ALPHA_CONF_EN is enabled."]
10pub type BLEND1_RX_FIX_ALPHA_R = crate::FieldReader;
11#[doc = "Field `BLEND1_RX_FIX_ALPHA` writer - The value would replace the alpha value in received pixel for foreground plane of blender when PPA_BLEND1_RX_ALPHA_CONF_EN is enabled."]
12pub type BLEND1_RX_FIX_ALPHA_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `BLEND0_RX_ALPHA_MOD` reader - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
14pub type BLEND0_RX_ALPHA_MOD_R = crate::FieldReader;
15#[doc = "Field `BLEND0_RX_ALPHA_MOD` writer - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
16pub type BLEND0_RX_ALPHA_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `BLEND1_RX_ALPHA_MOD` reader - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
18pub type BLEND1_RX_ALPHA_MOD_R = crate::FieldReader;
19#[doc = "Field `BLEND1_RX_ALPHA_MOD` writer - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
20pub type BLEND1_RX_ALPHA_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21#[doc = "Field `BLEND0_RX_ALPHA_INV` reader - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
22pub type BLEND0_RX_ALPHA_INV_R = crate::BitReader;
23#[doc = "Field `BLEND0_RX_ALPHA_INV` writer - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
24pub type BLEND0_RX_ALPHA_INV_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `BLEND1_RX_ALPHA_INV` reader - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
26pub type BLEND1_RX_ALPHA_INV_R = crate::BitReader;
27#[doc = "Field `BLEND1_RX_ALPHA_INV` writer - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
28pub type BLEND1_RX_ALPHA_INV_W<'a, REG> = crate::BitWriter<'a, REG>;
29impl R {
30    #[doc = "Bits 0:7 - The value would replace the alpha value in received pixel for background plane of blender when PPA_BLEND0_RX_ALPHA_CONF_EN is enabled."]
31    #[inline(always)]
32    pub fn blend0_rx_fix_alpha(&self) -> BLEND0_RX_FIX_ALPHA_R {
33        BLEND0_RX_FIX_ALPHA_R::new((self.bits & 0xff) as u8)
34    }
35    #[doc = "Bits 8:15 - The value would replace the alpha value in received pixel for foreground plane of blender when PPA_BLEND1_RX_ALPHA_CONF_EN is enabled."]
36    #[inline(always)]
37    pub fn blend1_rx_fix_alpha(&self) -> BLEND1_RX_FIX_ALPHA_R {
38        BLEND1_RX_FIX_ALPHA_R::new(((self.bits >> 8) & 0xff) as u8)
39    }
40    #[doc = "Bits 16:17 - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
41    #[inline(always)]
42    pub fn blend0_rx_alpha_mod(&self) -> BLEND0_RX_ALPHA_MOD_R {
43        BLEND0_RX_ALPHA_MOD_R::new(((self.bits >> 16) & 3) as u8)
44    }
45    #[doc = "Bits 18:19 - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
46    #[inline(always)]
47    pub fn blend1_rx_alpha_mod(&self) -> BLEND1_RX_ALPHA_MOD_R {
48        BLEND1_RX_ALPHA_MOD_R::new(((self.bits >> 18) & 3) as u8)
49    }
50    #[doc = "Bit 20 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
51    #[inline(always)]
52    pub fn blend0_rx_alpha_inv(&self) -> BLEND0_RX_ALPHA_INV_R {
53        BLEND0_RX_ALPHA_INV_R::new(((self.bits >> 20) & 1) != 0)
54    }
55    #[doc = "Bit 21 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
56    #[inline(always)]
57    pub fn blend1_rx_alpha_inv(&self) -> BLEND1_RX_ALPHA_INV_R {
58        BLEND1_RX_ALPHA_INV_R::new(((self.bits >> 21) & 1) != 0)
59    }
60}
61#[cfg(feature = "impl-register-debug")]
62impl core::fmt::Debug for R {
63    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64        f.debug_struct("BLEND_FIX_ALPHA")
65            .field(
66                "blend0_rx_fix_alpha",
67                &format_args!("{}", self.blend0_rx_fix_alpha().bits()),
68            )
69            .field(
70                "blend1_rx_fix_alpha",
71                &format_args!("{}", self.blend1_rx_fix_alpha().bits()),
72            )
73            .field(
74                "blend0_rx_alpha_mod",
75                &format_args!("{}", self.blend0_rx_alpha_mod().bits()),
76            )
77            .field(
78                "blend1_rx_alpha_mod",
79                &format_args!("{}", self.blend1_rx_alpha_mod().bits()),
80            )
81            .field(
82                "blend0_rx_alpha_inv",
83                &format_args!("{}", self.blend0_rx_alpha_inv().bit()),
84            )
85            .field(
86                "blend1_rx_alpha_inv",
87                &format_args!("{}", self.blend1_rx_alpha_inv().bit()),
88            )
89            .finish()
90    }
91}
92#[cfg(feature = "impl-register-debug")]
93impl core::fmt::Debug for crate::generic::Reg<BLEND_FIX_ALPHA_SPEC> {
94    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
95        core::fmt::Debug::fmt(&self.read(), f)
96    }
97}
98impl W {
99    #[doc = "Bits 0:7 - The value would replace the alpha value in received pixel for background plane of blender when PPA_BLEND0_RX_ALPHA_CONF_EN is enabled."]
100    #[inline(always)]
101    #[must_use]
102    pub fn blend0_rx_fix_alpha(&mut self) -> BLEND0_RX_FIX_ALPHA_W<BLEND_FIX_ALPHA_SPEC> {
103        BLEND0_RX_FIX_ALPHA_W::new(self, 0)
104    }
105    #[doc = "Bits 8:15 - The value would replace the alpha value in received pixel for foreground plane of blender when PPA_BLEND1_RX_ALPHA_CONF_EN is enabled."]
106    #[inline(always)]
107    #[must_use]
108    pub fn blend1_rx_fix_alpha(&mut self) -> BLEND1_RX_FIX_ALPHA_W<BLEND_FIX_ALPHA_SPEC> {
109        BLEND1_RX_FIX_ALPHA_W::new(self, 8)
110    }
111    #[doc = "Bits 16:17 - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
112    #[inline(always)]
113    #[must_use]
114    pub fn blend0_rx_alpha_mod(&mut self) -> BLEND0_RX_ALPHA_MOD_W<BLEND_FIX_ALPHA_SPEC> {
115        BLEND0_RX_ALPHA_MOD_W::new(self, 16)
116    }
117    #[doc = "Bits 18:19 - Alpha mode. 0/3: not replace alpha. 1: replace alpha with PPA_SR_FIX_ALPHA. 2: Original alpha multiply with PPA_SR_FIX_ALPHA/256."]
118    #[inline(always)]
119    #[must_use]
120    pub fn blend1_rx_alpha_mod(&mut self) -> BLEND1_RX_ALPHA_MOD_W<BLEND_FIX_ALPHA_SPEC> {
121        BLEND1_RX_ALPHA_MOD_W::new(self, 18)
122    }
123    #[doc = "Bit 20 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
124    #[inline(always)]
125    #[must_use]
126    pub fn blend0_rx_alpha_inv(&mut self) -> BLEND0_RX_ALPHA_INV_W<BLEND_FIX_ALPHA_SPEC> {
127        BLEND0_RX_ALPHA_INV_W::new(self, 20)
128    }
129    #[doc = "Bit 21 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
130    #[inline(always)]
131    #[must_use]
132    pub fn blend1_rx_alpha_inv(&mut self) -> BLEND1_RX_ALPHA_INV_W<BLEND_FIX_ALPHA_SPEC> {
133        BLEND1_RX_ALPHA_INV_W::new(self, 21)
134    }
135}
136#[doc = "Blending engine alpha override register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`blend_fix_alpha::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 [`blend_fix_alpha::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
137pub struct BLEND_FIX_ALPHA_SPEC;
138impl crate::RegisterSpec for BLEND_FIX_ALPHA_SPEC {
139    type Ux = u32;
140}
141#[doc = "`read()` method returns [`blend_fix_alpha::R`](R) reader structure"]
142impl crate::Readable for BLEND_FIX_ALPHA_SPEC {}
143#[doc = "`write(|w| ..)` method takes [`blend_fix_alpha::W`](W) writer structure"]
144impl crate::Writable for BLEND_FIX_ALPHA_SPEC {
145    type Safety = crate::Unsafe;
146    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
147    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
148}
149#[doc = "`reset()` method sets BLEND_FIX_ALPHA to value 0x8080"]
150impl crate::Resettable for BLEND_FIX_ALPHA_SPEC {
151    const RESET_VALUE: u32 = 0x8080;
152}