ra6t2/adc_b/
adcmpmdr1.rs

1#[doc = "Register `ADCMPMDR1` reader"]
2pub struct R(crate::R<ADCMPMDR1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADCMPMDR1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADCMPMDR1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADCMPMDR1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ADCMPMDR1` writer"]
17pub struct W(crate::W<ADCMPMDR1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ADCMPMDR1_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<ADCMPMDR1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ADCMPMDR1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CMPMD4` reader - Compare Match 4 : Match Mode Selection"]
38pub type CMPMD4_R = crate::FieldReader<u8, CMPMD4_A>;
39#[doc = "Compare Match 4 : Match Mode Selection\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CMPMD4_A {
43    #[doc = "0: Generate the match event when high-side level or more"]
44    _00 = 0,
45    #[doc = "1: Generate the match event when low-side level or less"]
46    _01 = 1,
47    #[doc = "2: Generate the match event when high-side level or more, or low-side level or less"]
48    _10 = 2,
49    #[doc = "3: Generate the match event when low-side level or more and high-side level or less"]
50    _11 = 3,
51}
52impl From<CMPMD4_A> for u8 {
53    #[inline(always)]
54    fn from(variant: CMPMD4_A) -> Self {
55        variant as _
56    }
57}
58impl CMPMD4_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> CMPMD4_A {
62        match self.bits {
63            0 => CMPMD4_A::_00,
64            1 => CMPMD4_A::_01,
65            2 => CMPMD4_A::_10,
66            3 => CMPMD4_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 == CMPMD4_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 == CMPMD4_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 == CMPMD4_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 == CMPMD4_A::_11
89    }
90}
91#[doc = "Field `CMPMD4` writer - Compare Match 4 : Match Mode Selection"]
92pub type CMPMD4_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, ADCMPMDR1_SPEC, u8, CMPMD4_A, 2, O>;
94impl<'a, const O: u8> CMPMD4_W<'a, O> {
95    #[doc = "Generate the match event when high-side level or more"]
96    #[inline(always)]
97    pub fn _00(self) -> &'a mut W {
98        self.variant(CMPMD4_A::_00)
99    }
100    #[doc = "Generate the match event when low-side level or less"]
101    #[inline(always)]
102    pub fn _01(self) -> &'a mut W {
103        self.variant(CMPMD4_A::_01)
104    }
105    #[doc = "Generate the match event when high-side level or more, or low-side level or less"]
106    #[inline(always)]
107    pub fn _10(self) -> &'a mut W {
108        self.variant(CMPMD4_A::_10)
109    }
110    #[doc = "Generate the match event when low-side level or more and high-side level or less"]
111    #[inline(always)]
112    pub fn _11(self) -> &'a mut W {
113        self.variant(CMPMD4_A::_11)
114    }
115}
116#[doc = "Field `CMPMD5` reader - Compare Match 5 : Match Mode Selection"]
117pub type CMPMD5_R = crate::FieldReader<u8, CMPMD5_A>;
118#[doc = "Compare Match 5 : Match Mode Selection\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum CMPMD5_A {
122    #[doc = "0: Generate the match event when high-side level or more"]
123    _00 = 0,
124    #[doc = "1: Generate the match event when low-side level or less"]
125    _01 = 1,
126    #[doc = "2: Generate the match event when high-side level or more, or low-side level or less"]
127    _10 = 2,
128    #[doc = "3: Generate the match event when low-side level or more and high-side level or less"]
129    _11 = 3,
130}
131impl From<CMPMD5_A> for u8 {
132    #[inline(always)]
133    fn from(variant: CMPMD5_A) -> Self {
134        variant as _
135    }
136}
137impl CMPMD5_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> CMPMD5_A {
141        match self.bits {
142            0 => CMPMD5_A::_00,
143            1 => CMPMD5_A::_01,
144            2 => CMPMD5_A::_10,
145            3 => CMPMD5_A::_11,
146            _ => unreachable!(),
147        }
148    }
149    #[doc = "Checks if the value of the field is `_00`"]
150    #[inline(always)]
151    pub fn is_00(&self) -> bool {
152        *self == CMPMD5_A::_00
153    }
154    #[doc = "Checks if the value of the field is `_01`"]
155    #[inline(always)]
156    pub fn is_01(&self) -> bool {
157        *self == CMPMD5_A::_01
158    }
159    #[doc = "Checks if the value of the field is `_10`"]
160    #[inline(always)]
161    pub fn is_10(&self) -> bool {
162        *self == CMPMD5_A::_10
163    }
164    #[doc = "Checks if the value of the field is `_11`"]
165    #[inline(always)]
166    pub fn is_11(&self) -> bool {
167        *self == CMPMD5_A::_11
168    }
169}
170#[doc = "Field `CMPMD5` writer - Compare Match 5 : Match Mode Selection"]
171pub type CMPMD5_W<'a, const O: u8> =
172    crate::FieldWriterSafe<'a, u32, ADCMPMDR1_SPEC, u8, CMPMD5_A, 2, O>;
173impl<'a, const O: u8> CMPMD5_W<'a, O> {
174    #[doc = "Generate the match event when high-side level or more"]
175    #[inline(always)]
176    pub fn _00(self) -> &'a mut W {
177        self.variant(CMPMD5_A::_00)
178    }
179    #[doc = "Generate the match event when low-side level or less"]
180    #[inline(always)]
181    pub fn _01(self) -> &'a mut W {
182        self.variant(CMPMD5_A::_01)
183    }
184    #[doc = "Generate the match event when high-side level or more, or low-side level or less"]
185    #[inline(always)]
186    pub fn _10(self) -> &'a mut W {
187        self.variant(CMPMD5_A::_10)
188    }
189    #[doc = "Generate the match event when low-side level or more and high-side level or less"]
190    #[inline(always)]
191    pub fn _11(self) -> &'a mut W {
192        self.variant(CMPMD5_A::_11)
193    }
194}
195#[doc = "Field `CMPMD6` reader - Compare Match 6 : Match Mode Selection"]
196pub type CMPMD6_R = crate::FieldReader<u8, CMPMD6_A>;
197#[doc = "Compare Match 6 : Match Mode Selection\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum CMPMD6_A {
201    #[doc = "0: Generate the match event when high-side level or more"]
202    _00 = 0,
203    #[doc = "1: Generate the match event when low-side level or less"]
204    _01 = 1,
205    #[doc = "2: Generate the match event when high-side level or more, or low-side level or less"]
206    _10 = 2,
207    #[doc = "3: Generate the match event when low-side level or more and high-side level or less"]
208    _11 = 3,
209}
210impl From<CMPMD6_A> for u8 {
211    #[inline(always)]
212    fn from(variant: CMPMD6_A) -> Self {
213        variant as _
214    }
215}
216impl CMPMD6_R {
217    #[doc = "Get enumerated values variant"]
218    #[inline(always)]
219    pub fn variant(&self) -> CMPMD6_A {
220        match self.bits {
221            0 => CMPMD6_A::_00,
222            1 => CMPMD6_A::_01,
223            2 => CMPMD6_A::_10,
224            3 => CMPMD6_A::_11,
225            _ => unreachable!(),
226        }
227    }
228    #[doc = "Checks if the value of the field is `_00`"]
229    #[inline(always)]
230    pub fn is_00(&self) -> bool {
231        *self == CMPMD6_A::_00
232    }
233    #[doc = "Checks if the value of the field is `_01`"]
234    #[inline(always)]
235    pub fn is_01(&self) -> bool {
236        *self == CMPMD6_A::_01
237    }
238    #[doc = "Checks if the value of the field is `_10`"]
239    #[inline(always)]
240    pub fn is_10(&self) -> bool {
241        *self == CMPMD6_A::_10
242    }
243    #[doc = "Checks if the value of the field is `_11`"]
244    #[inline(always)]
245    pub fn is_11(&self) -> bool {
246        *self == CMPMD6_A::_11
247    }
248}
249#[doc = "Field `CMPMD6` writer - Compare Match 6 : Match Mode Selection"]
250pub type CMPMD6_W<'a, const O: u8> =
251    crate::FieldWriterSafe<'a, u32, ADCMPMDR1_SPEC, u8, CMPMD6_A, 2, O>;
252impl<'a, const O: u8> CMPMD6_W<'a, O> {
253    #[doc = "Generate the match event when high-side level or more"]
254    #[inline(always)]
255    pub fn _00(self) -> &'a mut W {
256        self.variant(CMPMD6_A::_00)
257    }
258    #[doc = "Generate the match event when low-side level or less"]
259    #[inline(always)]
260    pub fn _01(self) -> &'a mut W {
261        self.variant(CMPMD6_A::_01)
262    }
263    #[doc = "Generate the match event when high-side level or more, or low-side level or less"]
264    #[inline(always)]
265    pub fn _10(self) -> &'a mut W {
266        self.variant(CMPMD6_A::_10)
267    }
268    #[doc = "Generate the match event when low-side level or more and high-side level or less"]
269    #[inline(always)]
270    pub fn _11(self) -> &'a mut W {
271        self.variant(CMPMD6_A::_11)
272    }
273}
274#[doc = "Field `CMPMD7` reader - Compare Match 7 : Match Mode Selection"]
275pub type CMPMD7_R = crate::FieldReader<u8, CMPMD7_A>;
276#[doc = "Compare Match 7 : Match Mode Selection\n\nValue on reset: 0"]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278#[repr(u8)]
279pub enum CMPMD7_A {
280    #[doc = "0: Generate the match event when high-side level or more"]
281    _00 = 0,
282    #[doc = "1: Generate the match event when low-side level or less"]
283    _01 = 1,
284    #[doc = "2: Generate the match event when high-side level or more, or low-side level or less"]
285    _10 = 2,
286    #[doc = "3: Generate the match event when low-side level or more and high-side level or less"]
287    _11 = 3,
288}
289impl From<CMPMD7_A> for u8 {
290    #[inline(always)]
291    fn from(variant: CMPMD7_A) -> Self {
292        variant as _
293    }
294}
295impl CMPMD7_R {
296    #[doc = "Get enumerated values variant"]
297    #[inline(always)]
298    pub fn variant(&self) -> CMPMD7_A {
299        match self.bits {
300            0 => CMPMD7_A::_00,
301            1 => CMPMD7_A::_01,
302            2 => CMPMD7_A::_10,
303            3 => CMPMD7_A::_11,
304            _ => unreachable!(),
305        }
306    }
307    #[doc = "Checks if the value of the field is `_00`"]
308    #[inline(always)]
309    pub fn is_00(&self) -> bool {
310        *self == CMPMD7_A::_00
311    }
312    #[doc = "Checks if the value of the field is `_01`"]
313    #[inline(always)]
314    pub fn is_01(&self) -> bool {
315        *self == CMPMD7_A::_01
316    }
317    #[doc = "Checks if the value of the field is `_10`"]
318    #[inline(always)]
319    pub fn is_10(&self) -> bool {
320        *self == CMPMD7_A::_10
321    }
322    #[doc = "Checks if the value of the field is `_11`"]
323    #[inline(always)]
324    pub fn is_11(&self) -> bool {
325        *self == CMPMD7_A::_11
326    }
327}
328#[doc = "Field `CMPMD7` writer - Compare Match 7 : Match Mode Selection"]
329pub type CMPMD7_W<'a, const O: u8> =
330    crate::FieldWriterSafe<'a, u32, ADCMPMDR1_SPEC, u8, CMPMD7_A, 2, O>;
331impl<'a, const O: u8> CMPMD7_W<'a, O> {
332    #[doc = "Generate the match event when high-side level or more"]
333    #[inline(always)]
334    pub fn _00(self) -> &'a mut W {
335        self.variant(CMPMD7_A::_00)
336    }
337    #[doc = "Generate the match event when low-side level or less"]
338    #[inline(always)]
339    pub fn _01(self) -> &'a mut W {
340        self.variant(CMPMD7_A::_01)
341    }
342    #[doc = "Generate the match event when high-side level or more, or low-side level or less"]
343    #[inline(always)]
344    pub fn _10(self) -> &'a mut W {
345        self.variant(CMPMD7_A::_10)
346    }
347    #[doc = "Generate the match event when low-side level or more and high-side level or less"]
348    #[inline(always)]
349    pub fn _11(self) -> &'a mut W {
350        self.variant(CMPMD7_A::_11)
351    }
352}
353impl R {
354    #[doc = "Bits 0:1 - Compare Match 4 : Match Mode Selection"]
355    #[inline(always)]
356    pub fn cmpmd4(&self) -> CMPMD4_R {
357        CMPMD4_R::new((self.bits & 3) as u8)
358    }
359    #[doc = "Bits 8:9 - Compare Match 5 : Match Mode Selection"]
360    #[inline(always)]
361    pub fn cmpmd5(&self) -> CMPMD5_R {
362        CMPMD5_R::new(((self.bits >> 8) & 3) as u8)
363    }
364    #[doc = "Bits 16:17 - Compare Match 6 : Match Mode Selection"]
365    #[inline(always)]
366    pub fn cmpmd6(&self) -> CMPMD6_R {
367        CMPMD6_R::new(((self.bits >> 16) & 3) as u8)
368    }
369    #[doc = "Bits 24:25 - Compare Match 7 : Match Mode Selection"]
370    #[inline(always)]
371    pub fn cmpmd7(&self) -> CMPMD7_R {
372        CMPMD7_R::new(((self.bits >> 24) & 3) as u8)
373    }
374}
375impl W {
376    #[doc = "Bits 0:1 - Compare Match 4 : Match Mode Selection"]
377    #[inline(always)]
378    #[must_use]
379    pub fn cmpmd4(&mut self) -> CMPMD4_W<0> {
380        CMPMD4_W::new(self)
381    }
382    #[doc = "Bits 8:9 - Compare Match 5 : Match Mode Selection"]
383    #[inline(always)]
384    #[must_use]
385    pub fn cmpmd5(&mut self) -> CMPMD5_W<8> {
386        CMPMD5_W::new(self)
387    }
388    #[doc = "Bits 16:17 - Compare Match 6 : Match Mode Selection"]
389    #[inline(always)]
390    #[must_use]
391    pub fn cmpmd6(&mut self) -> CMPMD6_W<16> {
392        CMPMD6_W::new(self)
393    }
394    #[doc = "Bits 24:25 - Compare Match 7 : Match Mode Selection"]
395    #[inline(always)]
396    #[must_use]
397    pub fn cmpmd7(&mut self) -> CMPMD7_W<24> {
398        CMPMD7_W::new(self)
399    }
400    #[doc = "Writes raw bits to the register."]
401    #[inline(always)]
402    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
403        self.0.bits(bits);
404        self
405    }
406}
407#[doc = "Compare Match Mode Selection Register 1\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 [adcmpmdr1](index.html) module"]
408pub struct ADCMPMDR1_SPEC;
409impl crate::RegisterSpec for ADCMPMDR1_SPEC {
410    type Ux = u32;
411}
412#[doc = "`read()` method returns [adcmpmdr1::R](R) reader structure"]
413impl crate::Readable for ADCMPMDR1_SPEC {
414    type Reader = R;
415}
416#[doc = "`write(|w| ..)` method takes [adcmpmdr1::W](W) writer structure"]
417impl crate::Writable for ADCMPMDR1_SPEC {
418    type Writer = W;
419    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
420    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
421}
422#[doc = "`reset()` method sets ADCMPMDR1 to value 0"]
423impl crate::Resettable for ADCMPMDR1_SPEC {
424    const RESET_VALUE: Self::Ux = 0;
425}