d1_pac/tve/
tve_configuration1.rs

1#[doc = "Register `tve_configuration1` reader"]
2pub type R = crate::R<TVE_CONFIGURATION1_SPEC>;
3#[doc = "Register `tve_configuration1` writer"]
4pub type W = crate::W<TVE_CONFIGURATION1_SPEC>;
5#[doc = "Field `bypass_yclamp` reader - Y input clamping selection\n\nThis bit selects whether the Video Encoder Y input is clamped to 64 to 940 or not. When not clamped the expected range is 0 to 1023. The U and V inputs are always clamped to the range 64 to 960."]
6pub type BYPASS_YCLAMP_R = crate::BitReader<BYPASS_YCLAMP_A>;
7#[doc = "Y input clamping selection\n\nThis bit selects whether the Video Encoder Y input is clamped to 64 to 940 or not. When not clamped the expected range is 0 to 1023. The U and V inputs are always clamped to the range 64 to 960.\n\nValue on reset: 1"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum BYPASS_YCLAMP_A {
10    #[doc = "0: The Video Encoder Y input is clamped"]
11    CLAMPED = 0,
12    #[doc = "1: The Video Encoder Y input is not clamped"]
13    NOT_CLAMPED = 1,
14}
15impl From<BYPASS_YCLAMP_A> for bool {
16    #[inline(always)]
17    fn from(variant: BYPASS_YCLAMP_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl BYPASS_YCLAMP_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> BYPASS_YCLAMP_A {
25        match self.bits {
26            false => BYPASS_YCLAMP_A::CLAMPED,
27            true => BYPASS_YCLAMP_A::NOT_CLAMPED,
28        }
29    }
30    #[doc = "The Video Encoder Y input is clamped"]
31    #[inline(always)]
32    pub fn is_clamped(&self) -> bool {
33        *self == BYPASS_YCLAMP_A::CLAMPED
34    }
35    #[doc = "The Video Encoder Y input is not clamped"]
36    #[inline(always)]
37    pub fn is_not_clamped(&self) -> bool {
38        *self == BYPASS_YCLAMP_A::NOT_CLAMPED
39    }
40}
41#[doc = "Field `bypass_yclamp` writer - Y input clamping selection\n\nThis bit selects whether the Video Encoder Y input is clamped to 64 to 940 or not. When not clamped the expected range is 0 to 1023. The U and V inputs are always clamped to the range 64 to 960."]
42pub type BYPASS_YCLAMP_W<'a, REG> = crate::BitWriter<'a, REG, BYPASS_YCLAMP_A>;
43impl<'a, REG> BYPASS_YCLAMP_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "The Video Encoder Y input is clamped"]
48    #[inline(always)]
49    pub fn clamped(self) -> &'a mut crate::W<REG> {
50        self.variant(BYPASS_YCLAMP_A::CLAMPED)
51    }
52    #[doc = "The Video Encoder Y input is not clamped"]
53    #[inline(always)]
54    pub fn not_clamped(self) -> &'a mut crate::W<REG> {
55        self.variant(BYPASS_YCLAMP_A::NOT_CLAMPED)
56    }
57}
58#[doc = "Field `rgb_setup` reader - \"Set-up\" enable for RGB outputs. This bit specifies if the \"set-up\" implied value (black_level - blank_level) specified for the CVBS signal is used also for the RGB signals."]
59pub type RGB_SETUP_R = crate::BitReader<RGB_SETUP_A>;
60#[doc = "\"Set-up\" enable for RGB outputs. This bit specifies if the \"set-up\" implied value (black_level - blank_level) specified for the CVBS signal is used also for the RGB signals.\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum RGB_SETUP_A {
63    #[doc = "0: The \"set-up\" is not used, or i.e. comp_yuv is equal to b'1'."]
64    NOT_USED = 0,
65    #[doc = "1: The implied \"set-up\" is used for the RGB signals"]
66    USED = 1,
67}
68impl From<RGB_SETUP_A> for bool {
69    #[inline(always)]
70    fn from(variant: RGB_SETUP_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl RGB_SETUP_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> RGB_SETUP_A {
78        match self.bits {
79            false => RGB_SETUP_A::NOT_USED,
80            true => RGB_SETUP_A::USED,
81        }
82    }
83    #[doc = "The \"set-up\" is not used, or i.e. comp_yuv is equal to b'1'."]
84    #[inline(always)]
85    pub fn is_not_used(&self) -> bool {
86        *self == RGB_SETUP_A::NOT_USED
87    }
88    #[doc = "The implied \"set-up\" is used for the RGB signals"]
89    #[inline(always)]
90    pub fn is_used(&self) -> bool {
91        *self == RGB_SETUP_A::USED
92    }
93}
94#[doc = "Field `rgb_setup` writer - \"Set-up\" enable for RGB outputs. This bit specifies if the \"set-up\" implied value (black_level - blank_level) specified for the CVBS signal is used also for the RGB signals."]
95pub type RGB_SETUP_W<'a, REG> = crate::BitWriter<'a, REG, RGB_SETUP_A>;
96impl<'a, REG> RGB_SETUP_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "The \"set-up\" is not used, or i.e. comp_yuv is equal to b'1'."]
101    #[inline(always)]
102    pub fn not_used(self) -> &'a mut crate::W<REG> {
103        self.variant(RGB_SETUP_A::NOT_USED)
104    }
105    #[doc = "The implied \"set-up\" is used for the RGB signals"]
106    #[inline(always)]
107    pub fn used(self) -> &'a mut crate::W<REG> {
108        self.variant(RGB_SETUP_A::USED)
109    }
110}
111#[doc = "Field `rgb_sync` reader - R, G and B signals sync embedding selection.\n\nThese bits specify whether the sync signal is added to each of the R, G and B components (b'1') or not (b'0'). The bit\\[26\\] specify if the R signal has embedded syncs, the bit\\[25\\] specify if the G signal has embedded syncs and the bit\\[24\\] specify if the B signal has embedded syncs. When comp_yuv is equal to b'1', these bits are N.A. and should be set to b'000'. When the value is different from b'000', RGB_Setup should be set to b'1'."]
112pub type RGB_SYNC_R = crate::FieldReader;
113#[doc = "Field `rgb_sync` writer - R, G and B signals sync embedding selection.\n\nThese bits specify whether the sync signal is added to each of the R, G and B components (b'1') or not (b'0'). The bit\\[26\\] specify if the R signal has embedded syncs, the bit\\[25\\] specify if the G signal has embedded syncs and the bit\\[24\\] specify if the B signal has embedded syncs. When comp_yuv is equal to b'1', these bits are N.A. and should be set to b'000'. When the value is different from b'000', RGB_Setup should be set to b'1'."]
114pub type RGB_SYNC_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
115impl R {
116    #[doc = "Bit 0 - Y input clamping selection\n\nThis bit selects whether the Video Encoder Y input is clamped to 64 to 940 or not. When not clamped the expected range is 0 to 1023. The U and V inputs are always clamped to the range 64 to 960."]
117    #[inline(always)]
118    pub fn bypass_yclamp(&self) -> BYPASS_YCLAMP_R {
119        BYPASS_YCLAMP_R::new((self.bits & 1) != 0)
120    }
121    #[doc = "Bit 16 - \"Set-up\" enable for RGB outputs. This bit specifies if the \"set-up\" implied value (black_level - blank_level) specified for the CVBS signal is used also for the RGB signals."]
122    #[inline(always)]
123    pub fn rgb_setup(&self) -> RGB_SETUP_R {
124        RGB_SETUP_R::new(((self.bits >> 16) & 1) != 0)
125    }
126    #[doc = "Bits 24:26 - R, G and B signals sync embedding selection.\n\nThese bits specify whether the sync signal is added to each of the R, G and B components (b'1') or not (b'0'). The bit\\[26\\] specify if the R signal has embedded syncs, the bit\\[25\\] specify if the G signal has embedded syncs and the bit\\[24\\] specify if the B signal has embedded syncs. When comp_yuv is equal to b'1', these bits are N.A. and should be set to b'000'. When the value is different from b'000', RGB_Setup should be set to b'1'."]
127    #[inline(always)]
128    pub fn rgb_sync(&self) -> RGB_SYNC_R {
129        RGB_SYNC_R::new(((self.bits >> 24) & 7) as u8)
130    }
131}
132impl W {
133    #[doc = "Bit 0 - Y input clamping selection\n\nThis bit selects whether the Video Encoder Y input is clamped to 64 to 940 or not. When not clamped the expected range is 0 to 1023. The U and V inputs are always clamped to the range 64 to 960."]
134    #[inline(always)]
135    #[must_use]
136    pub fn bypass_yclamp(&mut self) -> BYPASS_YCLAMP_W<TVE_CONFIGURATION1_SPEC> {
137        BYPASS_YCLAMP_W::new(self, 0)
138    }
139    #[doc = "Bit 16 - \"Set-up\" enable for RGB outputs. This bit specifies if the \"set-up\" implied value (black_level - blank_level) specified for the CVBS signal is used also for the RGB signals."]
140    #[inline(always)]
141    #[must_use]
142    pub fn rgb_setup(&mut self) -> RGB_SETUP_W<TVE_CONFIGURATION1_SPEC> {
143        RGB_SETUP_W::new(self, 16)
144    }
145    #[doc = "Bits 24:26 - R, G and B signals sync embedding selection.\n\nThese bits specify whether the sync signal is added to each of the R, G and B components (b'1') or not (b'0'). The bit\\[26\\] specify if the R signal has embedded syncs, the bit\\[25\\] specify if the G signal has embedded syncs and the bit\\[24\\] specify if the B signal has embedded syncs. When comp_yuv is equal to b'1', these bits are N.A. and should be set to b'000'. When the value is different from b'000', RGB_Setup should be set to b'1'."]
146    #[inline(always)]
147    #[must_use]
148    pub fn rgb_sync(&mut self) -> RGB_SYNC_W<TVE_CONFIGURATION1_SPEC> {
149        RGB_SYNC_W::new(self, 24)
150    }
151    #[doc = r" Writes raw bits to the register."]
152    #[doc = r""]
153    #[doc = r" # Safety"]
154    #[doc = r""]
155    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
156    #[inline(always)]
157    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
158        self.bits = bits;
159        self
160    }
161}
162#[doc = "TV Encoder Configuration Register1\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_configuration1::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_configuration1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
163pub struct TVE_CONFIGURATION1_SPEC;
164impl crate::RegisterSpec for TVE_CONFIGURATION1_SPEC {
165    type Ux = u32;
166}
167#[doc = "`read()` method returns [`tve_configuration1::R`](R) reader structure"]
168impl crate::Readable for TVE_CONFIGURATION1_SPEC {}
169#[doc = "`write(|w| ..)` method takes [`tve_configuration1::W`](W) writer structure"]
170impl crate::Writable for TVE_CONFIGURATION1_SPEC {
171    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
172    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
173}
174#[doc = "`reset()` method sets tve_configuration1 to value 0x01"]
175impl crate::Resettable for TVE_CONFIGURATION1_SPEC {
176    const RESET_VALUE: Self::Ux = 0x01;
177}