d1_pac/tcon_lcd0/
lcd_cmap_ctl.rs

1#[doc = "Register `lcd_cmap_ctl` reader"]
2pub type R = crate::R<LCD_CMAP_CTL_SPEC>;
3#[doc = "Register `lcd_cmap_ctl` writer"]
4pub type W = crate::W<LCD_CMAP_CTL_SPEC>;
5#[doc = "Field `out_format` reader - Set the pixel output format in color map function."]
6pub type OUT_FORMAT_R = crate::BitReader<OUT_FORMAT_A>;
7#[doc = "Set the pixel output format in color map function.\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum OUT_FORMAT_A {
10    #[doc = "0: 4 pixel output mode: Out0 -> Out1 -> Out2 -> Out3"]
11    P4 = 0,
12    #[doc = "1: 2 pixel output mode: Out0 -> Out1"]
13    P2 = 1,
14}
15impl From<OUT_FORMAT_A> for bool {
16    #[inline(always)]
17    fn from(variant: OUT_FORMAT_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl OUT_FORMAT_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> OUT_FORMAT_A {
25        match self.bits {
26            false => OUT_FORMAT_A::P4,
27            true => OUT_FORMAT_A::P2,
28        }
29    }
30    #[doc = "4 pixel output mode: Out0 -> Out1 -> Out2 -> Out3"]
31    #[inline(always)]
32    pub fn is_p4(&self) -> bool {
33        *self == OUT_FORMAT_A::P4
34    }
35    #[doc = "2 pixel output mode: Out0 -> Out1"]
36    #[inline(always)]
37    pub fn is_p2(&self) -> bool {
38        *self == OUT_FORMAT_A::P2
39    }
40}
41#[doc = "Field `out_format` writer - Set the pixel output format in color map function."]
42pub type OUT_FORMAT_W<'a, REG> = crate::BitWriter<'a, REG, OUT_FORMAT_A>;
43impl<'a, REG> OUT_FORMAT_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "4 pixel output mode: Out0 -> Out1 -> Out2 -> Out3"]
48    #[inline(always)]
49    pub fn p4(self) -> &'a mut crate::W<REG> {
50        self.variant(OUT_FORMAT_A::P4)
51    }
52    #[doc = "2 pixel output mode: Out0 -> Out1"]
53    #[inline(always)]
54    pub fn p2(self) -> &'a mut crate::W<REG> {
55        self.variant(OUT_FORMAT_A::P2)
56    }
57}
58#[doc = "Field `color_map_en` reader - Enable the color map function. This module only works when X is divided by 4."]
59pub type COLOR_MAP_EN_R = crate::BitReader<COLOR_MAP_EN_A>;
60#[doc = "Enable the color map function. This module only works when X is divided by 4.\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum COLOR_MAP_EN_A {
63    #[doc = "0: Bypass"]
64    BYPASS = 0,
65    #[doc = "1: Enable"]
66    ENABLE = 1,
67}
68impl From<COLOR_MAP_EN_A> for bool {
69    #[inline(always)]
70    fn from(variant: COLOR_MAP_EN_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl COLOR_MAP_EN_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> COLOR_MAP_EN_A {
78        match self.bits {
79            false => COLOR_MAP_EN_A::BYPASS,
80            true => COLOR_MAP_EN_A::ENABLE,
81        }
82    }
83    #[doc = "Bypass"]
84    #[inline(always)]
85    pub fn is_bypass(&self) -> bool {
86        *self == COLOR_MAP_EN_A::BYPASS
87    }
88    #[doc = "Enable"]
89    #[inline(always)]
90    pub fn is_enable(&self) -> bool {
91        *self == COLOR_MAP_EN_A::ENABLE
92    }
93}
94#[doc = "Field `color_map_en` writer - Enable the color map function. This module only works when X is divided by 4."]
95pub type COLOR_MAP_EN_W<'a, REG> = crate::BitWriter<'a, REG, COLOR_MAP_EN_A>;
96impl<'a, REG> COLOR_MAP_EN_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Bypass"]
101    #[inline(always)]
102    pub fn bypass(self) -> &'a mut crate::W<REG> {
103        self.variant(COLOR_MAP_EN_A::BYPASS)
104    }
105    #[doc = "Enable"]
106    #[inline(always)]
107    pub fn enable(self) -> &'a mut crate::W<REG> {
108        self.variant(COLOR_MAP_EN_A::ENABLE)
109    }
110}
111impl R {
112    #[doc = "Bit 0 - Set the pixel output format in color map function."]
113    #[inline(always)]
114    pub fn out_format(&self) -> OUT_FORMAT_R {
115        OUT_FORMAT_R::new((self.bits & 1) != 0)
116    }
117    #[doc = "Bit 31 - Enable the color map function. This module only works when X is divided by 4."]
118    #[inline(always)]
119    pub fn color_map_en(&self) -> COLOR_MAP_EN_R {
120        COLOR_MAP_EN_R::new(((self.bits >> 31) & 1) != 0)
121    }
122}
123impl W {
124    #[doc = "Bit 0 - Set the pixel output format in color map function."]
125    #[inline(always)]
126    #[must_use]
127    pub fn out_format(&mut self) -> OUT_FORMAT_W<LCD_CMAP_CTL_SPEC> {
128        OUT_FORMAT_W::new(self, 0)
129    }
130    #[doc = "Bit 31 - Enable the color map function. This module only works when X is divided by 4."]
131    #[inline(always)]
132    #[must_use]
133    pub fn color_map_en(&mut self) -> COLOR_MAP_EN_W<LCD_CMAP_CTL_SPEC> {
134        COLOR_MAP_EN_W::new(self, 31)
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 = "LCD Color Map Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`lcd_cmap_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 [`lcd_cmap_ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
148pub struct LCD_CMAP_CTL_SPEC;
149impl crate::RegisterSpec for LCD_CMAP_CTL_SPEC {
150    type Ux = u32;
151}
152#[doc = "`read()` method returns [`lcd_cmap_ctl::R`](R) reader structure"]
153impl crate::Readable for LCD_CMAP_CTL_SPEC {}
154#[doc = "`write(|w| ..)` method takes [`lcd_cmap_ctl::W`](W) writer structure"]
155impl crate::Writable for LCD_CMAP_CTL_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 lcd_cmap_ctl to value 0"]
160impl crate::Resettable for LCD_CMAP_CTL_SPEC {
161    const RESET_VALUE: Self::Ux = 0;
162}