1#[doc = "Register `CSR` reader"]
2pub type R = crate::R<CsrSpec>;
3#[doc = "Register `CSR` writer"]
4pub type W = crate::W<CsrSpec>;
5#[doc = "Analog Comparator Flag Rising\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Cfr {
9 #[doc = "0: Not detected"]
10 NotDetected = 0,
11 #[doc = "1: Detected"]
12 Detected = 1,
13}
14impl From<Cfr> for bool {
15 #[inline(always)]
16 fn from(variant: Cfr) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `CFR` reader - Analog Comparator Flag Rising"]
21pub type CfrR = crate::BitReader<Cfr>;
22impl CfrR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Cfr {
26 match self.bits {
27 false => Cfr::NotDetected,
28 true => Cfr::Detected,
29 }
30 }
31 #[doc = "Not detected"]
32 #[inline(always)]
33 pub fn is_not_detected(&self) -> bool {
34 *self == Cfr::NotDetected
35 }
36 #[doc = "Detected"]
37 #[inline(always)]
38 pub fn is_detected(&self) -> bool {
39 *self == Cfr::Detected
40 }
41}
42#[doc = "Field `CFR` writer - Analog Comparator Flag Rising"]
43pub type CfrW<'a, REG> = crate::BitWriter1C<'a, REG, Cfr>;
44impl<'a, REG> CfrW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Not detected"]
49 #[inline(always)]
50 pub fn not_detected(self) -> &'a mut crate::W<REG> {
51 self.variant(Cfr::NotDetected)
52 }
53 #[doc = "Detected"]
54 #[inline(always)]
55 pub fn detected(self) -> &'a mut crate::W<REG> {
56 self.variant(Cfr::Detected)
57 }
58}
59#[doc = "Analog Comparator Flag Falling\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Cff {
63 #[doc = "0: Not detected"]
64 NotDetected = 0,
65 #[doc = "1: Detected"]
66 Detected = 1,
67}
68impl From<Cff> for bool {
69 #[inline(always)]
70 fn from(variant: Cff) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `CFF` reader - Analog Comparator Flag Falling"]
75pub type CffR = crate::BitReader<Cff>;
76impl CffR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Cff {
80 match self.bits {
81 false => Cff::NotDetected,
82 true => Cff::Detected,
83 }
84 }
85 #[doc = "Not detected"]
86 #[inline(always)]
87 pub fn is_not_detected(&self) -> bool {
88 *self == Cff::NotDetected
89 }
90 #[doc = "Detected"]
91 #[inline(always)]
92 pub fn is_detected(&self) -> bool {
93 *self == Cff::Detected
94 }
95}
96#[doc = "Field `CFF` writer - Analog Comparator Flag Falling"]
97pub type CffW<'a, REG> = crate::BitWriter1C<'a, REG, Cff>;
98impl<'a, REG> CffW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Not detected"]
103 #[inline(always)]
104 pub fn not_detected(self) -> &'a mut crate::W<REG> {
105 self.variant(Cff::NotDetected)
106 }
107 #[doc = "Detected"]
108 #[inline(always)]
109 pub fn detected(self) -> &'a mut crate::W<REG> {
110 self.variant(Cff::Detected)
111 }
112}
113#[doc = "Round-Robin Flag\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Rrf {
117 #[doc = "0: Not detected"]
118 NotDetected = 0,
119 #[doc = "1: Detected"]
120 Detected = 1,
121}
122impl From<Rrf> for bool {
123 #[inline(always)]
124 fn from(variant: Rrf) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `RRF` reader - Round-Robin Flag"]
129pub type RrfR = crate::BitReader<Rrf>;
130impl RrfR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Rrf {
134 match self.bits {
135 false => Rrf::NotDetected,
136 true => Rrf::Detected,
137 }
138 }
139 #[doc = "Not detected"]
140 #[inline(always)]
141 pub fn is_not_detected(&self) -> bool {
142 *self == Rrf::NotDetected
143 }
144 #[doc = "Detected"]
145 #[inline(always)]
146 pub fn is_detected(&self) -> bool {
147 *self == Rrf::Detected
148 }
149}
150#[doc = "Field `RRF` writer - Round-Robin Flag"]
151pub type RrfW<'a, REG> = crate::BitWriter1C<'a, REG, Rrf>;
152impl<'a, REG> RrfW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Not detected"]
157 #[inline(always)]
158 pub fn not_detected(self) -> &'a mut crate::W<REG> {
159 self.variant(Rrf::NotDetected)
160 }
161 #[doc = "Detected"]
162 #[inline(always)]
163 pub fn detected(self) -> &'a mut crate::W<REG> {
164 self.variant(Rrf::Detected)
165 }
166}
167#[doc = "Field `COUT` reader - Analog Comparator Output"]
168pub type CoutR = crate::BitReader;
169impl R {
170 #[doc = "Bit 0 - Analog Comparator Flag Rising"]
171 #[inline(always)]
172 pub fn cfr(&self) -> CfrR {
173 CfrR::new((self.bits & 1) != 0)
174 }
175 #[doc = "Bit 1 - Analog Comparator Flag Falling"]
176 #[inline(always)]
177 pub fn cff(&self) -> CffR {
178 CffR::new(((self.bits >> 1) & 1) != 0)
179 }
180 #[doc = "Bit 2 - Round-Robin Flag"]
181 #[inline(always)]
182 pub fn rrf(&self) -> RrfR {
183 RrfR::new(((self.bits >> 2) & 1) != 0)
184 }
185 #[doc = "Bit 8 - Analog Comparator Output"]
186 #[inline(always)]
187 pub fn cout(&self) -> CoutR {
188 CoutR::new(((self.bits >> 8) & 1) != 0)
189 }
190}
191#[cfg(feature = "debug")]
192impl core::fmt::Debug for R {
193 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
194 f.debug_struct("CSR")
195 .field("cfr", &self.cfr())
196 .field("cff", &self.cff())
197 .field("rrf", &self.rrf())
198 .field("cout", &self.cout())
199 .finish()
200 }
201}
202impl W {
203 #[doc = "Bit 0 - Analog Comparator Flag Rising"]
204 #[inline(always)]
205 pub fn cfr(&mut self) -> CfrW<'_, CsrSpec> {
206 CfrW::new(self, 0)
207 }
208 #[doc = "Bit 1 - Analog Comparator Flag Falling"]
209 #[inline(always)]
210 pub fn cff(&mut self) -> CffW<'_, CsrSpec> {
211 CffW::new(self, 1)
212 }
213 #[doc = "Bit 2 - Round-Robin Flag"]
214 #[inline(always)]
215 pub fn rrf(&mut self) -> RrfW<'_, CsrSpec> {
216 RrfW::new(self, 2)
217 }
218}
219#[doc = "Comparator Status\n\nYou can [`read`](crate::Reg::read) this register and get [`csr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`csr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
220pub struct CsrSpec;
221impl crate::RegisterSpec for CsrSpec {
222 type Ux = u32;
223}
224#[doc = "`read()` method returns [`csr::R`](R) reader structure"]
225impl crate::Readable for CsrSpec {}
226#[doc = "`write(|w| ..)` method takes [`csr::W`](W) writer structure"]
227impl crate::Writable for CsrSpec {
228 type Safety = crate::Unsafe;
229 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x07;
230}
231#[doc = "`reset()` method sets CSR to value 0"]
232impl crate::Resettable for CsrSpec {}