d1_pac/tve/
tve_slave_parameter.rs

1#[doc = "Register `tve_slave_parameter` reader"]
2pub type R = crate::R<TVE_SLAVE_PARAMETER_SPEC>;
3#[doc = "Register `tve_slave_parameter` writer"]
4pub type W = crate::W<TVE_SLAVE_PARAMETER_SPEC>;
5#[doc = "Field `slave_mode` reader - Slave mode selection\n\nThis bit selects whether the Video Encoder is sync slave, partial slave or sync master. It should be set to B'0'."]
6pub type SLAVE_MODE_R = crate::BitReader<SLAVE_MODE_A>;
7#[doc = "Slave mode selection\n\nThis bit selects whether the Video Encoder is sync slave, partial slave or sync master. It should be set to B'0'.\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum SLAVE_MODE_A {
10    #[doc = "0: The Video Encoder is not a full sync slave (i.e. it is a partial sync slave or a sync master)"]
11    NOT_FULL_SYNC_SLAVE = 0,
12}
13impl From<SLAVE_MODE_A> for bool {
14    #[inline(always)]
15    fn from(variant: SLAVE_MODE_A) -> Self {
16        variant as u8 != 0
17    }
18}
19impl SLAVE_MODE_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> Option<SLAVE_MODE_A> {
23        match self.bits {
24            false => Some(SLAVE_MODE_A::NOT_FULL_SYNC_SLAVE),
25            _ => None,
26        }
27    }
28    #[doc = "The Video Encoder is not a full sync slave (i.e. it is a partial sync slave or a sync master)"]
29    #[inline(always)]
30    pub fn is_not_full_sync_slave(&self) -> bool {
31        *self == SLAVE_MODE_A::NOT_FULL_SYNC_SLAVE
32    }
33}
34#[doc = "Field `slave_mode` writer - Slave mode selection\n\nThis bit selects whether the Video Encoder is sync slave, partial slave or sync master. It should be set to B'0'."]
35pub type SLAVE_MODE_W<'a, REG> = crate::BitWriter<'a, REG, SLAVE_MODE_A>;
36impl<'a, REG> SLAVE_MODE_W<'a, REG>
37where
38    REG: crate::Writable + crate::RegisterSpec,
39{
40    #[doc = "The Video Encoder is not a full sync slave (i.e. it is a partial sync slave or a sync master)"]
41    #[inline(always)]
42    pub fn not_full_sync_slave(self) -> &'a mut crate::W<REG> {
43        self.variant(SLAVE_MODE_A::NOT_FULL_SYNC_SLAVE)
44    }
45}
46#[doc = "Field `slave_thresh` reader - Horizontal line adjustment threshold selection\n\nThis bit selects whether the number of lines after which the Video Encoder starts the horizontal line length adjustment is slave mode is 0 or 30."]
47pub type SLAVE_THRESH_R = crate::BitReader<SLAVE_THRESH_A>;
48#[doc = "Horizontal line adjustment threshold selection\n\nThis bit selects whether the number of lines after which the Video Encoder starts the horizontal line length adjustment is slave mode is 0 or 30.\n\nValue on reset: 0"]
49#[derive(Clone, Copy, Debug, PartialEq, Eq)]
50pub enum SLAVE_THRESH_A {
51    #[doc = "0: Number of lines is 0"]
52    _0 = 0,
53    #[doc = "1: Number of lines is 30"]
54    _30 = 1,
55}
56impl From<SLAVE_THRESH_A> for bool {
57    #[inline(always)]
58    fn from(variant: SLAVE_THRESH_A) -> Self {
59        variant as u8 != 0
60    }
61}
62impl SLAVE_THRESH_R {
63    #[doc = "Get enumerated values variant"]
64    #[inline(always)]
65    pub const fn variant(&self) -> SLAVE_THRESH_A {
66        match self.bits {
67            false => SLAVE_THRESH_A::_0,
68            true => SLAVE_THRESH_A::_30,
69        }
70    }
71    #[doc = "Number of lines is 0"]
72    #[inline(always)]
73    pub fn is_0(&self) -> bool {
74        *self == SLAVE_THRESH_A::_0
75    }
76    #[doc = "Number of lines is 30"]
77    #[inline(always)]
78    pub fn is_30(&self) -> bool {
79        *self == SLAVE_THRESH_A::_30
80    }
81}
82#[doc = "Field `slave_thresh` writer - Horizontal line adjustment threshold selection\n\nThis bit selects whether the number of lines after which the Video Encoder starts the horizontal line length adjustment is slave mode is 0 or 30."]
83pub type SLAVE_THRESH_W<'a, REG> = crate::BitWriter<'a, REG, SLAVE_THRESH_A>;
84impl<'a, REG> SLAVE_THRESH_W<'a, REG>
85where
86    REG: crate::Writable + crate::RegisterSpec,
87{
88    #[doc = "Number of lines is 0"]
89    #[inline(always)]
90    pub fn _0(self) -> &'a mut crate::W<REG> {
91        self.variant(SLAVE_THRESH_A::_0)
92    }
93    #[doc = "Number of lines is 30"]
94    #[inline(always)]
95    pub fn _30(self) -> &'a mut crate::W<REG> {
96        self.variant(SLAVE_THRESH_A::_30)
97    }
98}
99impl R {
100    #[doc = "Bit 0 - Slave mode selection\n\nThis bit selects whether the Video Encoder is sync slave, partial slave or sync master. It should be set to B'0'."]
101    #[inline(always)]
102    pub fn slave_mode(&self) -> SLAVE_MODE_R {
103        SLAVE_MODE_R::new((self.bits & 1) != 0)
104    }
105    #[doc = "Bit 8 - Horizontal line adjustment threshold selection\n\nThis bit selects whether the number of lines after which the Video Encoder starts the horizontal line length adjustment is slave mode is 0 or 30."]
106    #[inline(always)]
107    pub fn slave_thresh(&self) -> SLAVE_THRESH_R {
108        SLAVE_THRESH_R::new(((self.bits >> 8) & 1) != 0)
109    }
110}
111impl W {
112    #[doc = "Bit 0 - Slave mode selection\n\nThis bit selects whether the Video Encoder is sync slave, partial slave or sync master. It should be set to B'0'."]
113    #[inline(always)]
114    #[must_use]
115    pub fn slave_mode(&mut self) -> SLAVE_MODE_W<TVE_SLAVE_PARAMETER_SPEC> {
116        SLAVE_MODE_W::new(self, 0)
117    }
118    #[doc = "Bit 8 - Horizontal line adjustment threshold selection\n\nThis bit selects whether the number of lines after which the Video Encoder starts the horizontal line length adjustment is slave mode is 0 or 30."]
119    #[inline(always)]
120    #[must_use]
121    pub fn slave_thresh(&mut self) -> SLAVE_THRESH_W<TVE_SLAVE_PARAMETER_SPEC> {
122        SLAVE_THRESH_W::new(self, 8)
123    }
124    #[doc = r" Writes raw bits to the register."]
125    #[doc = r""]
126    #[doc = r" # Safety"]
127    #[doc = r""]
128    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
129    #[inline(always)]
130    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
131        self.bits = bits;
132        self
133    }
134}
135#[doc = "TV Encoder Slave Parameter Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_slave_parameter::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_slave_parameter::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
136pub struct TVE_SLAVE_PARAMETER_SPEC;
137impl crate::RegisterSpec for TVE_SLAVE_PARAMETER_SPEC {
138    type Ux = u32;
139}
140#[doc = "`read()` method returns [`tve_slave_parameter::R`](R) reader structure"]
141impl crate::Readable for TVE_SLAVE_PARAMETER_SPEC {}
142#[doc = "`write(|w| ..)` method takes [`tve_slave_parameter::W`](W) writer structure"]
143impl crate::Writable for TVE_SLAVE_PARAMETER_SPEC {
144    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
145    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
146}
147#[doc = "`reset()` method sets tve_slave_parameter to value 0"]
148impl crate::Resettable for TVE_SLAVE_PARAMETER_SPEC {
149    const RESET_VALUE: Self::Ux = 0;
150}