efm32gg890_pac/cmu/
lcdctrl.rs1#[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> = crate::FieldWriter<'a, u32, LCDCTRL_SPEC, u8, u8, 3, 0>;
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> = crate::BitWriter<'a, u32, LCDCTRL_SPEC, bool, 3>;
45#[doc = "Voltage Boost Frequency Division\n\nValue on reset: 2"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47#[repr(u8)]
48pub enum VBFDIV_A {
49 #[doc = "0: Voltage Boost update Frequency = LFACLK."]
50 DIV1 = 0,
51 #[doc = "1: Voltage Boost update Frequency = LFACLK/2."]
52 DIV2 = 1,
53 #[doc = "2: Voltage Boost update Frequency = LFACLK/4."]
54 DIV4 = 2,
55 #[doc = "3: Voltage Boost update Frequency = LFACLK/8."]
56 DIV8 = 3,
57 #[doc = "4: Voltage Boost update Frequency = LFACLK/16."]
58 DIV16 = 4,
59 #[doc = "5: Voltage Boost update Frequency = LFACLK/32."]
60 DIV32 = 5,
61 #[doc = "6: Voltage Boost update Frequency = LFACLK/64."]
62 DIV64 = 6,
63 #[doc = "7: Voltage Boost update Frequency = LFACLK/128."]
64 DIV128 = 7,
65}
66impl From<VBFDIV_A> for u8 {
67 #[inline(always)]
68 fn from(variant: VBFDIV_A) -> Self {
69 variant as _
70 }
71}
72#[doc = "Field `VBFDIV` reader - Voltage Boost Frequency Division"]
73pub type VBFDIV_R = crate::FieldReader<u8, VBFDIV_A>;
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> = crate::FieldWriterSafe<'a, u32, LCDCTRL_SPEC, u8, VBFDIV_A, 3, 4>;
133impl<'a> VBFDIV_W<'a> {
134 #[doc = "Voltage Boost update Frequency = LFACLK."]
135 #[inline(always)]
136 pub fn div1(self) -> &'a mut W {
137 self.variant(VBFDIV_A::DIV1)
138 }
139 #[doc = "Voltage Boost update Frequency = LFACLK/2."]
140 #[inline(always)]
141 pub fn div2(self) -> &'a mut W {
142 self.variant(VBFDIV_A::DIV2)
143 }
144 #[doc = "Voltage Boost update Frequency = LFACLK/4."]
145 #[inline(always)]
146 pub fn div4(self) -> &'a mut W {
147 self.variant(VBFDIV_A::DIV4)
148 }
149 #[doc = "Voltage Boost update Frequency = LFACLK/8."]
150 #[inline(always)]
151 pub fn div8(self) -> &'a mut W {
152 self.variant(VBFDIV_A::DIV8)
153 }
154 #[doc = "Voltage Boost update Frequency = LFACLK/16."]
155 #[inline(always)]
156 pub fn div16(self) -> &'a mut W {
157 self.variant(VBFDIV_A::DIV16)
158 }
159 #[doc = "Voltage Boost update Frequency = LFACLK/32."]
160 #[inline(always)]
161 pub fn div32(self) -> &'a mut W {
162 self.variant(VBFDIV_A::DIV32)
163 }
164 #[doc = "Voltage Boost update Frequency = LFACLK/64."]
165 #[inline(always)]
166 pub fn div64(self) -> &'a mut W {
167 self.variant(VBFDIV_A::DIV64)
168 }
169 #[doc = "Voltage Boost update Frequency = LFACLK/128."]
170 #[inline(always)]
171 pub fn div128(self) -> &'a mut W {
172 self.variant(VBFDIV_A::DIV128)
173 }
174}
175impl R {
176 #[doc = "Bits 0:2 - Frame Rate Control"]
177 #[inline(always)]
178 pub fn fdiv(&self) -> FDIV_R {
179 FDIV_R::new((self.bits & 7) as u8)
180 }
181 #[doc = "Bit 3 - Voltage Boost Enable"]
182 #[inline(always)]
183 pub fn vboosten(&self) -> VBOOSTEN_R {
184 VBOOSTEN_R::new(((self.bits >> 3) & 1) != 0)
185 }
186 #[doc = "Bits 4:6 - Voltage Boost Frequency Division"]
187 #[inline(always)]
188 pub fn vbfdiv(&self) -> VBFDIV_R {
189 VBFDIV_R::new(((self.bits >> 4) & 7) as u8)
190 }
191}
192impl W {
193 #[doc = "Bits 0:2 - Frame Rate Control"]
194 #[inline(always)]
195 pub fn fdiv(&mut self) -> FDIV_W {
196 FDIV_W::new(self)
197 }
198 #[doc = "Bit 3 - Voltage Boost Enable"]
199 #[inline(always)]
200 pub fn vboosten(&mut self) -> VBOOSTEN_W {
201 VBOOSTEN_W::new(self)
202 }
203 #[doc = "Bits 4:6 - Voltage Boost Frequency Division"]
204 #[inline(always)]
205 pub fn vbfdiv(&mut self) -> VBFDIV_W {
206 VBFDIV_W::new(self)
207 }
208 #[doc = "Writes raw bits to the register."]
209 #[inline(always)]
210 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
211 self.0.bits(bits);
212 self
213 }
214}
215#[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"]
216pub struct LCDCTRL_SPEC;
217impl crate::RegisterSpec for LCDCTRL_SPEC {
218 type Ux = u32;
219}
220#[doc = "`read()` method returns [lcdctrl::R](R) reader structure"]
221impl crate::Readable for LCDCTRL_SPEC {
222 type Reader = R;
223}
224#[doc = "`write(|w| ..)` method takes [lcdctrl::W](W) writer structure"]
225impl crate::Writable for LCDCTRL_SPEC {
226 type Writer = W;
227}
228#[doc = "`reset()` method sets LCDCTRL to value 0x20"]
229impl crate::Resettable for LCDCTRL_SPEC {
230 #[inline(always)]
231 fn reset_value() -> Self::Ux {
232 0x20
233 }
234}