efm32gg_pac/efm32gg995/cmu/
lcdctrl.rs

1#[doc = "Register `LCDCTRL` reader"]
2pub struct R(crate::R<LCDCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<LCDCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<LCDCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<LCDCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `LCDCTRL` writer"]
17pub struct W(crate::W<LCDCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<LCDCTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<LCDCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<LCDCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `FDIV` reader - Frame Rate Control"]
38pub type FDIV_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `FDIV` writer - Frame Rate Control"]
40pub type FDIV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, LCDCTRL_SPEC, u8, u8, 3, O>;
41#[doc = "Field `VBOOSTEN` reader - Voltage Boost Enable"]
42pub type VBOOSTEN_R = crate::BitReader<bool>;
43#[doc = "Field `VBOOSTEN` writer - Voltage Boost Enable"]
44pub type VBOOSTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, LCDCTRL_SPEC, bool, O>;
45#[doc = "Field `VBFDIV` reader - Voltage Boost Frequency Division"]
46pub type VBFDIV_R = crate::FieldReader<u8, VBFDIV_A>;
47#[doc = "Voltage Boost Frequency Division\n\nValue on reset: 2"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49#[repr(u8)]
50pub enum VBFDIV_A {
51    #[doc = "0: Voltage Boost update Frequency = LFACLK."]
52    DIV1 = 0,
53    #[doc = "1: Voltage Boost update Frequency = LFACLK/2."]
54    DIV2 = 1,
55    #[doc = "2: Voltage Boost update Frequency = LFACLK/4."]
56    DIV4 = 2,
57    #[doc = "3: Voltage Boost update Frequency = LFACLK/8."]
58    DIV8 = 3,
59    #[doc = "4: Voltage Boost update Frequency = LFACLK/16."]
60    DIV16 = 4,
61    #[doc = "5: Voltage Boost update Frequency = LFACLK/32."]
62    DIV32 = 5,
63    #[doc = "6: Voltage Boost update Frequency = LFACLK/64."]
64    DIV64 = 6,
65    #[doc = "7: Voltage Boost update Frequency = LFACLK/128."]
66    DIV128 = 7,
67}
68impl From<VBFDIV_A> for u8 {
69    #[inline(always)]
70    fn from(variant: VBFDIV_A) -> Self {
71        variant as _
72    }
73}
74impl VBFDIV_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> VBFDIV_A {
78        match self.bits {
79            0 => VBFDIV_A::DIV1,
80            1 => VBFDIV_A::DIV2,
81            2 => VBFDIV_A::DIV4,
82            3 => VBFDIV_A::DIV8,
83            4 => VBFDIV_A::DIV16,
84            5 => VBFDIV_A::DIV32,
85            6 => VBFDIV_A::DIV64,
86            7 => VBFDIV_A::DIV128,
87            _ => unreachable!(),
88        }
89    }
90    #[doc = "Checks if the value of the field is `DIV1`"]
91    #[inline(always)]
92    pub fn is_div1(&self) -> bool {
93        *self == VBFDIV_A::DIV1
94    }
95    #[doc = "Checks if the value of the field is `DIV2`"]
96    #[inline(always)]
97    pub fn is_div2(&self) -> bool {
98        *self == VBFDIV_A::DIV2
99    }
100    #[doc = "Checks if the value of the field is `DIV4`"]
101    #[inline(always)]
102    pub fn is_div4(&self) -> bool {
103        *self == VBFDIV_A::DIV4
104    }
105    #[doc = "Checks if the value of the field is `DIV8`"]
106    #[inline(always)]
107    pub fn is_div8(&self) -> bool {
108        *self == VBFDIV_A::DIV8
109    }
110    #[doc = "Checks if the value of the field is `DIV16`"]
111    #[inline(always)]
112    pub fn is_div16(&self) -> bool {
113        *self == VBFDIV_A::DIV16
114    }
115    #[doc = "Checks if the value of the field is `DIV32`"]
116    #[inline(always)]
117    pub fn is_div32(&self) -> bool {
118        *self == VBFDIV_A::DIV32
119    }
120    #[doc = "Checks if the value of the field is `DIV64`"]
121    #[inline(always)]
122    pub fn is_div64(&self) -> bool {
123        *self == VBFDIV_A::DIV64
124    }
125    #[doc = "Checks if the value of the field is `DIV128`"]
126    #[inline(always)]
127    pub fn is_div128(&self) -> bool {
128        *self == VBFDIV_A::DIV128
129    }
130}
131#[doc = "Field `VBFDIV` writer - Voltage Boost Frequency Division"]
132pub type VBFDIV_W<'a, const O: u8> =
133    crate::FieldWriterSafe<'a, u32, LCDCTRL_SPEC, u8, VBFDIV_A, 3, O>;
134impl<'a, const O: u8> VBFDIV_W<'a, O> {
135    #[doc = "Voltage Boost update Frequency = LFACLK."]
136    #[inline(always)]
137    pub fn div1(self) -> &'a mut W {
138        self.variant(VBFDIV_A::DIV1)
139    }
140    #[doc = "Voltage Boost update Frequency = LFACLK/2."]
141    #[inline(always)]
142    pub fn div2(self) -> &'a mut W {
143        self.variant(VBFDIV_A::DIV2)
144    }
145    #[doc = "Voltage Boost update Frequency = LFACLK/4."]
146    #[inline(always)]
147    pub fn div4(self) -> &'a mut W {
148        self.variant(VBFDIV_A::DIV4)
149    }
150    #[doc = "Voltage Boost update Frequency = LFACLK/8."]
151    #[inline(always)]
152    pub fn div8(self) -> &'a mut W {
153        self.variant(VBFDIV_A::DIV8)
154    }
155    #[doc = "Voltage Boost update Frequency = LFACLK/16."]
156    #[inline(always)]
157    pub fn div16(self) -> &'a mut W {
158        self.variant(VBFDIV_A::DIV16)
159    }
160    #[doc = "Voltage Boost update Frequency = LFACLK/32."]
161    #[inline(always)]
162    pub fn div32(self) -> &'a mut W {
163        self.variant(VBFDIV_A::DIV32)
164    }
165    #[doc = "Voltage Boost update Frequency = LFACLK/64."]
166    #[inline(always)]
167    pub fn div64(self) -> &'a mut W {
168        self.variant(VBFDIV_A::DIV64)
169    }
170    #[doc = "Voltage Boost update Frequency = LFACLK/128."]
171    #[inline(always)]
172    pub fn div128(self) -> &'a mut W {
173        self.variant(VBFDIV_A::DIV128)
174    }
175}
176impl R {
177    #[doc = "Bits 0:2 - Frame Rate Control"]
178    #[inline(always)]
179    pub fn fdiv(&self) -> FDIV_R {
180        FDIV_R::new((self.bits & 7) as u8)
181    }
182    #[doc = "Bit 3 - Voltage Boost Enable"]
183    #[inline(always)]
184    pub fn vboosten(&self) -> VBOOSTEN_R {
185        VBOOSTEN_R::new(((self.bits >> 3) & 1) != 0)
186    }
187    #[doc = "Bits 4:6 - Voltage Boost Frequency Division"]
188    #[inline(always)]
189    pub fn vbfdiv(&self) -> VBFDIV_R {
190        VBFDIV_R::new(((self.bits >> 4) & 7) as u8)
191    }
192}
193impl W {
194    #[doc = "Bits 0:2 - Frame Rate Control"]
195    #[inline(always)]
196    #[must_use]
197    pub fn fdiv(&mut self) -> FDIV_W<0> {
198        FDIV_W::new(self)
199    }
200    #[doc = "Bit 3 - Voltage Boost Enable"]
201    #[inline(always)]
202    #[must_use]
203    pub fn vboosten(&mut self) -> VBOOSTEN_W<3> {
204        VBOOSTEN_W::new(self)
205    }
206    #[doc = "Bits 4:6 - Voltage Boost Frequency Division"]
207    #[inline(always)]
208    #[must_use]
209    pub fn vbfdiv(&mut self) -> VBFDIV_W<4> {
210        VBFDIV_W::new(self)
211    }
212    #[doc = "Writes raw bits to the register."]
213    #[inline(always)]
214    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
215        self.0.bits(bits);
216        self
217    }
218}
219#[doc = "LCD Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lcdctrl](index.html) module"]
220pub struct LCDCTRL_SPEC;
221impl crate::RegisterSpec for LCDCTRL_SPEC {
222    type Ux = u32;
223}
224#[doc = "`read()` method returns [lcdctrl::R](R) reader structure"]
225impl crate::Readable for LCDCTRL_SPEC {
226    type Reader = R;
227}
228#[doc = "`write(|w| ..)` method takes [lcdctrl::W](W) writer structure"]
229impl crate::Writable for LCDCTRL_SPEC {
230    type Writer = W;
231    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
232    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
233}
234#[doc = "`reset()` method sets LCDCTRL to value 0x20"]
235impl crate::Resettable for LCDCTRL_SPEC {
236    const RESET_VALUE: Self::Ux = 0x20;
237}