esp32p4/isp/
dpc_conf.rs

1#[doc = "Register `DPC_CONF` reader"]
2pub type R = crate::R<DPC_CONF_SPEC>;
3#[doc = "Register `DPC_CONF` writer"]
4pub type W = crate::W<DPC_CONF_SPEC>;
5#[doc = "Field `DPC_THRESHOLD_L` reader - this bit configures the threshold to detect black img in check mode, or the low threshold(use 8 bit 0~255) in dyn method 0, or the low threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
6pub type DPC_THRESHOLD_L_R = crate::FieldReader;
7#[doc = "Field `DPC_THRESHOLD_L` writer - this bit configures the threshold to detect black img in check mode, or the low threshold(use 8 bit 0~255) in dyn method 0, or the low threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
8pub type DPC_THRESHOLD_L_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `DPC_THRESHOLD_H` reader - this bit configures the threshold to detect white img in check mode, or the high threshold(use 8 bit 0~255) in dyn method 0, or the high threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
10pub type DPC_THRESHOLD_H_R = crate::FieldReader;
11#[doc = "Field `DPC_THRESHOLD_H` writer - this bit configures the threshold to detect white img in check mode, or the high threshold(use 8 bit 0~255) in dyn method 0, or the high threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
12pub type DPC_THRESHOLD_H_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `DPC_FACTOR_DARK` reader - this field configures the dynamic correction method 1 dark factor"]
14pub type DPC_FACTOR_DARK_R = crate::FieldReader;
15#[doc = "Field `DPC_FACTOR_DARK` writer - this field configures the dynamic correction method 1 dark factor"]
16pub type DPC_FACTOR_DARK_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
17#[doc = "Field `DPC_FACTOR_BRIG` reader - this field configures the dynamic correction method 1 bright factor"]
18pub type DPC_FACTOR_BRIG_R = crate::FieldReader;
19#[doc = "Field `DPC_FACTOR_BRIG` writer - this field configures the dynamic correction method 1 bright factor"]
20pub type DPC_FACTOR_BRIG_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
21impl R {
22    #[doc = "Bits 0:7 - this bit configures the threshold to detect black img in check mode, or the low threshold(use 8 bit 0~255) in dyn method 0, or the low threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
23    #[inline(always)]
24    pub fn dpc_threshold_l(&self) -> DPC_THRESHOLD_L_R {
25        DPC_THRESHOLD_L_R::new((self.bits & 0xff) as u8)
26    }
27    #[doc = "Bits 8:15 - this bit configures the threshold to detect white img in check mode, or the high threshold(use 8 bit 0~255) in dyn method 0, or the high threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
28    #[inline(always)]
29    pub fn dpc_threshold_h(&self) -> DPC_THRESHOLD_H_R {
30        DPC_THRESHOLD_H_R::new(((self.bits >> 8) & 0xff) as u8)
31    }
32    #[doc = "Bits 16:21 - this field configures the dynamic correction method 1 dark factor"]
33    #[inline(always)]
34    pub fn dpc_factor_dark(&self) -> DPC_FACTOR_DARK_R {
35        DPC_FACTOR_DARK_R::new(((self.bits >> 16) & 0x3f) as u8)
36    }
37    #[doc = "Bits 22:27 - this field configures the dynamic correction method 1 bright factor"]
38    #[inline(always)]
39    pub fn dpc_factor_brig(&self) -> DPC_FACTOR_BRIG_R {
40        DPC_FACTOR_BRIG_R::new(((self.bits >> 22) & 0x3f) as u8)
41    }
42}
43#[cfg(feature = "impl-register-debug")]
44impl core::fmt::Debug for R {
45    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
46        f.debug_struct("DPC_CONF")
47            .field(
48                "dpc_threshold_l",
49                &format_args!("{}", self.dpc_threshold_l().bits()),
50            )
51            .field(
52                "dpc_threshold_h",
53                &format_args!("{}", self.dpc_threshold_h().bits()),
54            )
55            .field(
56                "dpc_factor_dark",
57                &format_args!("{}", self.dpc_factor_dark().bits()),
58            )
59            .field(
60                "dpc_factor_brig",
61                &format_args!("{}", self.dpc_factor_brig().bits()),
62            )
63            .finish()
64    }
65}
66#[cfg(feature = "impl-register-debug")]
67impl core::fmt::Debug for crate::generic::Reg<DPC_CONF_SPEC> {
68    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
69        core::fmt::Debug::fmt(&self.read(), f)
70    }
71}
72impl W {
73    #[doc = "Bits 0:7 - this bit configures the threshold to detect black img in check mode, or the low threshold(use 8 bit 0~255) in dyn method 0, or the low threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
74    #[inline(always)]
75    #[must_use]
76    pub fn dpc_threshold_l(&mut self) -> DPC_THRESHOLD_L_W<DPC_CONF_SPEC> {
77        DPC_THRESHOLD_L_W::new(self, 0)
78    }
79    #[doc = "Bits 8:15 - this bit configures the threshold to detect white img in check mode, or the high threshold(use 8 bit 0~255) in dyn method 0, or the high threshold factor (use 5 bit 10000-> 16/16, 00001->1/16, 0/16~16/16) in dyn method 1"]
80    #[inline(always)]
81    #[must_use]
82    pub fn dpc_threshold_h(&mut self) -> DPC_THRESHOLD_H_W<DPC_CONF_SPEC> {
83        DPC_THRESHOLD_H_W::new(self, 8)
84    }
85    #[doc = "Bits 16:21 - this field configures the dynamic correction method 1 dark factor"]
86    #[inline(always)]
87    #[must_use]
88    pub fn dpc_factor_dark(&mut self) -> DPC_FACTOR_DARK_W<DPC_CONF_SPEC> {
89        DPC_FACTOR_DARK_W::new(self, 16)
90    }
91    #[doc = "Bits 22:27 - this field configures the dynamic correction method 1 bright factor"]
92    #[inline(always)]
93    #[must_use]
94    pub fn dpc_factor_brig(&mut self) -> DPC_FACTOR_BRIG_W<DPC_CONF_SPEC> {
95        DPC_FACTOR_BRIG_W::new(self, 22)
96    }
97}
98#[doc = "DPC parameter config register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`dpc_conf::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 [`dpc_conf::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct DPC_CONF_SPEC;
100impl crate::RegisterSpec for DPC_CONF_SPEC {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`dpc_conf::R`](R) reader structure"]
104impl crate::Readable for DPC_CONF_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`dpc_conf::W`](W) writer structure"]
106impl crate::Writable for DPC_CONF_SPEC {
107    type Safety = crate::Unsafe;
108    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
109    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
110}
111#[doc = "`reset()` method sets DPC_CONF to value 0x0410_3030"]
112impl crate::Resettable for DPC_CONF_SPEC {
113    const RESET_VALUE: u32 = 0x0410_3030;
114}