atsamd11d/wdt/
ewctrl.rs
1#[doc = "Register `EWCTRL` reader"]
2pub type R = crate::R<EwctrlSpec>;
3#[doc = "Register `EWCTRL` writer"]
4pub type W = crate::W<EwctrlSpec>;
5#[doc = "Early Warning Interrupt Time Offset\n\nValue on reset: 11"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Ewoffsetselect {
9 #[doc = "0: 8 clock cycles"]
10 _8 = 0,
11 #[doc = "1: 16 clock cycles"]
12 _16 = 1,
13 #[doc = "2: 32 clock cycles"]
14 _32 = 2,
15 #[doc = "3: 64 clock cycles"]
16 _64 = 3,
17 #[doc = "4: 128 clock cycles"]
18 _128 = 4,
19 #[doc = "5: 256 clock cycles"]
20 _256 = 5,
21 #[doc = "6: 512 clock cycles"]
22 _512 = 6,
23 #[doc = "7: 1024 clock cycles"]
24 _1k = 7,
25 #[doc = "8: 2048 clock cycles"]
26 _2k = 8,
27 #[doc = "9: 4096 clock cycles"]
28 _4k = 9,
29 #[doc = "10: 8192 clock cycles"]
30 _8k = 10,
31 #[doc = "11: 16384 clock cycles"]
32 _16k = 11,
33}
34impl From<Ewoffsetselect> for u8 {
35 #[inline(always)]
36 fn from(variant: Ewoffsetselect) -> Self {
37 variant as _
38 }
39}
40impl crate::FieldSpec for Ewoffsetselect {
41 type Ux = u8;
42}
43impl crate::IsEnum for Ewoffsetselect {}
44#[doc = "Field `EWOFFSET` reader - Early Warning Interrupt Time Offset"]
45pub type EwoffsetR = crate::FieldReader<Ewoffsetselect>;
46impl EwoffsetR {
47 #[doc = "Get enumerated values variant"]
48 #[inline(always)]
49 pub const fn variant(&self) -> Option<Ewoffsetselect> {
50 match self.bits {
51 0 => Some(Ewoffsetselect::_8),
52 1 => Some(Ewoffsetselect::_16),
53 2 => Some(Ewoffsetselect::_32),
54 3 => Some(Ewoffsetselect::_64),
55 4 => Some(Ewoffsetselect::_128),
56 5 => Some(Ewoffsetselect::_256),
57 6 => Some(Ewoffsetselect::_512),
58 7 => Some(Ewoffsetselect::_1k),
59 8 => Some(Ewoffsetselect::_2k),
60 9 => Some(Ewoffsetselect::_4k),
61 10 => Some(Ewoffsetselect::_8k),
62 11 => Some(Ewoffsetselect::_16k),
63 _ => None,
64 }
65 }
66 #[doc = "8 clock cycles"]
67 #[inline(always)]
68 pub fn is_8(&self) -> bool {
69 *self == Ewoffsetselect::_8
70 }
71 #[doc = "16 clock cycles"]
72 #[inline(always)]
73 pub fn is_16(&self) -> bool {
74 *self == Ewoffsetselect::_16
75 }
76 #[doc = "32 clock cycles"]
77 #[inline(always)]
78 pub fn is_32(&self) -> bool {
79 *self == Ewoffsetselect::_32
80 }
81 #[doc = "64 clock cycles"]
82 #[inline(always)]
83 pub fn is_64(&self) -> bool {
84 *self == Ewoffsetselect::_64
85 }
86 #[doc = "128 clock cycles"]
87 #[inline(always)]
88 pub fn is_128(&self) -> bool {
89 *self == Ewoffsetselect::_128
90 }
91 #[doc = "256 clock cycles"]
92 #[inline(always)]
93 pub fn is_256(&self) -> bool {
94 *self == Ewoffsetselect::_256
95 }
96 #[doc = "512 clock cycles"]
97 #[inline(always)]
98 pub fn is_512(&self) -> bool {
99 *self == Ewoffsetselect::_512
100 }
101 #[doc = "1024 clock cycles"]
102 #[inline(always)]
103 pub fn is_1k(&self) -> bool {
104 *self == Ewoffsetselect::_1k
105 }
106 #[doc = "2048 clock cycles"]
107 #[inline(always)]
108 pub fn is_2k(&self) -> bool {
109 *self == Ewoffsetselect::_2k
110 }
111 #[doc = "4096 clock cycles"]
112 #[inline(always)]
113 pub fn is_4k(&self) -> bool {
114 *self == Ewoffsetselect::_4k
115 }
116 #[doc = "8192 clock cycles"]
117 #[inline(always)]
118 pub fn is_8k(&self) -> bool {
119 *self == Ewoffsetselect::_8k
120 }
121 #[doc = "16384 clock cycles"]
122 #[inline(always)]
123 pub fn is_16k(&self) -> bool {
124 *self == Ewoffsetselect::_16k
125 }
126}
127#[doc = "Field `EWOFFSET` writer - Early Warning Interrupt Time Offset"]
128pub type EwoffsetW<'a, REG> = crate::FieldWriter<'a, REG, 4, Ewoffsetselect>;
129impl<'a, REG> EwoffsetW<'a, REG>
130where
131 REG: crate::Writable + crate::RegisterSpec,
132 REG::Ux: From<u8>,
133{
134 #[doc = "8 clock cycles"]
135 #[inline(always)]
136 pub fn _8(self) -> &'a mut crate::W<REG> {
137 self.variant(Ewoffsetselect::_8)
138 }
139 #[doc = "16 clock cycles"]
140 #[inline(always)]
141 pub fn _16(self) -> &'a mut crate::W<REG> {
142 self.variant(Ewoffsetselect::_16)
143 }
144 #[doc = "32 clock cycles"]
145 #[inline(always)]
146 pub fn _32(self) -> &'a mut crate::W<REG> {
147 self.variant(Ewoffsetselect::_32)
148 }
149 #[doc = "64 clock cycles"]
150 #[inline(always)]
151 pub fn _64(self) -> &'a mut crate::W<REG> {
152 self.variant(Ewoffsetselect::_64)
153 }
154 #[doc = "128 clock cycles"]
155 #[inline(always)]
156 pub fn _128(self) -> &'a mut crate::W<REG> {
157 self.variant(Ewoffsetselect::_128)
158 }
159 #[doc = "256 clock cycles"]
160 #[inline(always)]
161 pub fn _256(self) -> &'a mut crate::W<REG> {
162 self.variant(Ewoffsetselect::_256)
163 }
164 #[doc = "512 clock cycles"]
165 #[inline(always)]
166 pub fn _512(self) -> &'a mut crate::W<REG> {
167 self.variant(Ewoffsetselect::_512)
168 }
169 #[doc = "1024 clock cycles"]
170 #[inline(always)]
171 pub fn _1k(self) -> &'a mut crate::W<REG> {
172 self.variant(Ewoffsetselect::_1k)
173 }
174 #[doc = "2048 clock cycles"]
175 #[inline(always)]
176 pub fn _2k(self) -> &'a mut crate::W<REG> {
177 self.variant(Ewoffsetselect::_2k)
178 }
179 #[doc = "4096 clock cycles"]
180 #[inline(always)]
181 pub fn _4k(self) -> &'a mut crate::W<REG> {
182 self.variant(Ewoffsetselect::_4k)
183 }
184 #[doc = "8192 clock cycles"]
185 #[inline(always)]
186 pub fn _8k(self) -> &'a mut crate::W<REG> {
187 self.variant(Ewoffsetselect::_8k)
188 }
189 #[doc = "16384 clock cycles"]
190 #[inline(always)]
191 pub fn _16k(self) -> &'a mut crate::W<REG> {
192 self.variant(Ewoffsetselect::_16k)
193 }
194}
195impl R {
196 #[doc = "Bits 0:3 - Early Warning Interrupt Time Offset"]
197 #[inline(always)]
198 pub fn ewoffset(&self) -> EwoffsetR {
199 EwoffsetR::new(self.bits & 0x0f)
200 }
201}
202impl W {
203 #[doc = "Bits 0:3 - Early Warning Interrupt Time Offset"]
204 #[inline(always)]
205 #[must_use]
206 pub fn ewoffset(&mut self) -> EwoffsetW<EwctrlSpec> {
207 EwoffsetW::new(self, 0)
208 }
209}
210#[doc = "Early Warning Interrupt Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ewctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ewctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
211pub struct EwctrlSpec;
212impl crate::RegisterSpec for EwctrlSpec {
213 type Ux = u8;
214}
215#[doc = "`read()` method returns [`ewctrl::R`](R) reader structure"]
216impl crate::Readable for EwctrlSpec {}
217#[doc = "`write(|w| ..)` method takes [`ewctrl::W`](W) writer structure"]
218impl crate::Writable for EwctrlSpec {
219 type Safety = crate::Unsafe;
220 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
221 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
222}
223#[doc = "`reset()` method sets EWCTRL to value 0x0b"]
224impl crate::Resettable for EwctrlSpec {
225 const RESET_VALUE: u8 = 0x0b;
226}