1#[doc = "Register `CTSUCRB` reader"]
2pub struct R(crate::R<CTSUCRB_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTSUCRB_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTSUCRB_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTSUCRB_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTSUCRB` writer"]
17pub struct W(crate::W<CTSUCRB_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTSUCRB_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<CTSUCRB_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTSUCRB_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PRRATIO` reader - Frequency of Drive Pulse Phase Control"]
38pub type PRRATIO_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `PRRATIO` writer - Frequency of Drive Pulse Phase Control"]
40pub type PRRATIO_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTSUCRB_SPEC, u8, u8, 4, O>;
41#[doc = "Field `PRMODE` reader - Phase Control Period"]
42pub type PRMODE_R = crate::FieldReader<u8, PRMODE_A>;
43#[doc = "Phase Control Period\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum PRMODE_A {
47 #[doc = "0: 510 pulses (512 pulses when PROFF = 1)"]
48 _00 = 0,
49 #[doc = "1: 126 pulses (128 pulses when PROFF = 1)"]
50 _01 = 1,
51 #[doc = "2: 62 pulses (64 pulses when PROFF = 1)"]
52 _10 = 2,
53 #[doc = "3: Setting prohibited"]
54 _11 = 3,
55}
56impl From<PRMODE_A> for u8 {
57 #[inline(always)]
58 fn from(variant: PRMODE_A) -> Self {
59 variant as _
60 }
61}
62impl PRMODE_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> PRMODE_A {
66 match self.bits {
67 0 => PRMODE_A::_00,
68 1 => PRMODE_A::_01,
69 2 => PRMODE_A::_10,
70 3 => PRMODE_A::_11,
71 _ => unreachable!(),
72 }
73 }
74 #[doc = "Checks if the value of the field is `_00`"]
75 #[inline(always)]
76 pub fn is_00(&self) -> bool {
77 *self == PRMODE_A::_00
78 }
79 #[doc = "Checks if the value of the field is `_01`"]
80 #[inline(always)]
81 pub fn is_01(&self) -> bool {
82 *self == PRMODE_A::_01
83 }
84 #[doc = "Checks if the value of the field is `_10`"]
85 #[inline(always)]
86 pub fn is_10(&self) -> bool {
87 *self == PRMODE_A::_10
88 }
89 #[doc = "Checks if the value of the field is `_11`"]
90 #[inline(always)]
91 pub fn is_11(&self) -> bool {
92 *self == PRMODE_A::_11
93 }
94}
95#[doc = "Field `PRMODE` writer - Phase Control Period"]
96pub type PRMODE_W<'a, const O: u8> =
97 crate::FieldWriterSafe<'a, u32, CTSUCRB_SPEC, u8, PRMODE_A, 2, O>;
98impl<'a, const O: u8> PRMODE_W<'a, O> {
99 #[doc = "510 pulses (512 pulses when PROFF = 1)"]
100 #[inline(always)]
101 pub fn _00(self) -> &'a mut W {
102 self.variant(PRMODE_A::_00)
103 }
104 #[doc = "126 pulses (128 pulses when PROFF = 1)"]
105 #[inline(always)]
106 pub fn _01(self) -> &'a mut W {
107 self.variant(PRMODE_A::_01)
108 }
109 #[doc = "62 pulses (64 pulses when PROFF = 1)"]
110 #[inline(always)]
111 pub fn _10(self) -> &'a mut W {
112 self.variant(PRMODE_A::_10)
113 }
114 #[doc = "Setting prohibited"]
115 #[inline(always)]
116 pub fn _11(self) -> &'a mut W {
117 self.variant(PRMODE_A::_11)
118 }
119}
120#[doc = "Field `SOFF` reader - High-Pass Noise Reduction Function Disable"]
121pub type SOFF_R = crate::BitReader<SOFF_A>;
122#[doc = "High-Pass Noise Reduction Function Disable\n\nValue on reset: 0"]
123#[derive(Clone, Copy, Debug, PartialEq, Eq)]
124pub enum SOFF_A {
125 #[doc = "0: Turn the spread spectrum on"]
126 _0 = 0,
127 #[doc = "1: Turn the spread spectrum off"]
128 _1 = 1,
129}
130impl From<SOFF_A> for bool {
131 #[inline(always)]
132 fn from(variant: SOFF_A) -> Self {
133 variant as u8 != 0
134 }
135}
136impl SOFF_R {
137 #[doc = "Get enumerated values variant"]
138 #[inline(always)]
139 pub fn variant(&self) -> SOFF_A {
140 match self.bits {
141 false => SOFF_A::_0,
142 true => SOFF_A::_1,
143 }
144 }
145 #[doc = "Checks if the value of the field is `_0`"]
146 #[inline(always)]
147 pub fn is_0(&self) -> bool {
148 *self == SOFF_A::_0
149 }
150 #[doc = "Checks if the value of the field is `_1`"]
151 #[inline(always)]
152 pub fn is_1(&self) -> bool {
153 *self == SOFF_A::_1
154 }
155}
156#[doc = "Field `SOFF` writer - High-Pass Noise Reduction Function Disable"]
157pub type SOFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTSUCRB_SPEC, SOFF_A, O>;
158impl<'a, const O: u8> SOFF_W<'a, O> {
159 #[doc = "Turn the spread spectrum on"]
160 #[inline(always)]
161 pub fn _0(self) -> &'a mut W {
162 self.variant(SOFF_A::_0)
163 }
164 #[doc = "Turn the spread spectrum off"]
165 #[inline(always)]
166 pub fn _1(self) -> &'a mut W {
167 self.variant(SOFF_A::_1)
168 }
169}
170#[doc = "Field `PROFF` reader - Drive Pulse Phase Control"]
171pub type PROFF_R = crate::BitReader<PROFF_A>;
172#[doc = "Drive Pulse Phase Control\n\nValue on reset: 0"]
173#[derive(Clone, Copy, Debug, PartialEq, Eq)]
174pub enum PROFF_A {
175 #[doc = "0: The drive pulse phase is controlled by random numbers."]
176 _0 = 0,
177 #[doc = "1: The drive pulse phase is not controlled by random numbers."]
178 _1 = 1,
179}
180impl From<PROFF_A> for bool {
181 #[inline(always)]
182 fn from(variant: PROFF_A) -> Self {
183 variant as u8 != 0
184 }
185}
186impl PROFF_R {
187 #[doc = "Get enumerated values variant"]
188 #[inline(always)]
189 pub fn variant(&self) -> PROFF_A {
190 match self.bits {
191 false => PROFF_A::_0,
192 true => PROFF_A::_1,
193 }
194 }
195 #[doc = "Checks if the value of the field is `_0`"]
196 #[inline(always)]
197 pub fn is_0(&self) -> bool {
198 *self == PROFF_A::_0
199 }
200 #[doc = "Checks if the value of the field is `_1`"]
201 #[inline(always)]
202 pub fn is_1(&self) -> bool {
203 *self == PROFF_A::_1
204 }
205}
206#[doc = "Field `PROFF` writer - Drive Pulse Phase Control"]
207pub type PROFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTSUCRB_SPEC, PROFF_A, O>;
208impl<'a, const O: u8> PROFF_W<'a, O> {
209 #[doc = "The drive pulse phase is controlled by random numbers."]
210 #[inline(always)]
211 pub fn _0(self) -> &'a mut W {
212 self.variant(PROFF_A::_0)
213 }
214 #[doc = "The drive pulse phase is not controlled by random numbers."]
215 #[inline(always)]
216 pub fn _1(self) -> &'a mut W {
217 self.variant(PROFF_A::_1)
218 }
219}
220#[doc = "Field `SST` reader - Wait Time Sensor Stabilization"]
221pub type SST_R = crate::FieldReader<u8, u8>;
222#[doc = "Field `SST` writer - Wait Time Sensor Stabilization"]
223pub type SST_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTSUCRB_SPEC, u8, u8, 8, O>;
224#[doc = "Field `SSMOD` reader - Spread Spectrum Modulation Frequency"]
225pub type SSMOD_R = crate::FieldReader<u8, SSMOD_A>;
226#[doc = "Spread Spectrum Modulation Frequency\n\nValue on reset: 0"]
227#[derive(Clone, Copy, Debug, PartialEq, Eq)]
228#[repr(u8)]
229pub enum SSMOD_A {
230 #[doc = "0: 125 kHz (recommended)"]
231 _000 = 0,
232 #[doc = "1: 83.3 kHz"]
233 _001 = 1,
234 #[doc = "2: 62.5 kHz"]
235 _010 = 2,
236 #[doc = "3: 31.3 kHz"]
237 _011 = 3,
238}
239impl From<SSMOD_A> for u8 {
240 #[inline(always)]
241 fn from(variant: SSMOD_A) -> Self {
242 variant as _
243 }
244}
245impl SSMOD_R {
246 #[doc = "Get enumerated values variant"]
247 #[inline(always)]
248 pub fn variant(&self) -> Option<SSMOD_A> {
249 match self.bits {
250 0 => Some(SSMOD_A::_000),
251 1 => Some(SSMOD_A::_001),
252 2 => Some(SSMOD_A::_010),
253 3 => Some(SSMOD_A::_011),
254 _ => None,
255 }
256 }
257 #[doc = "Checks if the value of the field is `_000`"]
258 #[inline(always)]
259 pub fn is_000(&self) -> bool {
260 *self == SSMOD_A::_000
261 }
262 #[doc = "Checks if the value of the field is `_001`"]
263 #[inline(always)]
264 pub fn is_001(&self) -> bool {
265 *self == SSMOD_A::_001
266 }
267 #[doc = "Checks if the value of the field is `_010`"]
268 #[inline(always)]
269 pub fn is_010(&self) -> bool {
270 *self == SSMOD_A::_010
271 }
272 #[doc = "Checks if the value of the field is `_011`"]
273 #[inline(always)]
274 pub fn is_011(&self) -> bool {
275 *self == SSMOD_A::_011
276 }
277}
278#[doc = "Field `SSMOD` writer - Spread Spectrum Modulation Frequency"]
279pub type SSMOD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTSUCRB_SPEC, u8, SSMOD_A, 3, O>;
280impl<'a, const O: u8> SSMOD_W<'a, O> {
281 #[doc = "125 kHz (recommended)"]
282 #[inline(always)]
283 pub fn _000(self) -> &'a mut W {
284 self.variant(SSMOD_A::_000)
285 }
286 #[doc = "83.3 kHz"]
287 #[inline(always)]
288 pub fn _001(self) -> &'a mut W {
289 self.variant(SSMOD_A::_001)
290 }
291 #[doc = "62.5 kHz"]
292 #[inline(always)]
293 pub fn _010(self) -> &'a mut W {
294 self.variant(SSMOD_A::_010)
295 }
296 #[doc = "31.3 kHz"]
297 #[inline(always)]
298 pub fn _011(self) -> &'a mut W {
299 self.variant(SSMOD_A::_011)
300 }
301}
302#[doc = "Field `SSCNT` reader - Adjusting the SUCLK frequency"]
303pub type SSCNT_R = crate::FieldReader<u8, SSCNT_A>;
304#[doc = "Adjusting the SUCLK frequency\n\nValue on reset: 0"]
305#[derive(Clone, Copy, Debug, PartialEq, Eq)]
306#[repr(u8)]
307pub enum SSCNT_A {
308 #[doc = "0: CTSUTRIMA.SUADJD + 0x00 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x00 (SDPSEL = 1)"]
309 _00 = 0,
310 #[doc = "1: CTSUTRIMA.SUADJD + 0x10 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x20 (SDPSEL = 1)"]
311 _01 = 1,
312 #[doc = "2: CTSUTRIMA.SUADJD + 0x20 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x40 (SDPSEL = 1)"]
313 _10 = 2,
314 #[doc = "3: CTSUTRIMA.SUADJD + 0x30 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x40 (SDPSEL = 1)"]
315 _11 = 3,
316}
317impl From<SSCNT_A> for u8 {
318 #[inline(always)]
319 fn from(variant: SSCNT_A) -> Self {
320 variant as _
321 }
322}
323impl SSCNT_R {
324 #[doc = "Get enumerated values variant"]
325 #[inline(always)]
326 pub fn variant(&self) -> SSCNT_A {
327 match self.bits {
328 0 => SSCNT_A::_00,
329 1 => SSCNT_A::_01,
330 2 => SSCNT_A::_10,
331 3 => SSCNT_A::_11,
332 _ => unreachable!(),
333 }
334 }
335 #[doc = "Checks if the value of the field is `_00`"]
336 #[inline(always)]
337 pub fn is_00(&self) -> bool {
338 *self == SSCNT_A::_00
339 }
340 #[doc = "Checks if the value of the field is `_01`"]
341 #[inline(always)]
342 pub fn is_01(&self) -> bool {
343 *self == SSCNT_A::_01
344 }
345 #[doc = "Checks if the value of the field is `_10`"]
346 #[inline(always)]
347 pub fn is_10(&self) -> bool {
348 *self == SSCNT_A::_10
349 }
350 #[doc = "Checks if the value of the field is `_11`"]
351 #[inline(always)]
352 pub fn is_11(&self) -> bool {
353 *self == SSCNT_A::_11
354 }
355}
356#[doc = "Field `SSCNT` writer - Adjusting the SUCLK frequency"]
357pub type SSCNT_W<'a, const O: u8> =
358 crate::FieldWriterSafe<'a, u32, CTSUCRB_SPEC, u8, SSCNT_A, 2, O>;
359impl<'a, const O: u8> SSCNT_W<'a, O> {
360 #[doc = "CTSUTRIMA.SUADJD + 0x00 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x00 (SDPSEL = 1)"]
361 #[inline(always)]
362 pub fn _00(self) -> &'a mut W {
363 self.variant(SSCNT_A::_00)
364 }
365 #[doc = "CTSUTRIMA.SUADJD + 0x10 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x20 (SDPSEL = 1)"]
366 #[inline(always)]
367 pub fn _01(self) -> &'a mut W {
368 self.variant(SSCNT_A::_01)
369 }
370 #[doc = "CTSUTRIMA.SUADJD + 0x20 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x40 (SDPSEL = 1)"]
371 #[inline(always)]
372 pub fn _10(self) -> &'a mut W {
373 self.variant(SSCNT_A::_10)
374 }
375 #[doc = "CTSUTRIMA.SUADJD + 0x30 (SDPSEL = 0) CTSUSUCLKx.SUADJDn + 0x40 (SDPSEL = 1)"]
376 #[inline(always)]
377 pub fn _11(self) -> &'a mut W {
378 self.variant(SSCNT_A::_11)
379 }
380}
381impl R {
382 #[doc = "Bits 0:3 - Frequency of Drive Pulse Phase Control"]
383 #[inline(always)]
384 pub fn prratio(&self) -> PRRATIO_R {
385 PRRATIO_R::new((self.bits & 0x0f) as u8)
386 }
387 #[doc = "Bits 4:5 - Phase Control Period"]
388 #[inline(always)]
389 pub fn prmode(&self) -> PRMODE_R {
390 PRMODE_R::new(((self.bits >> 4) & 3) as u8)
391 }
392 #[doc = "Bit 6 - High-Pass Noise Reduction Function Disable"]
393 #[inline(always)]
394 pub fn soff(&self) -> SOFF_R {
395 SOFF_R::new(((self.bits >> 6) & 1) != 0)
396 }
397 #[doc = "Bit 7 - Drive Pulse Phase Control"]
398 #[inline(always)]
399 pub fn proff(&self) -> PROFF_R {
400 PROFF_R::new(((self.bits >> 7) & 1) != 0)
401 }
402 #[doc = "Bits 8:15 - Wait Time Sensor Stabilization"]
403 #[inline(always)]
404 pub fn sst(&self) -> SST_R {
405 SST_R::new(((self.bits >> 8) & 0xff) as u8)
406 }
407 #[doc = "Bits 24:26 - Spread Spectrum Modulation Frequency"]
408 #[inline(always)]
409 pub fn ssmod(&self) -> SSMOD_R {
410 SSMOD_R::new(((self.bits >> 24) & 7) as u8)
411 }
412 #[doc = "Bits 28:29 - Adjusting the SUCLK frequency"]
413 #[inline(always)]
414 pub fn sscnt(&self) -> SSCNT_R {
415 SSCNT_R::new(((self.bits >> 28) & 3) as u8)
416 }
417}
418impl W {
419 #[doc = "Bits 0:3 - Frequency of Drive Pulse Phase Control"]
420 #[inline(always)]
421 #[must_use]
422 pub fn prratio(&mut self) -> PRRATIO_W<0> {
423 PRRATIO_W::new(self)
424 }
425 #[doc = "Bits 4:5 - Phase Control Period"]
426 #[inline(always)]
427 #[must_use]
428 pub fn prmode(&mut self) -> PRMODE_W<4> {
429 PRMODE_W::new(self)
430 }
431 #[doc = "Bit 6 - High-Pass Noise Reduction Function Disable"]
432 #[inline(always)]
433 #[must_use]
434 pub fn soff(&mut self) -> SOFF_W<6> {
435 SOFF_W::new(self)
436 }
437 #[doc = "Bit 7 - Drive Pulse Phase Control"]
438 #[inline(always)]
439 #[must_use]
440 pub fn proff(&mut self) -> PROFF_W<7> {
441 PROFF_W::new(self)
442 }
443 #[doc = "Bits 8:15 - Wait Time Sensor Stabilization"]
444 #[inline(always)]
445 #[must_use]
446 pub fn sst(&mut self) -> SST_W<8> {
447 SST_W::new(self)
448 }
449 #[doc = "Bits 24:26 - Spread Spectrum Modulation Frequency"]
450 #[inline(always)]
451 #[must_use]
452 pub fn ssmod(&mut self) -> SSMOD_W<24> {
453 SSMOD_W::new(self)
454 }
455 #[doc = "Bits 28:29 - Adjusting the SUCLK frequency"]
456 #[inline(always)]
457 #[must_use]
458 pub fn sscnt(&mut self) -> SSCNT_W<28> {
459 SSCNT_W::new(self)
460 }
461 #[doc = "Writes raw bits to the register."]
462 #[inline(always)]
463 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
464 self.0.bits(bits);
465 self
466 }
467}
468#[doc = "CTSU Control Register B\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 [ctsucrb](index.html) module"]
469pub struct CTSUCRB_SPEC;
470impl crate::RegisterSpec for CTSUCRB_SPEC {
471 type Ux = u32;
472}
473#[doc = "`read()` method returns [ctsucrb::R](R) reader structure"]
474impl crate::Readable for CTSUCRB_SPEC {
475 type Reader = R;
476}
477#[doc = "`write(|w| ..)` method takes [ctsucrb::W](W) writer structure"]
478impl crate::Writable for CTSUCRB_SPEC {
479 type Writer = W;
480 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
481 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
482}
483#[doc = "`reset()` method sets CTSUCRB to value 0"]
484impl crate::Resettable for CTSUCRB_SPEC {
485 const RESET_VALUE: Self::Ux = 0;
486}