1#[doc = "Register `BLC_CTRL1` reader"]
2pub type R = crate::R<BLC_CTRL1_SPEC>;
3#[doc = "Register `BLC_CTRL1` writer"]
4pub type W = crate::W<BLC_CTRL1_SPEC>;
5#[doc = "Field `BLC_WINDOW_TOP` reader - this field configures blc average calculation window top"]
6pub type BLC_WINDOW_TOP_R = crate::FieldReader<u16>;
7#[doc = "Field `BLC_WINDOW_TOP` writer - this field configures blc average calculation window top"]
8pub type BLC_WINDOW_TOP_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
9#[doc = "Field `BLC_WINDOW_LEFT` reader - this field configures blc average calculation window left"]
10pub type BLC_WINDOW_LEFT_R = crate::FieldReader<u16>;
11#[doc = "Field `BLC_WINDOW_LEFT` writer - this field configures blc average calculation window left"]
12pub type BLC_WINDOW_LEFT_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
13#[doc = "Field `BLC_WINDOW_VNUM` reader - this field configures blc average calculation window vnum"]
14pub type BLC_WINDOW_VNUM_R = crate::FieldReader;
15#[doc = "Field `BLC_WINDOW_VNUM` writer - this field configures blc average calculation window vnum"]
16pub type BLC_WINDOW_VNUM_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
17#[doc = "Field `BLC_WINDOW_HNUM` reader - this field configures blc average calculation window hnum"]
18pub type BLC_WINDOW_HNUM_R = crate::FieldReader;
19#[doc = "Field `BLC_WINDOW_HNUM` writer - this field configures blc average calculation window hnum"]
20pub type BLC_WINDOW_HNUM_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
21#[doc = "Field `BLC_FILTER_EN` reader - this bit configures enable blc average input filter. 0: disable, 1: enable"]
22pub type BLC_FILTER_EN_R = crate::BitReader;
23#[doc = "Field `BLC_FILTER_EN` writer - this bit configures enable blc average input filter. 0: disable, 1: enable"]
24pub type BLC_FILTER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
25impl R {
26 #[doc = "Bits 0:10 - this field configures blc average calculation window top"]
27 #[inline(always)]
28 pub fn blc_window_top(&self) -> BLC_WINDOW_TOP_R {
29 BLC_WINDOW_TOP_R::new((self.bits & 0x07ff) as u16)
30 }
31 #[doc = "Bits 11:21 - this field configures blc average calculation window left"]
32 #[inline(always)]
33 pub fn blc_window_left(&self) -> BLC_WINDOW_LEFT_R {
34 BLC_WINDOW_LEFT_R::new(((self.bits >> 11) & 0x07ff) as u16)
35 }
36 #[doc = "Bits 22:25 - this field configures blc average calculation window vnum"]
37 #[inline(always)]
38 pub fn blc_window_vnum(&self) -> BLC_WINDOW_VNUM_R {
39 BLC_WINDOW_VNUM_R::new(((self.bits >> 22) & 0x0f) as u8)
40 }
41 #[doc = "Bits 26:29 - this field configures blc average calculation window hnum"]
42 #[inline(always)]
43 pub fn blc_window_hnum(&self) -> BLC_WINDOW_HNUM_R {
44 BLC_WINDOW_HNUM_R::new(((self.bits >> 26) & 0x0f) as u8)
45 }
46 #[doc = "Bit 30 - this bit configures enable blc average input filter. 0: disable, 1: enable"]
47 #[inline(always)]
48 pub fn blc_filter_en(&self) -> BLC_FILTER_EN_R {
49 BLC_FILTER_EN_R::new(((self.bits >> 30) & 1) != 0)
50 }
51}
52#[cfg(feature = "impl-register-debug")]
53impl core::fmt::Debug for R {
54 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
55 f.debug_struct("BLC_CTRL1")
56 .field(
57 "blc_window_top",
58 &format_args!("{}", self.blc_window_top().bits()),
59 )
60 .field(
61 "blc_window_left",
62 &format_args!("{}", self.blc_window_left().bits()),
63 )
64 .field(
65 "blc_window_vnum",
66 &format_args!("{}", self.blc_window_vnum().bits()),
67 )
68 .field(
69 "blc_window_hnum",
70 &format_args!("{}", self.blc_window_hnum().bits()),
71 )
72 .field(
73 "blc_filter_en",
74 &format_args!("{}", self.blc_filter_en().bit()),
75 )
76 .finish()
77 }
78}
79#[cfg(feature = "impl-register-debug")]
80impl core::fmt::Debug for crate::generic::Reg<BLC_CTRL1_SPEC> {
81 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
82 core::fmt::Debug::fmt(&self.read(), f)
83 }
84}
85impl W {
86 #[doc = "Bits 0:10 - this field configures blc average calculation window top"]
87 #[inline(always)]
88 #[must_use]
89 pub fn blc_window_top(&mut self) -> BLC_WINDOW_TOP_W<BLC_CTRL1_SPEC> {
90 BLC_WINDOW_TOP_W::new(self, 0)
91 }
92 #[doc = "Bits 11:21 - this field configures blc average calculation window left"]
93 #[inline(always)]
94 #[must_use]
95 pub fn blc_window_left(&mut self) -> BLC_WINDOW_LEFT_W<BLC_CTRL1_SPEC> {
96 BLC_WINDOW_LEFT_W::new(self, 11)
97 }
98 #[doc = "Bits 22:25 - this field configures blc average calculation window vnum"]
99 #[inline(always)]
100 #[must_use]
101 pub fn blc_window_vnum(&mut self) -> BLC_WINDOW_VNUM_W<BLC_CTRL1_SPEC> {
102 BLC_WINDOW_VNUM_W::new(self, 22)
103 }
104 #[doc = "Bits 26:29 - this field configures blc average calculation window hnum"]
105 #[inline(always)]
106 #[must_use]
107 pub fn blc_window_hnum(&mut self) -> BLC_WINDOW_HNUM_W<BLC_CTRL1_SPEC> {
108 BLC_WINDOW_HNUM_W::new(self, 26)
109 }
110 #[doc = "Bit 30 - this bit configures enable blc average input filter. 0: disable, 1: enable"]
111 #[inline(always)]
112 #[must_use]
113 pub fn blc_filter_en(&mut self) -> BLC_FILTER_EN_W<BLC_CTRL1_SPEC> {
114 BLC_FILTER_EN_W::new(self, 30)
115 }
116}
117#[doc = "blc window control register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`blc_ctrl1::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 [`blc_ctrl1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
118pub struct BLC_CTRL1_SPEC;
119impl crate::RegisterSpec for BLC_CTRL1_SPEC {
120 type Ux = u32;
121}
122#[doc = "`read()` method returns [`blc_ctrl1::R`](R) reader structure"]
123impl crate::Readable for BLC_CTRL1_SPEC {}
124#[doc = "`write(|w| ..)` method takes [`blc_ctrl1::W`](W) writer structure"]
125impl crate::Writable for BLC_CTRL1_SPEC {
126 type Safety = crate::Unsafe;
127 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
128 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
129}
130#[doc = "`reset()` method sets BLC_CTRL1 to value 0"]
131impl crate::Resettable for BLC_CTRL1_SPEC {
132 const RESET_VALUE: u32 = 0;
133}