ra2a1/adc160/
adcmpser.rs

1#[doc = "Register `ADCMPSER` reader"]
2pub struct R(crate::R<ADCMPSER_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADCMPSER_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADCMPSER_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADCMPSER_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ADCMPSER` writer"]
17pub struct W(crate::W<ADCMPSER_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ADCMPSER_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<ADCMPSER_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ADCMPSER_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CMPSTTSA` reader - Compare Window A Temperature Sensor Output Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time.\n\nThe field is **modified** in some way after a read operation."]
38pub type CMPSTTSA_R = crate::BitReader<CMPSTTSA_A>;
39#[doc = "Compare Window A Temperature Sensor Output Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CMPSTTSA_A {
42    #[doc = "0: Comparison conditions are not met."]
43    _0 = 0,
44    #[doc = "1: Comparison conditions are met."]
45    _1 = 1,
46}
47impl From<CMPSTTSA_A> for bool {
48    #[inline(always)]
49    fn from(variant: CMPSTTSA_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CMPSTTSA_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CMPSTTSA_A {
57        match self.bits {
58            false => CMPSTTSA_A::_0,
59            true => CMPSTTSA_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == CMPSTTSA_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == CMPSTTSA_A::_1
71    }
72}
73#[doc = "Field `CMPSTTSA` writer - Compare Window A Temperature Sensor Output Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
74pub type CMPSTTSA_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ADCMPSER_SPEC, CMPSTTSA_A, O>;
75impl<'a, const O: u8> CMPSTTSA_W<'a, O> {
76    #[doc = "Comparison conditions are not met."]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(CMPSTTSA_A::_0)
80    }
81    #[doc = "Comparison conditions are met."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(CMPSTTSA_A::_1)
85    }
86}
87#[doc = "Field `CMPSTOCA` reader - Compare Window A Internal Reference Voltage Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time.\n\nThe field is **modified** in some way after a read operation."]
88pub type CMPSTOCA_R = crate::BitReader<CMPSTOCA_A>;
89#[doc = "Compare Window A Internal Reference Voltage Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time.\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum CMPSTOCA_A {
92    #[doc = "0: Comparison conditions are not met."]
93    _0 = 0,
94    #[doc = "1: Comparison conditions are met."]
95    _1 = 1,
96}
97impl From<CMPSTOCA_A> for bool {
98    #[inline(always)]
99    fn from(variant: CMPSTOCA_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl CMPSTOCA_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> CMPSTOCA_A {
107        match self.bits {
108            false => CMPSTOCA_A::_0,
109            true => CMPSTOCA_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == CMPSTOCA_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == CMPSTOCA_A::_1
121    }
122}
123#[doc = "Field `CMPSTOCA` writer - Compare Window A Internal Reference Voltage Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
124pub type CMPSTOCA_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ADCMPSER_SPEC, CMPSTOCA_A, O>;
125impl<'a, const O: u8> CMPSTOCA_W<'a, O> {
126    #[doc = "Comparison conditions are not met."]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(CMPSTOCA_A::_0)
130    }
131    #[doc = "Comparison conditions are met."]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(CMPSTOCA_A::_1)
135    }
136}
137impl R {
138    #[doc = "Bit 0 - Compare Window A Temperature Sensor Output Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
139    #[inline(always)]
140    pub fn cmpsttsa(&self) -> CMPSTTSA_R {
141        CMPSTTSA_R::new((self.bits & 1) != 0)
142    }
143    #[doc = "Bit 1 - Compare Window A Internal Reference Voltage Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
144    #[inline(always)]
145    pub fn cmpstoca(&self) -> CMPSTOCA_R {
146        CMPSTOCA_R::new(((self.bits >> 1) & 1) != 0)
147    }
148}
149impl W {
150    #[doc = "Bit 0 - Compare Window A Temperature Sensor Output Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
151    #[inline(always)]
152    #[must_use]
153    pub fn cmpsttsa(&mut self) -> CMPSTTSA_W<0> {
154        CMPSTTSA_W::new(self)
155    }
156    #[doc = "Bit 1 - Compare Window A Internal Reference Voltage Compare Flag When window A operation is enabled (ADCMPCR.CMPAE = 1b), this bit indicates the temperature sensor output comparison result. When window A operation is disabled (ADCMPCR.CMPAE = 0b), comparison conditions for CMPSTTSA are not met any time."]
157    #[inline(always)]
158    #[must_use]
159    pub fn cmpstoca(&mut self) -> CMPSTOCA_W<1> {
160        CMPSTOCA_W::new(self)
161    }
162    #[doc = "Writes raw bits to the register."]
163    #[inline(always)]
164    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
165        self.0.bits(bits);
166        self
167    }
168}
169#[doc = "A/D Compare Function Window A Extended Input Channel Status 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 [adcmpser](index.html) module"]
170pub struct ADCMPSER_SPEC;
171impl crate::RegisterSpec for ADCMPSER_SPEC {
172    type Ux = u8;
173}
174#[doc = "`read()` method returns [adcmpser::R](R) reader structure"]
175impl crate::Readable for ADCMPSER_SPEC {
176    type Reader = R;
177}
178#[doc = "`write(|w| ..)` method takes [adcmpser::W](W) writer structure"]
179impl crate::Writable for ADCMPSER_SPEC {
180    type Writer = W;
181    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x03;
182    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
183}
184#[doc = "`reset()` method sets ADCMPSER to value 0"]
185impl crate::Resettable for ADCMPSER_SPEC {
186    const RESET_VALUE: Self::Ux = 0;
187}