1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CtrlSpec>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CtrlSpec>;
5#[doc = "Field `DELAYVAL` reader - Tick Interval"]
6pub type DelayvalR = crate::FieldReader<u32>;
7#[doc = "Field `DELAYVAL` writer - Tick Interval"]
8pub type DelayvalW<'a, REG> = crate::FieldWriter<'a, REG, 31, u32>;
9#[doc = "Repeat Delay\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum Repeat {
13 #[doc = "0: One-time delay"]
14 Delayonce = 0,
15 #[doc = "1: Delay repeats continuously"]
16 Delayrepeats = 1,
17}
18impl From<Repeat> for bool {
19 #[inline(always)]
20 fn from(variant: Repeat) -> Self {
21 variant as u8 != 0
22 }
23}
24#[doc = "Field `REPEAT` reader - Repeat Delay"]
25pub type RepeatR = crate::BitReader<Repeat>;
26impl RepeatR {
27 #[doc = "Get enumerated values variant"]
28 #[inline(always)]
29 pub const fn variant(&self) -> Repeat {
30 match self.bits {
31 false => Repeat::Delayonce,
32 true => Repeat::Delayrepeats,
33 }
34 }
35 #[doc = "One-time delay"]
36 #[inline(always)]
37 pub fn is_delayonce(&self) -> bool {
38 *self == Repeat::Delayonce
39 }
40 #[doc = "Delay repeats continuously"]
41 #[inline(always)]
42 pub fn is_delayrepeats(&self) -> bool {
43 *self == Repeat::Delayrepeats
44 }
45}
46#[doc = "Field `REPEAT` writer - Repeat Delay"]
47pub type RepeatW<'a, REG> = crate::BitWriter<'a, REG, Repeat>;
48impl<'a, REG> RepeatW<'a, REG>
49where
50 REG: crate::Writable + crate::RegisterSpec,
51{
52 #[doc = "One-time delay"]
53 #[inline(always)]
54 pub fn delayonce(self) -> &'a mut crate::W<REG> {
55 self.variant(Repeat::Delayonce)
56 }
57 #[doc = "Delay repeats continuously"]
58 #[inline(always)]
59 pub fn delayrepeats(self) -> &'a mut crate::W<REG> {
60 self.variant(Repeat::Delayrepeats)
61 }
62}
63impl R {
64 #[doc = "Bits 0:30 - Tick Interval"]
65 #[inline(always)]
66 pub fn delayval(&self) -> DelayvalR {
67 DelayvalR::new(self.bits & 0x7fff_ffff)
68 }
69 #[doc = "Bit 31 - Repeat Delay"]
70 #[inline(always)]
71 pub fn repeat(&self) -> RepeatR {
72 RepeatR::new(((self.bits >> 31) & 1) != 0)
73 }
74}
75#[cfg(feature = "debug")]
76impl core::fmt::Debug for R {
77 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
78 f.debug_struct("CTRL")
79 .field("delayval", &self.delayval())
80 .field("repeat", &self.repeat())
81 .finish()
82 }
83}
84impl W {
85 #[doc = "Bits 0:30 - Tick Interval"]
86 #[inline(always)]
87 pub fn delayval(&mut self) -> DelayvalW<'_, CtrlSpec> {
88 DelayvalW::new(self, 0)
89 }
90 #[doc = "Bit 31 - Repeat Delay"]
91 #[inline(always)]
92 pub fn repeat(&mut self) -> RepeatW<'_, CtrlSpec> {
93 RepeatW::new(self, 31)
94 }
95}
96#[doc = "Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct CtrlSpec;
98impl crate::RegisterSpec for CtrlSpec {
99 type Ux = u32;
100}
101#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
102impl crate::Readable for CtrlSpec {}
103#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
104impl crate::Writable for CtrlSpec {
105 type Safety = crate::Unsafe;
106}
107#[doc = "`reset()` method sets CTRL to value 0"]
108impl crate::Resettable for CtrlSpec {}