1#[doc = "Register `CTSUST` reader"]
2pub struct R(crate::R<CTSUST_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTSUST_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTSUST_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTSUST_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTSUST` writer"]
17pub struct W(crate::W<CTSUST_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTSUST_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<CTSUST_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTSUST_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CTSUSTC` reader - CTSU Measurement Status Counter"]
38pub type CTSUSTC_R = crate::FieldReader<u8, CTSUSTC_A>;
39#[doc = "CTSU Measurement Status Counter\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CTSUSTC_A {
43 #[doc = "0: Status 0"]
44 _000 = 0,
45 #[doc = "1: Status 1"]
46 _001 = 1,
47 #[doc = "2: Status 2"]
48 _010 = 2,
49 #[doc = "3: Status 3"]
50 _011 = 3,
51 #[doc = "4: Status 4"]
52 _100 = 4,
53 #[doc = "5: Status 5"]
54 _101 = 5,
55}
56impl From<CTSUSTC_A> for u8 {
57 #[inline(always)]
58 fn from(variant: CTSUSTC_A) -> Self {
59 variant as _
60 }
61}
62impl CTSUSTC_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> Option<CTSUSTC_A> {
66 match self.bits {
67 0 => Some(CTSUSTC_A::_000),
68 1 => Some(CTSUSTC_A::_001),
69 2 => Some(CTSUSTC_A::_010),
70 3 => Some(CTSUSTC_A::_011),
71 4 => Some(CTSUSTC_A::_100),
72 5 => Some(CTSUSTC_A::_101),
73 _ => None,
74 }
75 }
76 #[doc = "Checks if the value of the field is `_000`"]
77 #[inline(always)]
78 pub fn is_000(&self) -> bool {
79 *self == CTSUSTC_A::_000
80 }
81 #[doc = "Checks if the value of the field is `_001`"]
82 #[inline(always)]
83 pub fn is_001(&self) -> bool {
84 *self == CTSUSTC_A::_001
85 }
86 #[doc = "Checks if the value of the field is `_010`"]
87 #[inline(always)]
88 pub fn is_010(&self) -> bool {
89 *self == CTSUSTC_A::_010
90 }
91 #[doc = "Checks if the value of the field is `_011`"]
92 #[inline(always)]
93 pub fn is_011(&self) -> bool {
94 *self == CTSUSTC_A::_011
95 }
96 #[doc = "Checks if the value of the field is `_100`"]
97 #[inline(always)]
98 pub fn is_100(&self) -> bool {
99 *self == CTSUSTC_A::_100
100 }
101 #[doc = "Checks if the value of the field is `_101`"]
102 #[inline(always)]
103 pub fn is_101(&self) -> bool {
104 *self == CTSUSTC_A::_101
105 }
106}
107#[doc = "Field `CTSUDTSR` reader - CTSU Data Transfer Status Flag"]
108pub type CTSUDTSR_R = crate::BitReader<CTSUDTSR_A>;
109#[doc = "CTSU Data Transfer Status Flag\n\nValue on reset: 0"]
110#[derive(Clone, Copy, Debug, PartialEq, Eq)]
111pub enum CTSUDTSR_A {
112 #[doc = "0: Measurement result has been read"]
113 _0 = 0,
114 #[doc = "1: Measurement result has not been read"]
115 _1 = 1,
116}
117impl From<CTSUDTSR_A> for bool {
118 #[inline(always)]
119 fn from(variant: CTSUDTSR_A) -> Self {
120 variant as u8 != 0
121 }
122}
123impl CTSUDTSR_R {
124 #[doc = "Get enumerated values variant"]
125 #[inline(always)]
126 pub fn variant(&self) -> CTSUDTSR_A {
127 match self.bits {
128 false => CTSUDTSR_A::_0,
129 true => CTSUDTSR_A::_1,
130 }
131 }
132 #[doc = "Checks if the value of the field is `_0`"]
133 #[inline(always)]
134 pub fn is_0(&self) -> bool {
135 *self == CTSUDTSR_A::_0
136 }
137 #[doc = "Checks if the value of the field is `_1`"]
138 #[inline(always)]
139 pub fn is_1(&self) -> bool {
140 *self == CTSUDTSR_A::_1
141 }
142}
143#[doc = "Field `CTSUSOVF` reader - CTSU Sensor Counter Overflow Flag"]
144pub type CTSUSOVF_R = crate::BitReader<CTSUSOVF_A>;
145#[doc = "CTSU Sensor Counter Overflow Flag\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147pub enum CTSUSOVF_A {
148 #[doc = "0: No overflow"]
149 _0 = 0,
150 #[doc = "1: An overflow"]
151 _1 = 1,
152}
153impl From<CTSUSOVF_A> for bool {
154 #[inline(always)]
155 fn from(variant: CTSUSOVF_A) -> Self {
156 variant as u8 != 0
157 }
158}
159impl CTSUSOVF_R {
160 #[doc = "Get enumerated values variant"]
161 #[inline(always)]
162 pub fn variant(&self) -> CTSUSOVF_A {
163 match self.bits {
164 false => CTSUSOVF_A::_0,
165 true => CTSUSOVF_A::_1,
166 }
167 }
168 #[doc = "Checks if the value of the field is `_0`"]
169 #[inline(always)]
170 pub fn is_0(&self) -> bool {
171 *self == CTSUSOVF_A::_0
172 }
173 #[doc = "Checks if the value of the field is `_1`"]
174 #[inline(always)]
175 pub fn is_1(&self) -> bool {
176 *self == CTSUSOVF_A::_1
177 }
178}
179#[doc = "Field `CTSUSOVF` writer - CTSU Sensor Counter Overflow Flag"]
180pub type CTSUSOVF_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUST_SPEC, CTSUSOVF_A, O>;
181impl<'a, const O: u8> CTSUSOVF_W<'a, O> {
182 #[doc = "No overflow"]
183 #[inline(always)]
184 pub fn _0(self) -> &'a mut W {
185 self.variant(CTSUSOVF_A::_0)
186 }
187 #[doc = "An overflow"]
188 #[inline(always)]
189 pub fn _1(self) -> &'a mut W {
190 self.variant(CTSUSOVF_A::_1)
191 }
192}
193#[doc = "Field `CTSUROVF` reader - CTSU Reference Counter Overflow Flag"]
194pub type CTSUROVF_R = crate::BitReader<CTSUROVF_A>;
195#[doc = "CTSU Reference Counter Overflow Flag\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq, Eq)]
197pub enum CTSUROVF_A {
198 #[doc = "0: No overflow"]
199 _0 = 0,
200 #[doc = "1: An overflow"]
201 _1 = 1,
202}
203impl From<CTSUROVF_A> for bool {
204 #[inline(always)]
205 fn from(variant: CTSUROVF_A) -> Self {
206 variant as u8 != 0
207 }
208}
209impl CTSUROVF_R {
210 #[doc = "Get enumerated values variant"]
211 #[inline(always)]
212 pub fn variant(&self) -> CTSUROVF_A {
213 match self.bits {
214 false => CTSUROVF_A::_0,
215 true => CTSUROVF_A::_1,
216 }
217 }
218 #[doc = "Checks if the value of the field is `_0`"]
219 #[inline(always)]
220 pub fn is_0(&self) -> bool {
221 *self == CTSUROVF_A::_0
222 }
223 #[doc = "Checks if the value of the field is `_1`"]
224 #[inline(always)]
225 pub fn is_1(&self) -> bool {
226 *self == CTSUROVF_A::_1
227 }
228}
229#[doc = "Field `CTSUROVF` writer - CTSU Reference Counter Overflow Flag"]
230pub type CTSUROVF_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUST_SPEC, CTSUROVF_A, O>;
231impl<'a, const O: u8> CTSUROVF_W<'a, O> {
232 #[doc = "No overflow"]
233 #[inline(always)]
234 pub fn _0(self) -> &'a mut W {
235 self.variant(CTSUROVF_A::_0)
236 }
237 #[doc = "An overflow"]
238 #[inline(always)]
239 pub fn _1(self) -> &'a mut W {
240 self.variant(CTSUROVF_A::_1)
241 }
242}
243#[doc = "Field `CTSUPS` reader - CTSU Mutual Capacitance Status Flag"]
244pub type CTSUPS_R = crate::BitReader<CTSUPS_A>;
245#[doc = "CTSU Mutual Capacitance Status Flag\n\nValue on reset: 0"]
246#[derive(Clone, Copy, Debug, PartialEq, Eq)]
247pub enum CTSUPS_A {
248 #[doc = "0: First measurement"]
249 _0 = 0,
250 #[doc = "1: Second measurement"]
251 _1 = 1,
252}
253impl From<CTSUPS_A> for bool {
254 #[inline(always)]
255 fn from(variant: CTSUPS_A) -> Self {
256 variant as u8 != 0
257 }
258}
259impl CTSUPS_R {
260 #[doc = "Get enumerated values variant"]
261 #[inline(always)]
262 pub fn variant(&self) -> CTSUPS_A {
263 match self.bits {
264 false => CTSUPS_A::_0,
265 true => CTSUPS_A::_1,
266 }
267 }
268 #[doc = "Checks if the value of the field is `_0`"]
269 #[inline(always)]
270 pub fn is_0(&self) -> bool {
271 *self == CTSUPS_A::_0
272 }
273 #[doc = "Checks if the value of the field is `_1`"]
274 #[inline(always)]
275 pub fn is_1(&self) -> bool {
276 *self == CTSUPS_A::_1
277 }
278}
279impl R {
280 #[doc = "Bits 0:2 - CTSU Measurement Status Counter"]
281 #[inline(always)]
282 pub fn ctsustc(&self) -> CTSUSTC_R {
283 CTSUSTC_R::new(self.bits & 7)
284 }
285 #[doc = "Bit 4 - CTSU Data Transfer Status Flag"]
286 #[inline(always)]
287 pub fn ctsudtsr(&self) -> CTSUDTSR_R {
288 CTSUDTSR_R::new(((self.bits >> 4) & 1) != 0)
289 }
290 #[doc = "Bit 5 - CTSU Sensor Counter Overflow Flag"]
291 #[inline(always)]
292 pub fn ctsusovf(&self) -> CTSUSOVF_R {
293 CTSUSOVF_R::new(((self.bits >> 5) & 1) != 0)
294 }
295 #[doc = "Bit 6 - CTSU Reference Counter Overflow Flag"]
296 #[inline(always)]
297 pub fn ctsurovf(&self) -> CTSUROVF_R {
298 CTSUROVF_R::new(((self.bits >> 6) & 1) != 0)
299 }
300 #[doc = "Bit 7 - CTSU Mutual Capacitance Status Flag"]
301 #[inline(always)]
302 pub fn ctsups(&self) -> CTSUPS_R {
303 CTSUPS_R::new(((self.bits >> 7) & 1) != 0)
304 }
305}
306impl W {
307 #[doc = "Bit 5 - CTSU Sensor Counter Overflow Flag"]
308 #[inline(always)]
309 #[must_use]
310 pub fn ctsusovf(&mut self) -> CTSUSOVF_W<5> {
311 CTSUSOVF_W::new(self)
312 }
313 #[doc = "Bit 6 - CTSU Reference Counter Overflow Flag"]
314 #[inline(always)]
315 #[must_use]
316 pub fn ctsurovf(&mut self) -> CTSUROVF_W<6> {
317 CTSUROVF_W::new(self)
318 }
319 #[doc = "Writes raw bits to the register."]
320 #[inline(always)]
321 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
322 self.0.bits(bits);
323 self
324 }
325}
326#[doc = "CTSU 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 [ctsust](index.html) module"]
327pub struct CTSUST_SPEC;
328impl crate::RegisterSpec for CTSUST_SPEC {
329 type Ux = u8;
330}
331#[doc = "`read()` method returns [ctsust::R](R) reader structure"]
332impl crate::Readable for CTSUST_SPEC {
333 type Reader = R;
334}
335#[doc = "`write(|w| ..)` method takes [ctsust::W](W) writer structure"]
336impl crate::Writable for CTSUST_SPEC {
337 type Writer = W;
338 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
339 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
340}
341#[doc = "`reset()` method sets CTSUST to value 0"]
342impl crate::Resettable for CTSUST_SPEC {
343 const RESET_VALUE: Self::Ux = 0;
344}