esp32p4/ppa/
sr_fix_alpha.rs

1#[doc = "Register `SR_FIX_ALPHA` reader"]
2pub type R = crate::R<SR_FIX_ALPHA_SPEC>;
3#[doc = "Register `SR_FIX_ALPHA` writer"]
4pub type W = crate::W<SR_FIX_ALPHA_SPEC>;
5#[doc = "Field `SR_RX_FIX_ALPHA` reader - The value would replace the alpha value in received pixel for Scaling and Rotating engine when PPA_SR_RX_ALPHA_CONF_EN is enabled."]
6pub type SR_RX_FIX_ALPHA_R = crate::FieldReader;
7#[doc = "Field `SR_RX_FIX_ALPHA` writer - The value would replace the alpha value in received pixel for Scaling and Rotating engine when PPA_SR_RX_ALPHA_CONF_EN is enabled."]
8pub type SR_RX_FIX_ALPHA_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `SR_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."]
10pub type SR_RX_ALPHA_MOD_R = crate::FieldReader;
11#[doc = "Field `SR_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."]
12pub type SR_RX_ALPHA_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `SR_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."]
14pub type SR_RX_ALPHA_INV_R = crate::BitReader;
15#[doc = "Field `SR_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."]
16pub type SR_RX_ALPHA_INV_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bits 0:7 - The value would replace the alpha value in received pixel for Scaling and Rotating engine when PPA_SR_RX_ALPHA_CONF_EN is enabled."]
19    #[inline(always)]
20    pub fn sr_rx_fix_alpha(&self) -> SR_RX_FIX_ALPHA_R {
21        SR_RX_FIX_ALPHA_R::new((self.bits & 0xff) as u8)
22    }
23    #[doc = "Bits 8:9 - 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."]
24    #[inline(always)]
25    pub fn sr_rx_alpha_mod(&self) -> SR_RX_ALPHA_MOD_R {
26        SR_RX_ALPHA_MOD_R::new(((self.bits >> 8) & 3) as u8)
27    }
28    #[doc = "Bit 10 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
29    #[inline(always)]
30    pub fn sr_rx_alpha_inv(&self) -> SR_RX_ALPHA_INV_R {
31        SR_RX_ALPHA_INV_R::new(((self.bits >> 10) & 1) != 0)
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("SR_FIX_ALPHA")
38            .field(
39                "sr_rx_fix_alpha",
40                &format_args!("{}", self.sr_rx_fix_alpha().bits()),
41            )
42            .field(
43                "sr_rx_alpha_mod",
44                &format_args!("{}", self.sr_rx_alpha_mod().bits()),
45            )
46            .field(
47                "sr_rx_alpha_inv",
48                &format_args!("{}", self.sr_rx_alpha_inv().bit()),
49            )
50            .finish()
51    }
52}
53#[cfg(feature = "impl-register-debug")]
54impl core::fmt::Debug for crate::generic::Reg<SR_FIX_ALPHA_SPEC> {
55    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
56        core::fmt::Debug::fmt(&self.read(), f)
57    }
58}
59impl W {
60    #[doc = "Bits 0:7 - The value would replace the alpha value in received pixel for Scaling and Rotating engine when PPA_SR_RX_ALPHA_CONF_EN is enabled."]
61    #[inline(always)]
62    #[must_use]
63    pub fn sr_rx_fix_alpha(&mut self) -> SR_RX_FIX_ALPHA_W<SR_FIX_ALPHA_SPEC> {
64        SR_RX_FIX_ALPHA_W::new(self, 0)
65    }
66    #[doc = "Bits 8:9 - 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."]
67    #[inline(always)]
68    #[must_use]
69    pub fn sr_rx_alpha_mod(&mut self) -> SR_RX_ALPHA_MOD_W<SR_FIX_ALPHA_SPEC> {
70        SR_RX_ALPHA_MOD_W::new(self, 8)
71    }
72    #[doc = "Bit 10 - Set this bit to invert the original alpha value. When RX color mode is RGB565/RGB88. The original alpha value is 255."]
73    #[inline(always)]
74    #[must_use]
75    pub fn sr_rx_alpha_inv(&mut self) -> SR_RX_ALPHA_INV_W<SR_FIX_ALPHA_SPEC> {
76        SR_RX_ALPHA_INV_W::new(self, 10)
77    }
78}
79#[doc = "Scaling and rotating engine alpha override register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`sr_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 [`sr_fix_alpha::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct SR_FIX_ALPHA_SPEC;
81impl crate::RegisterSpec for SR_FIX_ALPHA_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`sr_fix_alpha::R`](R) reader structure"]
85impl crate::Readable for SR_FIX_ALPHA_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`sr_fix_alpha::W`](W) writer structure"]
87impl crate::Writable for SR_FIX_ALPHA_SPEC {
88    type Safety = crate::Unsafe;
89    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
90    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91}
92#[doc = "`reset()` method sets SR_FIX_ALPHA to value 0x80"]
93impl crate::Resettable for SR_FIX_ALPHA_SPEC {
94    const RESET_VALUE: u32 = 0x80;
95}