1#[doc = "Register `DOCR` reader"]
2pub struct R(crate::R<DOCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DOCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DOCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DOCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DOCR` writer"]
17pub struct W(crate::W<DOCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DOCR_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<DOCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DOCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `OMS` reader - Operating Mode Select"]
38pub type OMS_R = crate::FieldReader<u8, OMS_A>;
39#[doc = "Operating Mode Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum OMS_A {
43 #[doc = "0: Data comparison mode"]
44 _00 = 0,
45 #[doc = "1: Data addition mode"]
46 _01 = 1,
47 #[doc = "2: Data subtraction mode"]
48 _10 = 2,
49 #[doc = "3: Setting prohibited"]
50 _11 = 3,
51}
52impl From<OMS_A> for u8 {
53 #[inline(always)]
54 fn from(variant: OMS_A) -> Self {
55 variant as _
56 }
57}
58impl OMS_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> OMS_A {
62 match self.bits {
63 0 => OMS_A::_00,
64 1 => OMS_A::_01,
65 2 => OMS_A::_10,
66 3 => OMS_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == OMS_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == OMS_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == OMS_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == OMS_A::_11
89 }
90}
91#[doc = "Field `OMS` writer - Operating Mode Select"]
92pub type OMS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, DOCR_SPEC, u8, OMS_A, 2, O>;
93impl<'a, const O: u8> OMS_W<'a, O> {
94 #[doc = "Data comparison mode"]
95 #[inline(always)]
96 pub fn _00(self) -> &'a mut W {
97 self.variant(OMS_A::_00)
98 }
99 #[doc = "Data addition mode"]
100 #[inline(always)]
101 pub fn _01(self) -> &'a mut W {
102 self.variant(OMS_A::_01)
103 }
104 #[doc = "Data subtraction mode"]
105 #[inline(always)]
106 pub fn _10(self) -> &'a mut W {
107 self.variant(OMS_A::_10)
108 }
109 #[doc = "Setting prohibited"]
110 #[inline(always)]
111 pub fn _11(self) -> &'a mut W {
112 self.variant(OMS_A::_11)
113 }
114}
115#[doc = "Field `DOBW` reader - Data Operation Bit Width Select"]
116pub type DOBW_R = crate::BitReader<DOBW_A>;
117#[doc = "Data Operation Bit Width Select\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum DOBW_A {
120 #[doc = "0: 16-bit"]
121 _0 = 0,
122 #[doc = "1: 32-bit"]
123 _1 = 1,
124}
125impl From<DOBW_A> for bool {
126 #[inline(always)]
127 fn from(variant: DOBW_A) -> Self {
128 variant as u8 != 0
129 }
130}
131impl DOBW_R {
132 #[doc = "Get enumerated values variant"]
133 #[inline(always)]
134 pub fn variant(&self) -> DOBW_A {
135 match self.bits {
136 false => DOBW_A::_0,
137 true => DOBW_A::_1,
138 }
139 }
140 #[doc = "Checks if the value of the field is `_0`"]
141 #[inline(always)]
142 pub fn is_0(&self) -> bool {
143 *self == DOBW_A::_0
144 }
145 #[doc = "Checks if the value of the field is `_1`"]
146 #[inline(always)]
147 pub fn is_1(&self) -> bool {
148 *self == DOBW_A::_1
149 }
150}
151#[doc = "Field `DOBW` writer - Data Operation Bit Width Select"]
152pub type DOBW_W<'a, const O: u8> = crate::BitWriter<'a, u8, DOCR_SPEC, DOBW_A, O>;
153impl<'a, const O: u8> DOBW_W<'a, O> {
154 #[doc = "16-bit"]
155 #[inline(always)]
156 pub fn _0(self) -> &'a mut W {
157 self.variant(DOBW_A::_0)
158 }
159 #[doc = "32-bit"]
160 #[inline(always)]
161 pub fn _1(self) -> &'a mut W {
162 self.variant(DOBW_A::_1)
163 }
164}
165#[doc = "Field `DCSEL` reader - Detection Condition Select"]
166pub type DCSEL_R = crate::FieldReader<u8, DCSEL_A>;
167#[doc = "Detection Condition Select\n\nValue on reset: 0"]
168#[derive(Clone, Copy, Debug, PartialEq, Eq)]
169#[repr(u8)]
170pub enum DCSEL_A {
171 #[doc = "0: Mismatch (DODSR0 â\u{89} DODIR)"]
172 _000 = 0,
173 #[doc = "1: Match (DODSR0 = DODIR)"]
174 _001 = 1,
175 #[doc = "2: Lower (DODSR0 > DODIR)"]
176 _010 = 2,
177 #[doc = "3: Upper (DODSR0 < DODIR)"]
178 _011 = 3,
179 #[doc = "4: Inside window (DODSR0 < DODIR < DODSR1)"]
180 _100 = 4,
181 #[doc = "5: Outside window (DODIR < DODSR0, DODSR1 < DODIR)"]
182 _101 = 5,
183}
184impl From<DCSEL_A> for u8 {
185 #[inline(always)]
186 fn from(variant: DCSEL_A) -> Self {
187 variant as _
188 }
189}
190impl DCSEL_R {
191 #[doc = "Get enumerated values variant"]
192 #[inline(always)]
193 pub fn variant(&self) -> Option<DCSEL_A> {
194 match self.bits {
195 0 => Some(DCSEL_A::_000),
196 1 => Some(DCSEL_A::_001),
197 2 => Some(DCSEL_A::_010),
198 3 => Some(DCSEL_A::_011),
199 4 => Some(DCSEL_A::_100),
200 5 => Some(DCSEL_A::_101),
201 _ => None,
202 }
203 }
204 #[doc = "Checks if the value of the field is `_000`"]
205 #[inline(always)]
206 pub fn is_000(&self) -> bool {
207 *self == DCSEL_A::_000
208 }
209 #[doc = "Checks if the value of the field is `_001`"]
210 #[inline(always)]
211 pub fn is_001(&self) -> bool {
212 *self == DCSEL_A::_001
213 }
214 #[doc = "Checks if the value of the field is `_010`"]
215 #[inline(always)]
216 pub fn is_010(&self) -> bool {
217 *self == DCSEL_A::_010
218 }
219 #[doc = "Checks if the value of the field is `_011`"]
220 #[inline(always)]
221 pub fn is_011(&self) -> bool {
222 *self == DCSEL_A::_011
223 }
224 #[doc = "Checks if the value of the field is `_100`"]
225 #[inline(always)]
226 pub fn is_100(&self) -> bool {
227 *self == DCSEL_A::_100
228 }
229 #[doc = "Checks if the value of the field is `_101`"]
230 #[inline(always)]
231 pub fn is_101(&self) -> bool {
232 *self == DCSEL_A::_101
233 }
234}
235#[doc = "Field `DCSEL` writer - Detection Condition Select"]
236pub type DCSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u8, DOCR_SPEC, u8, DCSEL_A, 3, O>;
237impl<'a, const O: u8> DCSEL_W<'a, O> {
238 #[doc = "Mismatch (DODSR0 â\u{89} DODIR)"]
239 #[inline(always)]
240 pub fn _000(self) -> &'a mut W {
241 self.variant(DCSEL_A::_000)
242 }
243 #[doc = "Match (DODSR0 = DODIR)"]
244 #[inline(always)]
245 pub fn _001(self) -> &'a mut W {
246 self.variant(DCSEL_A::_001)
247 }
248 #[doc = "Lower (DODSR0 > DODIR)"]
249 #[inline(always)]
250 pub fn _010(self) -> &'a mut W {
251 self.variant(DCSEL_A::_010)
252 }
253 #[doc = "Upper (DODSR0 < DODIR)"]
254 #[inline(always)]
255 pub fn _011(self) -> &'a mut W {
256 self.variant(DCSEL_A::_011)
257 }
258 #[doc = "Inside window (DODSR0 < DODIR < DODSR1)"]
259 #[inline(always)]
260 pub fn _100(self) -> &'a mut W {
261 self.variant(DCSEL_A::_100)
262 }
263 #[doc = "Outside window (DODIR < DODSR0, DODSR1 < DODIR)"]
264 #[inline(always)]
265 pub fn _101(self) -> &'a mut W {
266 self.variant(DCSEL_A::_101)
267 }
268}
269#[doc = "Field `DOPCIE` reader - Data Operation Circuit Interrupt Enable"]
270pub type DOPCIE_R = crate::BitReader<DOPCIE_A>;
271#[doc = "Data Operation Circuit Interrupt Enable\n\nValue on reset: 0"]
272#[derive(Clone, Copy, Debug, PartialEq, Eq)]
273pub enum DOPCIE_A {
274 #[doc = "0: Disables interrupts from the data operation circuit."]
275 _0 = 0,
276 #[doc = "1: Enables interrupts from the data operation circuit."]
277 _1 = 1,
278}
279impl From<DOPCIE_A> for bool {
280 #[inline(always)]
281 fn from(variant: DOPCIE_A) -> Self {
282 variant as u8 != 0
283 }
284}
285impl DOPCIE_R {
286 #[doc = "Get enumerated values variant"]
287 #[inline(always)]
288 pub fn variant(&self) -> DOPCIE_A {
289 match self.bits {
290 false => DOPCIE_A::_0,
291 true => DOPCIE_A::_1,
292 }
293 }
294 #[doc = "Checks if the value of the field is `_0`"]
295 #[inline(always)]
296 pub fn is_0(&self) -> bool {
297 *self == DOPCIE_A::_0
298 }
299 #[doc = "Checks if the value of the field is `_1`"]
300 #[inline(always)]
301 pub fn is_1(&self) -> bool {
302 *self == DOPCIE_A::_1
303 }
304}
305#[doc = "Field `DOPCIE` writer - Data Operation Circuit Interrupt Enable"]
306pub type DOPCIE_W<'a, const O: u8> = crate::BitWriter<'a, u8, DOCR_SPEC, DOPCIE_A, O>;
307impl<'a, const O: u8> DOPCIE_W<'a, O> {
308 #[doc = "Disables interrupts from the data operation circuit."]
309 #[inline(always)]
310 pub fn _0(self) -> &'a mut W {
311 self.variant(DOPCIE_A::_0)
312 }
313 #[doc = "Enables interrupts from the data operation circuit."]
314 #[inline(always)]
315 pub fn _1(self) -> &'a mut W {
316 self.variant(DOPCIE_A::_1)
317 }
318}
319impl R {
320 #[doc = "Bits 0:1 - Operating Mode Select"]
321 #[inline(always)]
322 pub fn oms(&self) -> OMS_R {
323 OMS_R::new(self.bits & 3)
324 }
325 #[doc = "Bit 3 - Data Operation Bit Width Select"]
326 #[inline(always)]
327 pub fn dobw(&self) -> DOBW_R {
328 DOBW_R::new(((self.bits >> 3) & 1) != 0)
329 }
330 #[doc = "Bits 4:6 - Detection Condition Select"]
331 #[inline(always)]
332 pub fn dcsel(&self) -> DCSEL_R {
333 DCSEL_R::new((self.bits >> 4) & 7)
334 }
335 #[doc = "Bit 7 - Data Operation Circuit Interrupt Enable"]
336 #[inline(always)]
337 pub fn dopcie(&self) -> DOPCIE_R {
338 DOPCIE_R::new(((self.bits >> 7) & 1) != 0)
339 }
340}
341impl W {
342 #[doc = "Bits 0:1 - Operating Mode Select"]
343 #[inline(always)]
344 #[must_use]
345 pub fn oms(&mut self) -> OMS_W<0> {
346 OMS_W::new(self)
347 }
348 #[doc = "Bit 3 - Data Operation Bit Width Select"]
349 #[inline(always)]
350 #[must_use]
351 pub fn dobw(&mut self) -> DOBW_W<3> {
352 DOBW_W::new(self)
353 }
354 #[doc = "Bits 4:6 - Detection Condition Select"]
355 #[inline(always)]
356 #[must_use]
357 pub fn dcsel(&mut self) -> DCSEL_W<4> {
358 DCSEL_W::new(self)
359 }
360 #[doc = "Bit 7 - Data Operation Circuit Interrupt Enable"]
361 #[inline(always)]
362 #[must_use]
363 pub fn dopcie(&mut self) -> DOPCIE_W<7> {
364 DOPCIE_W::new(self)
365 }
366 #[doc = "Writes raw bits to the register."]
367 #[inline(always)]
368 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
369 self.0.bits(bits);
370 self
371 }
372}
373#[doc = "DOC Control Register\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 [docr](index.html) module"]
374pub struct DOCR_SPEC;
375impl crate::RegisterSpec for DOCR_SPEC {
376 type Ux = u8;
377}
378#[doc = "`read()` method returns [docr::R](R) reader structure"]
379impl crate::Readable for DOCR_SPEC {
380 type Reader = R;
381}
382#[doc = "`write(|w| ..)` method takes [docr::W](W) writer structure"]
383impl crate::Writable for DOCR_SPEC {
384 type Writer = W;
385 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
386 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
387}
388#[doc = "`reset()` method sets DOCR to value 0"]
389impl crate::Resettable for DOCR_SPEC {
390 const RESET_VALUE: Self::Ux = 0;
391}