d1_pac/tve/
tve_resync_parameters.rs

1#[doc = "Register `tve_resync_parameters` reader"]
2pub type R = crate::R<TVE_RESYNC_PARAMETERS_SPEC>;
3#[doc = "Register `tve_resync_parameters` writer"]
4pub type W = crate::W<TVE_RESYNC_PARAMETERS_SPEC>;
5#[doc = "Field `re_sync_pixel_num` reader - Re-sync line pixel from TCON"]
6pub type RE_SYNC_PIXEL_NUM_R = crate::FieldReader<u16>;
7#[doc = "Field `re_sync_pixel_num` writer - Re-sync line pixel from TCON"]
8pub type RE_SYNC_PIXEL_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
9#[doc = "Field `re_sync_line_num` reader - Re-sync line number from TCON"]
10pub type RE_SYNC_LINE_NUM_R = crate::FieldReader<u16>;
11#[doc = "Field `re_sync_line_num` writer - Re-sync line number from TCON"]
12pub type RE_SYNC_LINE_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
13#[doc = "Field `re_sync_dis` reader - "]
14pub type RE_SYNC_DIS_R = crate::BitReader<RE_SYNC_DIS_A>;
15#[doc = "\n\nValue on reset: 0"]
16#[derive(Clone, Copy, Debug, PartialEq, Eq)]
17pub enum RE_SYNC_DIS_A {
18    #[doc = "0: Re-Sync Enable"]
19    ENABLE = 0,
20    #[doc = "1: Re-Sync Disable"]
21    DISABLE = 1,
22}
23impl From<RE_SYNC_DIS_A> for bool {
24    #[inline(always)]
25    fn from(variant: RE_SYNC_DIS_A) -> Self {
26        variant as u8 != 0
27    }
28}
29impl RE_SYNC_DIS_R {
30    #[doc = "Get enumerated values variant"]
31    #[inline(always)]
32    pub const fn variant(&self) -> RE_SYNC_DIS_A {
33        match self.bits {
34            false => RE_SYNC_DIS_A::ENABLE,
35            true => RE_SYNC_DIS_A::DISABLE,
36        }
37    }
38    #[doc = "Re-Sync Enable"]
39    #[inline(always)]
40    pub fn is_enable(&self) -> bool {
41        *self == RE_SYNC_DIS_A::ENABLE
42    }
43    #[doc = "Re-Sync Disable"]
44    #[inline(always)]
45    pub fn is_disable(&self) -> bool {
46        *self == RE_SYNC_DIS_A::DISABLE
47    }
48}
49#[doc = "Field `re_sync_dis` writer - "]
50pub type RE_SYNC_DIS_W<'a, REG> = crate::BitWriter<'a, REG, RE_SYNC_DIS_A>;
51impl<'a, REG> RE_SYNC_DIS_W<'a, REG>
52where
53    REG: crate::Writable + crate::RegisterSpec,
54{
55    #[doc = "Re-Sync Enable"]
56    #[inline(always)]
57    pub fn enable(self) -> &'a mut crate::W<REG> {
58        self.variant(RE_SYNC_DIS_A::ENABLE)
59    }
60    #[doc = "Re-Sync Disable"]
61    #[inline(always)]
62    pub fn disable(self) -> &'a mut crate::W<REG> {
63        self.variant(RE_SYNC_DIS_A::DISABLE)
64    }
65}
66#[doc = "Field `re_sync_field` reader - Re-sync field"]
67pub type RE_SYNC_FIELD_R = crate::BitReader;
68#[doc = "Field `re_sync_field` writer - Re-sync field"]
69pub type RE_SYNC_FIELD_W<'a, REG> = crate::BitWriter<'a, REG>;
70impl R {
71    #[doc = "Bits 0:10 - Re-sync line pixel from TCON"]
72    #[inline(always)]
73    pub fn re_sync_pixel_num(&self) -> RE_SYNC_PIXEL_NUM_R {
74        RE_SYNC_PIXEL_NUM_R::new((self.bits & 0x07ff) as u16)
75    }
76    #[doc = "Bits 16:26 - Re-sync line number from TCON"]
77    #[inline(always)]
78    pub fn re_sync_line_num(&self) -> RE_SYNC_LINE_NUM_R {
79        RE_SYNC_LINE_NUM_R::new(((self.bits >> 16) & 0x07ff) as u16)
80    }
81    #[doc = "Bit 30"]
82    #[inline(always)]
83    pub fn re_sync_dis(&self) -> RE_SYNC_DIS_R {
84        RE_SYNC_DIS_R::new(((self.bits >> 30) & 1) != 0)
85    }
86    #[doc = "Bit 31 - Re-sync field"]
87    #[inline(always)]
88    pub fn re_sync_field(&self) -> RE_SYNC_FIELD_R {
89        RE_SYNC_FIELD_R::new(((self.bits >> 31) & 1) != 0)
90    }
91}
92impl W {
93    #[doc = "Bits 0:10 - Re-sync line pixel from TCON"]
94    #[inline(always)]
95    #[must_use]
96    pub fn re_sync_pixel_num(&mut self) -> RE_SYNC_PIXEL_NUM_W<TVE_RESYNC_PARAMETERS_SPEC> {
97        RE_SYNC_PIXEL_NUM_W::new(self, 0)
98    }
99    #[doc = "Bits 16:26 - Re-sync line number from TCON"]
100    #[inline(always)]
101    #[must_use]
102    pub fn re_sync_line_num(&mut self) -> RE_SYNC_LINE_NUM_W<TVE_RESYNC_PARAMETERS_SPEC> {
103        RE_SYNC_LINE_NUM_W::new(self, 16)
104    }
105    #[doc = "Bit 30"]
106    #[inline(always)]
107    #[must_use]
108    pub fn re_sync_dis(&mut self) -> RE_SYNC_DIS_W<TVE_RESYNC_PARAMETERS_SPEC> {
109        RE_SYNC_DIS_W::new(self, 30)
110    }
111    #[doc = "Bit 31 - Re-sync field"]
112    #[inline(always)]
113    #[must_use]
114    pub fn re_sync_field(&mut self) -> RE_SYNC_FIELD_W<TVE_RESYNC_PARAMETERS_SPEC> {
115        RE_SYNC_FIELD_W::new(self, 31)
116    }
117    #[doc = r" Writes raw bits to the register."]
118    #[doc = r""]
119    #[doc = r" # Safety"]
120    #[doc = r""]
121    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
122    #[inline(always)]
123    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
124        self.bits = bits;
125        self
126    }
127}
128#[doc = "TV Encoder Re-sync Parameters Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_resync_parameters::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_resync_parameters::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
129pub struct TVE_RESYNC_PARAMETERS_SPEC;
130impl crate::RegisterSpec for TVE_RESYNC_PARAMETERS_SPEC {
131    type Ux = u32;
132}
133#[doc = "`read()` method returns [`tve_resync_parameters::R`](R) reader structure"]
134impl crate::Readable for TVE_RESYNC_PARAMETERS_SPEC {}
135#[doc = "`write(|w| ..)` method takes [`tve_resync_parameters::W`](W) writer structure"]
136impl crate::Writable for TVE_RESYNC_PARAMETERS_SPEC {
137    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
139}
140#[doc = "`reset()` method sets tve_resync_parameters to value 0x0010_0001"]
141impl crate::Resettable for TVE_RESYNC_PARAMETERS_SPEC {
142    const RESET_VALUE: Self::Ux = 0x0010_0001;
143}