d1_pac/tve/
tve_configuration0.rs

1#[doc = "Register `tve_configuration0` reader"]
2pub type R = crate::R<TVE_CONFIGURATION0_SPEC>;
3#[doc = "Register `tve_configuration0` writer"]
4pub type W = crate::W<TVE_CONFIGURATION0_SPEC>;
5#[doc = "Field `uv_order` reader - This bit selects if the sample order at the chroma input to the Video Encoder is Cb first (i.e. Cb 0 Cr 0 Cb 1 Cr 1) or Cr first (i.e. Cr 0 Cb 0 Cr 1 Cb 1)."]
6pub type UV_ORDER_R = crate::BitReader<UV_ORDER_A>;
7#[doc = "This bit selects if the sample order at the chroma input to the Video Encoder is Cb first (i.e. Cb 0 Cr 0 Cb 1 Cr 1) or Cr first (i.e. Cr 0 Cb 0 Cr 1 Cb 1).\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum UV_ORDER_A {
10    #[doc = "0: The chroma sample input order is Cb first"]
11    C_B = 0,
12    #[doc = "1: The chroma sample input order is Cr first"]
13    C_R = 1,
14}
15impl From<UV_ORDER_A> for bool {
16    #[inline(always)]
17    fn from(variant: UV_ORDER_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl UV_ORDER_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> UV_ORDER_A {
25        match self.bits {
26            false => UV_ORDER_A::C_B,
27            true => UV_ORDER_A::C_R,
28        }
29    }
30    #[doc = "The chroma sample input order is Cb first"]
31    #[inline(always)]
32    pub fn is_c_b(&self) -> bool {
33        *self == UV_ORDER_A::C_B
34    }
35    #[doc = "The chroma sample input order is Cr first"]
36    #[inline(always)]
37    pub fn is_c_r(&self) -> bool {
38        *self == UV_ORDER_A::C_R
39    }
40}
41#[doc = "Field `uv_order` writer - This bit selects if the sample order at the chroma input to the Video Encoder is Cb first (i.e. Cb 0 Cr 0 Cb 1 Cr 1) or Cr first (i.e. Cr 0 Cb 0 Cr 1 Cb 1)."]
42pub type UV_ORDER_W<'a, REG> = crate::BitWriter<'a, REG, UV_ORDER_A>;
43impl<'a, REG> UV_ORDER_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "The chroma sample input order is Cb first"]
48    #[inline(always)]
49    pub fn c_b(self) -> &'a mut crate::W<REG> {
50        self.variant(UV_ORDER_A::C_B)
51    }
52    #[doc = "The chroma sample input order is Cr first"]
53    #[inline(always)]
54    pub fn c_r(self) -> &'a mut crate::W<REG> {
55        self.variant(UV_ORDER_A::C_R)
56    }
57}
58#[doc = "Field `invert_top` reader - Field parity input signal (top_field) polarity selection.\n\nThis bit selects whether the top field is indicated by a high level of the field parity signal or by the low level. The bit is applicable both when the Video Encoder is the sync master and when the Video Encoder is the sync slave."]
59pub type INVERT_TOP_R = crate::BitReader<INVERT_TOP_A>;
60#[doc = "Field parity input signal (top_field) polarity selection.\n\nThis bit selects whether the top field is indicated by a high level of the field parity signal or by the low level. The bit is applicable both when the Video Encoder is the sync master and when the Video Encoder is the sync slave.\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum INVERT_TOP_A {
63    #[doc = "0: Top field is indicated by low level"]
64    LOW = 0,
65    #[doc = "1: Top field is indicated by high level"]
66    HIGH = 1,
67}
68impl From<INVERT_TOP_A> for bool {
69    #[inline(always)]
70    fn from(variant: INVERT_TOP_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl INVERT_TOP_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> INVERT_TOP_A {
78        match self.bits {
79            false => INVERT_TOP_A::LOW,
80            true => INVERT_TOP_A::HIGH,
81        }
82    }
83    #[doc = "Top field is indicated by low level"]
84    #[inline(always)]
85    pub fn is_low(&self) -> bool {
86        *self == INVERT_TOP_A::LOW
87    }
88    #[doc = "Top field is indicated by high level"]
89    #[inline(always)]
90    pub fn is_high(&self) -> bool {
91        *self == INVERT_TOP_A::HIGH
92    }
93}
94#[doc = "Field `invert_top` writer - Field parity input signal (top_field) polarity selection.\n\nThis bit selects whether the top field is indicated by a high level of the field parity signal or by the low level. The bit is applicable both when the Video Encoder is the sync master and when the Video Encoder is the sync slave."]
95pub type INVERT_TOP_W<'a, REG> = crate::BitWriter<'a, REG, INVERT_TOP_A>;
96impl<'a, REG> INVERT_TOP_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Top field is indicated by low level"]
101    #[inline(always)]
102    pub fn low(self) -> &'a mut crate::W<REG> {
103        self.variant(INVERT_TOP_A::LOW)
104    }
105    #[doc = "Top field is indicated by high level"]
106    #[inline(always)]
107    pub fn high(self) -> &'a mut crate::W<REG> {
108        self.variant(INVERT_TOP_A::HIGH)
109    }
110}
111impl R {
112    #[doc = "Bit 0 - This bit selects if the sample order at the chroma input to the Video Encoder is Cb first (i.e. Cb 0 Cr 0 Cb 1 Cr 1) or Cr first (i.e. Cr 0 Cb 0 Cr 1 Cb 1)."]
113    #[inline(always)]
114    pub fn uv_order(&self) -> UV_ORDER_R {
115        UV_ORDER_R::new((self.bits & 1) != 0)
116    }
117    #[doc = "Bit 8 - Field parity input signal (top_field) polarity selection.\n\nThis bit selects whether the top field is indicated by a high level of the field parity signal or by the low level. The bit is applicable both when the Video Encoder is the sync master and when the Video Encoder is the sync slave."]
118    #[inline(always)]
119    pub fn invert_top(&self) -> INVERT_TOP_R {
120        INVERT_TOP_R::new(((self.bits >> 8) & 1) != 0)
121    }
122}
123impl W {
124    #[doc = "Bit 0 - This bit selects if the sample order at the chroma input to the Video Encoder is Cb first (i.e. Cb 0 Cr 0 Cb 1 Cr 1) or Cr first (i.e. Cr 0 Cb 0 Cr 1 Cb 1)."]
125    #[inline(always)]
126    #[must_use]
127    pub fn uv_order(&mut self) -> UV_ORDER_W<TVE_CONFIGURATION0_SPEC> {
128        UV_ORDER_W::new(self, 0)
129    }
130    #[doc = "Bit 8 - Field parity input signal (top_field) polarity selection.\n\nThis bit selects whether the top field is indicated by a high level of the field parity signal or by the low level. The bit is applicable both when the Video Encoder is the sync master and when the Video Encoder is the sync slave."]
131    #[inline(always)]
132    #[must_use]
133    pub fn invert_top(&mut self) -> INVERT_TOP_W<TVE_CONFIGURATION0_SPEC> {
134        INVERT_TOP_W::new(self, 8)
135    }
136    #[doc = r" Writes raw bits to the register."]
137    #[doc = r""]
138    #[doc = r" # Safety"]
139    #[doc = r""]
140    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
141    #[inline(always)]
142    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
143        self.bits = bits;
144        self
145    }
146}
147#[doc = "TV Encoder Configuration Register0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_configuration0::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_configuration0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
148pub struct TVE_CONFIGURATION0_SPEC;
149impl crate::RegisterSpec for TVE_CONFIGURATION0_SPEC {
150    type Ux = u32;
151}
152#[doc = "`read()` method returns [`tve_configuration0::R`](R) reader structure"]
153impl crate::Readable for TVE_CONFIGURATION0_SPEC {}
154#[doc = "`write(|w| ..)` method takes [`tve_configuration0::W`](W) writer structure"]
155impl crate::Writable for TVE_CONFIGURATION0_SPEC {
156    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
157    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
158}
159#[doc = "`reset()` method sets tve_configuration0 to value 0"]
160impl crate::Resettable for TVE_CONFIGURATION0_SPEC {
161    const RESET_VALUE: Self::Ux = 0;
162}