esp32p4/isp/
hist_weight0.rs

1#[doc = "Register `HIST_WEIGHT0` reader"]
2pub type R = crate::R<HIST_WEIGHT0_SPEC>;
3#[doc = "Register `HIST_WEIGHT0` writer"]
4pub type W = crate::W<HIST_WEIGHT0_SPEC>;
5#[doc = "Field `HIST_WEIGHT_03` reader - this field configures weight of subwindow 03"]
6pub type HIST_WEIGHT_03_R = crate::FieldReader;
7#[doc = "Field `HIST_WEIGHT_03` writer - this field configures weight of subwindow 03"]
8pub type HIST_WEIGHT_03_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `HIST_WEIGHT_02` reader - this field configures weight of subwindow 02"]
10pub type HIST_WEIGHT_02_R = crate::FieldReader;
11#[doc = "Field `HIST_WEIGHT_02` writer - this field configures weight of subwindow 02"]
12pub type HIST_WEIGHT_02_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `HIST_WEIGHT_01` reader - this field configures weight of subwindow 01"]
14pub type HIST_WEIGHT_01_R = crate::FieldReader;
15#[doc = "Field `HIST_WEIGHT_01` writer - this field configures weight of subwindow 01"]
16pub type HIST_WEIGHT_01_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
17#[doc = "Field `HIST_WEIGHT_00` reader - this field configures weight of subwindow 00 and sum of all weight should be 256"]
18pub type HIST_WEIGHT_00_R = crate::FieldReader;
19#[doc = "Field `HIST_WEIGHT_00` writer - this field configures weight of subwindow 00 and sum of all weight should be 256"]
20pub type HIST_WEIGHT_00_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
21impl R {
22    #[doc = "Bits 0:7 - this field configures weight of subwindow 03"]
23    #[inline(always)]
24    pub fn hist_weight_03(&self) -> HIST_WEIGHT_03_R {
25        HIST_WEIGHT_03_R::new((self.bits & 0xff) as u8)
26    }
27    #[doc = "Bits 8:15 - this field configures weight of subwindow 02"]
28    #[inline(always)]
29    pub fn hist_weight_02(&self) -> HIST_WEIGHT_02_R {
30        HIST_WEIGHT_02_R::new(((self.bits >> 8) & 0xff) as u8)
31    }
32    #[doc = "Bits 16:23 - this field configures weight of subwindow 01"]
33    #[inline(always)]
34    pub fn hist_weight_01(&self) -> HIST_WEIGHT_01_R {
35        HIST_WEIGHT_01_R::new(((self.bits >> 16) & 0xff) as u8)
36    }
37    #[doc = "Bits 24:31 - this field configures weight of subwindow 00 and sum of all weight should be 256"]
38    #[inline(always)]
39    pub fn hist_weight_00(&self) -> HIST_WEIGHT_00_R {
40        HIST_WEIGHT_00_R::new(((self.bits >> 24) & 0xff) 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("HIST_WEIGHT0")
47            .field(
48                "hist_weight_03",
49                &format_args!("{}", self.hist_weight_03().bits()),
50            )
51            .field(
52                "hist_weight_02",
53                &format_args!("{}", self.hist_weight_02().bits()),
54            )
55            .field(
56                "hist_weight_01",
57                &format_args!("{}", self.hist_weight_01().bits()),
58            )
59            .field(
60                "hist_weight_00",
61                &format_args!("{}", self.hist_weight_00().bits()),
62            )
63            .finish()
64    }
65}
66#[cfg(feature = "impl-register-debug")]
67impl core::fmt::Debug for crate::generic::Reg<HIST_WEIGHT0_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 field configures weight of subwindow 03"]
74    #[inline(always)]
75    #[must_use]
76    pub fn hist_weight_03(&mut self) -> HIST_WEIGHT_03_W<HIST_WEIGHT0_SPEC> {
77        HIST_WEIGHT_03_W::new(self, 0)
78    }
79    #[doc = "Bits 8:15 - this field configures weight of subwindow 02"]
80    #[inline(always)]
81    #[must_use]
82    pub fn hist_weight_02(&mut self) -> HIST_WEIGHT_02_W<HIST_WEIGHT0_SPEC> {
83        HIST_WEIGHT_02_W::new(self, 8)
84    }
85    #[doc = "Bits 16:23 - this field configures weight of subwindow 01"]
86    #[inline(always)]
87    #[must_use]
88    pub fn hist_weight_01(&mut self) -> HIST_WEIGHT_01_W<HIST_WEIGHT0_SPEC> {
89        HIST_WEIGHT_01_W::new(self, 16)
90    }
91    #[doc = "Bits 24:31 - this field configures weight of subwindow 00 and sum of all weight should be 256"]
92    #[inline(always)]
93    #[must_use]
94    pub fn hist_weight_00(&mut self) -> HIST_WEIGHT_00_W<HIST_WEIGHT0_SPEC> {
95        HIST_WEIGHT_00_W::new(self, 24)
96    }
97}
98#[doc = "histogram sub-window weight register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`hist_weight0::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 [`hist_weight0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct HIST_WEIGHT0_SPEC;
100impl crate::RegisterSpec for HIST_WEIGHT0_SPEC {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`hist_weight0::R`](R) reader structure"]
104impl crate::Readable for HIST_WEIGHT0_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`hist_weight0::W`](W) writer structure"]
106impl crate::Writable for HIST_WEIGHT0_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 HIST_WEIGHT0 to value 0x0101_0101"]
112impl crate::Resettable for HIST_WEIGHT0_SPEC {
113    const RESET_VALUE: u32 = 0x0101_0101;
114}