d1_pac/tcon_tv0/
tv_src_ctl.rs

1#[doc = "Register `tv_src_ctl` reader"]
2pub type R = crate::R<TV_SRC_CTL_SPEC>;
3#[doc = "Register `tv_src_ctl` writer"]
4pub type W = crate::W<TV_SRC_CTL_SPEC>;
5#[doc = "Field `tv_src_sel` reader - TV Source Select"]
6pub type TV_SRC_SEL_R = crate::FieldReader<TV_SRC_SEL_A>;
7#[doc = "TV Source Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum TV_SRC_SEL_A {
11    #[doc = "0: DE"]
12    DE = 0,
13    #[doc = "1: Color Check"]
14    COLOR = 1,
15    #[doc = "2: Grayscale Check"]
16    GRAYSCALE = 2,
17    #[doc = "3: Black by White Check"]
18    BLACK_BY_WHITE = 3,
19    #[doc = "7: Gridding Check"]
20    GRIDDING = 7,
21}
22impl From<TV_SRC_SEL_A> for u8 {
23    #[inline(always)]
24    fn from(variant: TV_SRC_SEL_A) -> Self {
25        variant as _
26    }
27}
28impl crate::FieldSpec for TV_SRC_SEL_A {
29    type Ux = u8;
30}
31impl TV_SRC_SEL_R {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> Option<TV_SRC_SEL_A> {
35        match self.bits {
36            0 => Some(TV_SRC_SEL_A::DE),
37            1 => Some(TV_SRC_SEL_A::COLOR),
38            2 => Some(TV_SRC_SEL_A::GRAYSCALE),
39            3 => Some(TV_SRC_SEL_A::BLACK_BY_WHITE),
40            7 => Some(TV_SRC_SEL_A::GRIDDING),
41            _ => None,
42        }
43    }
44    #[doc = "DE"]
45    #[inline(always)]
46    pub fn is_de(&self) -> bool {
47        *self == TV_SRC_SEL_A::DE
48    }
49    #[doc = "Color Check"]
50    #[inline(always)]
51    pub fn is_color(&self) -> bool {
52        *self == TV_SRC_SEL_A::COLOR
53    }
54    #[doc = "Grayscale Check"]
55    #[inline(always)]
56    pub fn is_grayscale(&self) -> bool {
57        *self == TV_SRC_SEL_A::GRAYSCALE
58    }
59    #[doc = "Black by White Check"]
60    #[inline(always)]
61    pub fn is_black_by_white(&self) -> bool {
62        *self == TV_SRC_SEL_A::BLACK_BY_WHITE
63    }
64    #[doc = "Gridding Check"]
65    #[inline(always)]
66    pub fn is_gridding(&self) -> bool {
67        *self == TV_SRC_SEL_A::GRIDDING
68    }
69}
70#[doc = "Field `tv_src_sel` writer - TV Source Select"]
71pub type TV_SRC_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TV_SRC_SEL_A>;
72impl<'a, REG> TV_SRC_SEL_W<'a, REG>
73where
74    REG: crate::Writable + crate::RegisterSpec,
75    REG::Ux: From<u8>,
76{
77    #[doc = "DE"]
78    #[inline(always)]
79    pub fn de(self) -> &'a mut crate::W<REG> {
80        self.variant(TV_SRC_SEL_A::DE)
81    }
82    #[doc = "Color Check"]
83    #[inline(always)]
84    pub fn color(self) -> &'a mut crate::W<REG> {
85        self.variant(TV_SRC_SEL_A::COLOR)
86    }
87    #[doc = "Grayscale Check"]
88    #[inline(always)]
89    pub fn grayscale(self) -> &'a mut crate::W<REG> {
90        self.variant(TV_SRC_SEL_A::GRAYSCALE)
91    }
92    #[doc = "Black by White Check"]
93    #[inline(always)]
94    pub fn black_by_white(self) -> &'a mut crate::W<REG> {
95        self.variant(TV_SRC_SEL_A::BLACK_BY_WHITE)
96    }
97    #[doc = "Gridding Check"]
98    #[inline(always)]
99    pub fn gridding(self) -> &'a mut crate::W<REG> {
100        self.variant(TV_SRC_SEL_A::GRIDDING)
101    }
102}
103impl R {
104    #[doc = "Bits 0:2 - TV Source Select"]
105    #[inline(always)]
106    pub fn tv_src_sel(&self) -> TV_SRC_SEL_R {
107        TV_SRC_SEL_R::new((self.bits & 7) as u8)
108    }
109}
110impl W {
111    #[doc = "Bits 0:2 - TV Source Select"]
112    #[inline(always)]
113    #[must_use]
114    pub fn tv_src_sel(&mut self) -> TV_SRC_SEL_W<TV_SRC_CTL_SPEC> {
115        TV_SRC_SEL_W::new(self, 0)
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 Source Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tv_src_ctl::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 [`tv_src_ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
129pub struct TV_SRC_CTL_SPEC;
130impl crate::RegisterSpec for TV_SRC_CTL_SPEC {
131    type Ux = u32;
132}
133#[doc = "`read()` method returns [`tv_src_ctl::R`](R) reader structure"]
134impl crate::Readable for TV_SRC_CTL_SPEC {}
135#[doc = "`write(|w| ..)` method takes [`tv_src_ctl::W`](W) writer structure"]
136impl crate::Writable for TV_SRC_CTL_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 tv_src_ctl to value 0"]
141impl crate::Resettable for TV_SRC_CTL_SPEC {
142    const RESET_VALUE: Self::Ux = 0;
143}