1pub type R = crate::R<BDTRrs>;
3pub type W = crate::W<BDTRrs>;
5pub type DTG_R = crate::FieldReader;
7pub type DTG_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14#[repr(u8)]
15pub enum LOCK {
16 Off = 0,
18 Level1 = 1,
20 Level2 = 2,
22 Level3 = 3,
24}
25impl From<LOCK> for u8 {
26 #[inline(always)]
27 fn from(variant: LOCK) -> Self {
28 variant as _
29 }
30}
31impl crate::FieldSpec for LOCK {
32 type Ux = u8;
33}
34impl crate::IsEnum for LOCK {}
35pub type LOCK_R = crate::FieldReader<LOCK>;
37impl LOCK_R {
38 #[inline(always)]
40 pub const fn variant(&self) -> LOCK {
41 match self.bits {
42 0 => LOCK::Off,
43 1 => LOCK::Level1,
44 2 => LOCK::Level2,
45 3 => LOCK::Level3,
46 _ => unreachable!(),
47 }
48 }
49 #[inline(always)]
51 pub fn is_off(&self) -> bool {
52 *self == LOCK::Off
53 }
54 #[inline(always)]
56 pub fn is_level1(&self) -> bool {
57 *self == LOCK::Level1
58 }
59 #[inline(always)]
61 pub fn is_level2(&self) -> bool {
62 *self == LOCK::Level2
63 }
64 #[inline(always)]
66 pub fn is_level3(&self) -> bool {
67 *self == LOCK::Level3
68 }
69}
70pub type LOCK_W<'a, REG> = crate::FieldWriter<'a, REG, 2, LOCK, crate::Safe>;
72impl<'a, REG> LOCK_W<'a, REG>
73where
74 REG: crate::Writable + crate::RegisterSpec,
75 REG::Ux: From<u8>,
76{
77 #[inline(always)]
79 pub fn off(self) -> &'a mut crate::W<REG> {
80 self.variant(LOCK::Off)
81 }
82 #[inline(always)]
84 pub fn level1(self) -> &'a mut crate::W<REG> {
85 self.variant(LOCK::Level1)
86 }
87 #[inline(always)]
89 pub fn level2(self) -> &'a mut crate::W<REG> {
90 self.variant(LOCK::Level2)
91 }
92 #[inline(always)]
94 pub fn level3(self) -> &'a mut crate::W<REG> {
95 self.variant(LOCK::Level3)
96 }
97}
98#[cfg_attr(feature = "defmt", derive(defmt::Format))]
102#[derive(Clone, Copy, Debug, PartialEq, Eq)]
103pub enum OSSI {
104 HiZ = 0,
106 IdleLevel = 1,
108}
109impl From<OSSI> for bool {
110 #[inline(always)]
111 fn from(variant: OSSI) -> Self {
112 variant as u8 != 0
113 }
114}
115pub type OSSI_R = crate::BitReader<OSSI>;
117impl OSSI_R {
118 #[inline(always)]
120 pub const fn variant(&self) -> OSSI {
121 match self.bits {
122 false => OSSI::HiZ,
123 true => OSSI::IdleLevel,
124 }
125 }
126 #[inline(always)]
128 pub fn is_hi_z(&self) -> bool {
129 *self == OSSI::HiZ
130 }
131 #[inline(always)]
133 pub fn is_idle_level(&self) -> bool {
134 *self == OSSI::IdleLevel
135 }
136}
137pub type OSSI_W<'a, REG> = crate::BitWriter<'a, REG, OSSI>;
139impl<'a, REG> OSSI_W<'a, REG>
140where
141 REG: crate::Writable + crate::RegisterSpec,
142{
143 #[inline(always)]
145 pub fn hi_z(self) -> &'a mut crate::W<REG> {
146 self.variant(OSSI::HiZ)
147 }
148 #[inline(always)]
150 pub fn idle_level(self) -> &'a mut crate::W<REG> {
151 self.variant(OSSI::IdleLevel)
152 }
153}
154#[cfg_attr(feature = "defmt", derive(defmt::Format))]
158#[derive(Clone, Copy, Debug, PartialEq, Eq)]
159pub enum OSSR {
160 HiZ = 0,
162 IdleLevel = 1,
164}
165impl From<OSSR> for bool {
166 #[inline(always)]
167 fn from(variant: OSSR) -> Self {
168 variant as u8 != 0
169 }
170}
171pub type OSSR_R = crate::BitReader<OSSR>;
173impl OSSR_R {
174 #[inline(always)]
176 pub const fn variant(&self) -> OSSR {
177 match self.bits {
178 false => OSSR::HiZ,
179 true => OSSR::IdleLevel,
180 }
181 }
182 #[inline(always)]
184 pub fn is_hi_z(&self) -> bool {
185 *self == OSSR::HiZ
186 }
187 #[inline(always)]
189 pub fn is_idle_level(&self) -> bool {
190 *self == OSSR::IdleLevel
191 }
192}
193pub type OSSR_W<'a, REG> = crate::BitWriter<'a, REG, OSSR>;
195impl<'a, REG> OSSR_W<'a, REG>
196where
197 REG: crate::Writable + crate::RegisterSpec,
198{
199 #[inline(always)]
201 pub fn hi_z(self) -> &'a mut crate::W<REG> {
202 self.variant(OSSR::HiZ)
203 }
204 #[inline(always)]
206 pub fn idle_level(self) -> &'a mut crate::W<REG> {
207 self.variant(OSSR::IdleLevel)
208 }
209}
210#[cfg_attr(feature = "defmt", derive(defmt::Format))]
214#[derive(Clone, Copy, Debug, PartialEq, Eq)]
215pub enum BKE {
216 Disabled = 0,
218 Enabled = 1,
220}
221impl From<BKE> for bool {
222 #[inline(always)]
223 fn from(variant: BKE) -> Self {
224 variant as u8 != 0
225 }
226}
227pub type BKE_R = crate::BitReader<BKE>;
229impl BKE_R {
230 #[inline(always)]
232 pub const fn variant(&self) -> BKE {
233 match self.bits {
234 false => BKE::Disabled,
235 true => BKE::Enabled,
236 }
237 }
238 #[inline(always)]
240 pub fn is_disabled(&self) -> bool {
241 *self == BKE::Disabled
242 }
243 #[inline(always)]
245 pub fn is_enabled(&self) -> bool {
246 *self == BKE::Enabled
247 }
248}
249pub type BKE_W<'a, REG> = crate::BitWriter<'a, REG, BKE>;
251impl<'a, REG> BKE_W<'a, REG>
252where
253 REG: crate::Writable + crate::RegisterSpec,
254{
255 #[inline(always)]
257 pub fn disabled(self) -> &'a mut crate::W<REG> {
258 self.variant(BKE::Disabled)
259 }
260 #[inline(always)]
262 pub fn enabled(self) -> &'a mut crate::W<REG> {
263 self.variant(BKE::Enabled)
264 }
265}
266#[cfg_attr(feature = "defmt", derive(defmt::Format))]
270#[derive(Clone, Copy, Debug, PartialEq, Eq)]
271pub enum BKP {
272 ActiveLow = 0,
274 ActiveHigh = 1,
276}
277impl From<BKP> for bool {
278 #[inline(always)]
279 fn from(variant: BKP) -> Self {
280 variant as u8 != 0
281 }
282}
283pub type BKP_R = crate::BitReader<BKP>;
285impl BKP_R {
286 #[inline(always)]
288 pub const fn variant(&self) -> BKP {
289 match self.bits {
290 false => BKP::ActiveLow,
291 true => BKP::ActiveHigh,
292 }
293 }
294 #[inline(always)]
296 pub fn is_active_low(&self) -> bool {
297 *self == BKP::ActiveLow
298 }
299 #[inline(always)]
301 pub fn is_active_high(&self) -> bool {
302 *self == BKP::ActiveHigh
303 }
304}
305pub type BKP_W<'a, REG> = crate::BitWriter<'a, REG, BKP>;
307impl<'a, REG> BKP_W<'a, REG>
308where
309 REG: crate::Writable + crate::RegisterSpec,
310{
311 #[inline(always)]
313 pub fn active_low(self) -> &'a mut crate::W<REG> {
314 self.variant(BKP::ActiveLow)
315 }
316 #[inline(always)]
318 pub fn active_high(self) -> &'a mut crate::W<REG> {
319 self.variant(BKP::ActiveHigh)
320 }
321}
322#[cfg_attr(feature = "defmt", derive(defmt::Format))]
326#[derive(Clone, Copy, Debug, PartialEq, Eq)]
327pub enum AOE {
328 Manual = 0,
330 Automatic = 1,
332}
333impl From<AOE> for bool {
334 #[inline(always)]
335 fn from(variant: AOE) -> Self {
336 variant as u8 != 0
337 }
338}
339pub type AOE_R = crate::BitReader<AOE>;
341impl AOE_R {
342 #[inline(always)]
344 pub const fn variant(&self) -> AOE {
345 match self.bits {
346 false => AOE::Manual,
347 true => AOE::Automatic,
348 }
349 }
350 #[inline(always)]
352 pub fn is_manual(&self) -> bool {
353 *self == AOE::Manual
354 }
355 #[inline(always)]
357 pub fn is_automatic(&self) -> bool {
358 *self == AOE::Automatic
359 }
360}
361pub type AOE_W<'a, REG> = crate::BitWriter<'a, REG, AOE>;
363impl<'a, REG> AOE_W<'a, REG>
364where
365 REG: crate::Writable + crate::RegisterSpec,
366{
367 #[inline(always)]
369 pub fn manual(self) -> &'a mut crate::W<REG> {
370 self.variant(AOE::Manual)
371 }
372 #[inline(always)]
374 pub fn automatic(self) -> &'a mut crate::W<REG> {
375 self.variant(AOE::Automatic)
376 }
377}
378#[cfg_attr(feature = "defmt", derive(defmt::Format))]
382#[derive(Clone, Copy, Debug, PartialEq, Eq)]
383pub enum MOE {
384 DisabledIdle = 0,
386 Enabled = 1,
388}
389impl From<MOE> for bool {
390 #[inline(always)]
391 fn from(variant: MOE) -> Self {
392 variant as u8 != 0
393 }
394}
395pub type MOE_R = crate::BitReader<MOE>;
397impl MOE_R {
398 #[inline(always)]
400 pub const fn variant(&self) -> MOE {
401 match self.bits {
402 false => MOE::DisabledIdle,
403 true => MOE::Enabled,
404 }
405 }
406 #[inline(always)]
408 pub fn is_disabled_idle(&self) -> bool {
409 *self == MOE::DisabledIdle
410 }
411 #[inline(always)]
413 pub fn is_enabled(&self) -> bool {
414 *self == MOE::Enabled
415 }
416}
417pub type MOE_W<'a, REG> = crate::BitWriter<'a, REG, MOE>;
419impl<'a, REG> MOE_W<'a, REG>
420where
421 REG: crate::Writable + crate::RegisterSpec,
422{
423 #[inline(always)]
425 pub fn disabled_idle(self) -> &'a mut crate::W<REG> {
426 self.variant(MOE::DisabledIdle)
427 }
428 #[inline(always)]
430 pub fn enabled(self) -> &'a mut crate::W<REG> {
431 self.variant(MOE::Enabled)
432 }
433}
434pub type BKF_R = crate::FieldReader;
436pub type BKF_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
438pub type BK2F_R = crate::FieldReader;
440pub type BK2F_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
442pub use BKE_R as BK2E_R;
444pub use BKE_W as BK2E_W;
446pub use BKP_R as BK2P_R;
448pub use BKP_W as BK2P_W;
450impl R {
451 #[inline(always)]
453 pub fn dtg(&self) -> DTG_R {
454 DTG_R::new((self.bits & 0xff) as u8)
455 }
456 #[inline(always)]
458 pub fn lock(&self) -> LOCK_R {
459 LOCK_R::new(((self.bits >> 8) & 3) as u8)
460 }
461 #[inline(always)]
463 pub fn ossi(&self) -> OSSI_R {
464 OSSI_R::new(((self.bits >> 10) & 1) != 0)
465 }
466 #[inline(always)]
468 pub fn ossr(&self) -> OSSR_R {
469 OSSR_R::new(((self.bits >> 11) & 1) != 0)
470 }
471 #[inline(always)]
473 pub fn bke(&self) -> BKE_R {
474 BKE_R::new(((self.bits >> 12) & 1) != 0)
475 }
476 #[inline(always)]
478 pub fn bkp(&self) -> BKP_R {
479 BKP_R::new(((self.bits >> 13) & 1) != 0)
480 }
481 #[inline(always)]
483 pub fn aoe(&self) -> AOE_R {
484 AOE_R::new(((self.bits >> 14) & 1) != 0)
485 }
486 #[inline(always)]
488 pub fn moe(&self) -> MOE_R {
489 MOE_R::new(((self.bits >> 15) & 1) != 0)
490 }
491 #[inline(always)]
493 pub fn bkf(&self) -> BKF_R {
494 BKF_R::new(((self.bits >> 16) & 0x0f) as u8)
495 }
496 #[inline(always)]
498 pub fn bk2f(&self) -> BK2F_R {
499 BK2F_R::new(((self.bits >> 20) & 0x0f) as u8)
500 }
501 #[inline(always)]
503 pub fn bk2e(&self) -> BK2E_R {
504 BK2E_R::new(((self.bits >> 24) & 1) != 0)
505 }
506 #[inline(always)]
508 pub fn bk2p(&self) -> BK2P_R {
509 BK2P_R::new(((self.bits >> 25) & 1) != 0)
510 }
511}
512impl core::fmt::Debug for R {
513 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
514 f.debug_struct("BDTR")
515 .field("bkp", &self.bkp())
516 .field("bk2p", &self.bk2p())
517 .field("bke", &self.bke())
518 .field("bk2e", &self.bk2e())
519 .field("bk2f", &self.bk2f())
520 .field("bkf", &self.bkf())
521 .field("moe", &self.moe())
522 .field("aoe", &self.aoe())
523 .field("ossr", &self.ossr())
524 .field("ossi", &self.ossi())
525 .field("lock", &self.lock())
526 .field("dtg", &self.dtg())
527 .finish()
528 }
529}
530impl W {
531 #[inline(always)]
533 pub fn dtg(&mut self) -> DTG_W<BDTRrs> {
534 DTG_W::new(self, 0)
535 }
536 #[inline(always)]
538 pub fn lock(&mut self) -> LOCK_W<BDTRrs> {
539 LOCK_W::new(self, 8)
540 }
541 #[inline(always)]
543 pub fn ossi(&mut self) -> OSSI_W<BDTRrs> {
544 OSSI_W::new(self, 10)
545 }
546 #[inline(always)]
548 pub fn ossr(&mut self) -> OSSR_W<BDTRrs> {
549 OSSR_W::new(self, 11)
550 }
551 #[inline(always)]
553 pub fn bke(&mut self) -> BKE_W<BDTRrs> {
554 BKE_W::new(self, 12)
555 }
556 #[inline(always)]
558 pub fn bkp(&mut self) -> BKP_W<BDTRrs> {
559 BKP_W::new(self, 13)
560 }
561 #[inline(always)]
563 pub fn aoe(&mut self) -> AOE_W<BDTRrs> {
564 AOE_W::new(self, 14)
565 }
566 #[inline(always)]
568 pub fn moe(&mut self) -> MOE_W<BDTRrs> {
569 MOE_W::new(self, 15)
570 }
571 #[inline(always)]
573 pub fn bkf(&mut self) -> BKF_W<BDTRrs> {
574 BKF_W::new(self, 16)
575 }
576 #[inline(always)]
578 pub fn bk2f(&mut self) -> BK2F_W<BDTRrs> {
579 BK2F_W::new(self, 20)
580 }
581 #[inline(always)]
583 pub fn bk2e(&mut self) -> BK2E_W<BDTRrs> {
584 BK2E_W::new(self, 24)
585 }
586 #[inline(always)]
588 pub fn bk2p(&mut self) -> BK2P_W<BDTRrs> {
589 BK2P_W::new(self, 25)
590 }
591}
592pub struct BDTRrs;
598impl crate::RegisterSpec for BDTRrs {
599 type Ux = u32;
600}
601impl crate::Readable for BDTRrs {}
603impl crate::Writable for BDTRrs {
605 type Safety = crate::Unsafe;
606}
607impl crate::Resettable for BDTRrs {}