ra2l1/adc120/
adcmpbnsr.rs1#[doc = "Register `ADCMPBNSR` reader"]
2pub struct R(crate::R<ADCMPBNSR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ADCMPBNSR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ADCMPBNSR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ADCMPBNSR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ADCMPBNSR` writer"]
17pub struct W(crate::W<ADCMPBNSR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ADCMPBNSR_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<ADCMPBNSR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ADCMPBNSR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CMPCHB` reader - Compare Window B Channel Select"]
38pub type CMPCHB_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `CMPCHB` writer - Compare Window B Channel Select"]
40pub type CMPCHB_W<'a, const O: u8> = crate::FieldWriter<'a, u8, ADCMPBNSR_SPEC, u8, u8, 6, O>;
41#[doc = "Field `CMPLB` reader - Compare Window B Comparison Condition Setting"]
42pub type CMPLB_R = crate::BitReader<CMPLB_A>;
43#[doc = "Compare Window B Comparison Condition Setting\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum CMPLB_A {
46 #[doc = "0: When window function is disabled (ADCMPCR.WCMPE = 0): ADWINLLB value > A/D-converted value When window function is enabled (ADCMPCR.WCMPE = 1): A/D-converted value < ADWINLLB value, or ADWINULB value < A/D-converted value"]
47 _0 = 0,
48 #[doc = "1: When window function is disabled (ADCMPCR.WCMPE = 0): ADWINLLB value < A/D-converted value When window function is enabled (ADCMPCR.WCMPE = 1): ADWINLLB value < A/D-converted value < ADWINULB value"]
49 _1 = 1,
50}
51impl From<CMPLB_A> for bool {
52 #[inline(always)]
53 fn from(variant: CMPLB_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl CMPLB_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> CMPLB_A {
61 match self.bits {
62 false => CMPLB_A::_0,
63 true => CMPLB_A::_1,
64 }
65 }
66 #[doc = "Checks if the value of the field is `_0`"]
67 #[inline(always)]
68 pub fn is_0(&self) -> bool {
69 *self == CMPLB_A::_0
70 }
71 #[doc = "Checks if the value of the field is `_1`"]
72 #[inline(always)]
73 pub fn is_1(&self) -> bool {
74 *self == CMPLB_A::_1
75 }
76}
77#[doc = "Field `CMPLB` writer - Compare Window B Comparison Condition Setting"]
78pub type CMPLB_W<'a, const O: u8> = crate::BitWriter<'a, u8, ADCMPBNSR_SPEC, CMPLB_A, O>;
79impl<'a, const O: u8> CMPLB_W<'a, O> {
80 #[doc = "When window function is disabled (ADCMPCR.WCMPE = 0): ADWINLLB value > A/D-converted value When window function is enabled (ADCMPCR.WCMPE = 1): A/D-converted value < ADWINLLB value, or ADWINULB value < A/D-converted value"]
81 #[inline(always)]
82 pub fn _0(self) -> &'a mut W {
83 self.variant(CMPLB_A::_0)
84 }
85 #[doc = "When window function is disabled (ADCMPCR.WCMPE = 0): ADWINLLB value < A/D-converted value When window function is enabled (ADCMPCR.WCMPE = 1): ADWINLLB value < A/D-converted value < ADWINULB value"]
86 #[inline(always)]
87 pub fn _1(self) -> &'a mut W {
88 self.variant(CMPLB_A::_1)
89 }
90}
91impl R {
92 #[doc = "Bits 0:5 - Compare Window B Channel Select"]
93 #[inline(always)]
94 pub fn cmpchb(&self) -> CMPCHB_R {
95 CMPCHB_R::new(self.bits & 0x3f)
96 }
97 #[doc = "Bit 7 - Compare Window B Comparison Condition Setting"]
98 #[inline(always)]
99 pub fn cmplb(&self) -> CMPLB_R {
100 CMPLB_R::new(((self.bits >> 7) & 1) != 0)
101 }
102}
103impl W {
104 #[doc = "Bits 0:5 - Compare Window B Channel Select"]
105 #[inline(always)]
106 #[must_use]
107 pub fn cmpchb(&mut self) -> CMPCHB_W<0> {
108 CMPCHB_W::new(self)
109 }
110 #[doc = "Bit 7 - Compare Window B Comparison Condition Setting"]
111 #[inline(always)]
112 #[must_use]
113 pub fn cmplb(&mut self) -> CMPLB_W<7> {
114 CMPLB_W::new(self)
115 }
116 #[doc = "Writes raw bits to the register."]
117 #[inline(always)]
118 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
119 self.0.bits(bits);
120 self
121 }
122}
123#[doc = "A/D Compare Function Window B Channel Select 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 [adcmpbnsr](index.html) module"]
124pub struct ADCMPBNSR_SPEC;
125impl crate::RegisterSpec for ADCMPBNSR_SPEC {
126 type Ux = u8;
127}
128#[doc = "`read()` method returns [adcmpbnsr::R](R) reader structure"]
129impl crate::Readable for ADCMPBNSR_SPEC {
130 type Reader = R;
131}
132#[doc = "`write(|w| ..)` method takes [adcmpbnsr::W](W) writer structure"]
133impl crate::Writable for ADCMPBNSR_SPEC {
134 type Writer = W;
135 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
136 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
137}
138#[doc = "`reset()` method sets ADCMPBNSR to value 0"]
139impl crate::Resettable for ADCMPBNSR_SPEC {
140 const RESET_VALUE: Self::Ux = 0;
141}