efm32gg11b310_pac/acmp1/
hysteresis1.rs1#[doc = "Register `HYSTERESIS1` reader"]
2pub struct R(crate::R<HYSTERESIS1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<HYSTERESIS1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<HYSTERESIS1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<HYSTERESIS1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `HYSTERESIS1` writer"]
17pub struct W(crate::W<HYSTERESIS1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<HYSTERESIS1_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<HYSTERESIS1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<HYSTERESIS1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Hysteresis Select When ACMPOUT=1\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum HYST_A {
41 #[doc = "0: No hysteresis"]
42 HYST0 = 0,
43 #[doc = "1: 14 mV hysteresis"]
44 HYST1 = 1,
45 #[doc = "2: 25 mV hysteresis"]
46 HYST2 = 2,
47 #[doc = "3: 30 mV hysteresis"]
48 HYST3 = 3,
49 #[doc = "4: 35 mV hysteresis"]
50 HYST4 = 4,
51 #[doc = "5: 39 mV hysteresis"]
52 HYST5 = 5,
53 #[doc = "6: 42 mV hysteresis"]
54 HYST6 = 6,
55 #[doc = "7: 45 mV hysteresis"]
56 HYST7 = 7,
57 #[doc = "8: No hysteresis"]
58 HYST8 = 8,
59 #[doc = "9: -14 mV hysteresis"]
60 HYST9 = 9,
61 #[doc = "10: -25 mV hysteresis"]
62 HYST10 = 10,
63 #[doc = "11: -30 mV hysteresis"]
64 HYST11 = 11,
65 #[doc = "12: -35 mV hysteresis"]
66 HYST12 = 12,
67 #[doc = "13: -39 mV hysteresis"]
68 HYST13 = 13,
69 #[doc = "14: -42 mV hysteresis"]
70 HYST14 = 14,
71 #[doc = "15: -45 mV hysteresis"]
72 HYST15 = 15,
73}
74impl From<HYST_A> for u8 {
75 #[inline(always)]
76 fn from(variant: HYST_A) -> Self {
77 variant as _
78 }
79}
80#[doc = "Field `HYST` reader - Hysteresis Select When ACMPOUT=1"]
81pub type HYST_R = crate::FieldReader<u8, HYST_A>;
82impl HYST_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> HYST_A {
86 match self.bits {
87 0 => HYST_A::HYST0,
88 1 => HYST_A::HYST1,
89 2 => HYST_A::HYST2,
90 3 => HYST_A::HYST3,
91 4 => HYST_A::HYST4,
92 5 => HYST_A::HYST5,
93 6 => HYST_A::HYST6,
94 7 => HYST_A::HYST7,
95 8 => HYST_A::HYST8,
96 9 => HYST_A::HYST9,
97 10 => HYST_A::HYST10,
98 11 => HYST_A::HYST11,
99 12 => HYST_A::HYST12,
100 13 => HYST_A::HYST13,
101 14 => HYST_A::HYST14,
102 15 => HYST_A::HYST15,
103 _ => unreachable!(),
104 }
105 }
106 #[doc = "Checks if the value of the field is `HYST0`"]
107 #[inline(always)]
108 pub fn is_hyst0(&self) -> bool {
109 *self == HYST_A::HYST0
110 }
111 #[doc = "Checks if the value of the field is `HYST1`"]
112 #[inline(always)]
113 pub fn is_hyst1(&self) -> bool {
114 *self == HYST_A::HYST1
115 }
116 #[doc = "Checks if the value of the field is `HYST2`"]
117 #[inline(always)]
118 pub fn is_hyst2(&self) -> bool {
119 *self == HYST_A::HYST2
120 }
121 #[doc = "Checks if the value of the field is `HYST3`"]
122 #[inline(always)]
123 pub fn is_hyst3(&self) -> bool {
124 *self == HYST_A::HYST3
125 }
126 #[doc = "Checks if the value of the field is `HYST4`"]
127 #[inline(always)]
128 pub fn is_hyst4(&self) -> bool {
129 *self == HYST_A::HYST4
130 }
131 #[doc = "Checks if the value of the field is `HYST5`"]
132 #[inline(always)]
133 pub fn is_hyst5(&self) -> bool {
134 *self == HYST_A::HYST5
135 }
136 #[doc = "Checks if the value of the field is `HYST6`"]
137 #[inline(always)]
138 pub fn is_hyst6(&self) -> bool {
139 *self == HYST_A::HYST6
140 }
141 #[doc = "Checks if the value of the field is `HYST7`"]
142 #[inline(always)]
143 pub fn is_hyst7(&self) -> bool {
144 *self == HYST_A::HYST7
145 }
146 #[doc = "Checks if the value of the field is `HYST8`"]
147 #[inline(always)]
148 pub fn is_hyst8(&self) -> bool {
149 *self == HYST_A::HYST8
150 }
151 #[doc = "Checks if the value of the field is `HYST9`"]
152 #[inline(always)]
153 pub fn is_hyst9(&self) -> bool {
154 *self == HYST_A::HYST9
155 }
156 #[doc = "Checks if the value of the field is `HYST10`"]
157 #[inline(always)]
158 pub fn is_hyst10(&self) -> bool {
159 *self == HYST_A::HYST10
160 }
161 #[doc = "Checks if the value of the field is `HYST11`"]
162 #[inline(always)]
163 pub fn is_hyst11(&self) -> bool {
164 *self == HYST_A::HYST11
165 }
166 #[doc = "Checks if the value of the field is `HYST12`"]
167 #[inline(always)]
168 pub fn is_hyst12(&self) -> bool {
169 *self == HYST_A::HYST12
170 }
171 #[doc = "Checks if the value of the field is `HYST13`"]
172 #[inline(always)]
173 pub fn is_hyst13(&self) -> bool {
174 *self == HYST_A::HYST13
175 }
176 #[doc = "Checks if the value of the field is `HYST14`"]
177 #[inline(always)]
178 pub fn is_hyst14(&self) -> bool {
179 *self == HYST_A::HYST14
180 }
181 #[doc = "Checks if the value of the field is `HYST15`"]
182 #[inline(always)]
183 pub fn is_hyst15(&self) -> bool {
184 *self == HYST_A::HYST15
185 }
186}
187#[doc = "Field `HYST` writer - Hysteresis Select When ACMPOUT=1"]
188pub type HYST_W<'a> = crate::FieldWriterSafe<'a, u32, HYSTERESIS1_SPEC, u8, HYST_A, 4, 0>;
189impl<'a> HYST_W<'a> {
190 #[doc = "No hysteresis"]
191 #[inline(always)]
192 pub fn hyst0(self) -> &'a mut W {
193 self.variant(HYST_A::HYST0)
194 }
195 #[doc = "14 mV hysteresis"]
196 #[inline(always)]
197 pub fn hyst1(self) -> &'a mut W {
198 self.variant(HYST_A::HYST1)
199 }
200 #[doc = "25 mV hysteresis"]
201 #[inline(always)]
202 pub fn hyst2(self) -> &'a mut W {
203 self.variant(HYST_A::HYST2)
204 }
205 #[doc = "30 mV hysteresis"]
206 #[inline(always)]
207 pub fn hyst3(self) -> &'a mut W {
208 self.variant(HYST_A::HYST3)
209 }
210 #[doc = "35 mV hysteresis"]
211 #[inline(always)]
212 pub fn hyst4(self) -> &'a mut W {
213 self.variant(HYST_A::HYST4)
214 }
215 #[doc = "39 mV hysteresis"]
216 #[inline(always)]
217 pub fn hyst5(self) -> &'a mut W {
218 self.variant(HYST_A::HYST5)
219 }
220 #[doc = "42 mV hysteresis"]
221 #[inline(always)]
222 pub fn hyst6(self) -> &'a mut W {
223 self.variant(HYST_A::HYST6)
224 }
225 #[doc = "45 mV hysteresis"]
226 #[inline(always)]
227 pub fn hyst7(self) -> &'a mut W {
228 self.variant(HYST_A::HYST7)
229 }
230 #[doc = "No hysteresis"]
231 #[inline(always)]
232 pub fn hyst8(self) -> &'a mut W {
233 self.variant(HYST_A::HYST8)
234 }
235 #[doc = "-14 mV hysteresis"]
236 #[inline(always)]
237 pub fn hyst9(self) -> &'a mut W {
238 self.variant(HYST_A::HYST9)
239 }
240 #[doc = "-25 mV hysteresis"]
241 #[inline(always)]
242 pub fn hyst10(self) -> &'a mut W {
243 self.variant(HYST_A::HYST10)
244 }
245 #[doc = "-30 mV hysteresis"]
246 #[inline(always)]
247 pub fn hyst11(self) -> &'a mut W {
248 self.variant(HYST_A::HYST11)
249 }
250 #[doc = "-35 mV hysteresis"]
251 #[inline(always)]
252 pub fn hyst12(self) -> &'a mut W {
253 self.variant(HYST_A::HYST12)
254 }
255 #[doc = "-39 mV hysteresis"]
256 #[inline(always)]
257 pub fn hyst13(self) -> &'a mut W {
258 self.variant(HYST_A::HYST13)
259 }
260 #[doc = "-42 mV hysteresis"]
261 #[inline(always)]
262 pub fn hyst14(self) -> &'a mut W {
263 self.variant(HYST_A::HYST14)
264 }
265 #[doc = "-45 mV hysteresis"]
266 #[inline(always)]
267 pub fn hyst15(self) -> &'a mut W {
268 self.variant(HYST_A::HYST15)
269 }
270}
271#[doc = "Field `DIVVA` reader - Divider for VA Voltage When ACMPOUT=1"]
272pub type DIVVA_R = crate::FieldReader<u8, u8>;
273#[doc = "Field `DIVVA` writer - Divider for VA Voltage When ACMPOUT=1"]
274pub type DIVVA_W<'a> = crate::FieldWriter<'a, u32, HYSTERESIS1_SPEC, u8, u8, 6, 16>;
275#[doc = "Field `DIVVB` reader - Divider for VB Voltage When ACMPOUT=1"]
276pub type DIVVB_R = crate::FieldReader<u8, u8>;
277#[doc = "Field `DIVVB` writer - Divider for VB Voltage When ACMPOUT=1"]
278pub type DIVVB_W<'a> = crate::FieldWriter<'a, u32, HYSTERESIS1_SPEC, u8, u8, 6, 24>;
279impl R {
280 #[doc = "Bits 0:3 - Hysteresis Select When ACMPOUT=1"]
281 #[inline(always)]
282 pub fn hyst(&self) -> HYST_R {
283 HYST_R::new((self.bits & 0x0f) as u8)
284 }
285 #[doc = "Bits 16:21 - Divider for VA Voltage When ACMPOUT=1"]
286 #[inline(always)]
287 pub fn divva(&self) -> DIVVA_R {
288 DIVVA_R::new(((self.bits >> 16) & 0x3f) as u8)
289 }
290 #[doc = "Bits 24:29 - Divider for VB Voltage When ACMPOUT=1"]
291 #[inline(always)]
292 pub fn divvb(&self) -> DIVVB_R {
293 DIVVB_R::new(((self.bits >> 24) & 0x3f) as u8)
294 }
295}
296impl W {
297 #[doc = "Bits 0:3 - Hysteresis Select When ACMPOUT=1"]
298 #[inline(always)]
299 pub fn hyst(&mut self) -> HYST_W {
300 HYST_W::new(self)
301 }
302 #[doc = "Bits 16:21 - Divider for VA Voltage When ACMPOUT=1"]
303 #[inline(always)]
304 pub fn divva(&mut self) -> DIVVA_W {
305 DIVVA_W::new(self)
306 }
307 #[doc = "Bits 24:29 - Divider for VB Voltage When ACMPOUT=1"]
308 #[inline(always)]
309 pub fn divvb(&mut self) -> DIVVB_W {
310 DIVVB_W::new(self)
311 }
312 #[doc = "Writes raw bits to the register."]
313 #[inline(always)]
314 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
315 self.0.bits(bits);
316 self
317 }
318}
319#[doc = "Hysteresis 1 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 [hysteresis1](index.html) module"]
320pub struct HYSTERESIS1_SPEC;
321impl crate::RegisterSpec for HYSTERESIS1_SPEC {
322 type Ux = u32;
323}
324#[doc = "`read()` method returns [hysteresis1::R](R) reader structure"]
325impl crate::Readable for HYSTERESIS1_SPEC {
326 type Reader = R;
327}
328#[doc = "`write(|w| ..)` method takes [hysteresis1::W](W) writer structure"]
329impl crate::Writable for HYSTERESIS1_SPEC {
330 type Writer = W;
331}
332#[doc = "`reset()` method sets HYSTERESIS1 to value 0"]
333impl crate::Resettable for HYSTERESIS1_SPEC {
334 #[inline(always)]
335 fn reset_value() -> Self::Ux {
336 0
337 }
338}