d1_pac/tve/
tve_low_pass_control.rs

1#[doc = "Register `tve_low_pass_control` reader"]
2pub type R = crate::R<TVE_LOW_PASS_CONTROL_SPEC>;
3#[doc = "Register `tve_low_pass_control` writer"]
4pub type W = crate::W<TVE_LOW_PASS_CONTROL_SPEC>;
5#[doc = "Field `en` reader - LP function enable"]
6pub type EN_R = crate::BitReader<EN_A>;
7#[doc = "LP function enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum EN_A {
10    #[doc = "0: Disable"]
11    DISABLE = 0,
12    #[doc = "1: Enable"]
13    ENABLE = 1,
14}
15impl From<EN_A> for bool {
16    #[inline(always)]
17    fn from(variant: EN_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl EN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> EN_A {
25        match self.bits {
26            false => EN_A::DISABLE,
27            true => EN_A::ENABLE,
28        }
29    }
30    #[doc = "Disable"]
31    #[inline(always)]
32    pub fn is_disable(&self) -> bool {
33        *self == EN_A::DISABLE
34    }
35    #[doc = "Enable"]
36    #[inline(always)]
37    pub fn is_enable(&self) -> bool {
38        *self == EN_A::ENABLE
39    }
40}
41#[doc = "Field `en` writer - LP function enable"]
42pub type EN_W<'a, REG> = crate::BitWriter<'a, REG, EN_A>;
43impl<'a, REG> EN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Disable"]
48    #[inline(always)]
49    pub fn disable(self) -> &'a mut crate::W<REG> {
50        self.variant(EN_A::DISABLE)
51    }
52    #[doc = "Enable"]
53    #[inline(always)]
54    pub fn enable(self) -> &'a mut crate::W<REG> {
55        self.variant(EN_A::ENABLE)
56    }
57}
58#[doc = "Field `enable_deflicker` reader - Enable_deflicker"]
59pub type ENABLE_DEFLICKER_R = crate::BitReader<ENABLE_DEFLICKER_A>;
60#[doc = "Enable_deflicker\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum ENABLE_DEFLICKER_A {
63    #[doc = "0: Disable deflicker"]
64    DISABLE = 0,
65    #[doc = "1: Enable deflicker"]
66    ENABLE = 1,
67}
68impl From<ENABLE_DEFLICKER_A> for bool {
69    #[inline(always)]
70    fn from(variant: ENABLE_DEFLICKER_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl ENABLE_DEFLICKER_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> ENABLE_DEFLICKER_A {
78        match self.bits {
79            false => ENABLE_DEFLICKER_A::DISABLE,
80            true => ENABLE_DEFLICKER_A::ENABLE,
81        }
82    }
83    #[doc = "Disable deflicker"]
84    #[inline(always)]
85    pub fn is_disable(&self) -> bool {
86        *self == ENABLE_DEFLICKER_A::DISABLE
87    }
88    #[doc = "Enable deflicker"]
89    #[inline(always)]
90    pub fn is_enable(&self) -> bool {
91        *self == ENABLE_DEFLICKER_A::ENABLE
92    }
93}
94#[doc = "Field `enable_deflicker` writer - Enable_deflicker"]
95pub type ENABLE_DEFLICKER_W<'a, REG> = crate::BitWriter<'a, REG, ENABLE_DEFLICKER_A>;
96impl<'a, REG> ENABLE_DEFLICKER_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Disable deflicker"]
101    #[inline(always)]
102    pub fn disable(self) -> &'a mut crate::W<REG> {
103        self.variant(ENABLE_DEFLICKER_A::DISABLE)
104    }
105    #[doc = "Enable deflicker"]
106    #[inline(always)]
107    pub fn enable(self) -> &'a mut crate::W<REG> {
108        self.variant(ENABLE_DEFLICKER_A::ENABLE)
109    }
110}
111#[doc = "Field `fix_coef_deflicker` reader - Fix_coef_deflicker"]
112pub type FIX_COEF_DEFLICKER_R = crate::BitReader<FIX_COEF_DEFLICKER_A>;
113#[doc = "Fix_coef_deflicker\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum FIX_COEF_DEFLICKER_A {
116    #[doc = "0: Auto deflicker"]
117    A_UTO = 0,
118    #[doc = "1: User deflicker"]
119    U_SER = 1,
120}
121impl From<FIX_COEF_DEFLICKER_A> for bool {
122    #[inline(always)]
123    fn from(variant: FIX_COEF_DEFLICKER_A) -> Self {
124        variant as u8 != 0
125    }
126}
127impl FIX_COEF_DEFLICKER_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> FIX_COEF_DEFLICKER_A {
131        match self.bits {
132            false => FIX_COEF_DEFLICKER_A::A_UTO,
133            true => FIX_COEF_DEFLICKER_A::U_SER,
134        }
135    }
136    #[doc = "Auto deflicker"]
137    #[inline(always)]
138    pub fn is_a_uto(&self) -> bool {
139        *self == FIX_COEF_DEFLICKER_A::A_UTO
140    }
141    #[doc = "User deflicker"]
142    #[inline(always)]
143    pub fn is_u_ser(&self) -> bool {
144        *self == FIX_COEF_DEFLICKER_A::U_SER
145    }
146}
147#[doc = "Field `fix_coef_deflicker` writer - Fix_coef_deflicker"]
148pub type FIX_COEF_DEFLICKER_W<'a, REG> = crate::BitWriter<'a, REG, FIX_COEF_DEFLICKER_A>;
149impl<'a, REG> FIX_COEF_DEFLICKER_W<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Auto deflicker"]
154    #[inline(always)]
155    pub fn a_uto(self) -> &'a mut crate::W<REG> {
156        self.variant(FIX_COEF_DEFLICKER_A::A_UTO)
157    }
158    #[doc = "User deflicker"]
159    #[inline(always)]
160    pub fn u_ser(self) -> &'a mut crate::W<REG> {
161        self.variant(FIX_COEF_DEFLICKER_A::U_SER)
162    }
163}
164#[doc = "Field `user_deflicker_coef` reader - User_deflicker_coef\n\nup: coef/32\n\nCenter: 1-coef/16\n\nDown: coef/32"]
165pub type USER_DEFLICKER_COEF_R = crate::FieldReader;
166#[doc = "Field `user_deflicker_coef` writer - User_deflicker_coef\n\nup: coef/32\n\nCenter: 1-coef/16\n\nDown: coef/32"]
167pub type USER_DEFLICKER_COEF_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
168impl R {
169    #[doc = "Bit 0 - LP function enable"]
170    #[inline(always)]
171    pub fn en(&self) -> EN_R {
172        EN_R::new((self.bits & 1) != 0)
173    }
174    #[doc = "Bit 8 - Enable_deflicker"]
175    #[inline(always)]
176    pub fn enable_deflicker(&self) -> ENABLE_DEFLICKER_R {
177        ENABLE_DEFLICKER_R::new(((self.bits >> 8) & 1) != 0)
178    }
179    #[doc = "Bit 9 - Fix_coef_deflicker"]
180    #[inline(always)]
181    pub fn fix_coef_deflicker(&self) -> FIX_COEF_DEFLICKER_R {
182        FIX_COEF_DEFLICKER_R::new(((self.bits >> 9) & 1) != 0)
183    }
184    #[doc = "Bits 10:13 - User_deflicker_coef\n\nup: coef/32\n\nCenter: 1-coef/16\n\nDown: coef/32"]
185    #[inline(always)]
186    pub fn user_deflicker_coef(&self) -> USER_DEFLICKER_COEF_R {
187        USER_DEFLICKER_COEF_R::new(((self.bits >> 10) & 0x0f) as u8)
188    }
189}
190impl W {
191    #[doc = "Bit 0 - LP function enable"]
192    #[inline(always)]
193    #[must_use]
194    pub fn en(&mut self) -> EN_W<TVE_LOW_PASS_CONTROL_SPEC> {
195        EN_W::new(self, 0)
196    }
197    #[doc = "Bit 8 - Enable_deflicker"]
198    #[inline(always)]
199    #[must_use]
200    pub fn enable_deflicker(&mut self) -> ENABLE_DEFLICKER_W<TVE_LOW_PASS_CONTROL_SPEC> {
201        ENABLE_DEFLICKER_W::new(self, 8)
202    }
203    #[doc = "Bit 9 - Fix_coef_deflicker"]
204    #[inline(always)]
205    #[must_use]
206    pub fn fix_coef_deflicker(&mut self) -> FIX_COEF_DEFLICKER_W<TVE_LOW_PASS_CONTROL_SPEC> {
207        FIX_COEF_DEFLICKER_W::new(self, 9)
208    }
209    #[doc = "Bits 10:13 - User_deflicker_coef\n\nup: coef/32\n\nCenter: 1-coef/16\n\nDown: coef/32"]
210    #[inline(always)]
211    #[must_use]
212    pub fn user_deflicker_coef(&mut self) -> USER_DEFLICKER_COEF_W<TVE_LOW_PASS_CONTROL_SPEC> {
213        USER_DEFLICKER_COEF_W::new(self, 10)
214    }
215    #[doc = r" Writes raw bits to the register."]
216    #[doc = r""]
217    #[doc = r" # Safety"]
218    #[doc = r""]
219    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
220    #[inline(always)]
221    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
222        self.bits = bits;
223        self
224    }
225}
226#[doc = "TV Encoder Low Pass Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_low_pass_control::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 [`tve_low_pass_control::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
227pub struct TVE_LOW_PASS_CONTROL_SPEC;
228impl crate::RegisterSpec for TVE_LOW_PASS_CONTROL_SPEC {
229    type Ux = u32;
230}
231#[doc = "`read()` method returns [`tve_low_pass_control::R`](R) reader structure"]
232impl crate::Readable for TVE_LOW_PASS_CONTROL_SPEC {}
233#[doc = "`write(|w| ..)` method takes [`tve_low_pass_control::W`](W) writer structure"]
234impl crate::Writable for TVE_LOW_PASS_CONTROL_SPEC {
235    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
236    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
237}
238#[doc = "`reset()` method sets tve_low_pass_control to value 0"]
239impl crate::Resettable for TVE_LOW_PASS_CONTROL_SPEC {
240    const RESET_VALUE: Self::Ux = 0;
241}