1#[doc = "Register `ADCMPCR` reader"]
2pub struct R(crate::R<ADCMPCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ADCMPCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ADCMPCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ADCMPCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ADCMPCR` writer"]
17pub struct W(crate::W<ADCMPCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ADCMPCR_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<ADCMPCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ADCMPCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CMPAB` reader - Window A/B Composite Conditions SettingNOTE: These bits are valid when both window A and window B are enabled (CMPAE = 1 and CMPBE = 1)."]
38pub type CMPAB_R = crate::FieldReader<u8, CMPAB_A>;
39#[doc = "Window A/B Composite Conditions SettingNOTE: These bits are valid when both window A and window B are enabled (CMPAE = 1 and CMPBE = 1).\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CMPAB_A {
43 #[doc = "0: S12ADWMELC is output when window A comparison conditions are met OR window B comparison conditions are met. S12ADWUMELC is output in other cases."]
44 _00 = 0,
45 #[doc = "1: S12ADWMELC is output when window A comparison conditions are met EXOR window B comparison conditions are met. S12ADWUMELC is output in other cases."]
46 _01 = 1,
47 #[doc = "2: S12ADWMELC is output when window A comparison conditions are met and window B comparison conditions are met. S12ADWUMELC is output in other cases."]
48 _10 = 2,
49 #[doc = "3: Setting prohibited."]
50 _11 = 3,
51}
52impl From<CMPAB_A> for u8 {
53 #[inline(always)]
54 fn from(variant: CMPAB_A) -> Self {
55 variant as _
56 }
57}
58impl CMPAB_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> CMPAB_A {
62 match self.bits {
63 0 => CMPAB_A::_00,
64 1 => CMPAB_A::_01,
65 2 => CMPAB_A::_10,
66 3 => CMPAB_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == CMPAB_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == CMPAB_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == CMPAB_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == CMPAB_A::_11
89 }
90}
91#[doc = "Field `CMPAB` writer - Window A/B Composite Conditions SettingNOTE: These bits are valid when both window A and window B are enabled (CMPAE = 1 and CMPBE = 1)."]
92pub type CMPAB_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u16, ADCMPCR_SPEC, u8, CMPAB_A, 2, O>;
94impl<'a, const O: u8> CMPAB_W<'a, O> {
95 #[doc = "S12ADWMELC is output when window A comparison conditions are met OR window B comparison conditions are met. S12ADWUMELC is output in other cases."]
96 #[inline(always)]
97 pub fn _00(self) -> &'a mut W {
98 self.variant(CMPAB_A::_00)
99 }
100 #[doc = "S12ADWMELC is output when window A comparison conditions are met EXOR window B comparison conditions are met. S12ADWUMELC is output in other cases."]
101 #[inline(always)]
102 pub fn _01(self) -> &'a mut W {
103 self.variant(CMPAB_A::_01)
104 }
105 #[doc = "S12ADWMELC is output when window A comparison conditions are met and window B comparison conditions are met. S12ADWUMELC is output in other cases."]
106 #[inline(always)]
107 pub fn _10(self) -> &'a mut W {
108 self.variant(CMPAB_A::_10)
109 }
110 #[doc = "Setting prohibited."]
111 #[inline(always)]
112 pub fn _11(self) -> &'a mut W {
113 self.variant(CMPAB_A::_11)
114 }
115}
116#[doc = "Field `CMPBE` reader - Compare Window B Operation Enable"]
117pub type CMPBE_R = crate::BitReader<CMPBE_A>;
118#[doc = "Compare Window B Operation Enable\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120pub enum CMPBE_A {
121 #[doc = "0: Compare window B operation is disabled. S12ADWMELC and S12ADWUMELC outputs are disabled."]
122 _0 = 0,
123 #[doc = "1: Compare window B operation is enabled."]
124 _1 = 1,
125}
126impl From<CMPBE_A> for bool {
127 #[inline(always)]
128 fn from(variant: CMPBE_A) -> Self {
129 variant as u8 != 0
130 }
131}
132impl CMPBE_R {
133 #[doc = "Get enumerated values variant"]
134 #[inline(always)]
135 pub fn variant(&self) -> CMPBE_A {
136 match self.bits {
137 false => CMPBE_A::_0,
138 true => CMPBE_A::_1,
139 }
140 }
141 #[doc = "Checks if the value of the field is `_0`"]
142 #[inline(always)]
143 pub fn is_0(&self) -> bool {
144 *self == CMPBE_A::_0
145 }
146 #[doc = "Checks if the value of the field is `_1`"]
147 #[inline(always)]
148 pub fn is_1(&self) -> bool {
149 *self == CMPBE_A::_1
150 }
151}
152#[doc = "Field `CMPBE` writer - Compare Window B Operation Enable"]
153pub type CMPBE_W<'a, const O: u8> = crate::BitWriter<'a, u16, ADCMPCR_SPEC, CMPBE_A, O>;
154impl<'a, const O: u8> CMPBE_W<'a, O> {
155 #[doc = "Compare window B operation is disabled. S12ADWMELC and S12ADWUMELC outputs are disabled."]
156 #[inline(always)]
157 pub fn _0(self) -> &'a mut W {
158 self.variant(CMPBE_A::_0)
159 }
160 #[doc = "Compare window B operation is enabled."]
161 #[inline(always)]
162 pub fn _1(self) -> &'a mut W {
163 self.variant(CMPBE_A::_1)
164 }
165}
166#[doc = "Field `CMPAE` reader - Compare Window A Operation Enable"]
167pub type CMPAE_R = crate::BitReader<CMPAE_A>;
168#[doc = "Compare Window A Operation Enable\n\nValue on reset: 0"]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum CMPAE_A {
171 #[doc = "0: Compare window A operation is disabled. S12ADWMELC and S12ADWUMELC outputs are disabled."]
172 _0 = 0,
173 #[doc = "1: Compare window A operation is enabled."]
174 _1 = 1,
175}
176impl From<CMPAE_A> for bool {
177 #[inline(always)]
178 fn from(variant: CMPAE_A) -> Self {
179 variant as u8 != 0
180 }
181}
182impl CMPAE_R {
183 #[doc = "Get enumerated values variant"]
184 #[inline(always)]
185 pub fn variant(&self) -> CMPAE_A {
186 match self.bits {
187 false => CMPAE_A::_0,
188 true => CMPAE_A::_1,
189 }
190 }
191 #[doc = "Checks if the value of the field is `_0`"]
192 #[inline(always)]
193 pub fn is_0(&self) -> bool {
194 *self == CMPAE_A::_0
195 }
196 #[doc = "Checks if the value of the field is `_1`"]
197 #[inline(always)]
198 pub fn is_1(&self) -> bool {
199 *self == CMPAE_A::_1
200 }
201}
202#[doc = "Field `CMPAE` writer - Compare Window A Operation Enable"]
203pub type CMPAE_W<'a, const O: u8> = crate::BitWriter<'a, u16, ADCMPCR_SPEC, CMPAE_A, O>;
204impl<'a, const O: u8> CMPAE_W<'a, O> {
205 #[doc = "Compare window A operation is disabled. S12ADWMELC and S12ADWUMELC outputs are disabled."]
206 #[inline(always)]
207 pub fn _0(self) -> &'a mut W {
208 self.variant(CMPAE_A::_0)
209 }
210 #[doc = "Compare window A operation is enabled."]
211 #[inline(always)]
212 pub fn _1(self) -> &'a mut W {
213 self.variant(CMPAE_A::_1)
214 }
215}
216#[doc = "Field `CMPBIE` reader - Compare B Interrupt Enable"]
217pub type CMPBIE_R = crate::BitReader<CMPBIE_A>;
218#[doc = "Compare B Interrupt Enable\n\nValue on reset: 0"]
219#[derive(Clone, Copy, Debug, PartialEq, Eq)]
220pub enum CMPBIE_A {
221 #[doc = "0: S12ADCMPBIi interrupt is disabled when comparison conditions (window B) are met."]
222 _0 = 0,
223 #[doc = "1: S12ADCMPBIi interrupt is enabled when comparison conditions (window B) are met."]
224 _1 = 1,
225}
226impl From<CMPBIE_A> for bool {
227 #[inline(always)]
228 fn from(variant: CMPBIE_A) -> Self {
229 variant as u8 != 0
230 }
231}
232impl CMPBIE_R {
233 #[doc = "Get enumerated values variant"]
234 #[inline(always)]
235 pub fn variant(&self) -> CMPBIE_A {
236 match self.bits {
237 false => CMPBIE_A::_0,
238 true => CMPBIE_A::_1,
239 }
240 }
241 #[doc = "Checks if the value of the field is `_0`"]
242 #[inline(always)]
243 pub fn is_0(&self) -> bool {
244 *self == CMPBIE_A::_0
245 }
246 #[doc = "Checks if the value of the field is `_1`"]
247 #[inline(always)]
248 pub fn is_1(&self) -> bool {
249 *self == CMPBIE_A::_1
250 }
251}
252#[doc = "Field `CMPBIE` writer - Compare B Interrupt Enable"]
253pub type CMPBIE_W<'a, const O: u8> = crate::BitWriter<'a, u16, ADCMPCR_SPEC, CMPBIE_A, O>;
254impl<'a, const O: u8> CMPBIE_W<'a, O> {
255 #[doc = "S12ADCMPBIi interrupt is disabled when comparison conditions (window B) are met."]
256 #[inline(always)]
257 pub fn _0(self) -> &'a mut W {
258 self.variant(CMPBIE_A::_0)
259 }
260 #[doc = "S12ADCMPBIi interrupt is enabled when comparison conditions (window B) are met."]
261 #[inline(always)]
262 pub fn _1(self) -> &'a mut W {
263 self.variant(CMPBIE_A::_1)
264 }
265}
266#[doc = "Field `WCMPE` reader - Window Function Setting"]
267pub type WCMPE_R = crate::BitReader<WCMPE_A>;
268#[doc = "Window Function Setting\n\nValue on reset: 0"]
269#[derive(Clone, Copy, Debug, PartialEq, Eq)]
270pub enum WCMPE_A {
271 #[doc = "0: Window function is disabled. Window A and window B operate as a comparator to comparator the single value on the lower side with the A/D conversion result."]
272 _0 = 0,
273 #[doc = "1: Window function is enabled. Window A and window B operate as a comparator to comparator the two values on the upper and lower sides with the A/D conversion result."]
274 _1 = 1,
275}
276impl From<WCMPE_A> for bool {
277 #[inline(always)]
278 fn from(variant: WCMPE_A) -> Self {
279 variant as u8 != 0
280 }
281}
282impl WCMPE_R {
283 #[doc = "Get enumerated values variant"]
284 #[inline(always)]
285 pub fn variant(&self) -> WCMPE_A {
286 match self.bits {
287 false => WCMPE_A::_0,
288 true => WCMPE_A::_1,
289 }
290 }
291 #[doc = "Checks if the value of the field is `_0`"]
292 #[inline(always)]
293 pub fn is_0(&self) -> bool {
294 *self == WCMPE_A::_0
295 }
296 #[doc = "Checks if the value of the field is `_1`"]
297 #[inline(always)]
298 pub fn is_1(&self) -> bool {
299 *self == WCMPE_A::_1
300 }
301}
302#[doc = "Field `WCMPE` writer - Window Function Setting"]
303pub type WCMPE_W<'a, const O: u8> = crate::BitWriter<'a, u16, ADCMPCR_SPEC, WCMPE_A, O>;
304impl<'a, const O: u8> WCMPE_W<'a, O> {
305 #[doc = "Window function is disabled. Window A and window B operate as a comparator to comparator the single value on the lower side with the A/D conversion result."]
306 #[inline(always)]
307 pub fn _0(self) -> &'a mut W {
308 self.variant(WCMPE_A::_0)
309 }
310 #[doc = "Window function is enabled. Window A and window B operate as a comparator to comparator the two values on the upper and lower sides with the A/D conversion result."]
311 #[inline(always)]
312 pub fn _1(self) -> &'a mut W {
313 self.variant(WCMPE_A::_1)
314 }
315}
316#[doc = "Field `CMPAIE` reader - Compare A Interrupt Enable"]
317pub type CMPAIE_R = crate::BitReader<CMPAIE_A>;
318#[doc = "Compare A Interrupt Enable\n\nValue on reset: 0"]
319#[derive(Clone, Copy, Debug, PartialEq, Eq)]
320pub enum CMPAIE_A {
321 #[doc = "0: S12ADCMPAIi interrupt is disabled when comparison conditions (window A) are met."]
322 _0 = 0,
323 #[doc = "1: S12ADCMPAIi interrupt is enabled when comparison conditions (window A) are met."]
324 _1 = 1,
325}
326impl From<CMPAIE_A> for bool {
327 #[inline(always)]
328 fn from(variant: CMPAIE_A) -> Self {
329 variant as u8 != 0
330 }
331}
332impl CMPAIE_R {
333 #[doc = "Get enumerated values variant"]
334 #[inline(always)]
335 pub fn variant(&self) -> CMPAIE_A {
336 match self.bits {
337 false => CMPAIE_A::_0,
338 true => CMPAIE_A::_1,
339 }
340 }
341 #[doc = "Checks if the value of the field is `_0`"]
342 #[inline(always)]
343 pub fn is_0(&self) -> bool {
344 *self == CMPAIE_A::_0
345 }
346 #[doc = "Checks if the value of the field is `_1`"]
347 #[inline(always)]
348 pub fn is_1(&self) -> bool {
349 *self == CMPAIE_A::_1
350 }
351}
352#[doc = "Field `CMPAIE` writer - Compare A Interrupt Enable"]
353pub type CMPAIE_W<'a, const O: u8> = crate::BitWriter<'a, u16, ADCMPCR_SPEC, CMPAIE_A, O>;
354impl<'a, const O: u8> CMPAIE_W<'a, O> {
355 #[doc = "S12ADCMPAIi interrupt is disabled when comparison conditions (window A) are met."]
356 #[inline(always)]
357 pub fn _0(self) -> &'a mut W {
358 self.variant(CMPAIE_A::_0)
359 }
360 #[doc = "S12ADCMPAIi interrupt is enabled when comparison conditions (window A) are met."]
361 #[inline(always)]
362 pub fn _1(self) -> &'a mut W {
363 self.variant(CMPAIE_A::_1)
364 }
365}
366impl R {
367 #[doc = "Bits 0:1 - Window A/B Composite Conditions SettingNOTE: These bits are valid when both window A and window B are enabled (CMPAE = 1 and CMPBE = 1)."]
368 #[inline(always)]
369 pub fn cmpab(&self) -> CMPAB_R {
370 CMPAB_R::new((self.bits & 3) as u8)
371 }
372 #[doc = "Bit 9 - Compare Window B Operation Enable"]
373 #[inline(always)]
374 pub fn cmpbe(&self) -> CMPBE_R {
375 CMPBE_R::new(((self.bits >> 9) & 1) != 0)
376 }
377 #[doc = "Bit 11 - Compare Window A Operation Enable"]
378 #[inline(always)]
379 pub fn cmpae(&self) -> CMPAE_R {
380 CMPAE_R::new(((self.bits >> 11) & 1) != 0)
381 }
382 #[doc = "Bit 13 - Compare B Interrupt Enable"]
383 #[inline(always)]
384 pub fn cmpbie(&self) -> CMPBIE_R {
385 CMPBIE_R::new(((self.bits >> 13) & 1) != 0)
386 }
387 #[doc = "Bit 14 - Window Function Setting"]
388 #[inline(always)]
389 pub fn wcmpe(&self) -> WCMPE_R {
390 WCMPE_R::new(((self.bits >> 14) & 1) != 0)
391 }
392 #[doc = "Bit 15 - Compare A Interrupt Enable"]
393 #[inline(always)]
394 pub fn cmpaie(&self) -> CMPAIE_R {
395 CMPAIE_R::new(((self.bits >> 15) & 1) != 0)
396 }
397}
398impl W {
399 #[doc = "Bits 0:1 - Window A/B Composite Conditions SettingNOTE: These bits are valid when both window A and window B are enabled (CMPAE = 1 and CMPBE = 1)."]
400 #[inline(always)]
401 #[must_use]
402 pub fn cmpab(&mut self) -> CMPAB_W<0> {
403 CMPAB_W::new(self)
404 }
405 #[doc = "Bit 9 - Compare Window B Operation Enable"]
406 #[inline(always)]
407 #[must_use]
408 pub fn cmpbe(&mut self) -> CMPBE_W<9> {
409 CMPBE_W::new(self)
410 }
411 #[doc = "Bit 11 - Compare Window A Operation Enable"]
412 #[inline(always)]
413 #[must_use]
414 pub fn cmpae(&mut self) -> CMPAE_W<11> {
415 CMPAE_W::new(self)
416 }
417 #[doc = "Bit 13 - Compare B Interrupt Enable"]
418 #[inline(always)]
419 #[must_use]
420 pub fn cmpbie(&mut self) -> CMPBIE_W<13> {
421 CMPBIE_W::new(self)
422 }
423 #[doc = "Bit 14 - Window Function Setting"]
424 #[inline(always)]
425 #[must_use]
426 pub fn wcmpe(&mut self) -> WCMPE_W<14> {
427 WCMPE_W::new(self)
428 }
429 #[doc = "Bit 15 - Compare A Interrupt Enable"]
430 #[inline(always)]
431 #[must_use]
432 pub fn cmpaie(&mut self) -> CMPAIE_W<15> {
433 CMPAIE_W::new(self)
434 }
435 #[doc = "Writes raw bits to the register."]
436 #[inline(always)]
437 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
438 self.0.bits(bits);
439 self
440 }
441}
442#[doc = "A/D Compare Function 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 [adcmpcr](index.html) module"]
443pub struct ADCMPCR_SPEC;
444impl crate::RegisterSpec for ADCMPCR_SPEC {
445 type Ux = u16;
446}
447#[doc = "`read()` method returns [adcmpcr::R](R) reader structure"]
448impl crate::Readable for ADCMPCR_SPEC {
449 type Reader = R;
450}
451#[doc = "`write(|w| ..)` method takes [adcmpcr::W](W) writer structure"]
452impl crate::Writable for ADCMPCR_SPEC {
453 type Writer = W;
454 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
455 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
456}
457#[doc = "`reset()` method sets ADCMPCR to value 0"]
458impl crate::Resettable for ADCMPCR_SPEC {
459 const RESET_VALUE: Self::Ux = 0;
460}