d1_pac/tcon_lcd0/
lcd_debug.rs

1#[doc = "Register `lcd_debug` reader"]
2pub type R = crate::R<LCD_DEBUG_SPEC>;
3#[doc = "Register `lcd_debug` writer"]
4pub type W = crate::W<LCD_DEBUG_SPEC>;
5#[doc = "Field `lcd_current_line` reader - The current scan line"]
6pub type LCD_CURRENT_LINE_R = crate::FieldReader<u16>;
7#[doc = "Field `lcd_field_pol` reader - The flag indicates the current field polarity"]
8pub type LCD_FIELD_POL_R = crate::BitReader<LCD_FIELD_POL_A>;
9#[doc = "The flag indicates the current field polarity\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum LCD_FIELD_POL_A {
12    #[doc = "0: Second field"]
13    SECOND = 0,
14    #[doc = "1: First field"]
15    FIRST = 1,
16}
17impl From<LCD_FIELD_POL_A> for bool {
18    #[inline(always)]
19    fn from(variant: LCD_FIELD_POL_A) -> Self {
20        variant as u8 != 0
21    }
22}
23impl LCD_FIELD_POL_R {
24    #[doc = "Get enumerated values variant"]
25    #[inline(always)]
26    pub const fn variant(&self) -> LCD_FIELD_POL_A {
27        match self.bits {
28            false => LCD_FIELD_POL_A::SECOND,
29            true => LCD_FIELD_POL_A::FIRST,
30        }
31    }
32    #[doc = "Second field"]
33    #[inline(always)]
34    pub fn is_second(&self) -> bool {
35        *self == LCD_FIELD_POL_A::SECOND
36    }
37    #[doc = "First field"]
38    #[inline(always)]
39    pub fn is_first(&self) -> bool {
40        *self == LCD_FIELD_POL_A::FIRST
41    }
42}
43#[doc = "Field `lcd_fifo_underflow` reader - The flag shows whether the fifos in underflow status"]
44pub type LCD_FIFO_UNDERFLOW_R = crate::BitReader<LCD_FIFO_UNDERFLOW_A>;
45#[doc = "The flag shows whether the fifos in underflow status\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum LCD_FIFO_UNDERFLOW_A {
48    #[doc = "0: Not underflow"]
49    NOT_UNDERFLOW = 0,
50    #[doc = "1: Underflow"]
51    U_NDERFLOW = 1,
52}
53impl From<LCD_FIFO_UNDERFLOW_A> for bool {
54    #[inline(always)]
55    fn from(variant: LCD_FIFO_UNDERFLOW_A) -> Self {
56        variant as u8 != 0
57    }
58}
59impl LCD_FIFO_UNDERFLOW_R {
60    #[doc = "Get enumerated values variant"]
61    #[inline(always)]
62    pub const fn variant(&self) -> LCD_FIFO_UNDERFLOW_A {
63        match self.bits {
64            false => LCD_FIFO_UNDERFLOW_A::NOT_UNDERFLOW,
65            true => LCD_FIFO_UNDERFLOW_A::U_NDERFLOW,
66        }
67    }
68    #[doc = "Not underflow"]
69    #[inline(always)]
70    pub fn is_not_underflow(&self) -> bool {
71        *self == LCD_FIFO_UNDERFLOW_A::NOT_UNDERFLOW
72    }
73    #[doc = "Underflow"]
74    #[inline(always)]
75    pub fn is_u_nderflow(&self) -> bool {
76        *self == LCD_FIFO_UNDERFLOW_A::U_NDERFLOW
77    }
78}
79impl R {
80    #[doc = "Bits 16:27 - The current scan line"]
81    #[inline(always)]
82    pub fn lcd_current_line(&self) -> LCD_CURRENT_LINE_R {
83        LCD_CURRENT_LINE_R::new(((self.bits >> 16) & 0x0fff) as u16)
84    }
85    #[doc = "Bit 29 - The flag indicates the current field polarity"]
86    #[inline(always)]
87    pub fn lcd_field_pol(&self) -> LCD_FIELD_POL_R {
88        LCD_FIELD_POL_R::new(((self.bits >> 29) & 1) != 0)
89    }
90    #[doc = "Bit 31 - The flag shows whether the fifos in underflow status"]
91    #[inline(always)]
92    pub fn lcd_fifo_underflow(&self) -> LCD_FIFO_UNDERFLOW_R {
93        LCD_FIFO_UNDERFLOW_R::new(((self.bits >> 31) & 1) != 0)
94    }
95}
96impl W {
97    #[doc = r" Writes raw bits to the register."]
98    #[doc = r""]
99    #[doc = r" # Safety"]
100    #[doc = r""]
101    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
102    #[inline(always)]
103    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
104        self.bits = bits;
105        self
106    }
107}
108#[doc = "LCD Debug Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`lcd_debug::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_debug::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
109pub struct LCD_DEBUG_SPEC;
110impl crate::RegisterSpec for LCD_DEBUG_SPEC {
111    type Ux = u32;
112}
113#[doc = "`read()` method returns [`lcd_debug::R`](R) reader structure"]
114impl crate::Readable for LCD_DEBUG_SPEC {}
115#[doc = "`write(|w| ..)` method takes [`lcd_debug::W`](W) writer structure"]
116impl crate::Writable for LCD_DEBUG_SPEC {
117    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
118    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
119}
120#[doc = "`reset()` method sets lcd_debug to value 0"]
121impl crate::Resettable for LCD_DEBUG_SPEC {
122    const RESET_VALUE: Self::Ux = 0;
123}