efm32gg_pac/efm32gg230/cmu/
lfbpresc0.rs1#[doc = "Register `LFBPRESC0` reader"]
2pub struct R(crate::R<LFBPRESC0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFBPRESC0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFBPRESC0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFBPRESC0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFBPRESC0` writer"]
17pub struct W(crate::W<LFBPRESC0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFBPRESC0_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<LFBPRESC0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFBPRESC0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LEUART0` reader - Low Energy UART 0 Prescaler"]
38pub type LEUART0_R = crate::FieldReader<u8, LEUART0_A>;
39#[doc = "Low Energy UART 0 Prescaler\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum LEUART0_A {
43 #[doc = "0: LFBCLKLEUART0 = LFBCLK"]
44 DIV1 = 0,
45 #[doc = "1: LFBCLKLEUART0 = LFBCLK/2"]
46 DIV2 = 1,
47 #[doc = "2: LFBCLKLEUART0 = LFBCLK/4"]
48 DIV4 = 2,
49 #[doc = "3: LFBCLKLEUART0 = LFBCLK/8"]
50 DIV8 = 3,
51}
52impl From<LEUART0_A> for u8 {
53 #[inline(always)]
54 fn from(variant: LEUART0_A) -> Self {
55 variant as _
56 }
57}
58impl LEUART0_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> LEUART0_A {
62 match self.bits {
63 0 => LEUART0_A::DIV1,
64 1 => LEUART0_A::DIV2,
65 2 => LEUART0_A::DIV4,
66 3 => LEUART0_A::DIV8,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `DIV1`"]
71 #[inline(always)]
72 pub fn is_div1(&self) -> bool {
73 *self == LEUART0_A::DIV1
74 }
75 #[doc = "Checks if the value of the field is `DIV2`"]
76 #[inline(always)]
77 pub fn is_div2(&self) -> bool {
78 *self == LEUART0_A::DIV2
79 }
80 #[doc = "Checks if the value of the field is `DIV4`"]
81 #[inline(always)]
82 pub fn is_div4(&self) -> bool {
83 *self == LEUART0_A::DIV4
84 }
85 #[doc = "Checks if the value of the field is `DIV8`"]
86 #[inline(always)]
87 pub fn is_div8(&self) -> bool {
88 *self == LEUART0_A::DIV8
89 }
90}
91#[doc = "Field `LEUART0` writer - Low Energy UART 0 Prescaler"]
92pub type LEUART0_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u32, LFBPRESC0_SPEC, u8, LEUART0_A, 2, O>;
94impl<'a, const O: u8> LEUART0_W<'a, O> {
95 #[doc = "LFBCLKLEUART0 = LFBCLK"]
96 #[inline(always)]
97 pub fn div1(self) -> &'a mut W {
98 self.variant(LEUART0_A::DIV1)
99 }
100 #[doc = "LFBCLKLEUART0 = LFBCLK/2"]
101 #[inline(always)]
102 pub fn div2(self) -> &'a mut W {
103 self.variant(LEUART0_A::DIV2)
104 }
105 #[doc = "LFBCLKLEUART0 = LFBCLK/4"]
106 #[inline(always)]
107 pub fn div4(self) -> &'a mut W {
108 self.variant(LEUART0_A::DIV4)
109 }
110 #[doc = "LFBCLKLEUART0 = LFBCLK/8"]
111 #[inline(always)]
112 pub fn div8(self) -> &'a mut W {
113 self.variant(LEUART0_A::DIV8)
114 }
115}
116#[doc = "Field `LEUART1` reader - Low Energy UART 1 Prescaler"]
117pub type LEUART1_R = crate::FieldReader<u8, LEUART1_A>;
118#[doc = "Low Energy UART 1 Prescaler\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum LEUART1_A {
122 #[doc = "0: LFBCLKLEUART1 = LFBCLK"]
123 DIV1 = 0,
124 #[doc = "1: LFBCLKLEUART1 = LFBCLK/2"]
125 DIV2 = 1,
126 #[doc = "2: LFBCLKLEUART1 = LFBCLK/4"]
127 DIV4 = 2,
128 #[doc = "3: LFBCLKLEUART1 = LFBCLK/8"]
129 DIV8 = 3,
130}
131impl From<LEUART1_A> for u8 {
132 #[inline(always)]
133 fn from(variant: LEUART1_A) -> Self {
134 variant as _
135 }
136}
137impl LEUART1_R {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub fn variant(&self) -> LEUART1_A {
141 match self.bits {
142 0 => LEUART1_A::DIV1,
143 1 => LEUART1_A::DIV2,
144 2 => LEUART1_A::DIV4,
145 3 => LEUART1_A::DIV8,
146 _ => unreachable!(),
147 }
148 }
149 #[doc = "Checks if the value of the field is `DIV1`"]
150 #[inline(always)]
151 pub fn is_div1(&self) -> bool {
152 *self == LEUART1_A::DIV1
153 }
154 #[doc = "Checks if the value of the field is `DIV2`"]
155 #[inline(always)]
156 pub fn is_div2(&self) -> bool {
157 *self == LEUART1_A::DIV2
158 }
159 #[doc = "Checks if the value of the field is `DIV4`"]
160 #[inline(always)]
161 pub fn is_div4(&self) -> bool {
162 *self == LEUART1_A::DIV4
163 }
164 #[doc = "Checks if the value of the field is `DIV8`"]
165 #[inline(always)]
166 pub fn is_div8(&self) -> bool {
167 *self == LEUART1_A::DIV8
168 }
169}
170#[doc = "Field `LEUART1` writer - Low Energy UART 1 Prescaler"]
171pub type LEUART1_W<'a, const O: u8> =
172 crate::FieldWriterSafe<'a, u32, LFBPRESC0_SPEC, u8, LEUART1_A, 2, O>;
173impl<'a, const O: u8> LEUART1_W<'a, O> {
174 #[doc = "LFBCLKLEUART1 = LFBCLK"]
175 #[inline(always)]
176 pub fn div1(self) -> &'a mut W {
177 self.variant(LEUART1_A::DIV1)
178 }
179 #[doc = "LFBCLKLEUART1 = LFBCLK/2"]
180 #[inline(always)]
181 pub fn div2(self) -> &'a mut W {
182 self.variant(LEUART1_A::DIV2)
183 }
184 #[doc = "LFBCLKLEUART1 = LFBCLK/4"]
185 #[inline(always)]
186 pub fn div4(self) -> &'a mut W {
187 self.variant(LEUART1_A::DIV4)
188 }
189 #[doc = "LFBCLKLEUART1 = LFBCLK/8"]
190 #[inline(always)]
191 pub fn div8(self) -> &'a mut W {
192 self.variant(LEUART1_A::DIV8)
193 }
194}
195impl R {
196 #[doc = "Bits 0:1 - Low Energy UART 0 Prescaler"]
197 #[inline(always)]
198 pub fn leuart0(&self) -> LEUART0_R {
199 LEUART0_R::new((self.bits & 3) as u8)
200 }
201 #[doc = "Bits 4:5 - Low Energy UART 1 Prescaler"]
202 #[inline(always)]
203 pub fn leuart1(&self) -> LEUART1_R {
204 LEUART1_R::new(((self.bits >> 4) & 3) as u8)
205 }
206}
207impl W {
208 #[doc = "Bits 0:1 - Low Energy UART 0 Prescaler"]
209 #[inline(always)]
210 #[must_use]
211 pub fn leuart0(&mut self) -> LEUART0_W<0> {
212 LEUART0_W::new(self)
213 }
214 #[doc = "Bits 4:5 - Low Energy UART 1 Prescaler"]
215 #[inline(always)]
216 #[must_use]
217 pub fn leuart1(&mut self) -> LEUART1_W<4> {
218 LEUART1_W::new(self)
219 }
220 #[doc = "Writes raw bits to the register."]
221 #[inline(always)]
222 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223 self.0.bits(bits);
224 self
225 }
226}
227#[doc = "Low Frequency B Prescaler Register 0 (Async Reg)\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 [lfbpresc0](index.html) module"]
228pub struct LFBPRESC0_SPEC;
229impl crate::RegisterSpec for LFBPRESC0_SPEC {
230 type Ux = u32;
231}
232#[doc = "`read()` method returns [lfbpresc0::R](R) reader structure"]
233impl crate::Readable for LFBPRESC0_SPEC {
234 type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [lfbpresc0::W](W) writer structure"]
237impl crate::Writable for LFBPRESC0_SPEC {
238 type Writer = W;
239 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
240 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
241}
242#[doc = "`reset()` method sets LFBPRESC0 to value 0"]
243impl crate::Resettable for LFBPRESC0_SPEC {
244 const RESET_VALUE: Self::Ux = 0;
245}