d1_pac/tcon_lcd0/
lcd_ctl.rs

1#[doc = "Register `lcd_ctl` reader"]
2pub type R = crate::R<LCD_CTL_SPEC>;
3#[doc = "Register `lcd_ctl` writer"]
4pub type W = crate::W<LCD_CTL_SPEC>;
5#[doc = "Field `lcd_src_sel` reader - LCD Source Select"]
6pub type LCD_SRC_SEL_R = crate::FieldReader<LCD_SRC_SEL_A>;
7#[doc = "LCD Source Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum LCD_SRC_SEL_A {
11    #[doc = "0: DE"]
12    DE = 0,
13    #[doc = "1: Color Check"]
14    COLOR_CHECK = 1,
15    #[doc = "2: Grayscale Check"]
16    GRAYSCALE_CHECK = 2,
17    #[doc = "3: Black by White Check"]
18    BLACK_BY_WHITE_CHECK = 3,
19    #[doc = "4: Test Data all 0"]
20    TEST_DATA_ALL_0 = 4,
21    #[doc = "5: Test Data all 1"]
22    TEST_DATA_ALL_1 = 5,
23    #[doc = "6: Reversed"]
24    REVERSED = 6,
25    #[doc = "7: Gridding Check"]
26    GRIDDING_CHECK = 7,
27}
28impl From<LCD_SRC_SEL_A> for u8 {
29    #[inline(always)]
30    fn from(variant: LCD_SRC_SEL_A) -> Self {
31        variant as _
32    }
33}
34impl crate::FieldSpec for LCD_SRC_SEL_A {
35    type Ux = u8;
36}
37impl LCD_SRC_SEL_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub const fn variant(&self) -> LCD_SRC_SEL_A {
41        match self.bits {
42            0 => LCD_SRC_SEL_A::DE,
43            1 => LCD_SRC_SEL_A::COLOR_CHECK,
44            2 => LCD_SRC_SEL_A::GRAYSCALE_CHECK,
45            3 => LCD_SRC_SEL_A::BLACK_BY_WHITE_CHECK,
46            4 => LCD_SRC_SEL_A::TEST_DATA_ALL_0,
47            5 => LCD_SRC_SEL_A::TEST_DATA_ALL_1,
48            6 => LCD_SRC_SEL_A::REVERSED,
49            7 => LCD_SRC_SEL_A::GRIDDING_CHECK,
50            _ => unreachable!(),
51        }
52    }
53    #[doc = "DE"]
54    #[inline(always)]
55    pub fn is_de(&self) -> bool {
56        *self == LCD_SRC_SEL_A::DE
57    }
58    #[doc = "Color Check"]
59    #[inline(always)]
60    pub fn is_color_check(&self) -> bool {
61        *self == LCD_SRC_SEL_A::COLOR_CHECK
62    }
63    #[doc = "Grayscale Check"]
64    #[inline(always)]
65    pub fn is_grayscale_check(&self) -> bool {
66        *self == LCD_SRC_SEL_A::GRAYSCALE_CHECK
67    }
68    #[doc = "Black by White Check"]
69    #[inline(always)]
70    pub fn is_black_by_white_check(&self) -> bool {
71        *self == LCD_SRC_SEL_A::BLACK_BY_WHITE_CHECK
72    }
73    #[doc = "Test Data all 0"]
74    #[inline(always)]
75    pub fn is_test_data_all_0(&self) -> bool {
76        *self == LCD_SRC_SEL_A::TEST_DATA_ALL_0
77    }
78    #[doc = "Test Data all 1"]
79    #[inline(always)]
80    pub fn is_test_data_all_1(&self) -> bool {
81        *self == LCD_SRC_SEL_A::TEST_DATA_ALL_1
82    }
83    #[doc = "Reversed"]
84    #[inline(always)]
85    pub fn is_reversed(&self) -> bool {
86        *self == LCD_SRC_SEL_A::REVERSED
87    }
88    #[doc = "Gridding Check"]
89    #[inline(always)]
90    pub fn is_gridding_check(&self) -> bool {
91        *self == LCD_SRC_SEL_A::GRIDDING_CHECK
92    }
93}
94#[doc = "Field `lcd_src_sel` writer - LCD Source Select"]
95pub type LCD_SRC_SEL_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 3, LCD_SRC_SEL_A>;
96impl<'a, REG> LCD_SRC_SEL_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99    REG::Ux: From<u8>,
100{
101    #[doc = "DE"]
102    #[inline(always)]
103    pub fn de(self) -> &'a mut crate::W<REG> {
104        self.variant(LCD_SRC_SEL_A::DE)
105    }
106    #[doc = "Color Check"]
107    #[inline(always)]
108    pub fn color_check(self) -> &'a mut crate::W<REG> {
109        self.variant(LCD_SRC_SEL_A::COLOR_CHECK)
110    }
111    #[doc = "Grayscale Check"]
112    #[inline(always)]
113    pub fn grayscale_check(self) -> &'a mut crate::W<REG> {
114        self.variant(LCD_SRC_SEL_A::GRAYSCALE_CHECK)
115    }
116    #[doc = "Black by White Check"]
117    #[inline(always)]
118    pub fn black_by_white_check(self) -> &'a mut crate::W<REG> {
119        self.variant(LCD_SRC_SEL_A::BLACK_BY_WHITE_CHECK)
120    }
121    #[doc = "Test Data all 0"]
122    #[inline(always)]
123    pub fn test_data_all_0(self) -> &'a mut crate::W<REG> {
124        self.variant(LCD_SRC_SEL_A::TEST_DATA_ALL_0)
125    }
126    #[doc = "Test Data all 1"]
127    #[inline(always)]
128    pub fn test_data_all_1(self) -> &'a mut crate::W<REG> {
129        self.variant(LCD_SRC_SEL_A::TEST_DATA_ALL_1)
130    }
131    #[doc = "Reversed"]
132    #[inline(always)]
133    pub fn reversed(self) -> &'a mut crate::W<REG> {
134        self.variant(LCD_SRC_SEL_A::REVERSED)
135    }
136    #[doc = "Gridding Check"]
137    #[inline(always)]
138    pub fn gridding_check(self) -> &'a mut crate::W<REG> {
139        self.variant(LCD_SRC_SEL_A::GRIDDING_CHECK)
140    }
141}
142#[doc = "Field `lcd_start_dly` reader - The unit of delay is T_line.\n\nNote: Valid only when LCD_EN == 1"]
143pub type LCD_START_DLY_R = crate::FieldReader;
144#[doc = "Field `lcd_start_dly` writer - The unit of delay is T_line.\n\nNote: Valid only when LCD_EN == 1"]
145pub type LCD_START_DLY_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
146#[doc = "Field `lcd_interlace_en` reader - This flag is valid only when LCD_EN == 1"]
147pub type LCD_INTERLACE_EN_R = crate::BitReader<LCD_INTERLACE_EN_A>;
148#[doc = "This flag is valid only when LCD_EN == 1\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq, Eq)]
150pub enum LCD_INTERLACE_EN_A {
151    #[doc = "0: Disable"]
152    DISABLE = 0,
153    #[doc = "1: Enable"]
154    ENABLE = 1,
155}
156impl From<LCD_INTERLACE_EN_A> for bool {
157    #[inline(always)]
158    fn from(variant: LCD_INTERLACE_EN_A) -> Self {
159        variant as u8 != 0
160    }
161}
162impl LCD_INTERLACE_EN_R {
163    #[doc = "Get enumerated values variant"]
164    #[inline(always)]
165    pub const fn variant(&self) -> LCD_INTERLACE_EN_A {
166        match self.bits {
167            false => LCD_INTERLACE_EN_A::DISABLE,
168            true => LCD_INTERLACE_EN_A::ENABLE,
169        }
170    }
171    #[doc = "Disable"]
172    #[inline(always)]
173    pub fn is_disable(&self) -> bool {
174        *self == LCD_INTERLACE_EN_A::DISABLE
175    }
176    #[doc = "Enable"]
177    #[inline(always)]
178    pub fn is_enable(&self) -> bool {
179        *self == LCD_INTERLACE_EN_A::ENABLE
180    }
181}
182#[doc = "Field `lcd_interlace_en` writer - This flag is valid only when LCD_EN == 1"]
183pub type LCD_INTERLACE_EN_W<'a, REG> = crate::BitWriter<'a, REG, LCD_INTERLACE_EN_A>;
184impl<'a, REG> LCD_INTERLACE_EN_W<'a, REG>
185where
186    REG: crate::Writable + crate::RegisterSpec,
187{
188    #[doc = "Disable"]
189    #[inline(always)]
190    pub fn disable(self) -> &'a mut crate::W<REG> {
191        self.variant(LCD_INTERLACE_EN_A::DISABLE)
192    }
193    #[doc = "Enable"]
194    #[inline(always)]
195    pub fn enable(self) -> &'a mut crate::W<REG> {
196        self.variant(LCD_INTERLACE_EN_A::ENABLE)
197    }
198}
199#[doc = "Field `lcd_fifo1_rst` reader - Writing 1 and then 0 to this bit will reset FIFO 1\n\nNote: 1 holding time must more than 1 DCLK"]
200pub type LCD_FIFO1_RST_R = crate::BitReader;
201#[doc = "Field `lcd_fifo1_rst` writer - Writing 1 and then 0 to this bit will reset FIFO 1\n\nNote: 1 holding time must more than 1 DCLK"]
202pub type LCD_FIFO1_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
203#[doc = "Field `lcd_rb_swap` reader - Enable the function to swap red data and blue data in fifo1."]
204pub type LCD_RB_SWAP_R = crate::BitReader<LCD_RB_SWAP_A>;
205#[doc = "Enable the function to swap red data and blue data in fifo1.\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq, Eq)]
207pub enum LCD_RB_SWAP_A {
208    #[doc = "0: Default"]
209    D_EFAULT = 0,
210    #[doc = "1: Swap RED and BLUE data at FIFO1"]
211    S_WAP = 1,
212}
213impl From<LCD_RB_SWAP_A> for bool {
214    #[inline(always)]
215    fn from(variant: LCD_RB_SWAP_A) -> Self {
216        variant as u8 != 0
217    }
218}
219impl LCD_RB_SWAP_R {
220    #[doc = "Get enumerated values variant"]
221    #[inline(always)]
222    pub const fn variant(&self) -> LCD_RB_SWAP_A {
223        match self.bits {
224            false => LCD_RB_SWAP_A::D_EFAULT,
225            true => LCD_RB_SWAP_A::S_WAP,
226        }
227    }
228    #[doc = "Default"]
229    #[inline(always)]
230    pub fn is_d_efault(&self) -> bool {
231        *self == LCD_RB_SWAP_A::D_EFAULT
232    }
233    #[doc = "Swap RED and BLUE data at FIFO1"]
234    #[inline(always)]
235    pub fn is_s_wap(&self) -> bool {
236        *self == LCD_RB_SWAP_A::S_WAP
237    }
238}
239#[doc = "Field `lcd_rb_swap` writer - Enable the function to swap red data and blue data in fifo1."]
240pub type LCD_RB_SWAP_W<'a, REG> = crate::BitWriter<'a, REG, LCD_RB_SWAP_A>;
241impl<'a, REG> LCD_RB_SWAP_W<'a, REG>
242where
243    REG: crate::Writable + crate::RegisterSpec,
244{
245    #[doc = "Default"]
246    #[inline(always)]
247    pub fn d_efault(self) -> &'a mut crate::W<REG> {
248        self.variant(LCD_RB_SWAP_A::D_EFAULT)
249    }
250    #[doc = "Swap RED and BLUE data at FIFO1"]
251    #[inline(always)]
252    pub fn s_wap(self) -> &'a mut crate::W<REG> {
253        self.variant(LCD_RB_SWAP_A::S_WAP)
254    }
255}
256#[doc = "Field `lcd_if` reader - Set the interface type of LCD controller"]
257pub type LCD_IF_R = crate::FieldReader<LCD_IF_A>;
258#[doc = "Set the interface type of LCD controller\n\nValue on reset: 0"]
259#[derive(Clone, Copy, Debug, PartialEq, Eq)]
260#[repr(u8)]
261pub enum LCD_IF_A {
262    #[doc = "0: HV (Sync + DE)"]
263    HV = 0,
264    #[doc = "1: 8080 I/F"]
265    IF_8080 = 1,
266}
267impl From<LCD_IF_A> for u8 {
268    #[inline(always)]
269    fn from(variant: LCD_IF_A) -> Self {
270        variant as _
271    }
272}
273impl crate::FieldSpec for LCD_IF_A {
274    type Ux = u8;
275}
276impl LCD_IF_R {
277    #[doc = "Get enumerated values variant"]
278    #[inline(always)]
279    pub const fn variant(&self) -> Option<LCD_IF_A> {
280        match self.bits {
281            0 => Some(LCD_IF_A::HV),
282            1 => Some(LCD_IF_A::IF_8080),
283            _ => None,
284        }
285    }
286    #[doc = "HV (Sync + DE)"]
287    #[inline(always)]
288    pub fn is_hv(&self) -> bool {
289        *self == LCD_IF_A::HV
290    }
291    #[doc = "8080 I/F"]
292    #[inline(always)]
293    pub fn is_if_8080(&self) -> bool {
294        *self == LCD_IF_A::IF_8080
295    }
296}
297#[doc = "Field `lcd_if` writer - Set the interface type of LCD controller"]
298pub type LCD_IF_W<'a, REG> = crate::FieldWriter<'a, REG, 2, LCD_IF_A>;
299impl<'a, REG> LCD_IF_W<'a, REG>
300where
301    REG: crate::Writable + crate::RegisterSpec,
302    REG::Ux: From<u8>,
303{
304    #[doc = "HV (Sync + DE)"]
305    #[inline(always)]
306    pub fn hv(self) -> &'a mut crate::W<REG> {
307        self.variant(LCD_IF_A::HV)
308    }
309    #[doc = "8080 I/F"]
310    #[inline(always)]
311    pub fn if_8080(self) -> &'a mut crate::W<REG> {
312        self.variant(LCD_IF_A::IF_8080)
313    }
314}
315#[doc = "Field `lcd_en` reader - It executes at the beginning of the first blank line of LCD timing."]
316pub type LCD_EN_R = crate::BitReader<LCD_EN_A>;
317#[doc = "It executes at the beginning of the first blank line of LCD timing.\n\nValue on reset: 0"]
318#[derive(Clone, Copy, Debug, PartialEq, Eq)]
319pub enum LCD_EN_A {
320    #[doc = "0: Disable"]
321    DISABLE = 0,
322    #[doc = "1: Enable"]
323    ENABLE = 1,
324}
325impl From<LCD_EN_A> for bool {
326    #[inline(always)]
327    fn from(variant: LCD_EN_A) -> Self {
328        variant as u8 != 0
329    }
330}
331impl LCD_EN_R {
332    #[doc = "Get enumerated values variant"]
333    #[inline(always)]
334    pub const fn variant(&self) -> LCD_EN_A {
335        match self.bits {
336            false => LCD_EN_A::DISABLE,
337            true => LCD_EN_A::ENABLE,
338        }
339    }
340    #[doc = "Disable"]
341    #[inline(always)]
342    pub fn is_disable(&self) -> bool {
343        *self == LCD_EN_A::DISABLE
344    }
345    #[doc = "Enable"]
346    #[inline(always)]
347    pub fn is_enable(&self) -> bool {
348        *self == LCD_EN_A::ENABLE
349    }
350}
351#[doc = "Field `lcd_en` writer - It executes at the beginning of the first blank line of LCD timing."]
352pub type LCD_EN_W<'a, REG> = crate::BitWriter<'a, REG, LCD_EN_A>;
353impl<'a, REG> LCD_EN_W<'a, REG>
354where
355    REG: crate::Writable + crate::RegisterSpec,
356{
357    #[doc = "Disable"]
358    #[inline(always)]
359    pub fn disable(self) -> &'a mut crate::W<REG> {
360        self.variant(LCD_EN_A::DISABLE)
361    }
362    #[doc = "Enable"]
363    #[inline(always)]
364    pub fn enable(self) -> &'a mut crate::W<REG> {
365        self.variant(LCD_EN_A::ENABLE)
366    }
367}
368impl R {
369    #[doc = "Bits 0:2 - LCD Source Select"]
370    #[inline(always)]
371    pub fn lcd_src_sel(&self) -> LCD_SRC_SEL_R {
372        LCD_SRC_SEL_R::new((self.bits & 7) as u8)
373    }
374    #[doc = "Bits 4:8 - The unit of delay is T_line.\n\nNote: Valid only when LCD_EN == 1"]
375    #[inline(always)]
376    pub fn lcd_start_dly(&self) -> LCD_START_DLY_R {
377        LCD_START_DLY_R::new(((self.bits >> 4) & 0x1f) as u8)
378    }
379    #[doc = "Bit 20 - This flag is valid only when LCD_EN == 1"]
380    #[inline(always)]
381    pub fn lcd_interlace_en(&self) -> LCD_INTERLACE_EN_R {
382        LCD_INTERLACE_EN_R::new(((self.bits >> 20) & 1) != 0)
383    }
384    #[doc = "Bit 21 - Writing 1 and then 0 to this bit will reset FIFO 1\n\nNote: 1 holding time must more than 1 DCLK"]
385    #[inline(always)]
386    pub fn lcd_fifo1_rst(&self) -> LCD_FIFO1_RST_R {
387        LCD_FIFO1_RST_R::new(((self.bits >> 21) & 1) != 0)
388    }
389    #[doc = "Bit 23 - Enable the function to swap red data and blue data in fifo1."]
390    #[inline(always)]
391    pub fn lcd_rb_swap(&self) -> LCD_RB_SWAP_R {
392        LCD_RB_SWAP_R::new(((self.bits >> 23) & 1) != 0)
393    }
394    #[doc = "Bits 24:25 - Set the interface type of LCD controller"]
395    #[inline(always)]
396    pub fn lcd_if(&self) -> LCD_IF_R {
397        LCD_IF_R::new(((self.bits >> 24) & 3) as u8)
398    }
399    #[doc = "Bit 31 - It executes at the beginning of the first blank line of LCD timing."]
400    #[inline(always)]
401    pub fn lcd_en(&self) -> LCD_EN_R {
402        LCD_EN_R::new(((self.bits >> 31) & 1) != 0)
403    }
404}
405impl W {
406    #[doc = "Bits 0:2 - LCD Source Select"]
407    #[inline(always)]
408    #[must_use]
409    pub fn lcd_src_sel(&mut self) -> LCD_SRC_SEL_W<LCD_CTL_SPEC> {
410        LCD_SRC_SEL_W::new(self, 0)
411    }
412    #[doc = "Bits 4:8 - The unit of delay is T_line.\n\nNote: Valid only when LCD_EN == 1"]
413    #[inline(always)]
414    #[must_use]
415    pub fn lcd_start_dly(&mut self) -> LCD_START_DLY_W<LCD_CTL_SPEC> {
416        LCD_START_DLY_W::new(self, 4)
417    }
418    #[doc = "Bit 20 - This flag is valid only when LCD_EN == 1"]
419    #[inline(always)]
420    #[must_use]
421    pub fn lcd_interlace_en(&mut self) -> LCD_INTERLACE_EN_W<LCD_CTL_SPEC> {
422        LCD_INTERLACE_EN_W::new(self, 20)
423    }
424    #[doc = "Bit 21 - Writing 1 and then 0 to this bit will reset FIFO 1\n\nNote: 1 holding time must more than 1 DCLK"]
425    #[inline(always)]
426    #[must_use]
427    pub fn lcd_fifo1_rst(&mut self) -> LCD_FIFO1_RST_W<LCD_CTL_SPEC> {
428        LCD_FIFO1_RST_W::new(self, 21)
429    }
430    #[doc = "Bit 23 - Enable the function to swap red data and blue data in fifo1."]
431    #[inline(always)]
432    #[must_use]
433    pub fn lcd_rb_swap(&mut self) -> LCD_RB_SWAP_W<LCD_CTL_SPEC> {
434        LCD_RB_SWAP_W::new(self, 23)
435    }
436    #[doc = "Bits 24:25 - Set the interface type of LCD controller"]
437    #[inline(always)]
438    #[must_use]
439    pub fn lcd_if(&mut self) -> LCD_IF_W<LCD_CTL_SPEC> {
440        LCD_IF_W::new(self, 24)
441    }
442    #[doc = "Bit 31 - It executes at the beginning of the first blank line of LCD timing."]
443    #[inline(always)]
444    #[must_use]
445    pub fn lcd_en(&mut self) -> LCD_EN_W<LCD_CTL_SPEC> {
446        LCD_EN_W::new(self, 31)
447    }
448    #[doc = r" Writes raw bits to the register."]
449    #[doc = r""]
450    #[doc = r" # Safety"]
451    #[doc = r""]
452    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
453    #[inline(always)]
454    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
455        self.bits = bits;
456        self
457    }
458}
459#[doc = "LCD Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`lcd_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_ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
460pub struct LCD_CTL_SPEC;
461impl crate::RegisterSpec for LCD_CTL_SPEC {
462    type Ux = u32;
463}
464#[doc = "`read()` method returns [`lcd_ctl::R`](R) reader structure"]
465impl crate::Readable for LCD_CTL_SPEC {}
466#[doc = "`write(|w| ..)` method takes [`lcd_ctl::W`](W) writer structure"]
467impl crate::Writable for LCD_CTL_SPEC {
468    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
469    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
470}
471#[doc = "`reset()` method sets lcd_ctl to value 0"]
472impl crate::Resettable for LCD_CTL_SPEC {
473    const RESET_VALUE: Self::Ux = 0;
474}