1pub struct R(crate::R<CR1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR1_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<CR1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type PE_R = crate::BitReader<PE_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum PE_A {
44 Disabled = 0,
46 Enabled = 1,
48}
49impl From<PE_A> for bool {
50 #[inline(always)]
51 fn from(variant: PE_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl PE_R {
56 #[inline(always)]
58 pub fn variant(&self) -> PE_A {
59 match self.bits {
60 false => PE_A::Disabled,
61 true => PE_A::Enabled,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == PE_A::Disabled
68 }
69 #[inline(always)]
71 pub fn is_enabled(&self) -> bool {
72 *self == PE_A::Enabled
73 }
74}
75pub type PE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, PE_A, O>;
77impl<'a, const O: u8> PE_W<'a, O> {
78 #[inline(always)]
80 pub fn disabled(self) -> &'a mut W {
81 self.variant(PE_A::Disabled)
82 }
83 #[inline(always)]
85 pub fn enabled(self) -> &'a mut W {
86 self.variant(PE_A::Enabled)
87 }
88}
89pub type ENPEC_R = crate::BitReader<bool>;
91pub type ENPEC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, bool, O>;
93pub type ENGC_R = crate::BitReader<ENGC_A>;
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum ENGC_A {
100 Disabled = 0,
102 Enabled = 1,
104}
105impl From<ENGC_A> for bool {
106 #[inline(always)]
107 fn from(variant: ENGC_A) -> Self {
108 variant as u8 != 0
109 }
110}
111impl ENGC_R {
112 #[inline(always)]
114 pub fn variant(&self) -> ENGC_A {
115 match self.bits {
116 false => ENGC_A::Disabled,
117 true => ENGC_A::Enabled,
118 }
119 }
120 #[inline(always)]
122 pub fn is_disabled(&self) -> bool {
123 *self == ENGC_A::Disabled
124 }
125 #[inline(always)]
127 pub fn is_enabled(&self) -> bool {
128 *self == ENGC_A::Enabled
129 }
130}
131pub type ENGC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, ENGC_A, O>;
133impl<'a, const O: u8> ENGC_W<'a, O> {
134 #[inline(always)]
136 pub fn disabled(self) -> &'a mut W {
137 self.variant(ENGC_A::Disabled)
138 }
139 #[inline(always)]
141 pub fn enabled(self) -> &'a mut W {
142 self.variant(ENGC_A::Enabled)
143 }
144}
145pub type NOSTRETCH_R = crate::BitReader<NOSTRETCH_A>;
147#[derive(Clone, Copy, Debug, PartialEq, Eq)]
151pub enum NOSTRETCH_A {
152 Enabled = 0,
154 Disabled = 1,
156}
157impl From<NOSTRETCH_A> for bool {
158 #[inline(always)]
159 fn from(variant: NOSTRETCH_A) -> Self {
160 variant as u8 != 0
161 }
162}
163impl NOSTRETCH_R {
164 #[inline(always)]
166 pub fn variant(&self) -> NOSTRETCH_A {
167 match self.bits {
168 false => NOSTRETCH_A::Enabled,
169 true => NOSTRETCH_A::Disabled,
170 }
171 }
172 #[inline(always)]
174 pub fn is_enabled(&self) -> bool {
175 *self == NOSTRETCH_A::Enabled
176 }
177 #[inline(always)]
179 pub fn is_disabled(&self) -> bool {
180 *self == NOSTRETCH_A::Disabled
181 }
182}
183pub type NOSTRETCH_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, NOSTRETCH_A, O>;
185impl<'a, const O: u8> NOSTRETCH_W<'a, O> {
186 #[inline(always)]
188 pub fn enabled(self) -> &'a mut W {
189 self.variant(NOSTRETCH_A::Enabled)
190 }
191 #[inline(always)]
193 pub fn disabled(self) -> &'a mut W {
194 self.variant(NOSTRETCH_A::Disabled)
195 }
196}
197pub type START_R = crate::BitReader<START_A>;
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum START_A {
204 NoStart = 0,
206 Start = 1,
208}
209impl From<START_A> for bool {
210 #[inline(always)]
211 fn from(variant: START_A) -> Self {
212 variant as u8 != 0
213 }
214}
215impl START_R {
216 #[inline(always)]
218 pub fn variant(&self) -> START_A {
219 match self.bits {
220 false => START_A::NoStart,
221 true => START_A::Start,
222 }
223 }
224 #[inline(always)]
226 pub fn is_no_start(&self) -> bool {
227 *self == START_A::NoStart
228 }
229 #[inline(always)]
231 pub fn is_start(&self) -> bool {
232 *self == START_A::Start
233 }
234}
235pub type START_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, START_A, O>;
237impl<'a, const O: u8> START_W<'a, O> {
238 #[inline(always)]
240 pub fn no_start(self) -> &'a mut W {
241 self.variant(START_A::NoStart)
242 }
243 #[inline(always)]
245 pub fn start(self) -> &'a mut W {
246 self.variant(START_A::Start)
247 }
248}
249pub type STOP_R = crate::BitReader<STOP_A>;
251#[derive(Clone, Copy, Debug, PartialEq, Eq)]
255pub enum STOP_A {
256 NoStop = 0,
258 Stop = 1,
260}
261impl From<STOP_A> for bool {
262 #[inline(always)]
263 fn from(variant: STOP_A) -> Self {
264 variant as u8 != 0
265 }
266}
267impl STOP_R {
268 #[inline(always)]
270 pub fn variant(&self) -> STOP_A {
271 match self.bits {
272 false => STOP_A::NoStop,
273 true => STOP_A::Stop,
274 }
275 }
276 #[inline(always)]
278 pub fn is_no_stop(&self) -> bool {
279 *self == STOP_A::NoStop
280 }
281 #[inline(always)]
283 pub fn is_stop(&self) -> bool {
284 *self == STOP_A::Stop
285 }
286}
287pub type STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, STOP_A, O>;
289impl<'a, const O: u8> STOP_W<'a, O> {
290 #[inline(always)]
292 pub fn no_stop(self) -> &'a mut W {
293 self.variant(STOP_A::NoStop)
294 }
295 #[inline(always)]
297 pub fn stop(self) -> &'a mut W {
298 self.variant(STOP_A::Stop)
299 }
300}
301pub type ACK_R = crate::BitReader<ACK_A>;
303#[derive(Clone, Copy, Debug, PartialEq, Eq)]
307pub enum ACK_A {
308 Nak = 0,
310 Ack = 1,
312}
313impl From<ACK_A> for bool {
314 #[inline(always)]
315 fn from(variant: ACK_A) -> Self {
316 variant as u8 != 0
317 }
318}
319impl ACK_R {
320 #[inline(always)]
322 pub fn variant(&self) -> ACK_A {
323 match self.bits {
324 false => ACK_A::Nak,
325 true => ACK_A::Ack,
326 }
327 }
328 #[inline(always)]
330 pub fn is_nak(&self) -> bool {
331 *self == ACK_A::Nak
332 }
333 #[inline(always)]
335 pub fn is_ack(&self) -> bool {
336 *self == ACK_A::Ack
337 }
338}
339pub type ACK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, ACK_A, O>;
341impl<'a, const O: u8> ACK_W<'a, O> {
342 #[inline(always)]
344 pub fn nak(self) -> &'a mut W {
345 self.variant(ACK_A::Nak)
346 }
347 #[inline(always)]
349 pub fn ack(self) -> &'a mut W {
350 self.variant(ACK_A::Ack)
351 }
352}
353pub type POS_R = crate::BitReader<POS_A>;
355#[derive(Clone, Copy, Debug, PartialEq, Eq)]
359pub enum POS_A {
360 Current = 0,
362 Next = 1,
364}
365impl From<POS_A> for bool {
366 #[inline(always)]
367 fn from(variant: POS_A) -> Self {
368 variant as u8 != 0
369 }
370}
371impl POS_R {
372 #[inline(always)]
374 pub fn variant(&self) -> POS_A {
375 match self.bits {
376 false => POS_A::Current,
377 true => POS_A::Next,
378 }
379 }
380 #[inline(always)]
382 pub fn is_current(&self) -> bool {
383 *self == POS_A::Current
384 }
385 #[inline(always)]
387 pub fn is_next(&self) -> bool {
388 *self == POS_A::Next
389 }
390}
391pub type POS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, POS_A, O>;
393impl<'a, const O: u8> POS_W<'a, O> {
394 #[inline(always)]
396 pub fn current(self) -> &'a mut W {
397 self.variant(POS_A::Current)
398 }
399 #[inline(always)]
401 pub fn next(self) -> &'a mut W {
402 self.variant(POS_A::Next)
403 }
404}
405pub type PEC_R = crate::BitReader<bool>;
407pub type PEC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, bool, O>;
409pub type SWRST_R = crate::BitReader<SWRST_A>;
411#[derive(Clone, Copy, Debug, PartialEq, Eq)]
415pub enum SWRST_A {
416 NotReset = 0,
418 Reset = 1,
420}
421impl From<SWRST_A> for bool {
422 #[inline(always)]
423 fn from(variant: SWRST_A) -> Self {
424 variant as u8 != 0
425 }
426}
427impl SWRST_R {
428 #[inline(always)]
430 pub fn variant(&self) -> SWRST_A {
431 match self.bits {
432 false => SWRST_A::NotReset,
433 true => SWRST_A::Reset,
434 }
435 }
436 #[inline(always)]
438 pub fn is_not_reset(&self) -> bool {
439 *self == SWRST_A::NotReset
440 }
441 #[inline(always)]
443 pub fn is_reset(&self) -> bool {
444 *self == SWRST_A::Reset
445 }
446}
447pub type SWRST_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, SWRST_A, O>;
449impl<'a, const O: u8> SWRST_W<'a, O> {
450 #[inline(always)]
452 pub fn not_reset(self) -> &'a mut W {
453 self.variant(SWRST_A::NotReset)
454 }
455 #[inline(always)]
457 pub fn reset(self) -> &'a mut W {
458 self.variant(SWRST_A::Reset)
459 }
460}
461impl R {
462 #[inline(always)]
464 pub fn pe(&self) -> PE_R {
465 PE_R::new((self.bits & 1) != 0)
466 }
467 #[inline(always)]
469 pub fn enpec(&self) -> ENPEC_R {
470 ENPEC_R::new(((self.bits >> 5) & 1) != 0)
471 }
472 #[inline(always)]
474 pub fn engc(&self) -> ENGC_R {
475 ENGC_R::new(((self.bits >> 6) & 1) != 0)
476 }
477 #[inline(always)]
479 pub fn nostretch(&self) -> NOSTRETCH_R {
480 NOSTRETCH_R::new(((self.bits >> 7) & 1) != 0)
481 }
482 #[inline(always)]
484 pub fn start(&self) -> START_R {
485 START_R::new(((self.bits >> 8) & 1) != 0)
486 }
487 #[inline(always)]
489 pub fn stop(&self) -> STOP_R {
490 STOP_R::new(((self.bits >> 9) & 1) != 0)
491 }
492 #[inline(always)]
494 pub fn ack(&self) -> ACK_R {
495 ACK_R::new(((self.bits >> 10) & 1) != 0)
496 }
497 #[inline(always)]
499 pub fn pos(&self) -> POS_R {
500 POS_R::new(((self.bits >> 11) & 1) != 0)
501 }
502 #[inline(always)]
504 pub fn pec(&self) -> PEC_R {
505 PEC_R::new(((self.bits >> 12) & 1) != 0)
506 }
507 #[inline(always)]
509 pub fn swrst(&self) -> SWRST_R {
510 SWRST_R::new(((self.bits >> 15) & 1) != 0)
511 }
512}
513impl W {
514 #[inline(always)]
516 #[must_use]
517 pub fn pe(&mut self) -> PE_W<0> {
518 PE_W::new(self)
519 }
520 #[inline(always)]
522 #[must_use]
523 pub fn enpec(&mut self) -> ENPEC_W<5> {
524 ENPEC_W::new(self)
525 }
526 #[inline(always)]
528 #[must_use]
529 pub fn engc(&mut self) -> ENGC_W<6> {
530 ENGC_W::new(self)
531 }
532 #[inline(always)]
534 #[must_use]
535 pub fn nostretch(&mut self) -> NOSTRETCH_W<7> {
536 NOSTRETCH_W::new(self)
537 }
538 #[inline(always)]
540 #[must_use]
541 pub fn start(&mut self) -> START_W<8> {
542 START_W::new(self)
543 }
544 #[inline(always)]
546 #[must_use]
547 pub fn stop(&mut self) -> STOP_W<9> {
548 STOP_W::new(self)
549 }
550 #[inline(always)]
552 #[must_use]
553 pub fn ack(&mut self) -> ACK_W<10> {
554 ACK_W::new(self)
555 }
556 #[inline(always)]
558 #[must_use]
559 pub fn pos(&mut self) -> POS_W<11> {
560 POS_W::new(self)
561 }
562 #[inline(always)]
564 #[must_use]
565 pub fn pec(&mut self) -> PEC_W<12> {
566 PEC_W::new(self)
567 }
568 #[inline(always)]
570 #[must_use]
571 pub fn swrst(&mut self) -> SWRST_W<15> {
572 SWRST_W::new(self)
573 }
574 #[inline(always)]
576 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
577 self.0.bits(bits);
578 self
579 }
580}
581pub struct CR1_SPEC;
587impl crate::RegisterSpec for CR1_SPEC {
588 type Ux = u32;
589}
590impl crate::Readable for CR1_SPEC {
592 type Reader = R;
593}
594impl crate::Writable for CR1_SPEC {
596 type Writer = W;
597 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
598 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
599}
600impl crate::Resettable for CR1_SPEC {
602 const RESET_VALUE: Self::Ux = 0;
603}