1#[doc = "Register `DAC1CFG0` reader"]
2pub type R = crate::R<DAC1CFG0_SPEC>;
3#[doc = "Register `DAC1CFG0` writer"]
4pub type W = crate::W<DAC1CFG0_SPEC>;
5#[doc = "Field `FREQ` reader - Integer Frequency Divider Value"]
6pub type FREQ_R = crate::FieldReader<u32>;
7#[doc = "Field `FREQ` writer - Integer Frequency Divider Value"]
8pub type FREQ_W<'a, REG> = crate::FieldWriter<'a, REG, 20, u32>;
9#[doc = "Enables and sets the Mode for DAC1\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum MODE_A {
13 #[doc = "0: disable/switch-off DAC"]
14 VALUE1 = 0,
15 #[doc = "1: Single Value Mode"]
16 VALUE2 = 1,
17 #[doc = "2: Data Mode"]
18 VALUE3 = 2,
19 #[doc = "3: Patgen Mode"]
20 VALUE4 = 3,
21 #[doc = "4: Noise Mode"]
22 VALUE5 = 4,
23 #[doc = "5: Ramp Mode"]
24 VALUE6 = 5,
25 #[doc = "6: na"]
26 VALUE7 = 6,
27 #[doc = "7: na"]
28 VALUE8 = 7,
29}
30impl From<MODE_A> for u8 {
31 #[inline(always)]
32 fn from(variant: MODE_A) -> Self {
33 variant as _
34 }
35}
36impl crate::FieldSpec for MODE_A {
37 type Ux = u8;
38}
39impl crate::IsEnum for MODE_A {}
40#[doc = "Field `MODE` reader - Enables and sets the Mode for DAC1"]
41pub type MODE_R = crate::FieldReader<MODE_A>;
42impl MODE_R {
43 #[doc = "Get enumerated values variant"]
44 #[inline(always)]
45 pub const fn variant(&self) -> MODE_A {
46 match self.bits {
47 0 => MODE_A::VALUE1,
48 1 => MODE_A::VALUE2,
49 2 => MODE_A::VALUE3,
50 3 => MODE_A::VALUE4,
51 4 => MODE_A::VALUE5,
52 5 => MODE_A::VALUE6,
53 6 => MODE_A::VALUE7,
54 7 => MODE_A::VALUE8,
55 _ => unreachable!(),
56 }
57 }
58 #[doc = "disable/switch-off DAC"]
59 #[inline(always)]
60 pub fn is_value1(&self) -> bool {
61 *self == MODE_A::VALUE1
62 }
63 #[doc = "Single Value Mode"]
64 #[inline(always)]
65 pub fn is_value2(&self) -> bool {
66 *self == MODE_A::VALUE2
67 }
68 #[doc = "Data Mode"]
69 #[inline(always)]
70 pub fn is_value3(&self) -> bool {
71 *self == MODE_A::VALUE3
72 }
73 #[doc = "Patgen Mode"]
74 #[inline(always)]
75 pub fn is_value4(&self) -> bool {
76 *self == MODE_A::VALUE4
77 }
78 #[doc = "Noise Mode"]
79 #[inline(always)]
80 pub fn is_value5(&self) -> bool {
81 *self == MODE_A::VALUE5
82 }
83 #[doc = "Ramp Mode"]
84 #[inline(always)]
85 pub fn is_value6(&self) -> bool {
86 *self == MODE_A::VALUE6
87 }
88 #[doc = "na"]
89 #[inline(always)]
90 pub fn is_value7(&self) -> bool {
91 *self == MODE_A::VALUE7
92 }
93 #[doc = "na"]
94 #[inline(always)]
95 pub fn is_value8(&self) -> bool {
96 *self == MODE_A::VALUE8
97 }
98}
99#[doc = "Field `MODE` writer - Enables and sets the Mode for DAC1"]
100pub type MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MODE_A, crate::Safe>;
101impl<'a, REG> MODE_W<'a, REG>
102where
103 REG: crate::Writable + crate::RegisterSpec,
104 REG::Ux: From<u8>,
105{
106 #[doc = "disable/switch-off DAC"]
107 #[inline(always)]
108 pub fn value1(self) -> &'a mut crate::W<REG> {
109 self.variant(MODE_A::VALUE1)
110 }
111 #[doc = "Single Value Mode"]
112 #[inline(always)]
113 pub fn value2(self) -> &'a mut crate::W<REG> {
114 self.variant(MODE_A::VALUE2)
115 }
116 #[doc = "Data Mode"]
117 #[inline(always)]
118 pub fn value3(self) -> &'a mut crate::W<REG> {
119 self.variant(MODE_A::VALUE3)
120 }
121 #[doc = "Patgen Mode"]
122 #[inline(always)]
123 pub fn value4(self) -> &'a mut crate::W<REG> {
124 self.variant(MODE_A::VALUE4)
125 }
126 #[doc = "Noise Mode"]
127 #[inline(always)]
128 pub fn value5(self) -> &'a mut crate::W<REG> {
129 self.variant(MODE_A::VALUE5)
130 }
131 #[doc = "Ramp Mode"]
132 #[inline(always)]
133 pub fn value6(self) -> &'a mut crate::W<REG> {
134 self.variant(MODE_A::VALUE6)
135 }
136 #[doc = "na"]
137 #[inline(always)]
138 pub fn value7(self) -> &'a mut crate::W<REG> {
139 self.variant(MODE_A::VALUE7)
140 }
141 #[doc = "na"]
142 #[inline(always)]
143 pub fn value8(self) -> &'a mut crate::W<REG> {
144 self.variant(MODE_A::VALUE8)
145 }
146}
147#[doc = "Selects between signed and unsigned DAC1 mode\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum SIGN_A {
150 #[doc = "0: DAC expects unsigned input data"]
151 VALUE1 = 0,
152 #[doc = "1: DAC expects signed input data"]
153 VALUE2 = 1,
154}
155impl From<SIGN_A> for bool {
156 #[inline(always)]
157 fn from(variant: SIGN_A) -> Self {
158 variant as u8 != 0
159 }
160}
161#[doc = "Field `SIGN` reader - Selects between signed and unsigned DAC1 mode"]
162pub type SIGN_R = crate::BitReader<SIGN_A>;
163impl SIGN_R {
164 #[doc = "Get enumerated values variant"]
165 #[inline(always)]
166 pub const fn variant(&self) -> SIGN_A {
167 match self.bits {
168 false => SIGN_A::VALUE1,
169 true => SIGN_A::VALUE2,
170 }
171 }
172 #[doc = "DAC expects unsigned input data"]
173 #[inline(always)]
174 pub fn is_value1(&self) -> bool {
175 *self == SIGN_A::VALUE1
176 }
177 #[doc = "DAC expects signed input data"]
178 #[inline(always)]
179 pub fn is_value2(&self) -> bool {
180 *self == SIGN_A::VALUE2
181 }
182}
183#[doc = "Field `SIGN` writer - Selects between signed and unsigned DAC1 mode"]
184pub type SIGN_W<'a, REG> = crate::BitWriter<'a, REG, SIGN_A>;
185impl<'a, REG> SIGN_W<'a, REG>
186where
187 REG: crate::Writable + crate::RegisterSpec,
188{
189 #[doc = "DAC expects unsigned input data"]
190 #[inline(always)]
191 pub fn value1(self) -> &'a mut crate::W<REG> {
192 self.variant(SIGN_A::VALUE1)
193 }
194 #[doc = "DAC expects signed input data"]
195 #[inline(always)]
196 pub fn value2(self) -> &'a mut crate::W<REG> {
197 self.variant(SIGN_A::VALUE2)
198 }
199}
200#[doc = "Field `FIFOIND` reader - Current write position inside the data FIFO"]
201pub type FIFOIND_R = crate::FieldReader;
202#[doc = "Indicate if the FIFO is empty\n\nValue on reset: 0"]
203#[derive(Clone, Copy, Debug, PartialEq, Eq)]
204pub enum FIFOEMP_A {
205 #[doc = "0: FIFO not empty"]
206 VALUE1 = 0,
207 #[doc = "1: FIFO empty"]
208 VALUE2 = 1,
209}
210impl From<FIFOEMP_A> for bool {
211 #[inline(always)]
212 fn from(variant: FIFOEMP_A) -> Self {
213 variant as u8 != 0
214 }
215}
216#[doc = "Field `FIFOEMP` reader - Indicate if the FIFO is empty"]
217pub type FIFOEMP_R = crate::BitReader<FIFOEMP_A>;
218impl FIFOEMP_R {
219 #[doc = "Get enumerated values variant"]
220 #[inline(always)]
221 pub const fn variant(&self) -> FIFOEMP_A {
222 match self.bits {
223 false => FIFOEMP_A::VALUE1,
224 true => FIFOEMP_A::VALUE2,
225 }
226 }
227 #[doc = "FIFO not empty"]
228 #[inline(always)]
229 pub fn is_value1(&self) -> bool {
230 *self == FIFOEMP_A::VALUE1
231 }
232 #[doc = "FIFO empty"]
233 #[inline(always)]
234 pub fn is_value2(&self) -> bool {
235 *self == FIFOEMP_A::VALUE2
236 }
237}
238#[doc = "Indicate if the FIFO is full\n\nValue on reset: 0"]
239#[derive(Clone, Copy, Debug, PartialEq, Eq)]
240pub enum FIFOFUL_A {
241 #[doc = "0: FIFO not full"]
242 VALUE1 = 0,
243 #[doc = "1: FIFO full"]
244 VALUE2 = 1,
245}
246impl From<FIFOFUL_A> for bool {
247 #[inline(always)]
248 fn from(variant: FIFOFUL_A) -> Self {
249 variant as u8 != 0
250 }
251}
252#[doc = "Field `FIFOFUL` reader - Indicate if the FIFO is full"]
253pub type FIFOFUL_R = crate::BitReader<FIFOFUL_A>;
254impl FIFOFUL_R {
255 #[doc = "Get enumerated values variant"]
256 #[inline(always)]
257 pub const fn variant(&self) -> FIFOFUL_A {
258 match self.bits {
259 false => FIFOFUL_A::VALUE1,
260 true => FIFOFUL_A::VALUE2,
261 }
262 }
263 #[doc = "FIFO not full"]
264 #[inline(always)]
265 pub fn is_value1(&self) -> bool {
266 *self == FIFOFUL_A::VALUE1
267 }
268 #[doc = "FIFO full"]
269 #[inline(always)]
270 pub fn is_value2(&self) -> bool {
271 *self == FIFOFUL_A::VALUE2
272 }
273}
274#[doc = "Negates the DAC1 output\n\nValue on reset: 0"]
275#[derive(Clone, Copy, Debug, PartialEq, Eq)]
276pub enum NEGATE_A {
277 #[doc = "0: DAC output not negated"]
278 VALUE1 = 0,
279 #[doc = "1: DAC output negated"]
280 VALUE2 = 1,
281}
282impl From<NEGATE_A> for bool {
283 #[inline(always)]
284 fn from(variant: NEGATE_A) -> Self {
285 variant as u8 != 0
286 }
287}
288#[doc = "Field `NEGATE` reader - Negates the DAC1 output"]
289pub type NEGATE_R = crate::BitReader<NEGATE_A>;
290impl NEGATE_R {
291 #[doc = "Get enumerated values variant"]
292 #[inline(always)]
293 pub const fn variant(&self) -> NEGATE_A {
294 match self.bits {
295 false => NEGATE_A::VALUE1,
296 true => NEGATE_A::VALUE2,
297 }
298 }
299 #[doc = "DAC output not negated"]
300 #[inline(always)]
301 pub fn is_value1(&self) -> bool {
302 *self == NEGATE_A::VALUE1
303 }
304 #[doc = "DAC output negated"]
305 #[inline(always)]
306 pub fn is_value2(&self) -> bool {
307 *self == NEGATE_A::VALUE2
308 }
309}
310#[doc = "Field `NEGATE` writer - Negates the DAC1 output"]
311pub type NEGATE_W<'a, REG> = crate::BitWriter<'a, REG, NEGATE_A>;
312impl<'a, REG> NEGATE_W<'a, REG>
313where
314 REG: crate::Writable + crate::RegisterSpec,
315{
316 #[doc = "DAC output not negated"]
317 #[inline(always)]
318 pub fn value1(self) -> &'a mut crate::W<REG> {
319 self.variant(NEGATE_A::VALUE1)
320 }
321 #[doc = "DAC output negated"]
322 #[inline(always)]
323 pub fn value2(self) -> &'a mut crate::W<REG> {
324 self.variant(NEGATE_A::VALUE2)
325 }
326}
327#[doc = "Enable sign output of DAC1 pattern generator\n\nValue on reset: 0"]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329pub enum SIGNEN_A {
330 #[doc = "0: disable"]
331 VALUE1 = 0,
332 #[doc = "1: enable"]
333 VALUE2 = 1,
334}
335impl From<SIGNEN_A> for bool {
336 #[inline(always)]
337 fn from(variant: SIGNEN_A) -> Self {
338 variant as u8 != 0
339 }
340}
341#[doc = "Field `SIGNEN` reader - Enable sign output of DAC1 pattern generator"]
342pub type SIGNEN_R = crate::BitReader<SIGNEN_A>;
343impl SIGNEN_R {
344 #[doc = "Get enumerated values variant"]
345 #[inline(always)]
346 pub const fn variant(&self) -> SIGNEN_A {
347 match self.bits {
348 false => SIGNEN_A::VALUE1,
349 true => SIGNEN_A::VALUE2,
350 }
351 }
352 #[doc = "disable"]
353 #[inline(always)]
354 pub fn is_value1(&self) -> bool {
355 *self == SIGNEN_A::VALUE1
356 }
357 #[doc = "enable"]
358 #[inline(always)]
359 pub fn is_value2(&self) -> bool {
360 *self == SIGNEN_A::VALUE2
361 }
362}
363#[doc = "Field `SIGNEN` writer - Enable sign output of DAC1 pattern generator"]
364pub type SIGNEN_W<'a, REG> = crate::BitWriter<'a, REG, SIGNEN_A>;
365impl<'a, REG> SIGNEN_W<'a, REG>
366where
367 REG: crate::Writable + crate::RegisterSpec,
368{
369 #[doc = "disable"]
370 #[inline(always)]
371 pub fn value1(self) -> &'a mut crate::W<REG> {
372 self.variant(SIGNEN_A::VALUE1)
373 }
374 #[doc = "enable"]
375 #[inline(always)]
376 pub fn value2(self) -> &'a mut crate::W<REG> {
377 self.variant(SIGNEN_A::VALUE2)
378 }
379}
380#[doc = "Enable DAC1 service request interrupt generation\n\nValue on reset: 0"]
381#[derive(Clone, Copy, Debug, PartialEq, Eq)]
382pub enum SREN_A {
383 #[doc = "0: disable"]
384 VALUE1 = 0,
385 #[doc = "1: enable"]
386 VALUE2 = 1,
387}
388impl From<SREN_A> for bool {
389 #[inline(always)]
390 fn from(variant: SREN_A) -> Self {
391 variant as u8 != 0
392 }
393}
394#[doc = "Field `SREN` reader - Enable DAC1 service request interrupt generation"]
395pub type SREN_R = crate::BitReader<SREN_A>;
396impl SREN_R {
397 #[doc = "Get enumerated values variant"]
398 #[inline(always)]
399 pub const fn variant(&self) -> SREN_A {
400 match self.bits {
401 false => SREN_A::VALUE1,
402 true => SREN_A::VALUE2,
403 }
404 }
405 #[doc = "disable"]
406 #[inline(always)]
407 pub fn is_value1(&self) -> bool {
408 *self == SREN_A::VALUE1
409 }
410 #[doc = "enable"]
411 #[inline(always)]
412 pub fn is_value2(&self) -> bool {
413 *self == SREN_A::VALUE2
414 }
415}
416#[doc = "Field `SREN` writer - Enable DAC1 service request interrupt generation"]
417pub type SREN_W<'a, REG> = crate::BitWriter<'a, REG, SREN_A>;
418impl<'a, REG> SREN_W<'a, REG>
419where
420 REG: crate::Writable + crate::RegisterSpec,
421{
422 #[doc = "disable"]
423 #[inline(always)]
424 pub fn value1(self) -> &'a mut crate::W<REG> {
425 self.variant(SREN_A::VALUE1)
426 }
427 #[doc = "enable"]
428 #[inline(always)]
429 pub fn value2(self) -> &'a mut crate::W<REG> {
430 self.variant(SREN_A::VALUE2)
431 }
432}
433#[doc = "RUN indicates the current DAC1 operation status\n\nValue on reset: 0"]
434#[derive(Clone, Copy, Debug, PartialEq, Eq)]
435pub enum RUN_A {
436 #[doc = "0: DAC1 channel disabled"]
437 VALUE1 = 0,
438 #[doc = "1: DAC1 channel in operation"]
439 VALUE2 = 1,
440}
441impl From<RUN_A> for bool {
442 #[inline(always)]
443 fn from(variant: RUN_A) -> Self {
444 variant as u8 != 0
445 }
446}
447#[doc = "Field `RUN` reader - RUN indicates the current DAC1 operation status"]
448pub type RUN_R = crate::BitReader<RUN_A>;
449impl RUN_R {
450 #[doc = "Get enumerated values variant"]
451 #[inline(always)]
452 pub const fn variant(&self) -> RUN_A {
453 match self.bits {
454 false => RUN_A::VALUE1,
455 true => RUN_A::VALUE2,
456 }
457 }
458 #[doc = "DAC1 channel disabled"]
459 #[inline(always)]
460 pub fn is_value1(&self) -> bool {
461 *self == RUN_A::VALUE1
462 }
463 #[doc = "DAC1 channel in operation"]
464 #[inline(always)]
465 pub fn is_value2(&self) -> bool {
466 *self == RUN_A::VALUE2
467 }
468}
469impl R {
470 #[doc = "Bits 0:19 - Integer Frequency Divider Value"]
471 #[inline(always)]
472 pub fn freq(&self) -> FREQ_R {
473 FREQ_R::new(self.bits & 0x000f_ffff)
474 }
475 #[doc = "Bits 20:22 - Enables and sets the Mode for DAC1"]
476 #[inline(always)]
477 pub fn mode(&self) -> MODE_R {
478 MODE_R::new(((self.bits >> 20) & 7) as u8)
479 }
480 #[doc = "Bit 23 - Selects between signed and unsigned DAC1 mode"]
481 #[inline(always)]
482 pub fn sign(&self) -> SIGN_R {
483 SIGN_R::new(((self.bits >> 23) & 1) != 0)
484 }
485 #[doc = "Bits 24:25 - Current write position inside the data FIFO"]
486 #[inline(always)]
487 pub fn fifoind(&self) -> FIFOIND_R {
488 FIFOIND_R::new(((self.bits >> 24) & 3) as u8)
489 }
490 #[doc = "Bit 26 - Indicate if the FIFO is empty"]
491 #[inline(always)]
492 pub fn fifoemp(&self) -> FIFOEMP_R {
493 FIFOEMP_R::new(((self.bits >> 26) & 1) != 0)
494 }
495 #[doc = "Bit 27 - Indicate if the FIFO is full"]
496 #[inline(always)]
497 pub fn fifoful(&self) -> FIFOFUL_R {
498 FIFOFUL_R::new(((self.bits >> 27) & 1) != 0)
499 }
500 #[doc = "Bit 28 - Negates the DAC1 output"]
501 #[inline(always)]
502 pub fn negate(&self) -> NEGATE_R {
503 NEGATE_R::new(((self.bits >> 28) & 1) != 0)
504 }
505 #[doc = "Bit 29 - Enable sign output of DAC1 pattern generator"]
506 #[inline(always)]
507 pub fn signen(&self) -> SIGNEN_R {
508 SIGNEN_R::new(((self.bits >> 29) & 1) != 0)
509 }
510 #[doc = "Bit 30 - Enable DAC1 service request interrupt generation"]
511 #[inline(always)]
512 pub fn sren(&self) -> SREN_R {
513 SREN_R::new(((self.bits >> 30) & 1) != 0)
514 }
515 #[doc = "Bit 31 - RUN indicates the current DAC1 operation status"]
516 #[inline(always)]
517 pub fn run(&self) -> RUN_R {
518 RUN_R::new(((self.bits >> 31) & 1) != 0)
519 }
520}
521impl W {
522 #[doc = "Bits 0:19 - Integer Frequency Divider Value"]
523 #[inline(always)]
524 pub fn freq(&mut self) -> FREQ_W<DAC1CFG0_SPEC> {
525 FREQ_W::new(self, 0)
526 }
527 #[doc = "Bits 20:22 - Enables and sets the Mode for DAC1"]
528 #[inline(always)]
529 pub fn mode(&mut self) -> MODE_W<DAC1CFG0_SPEC> {
530 MODE_W::new(self, 20)
531 }
532 #[doc = "Bit 23 - Selects between signed and unsigned DAC1 mode"]
533 #[inline(always)]
534 pub fn sign(&mut self) -> SIGN_W<DAC1CFG0_SPEC> {
535 SIGN_W::new(self, 23)
536 }
537 #[doc = "Bit 28 - Negates the DAC1 output"]
538 #[inline(always)]
539 pub fn negate(&mut self) -> NEGATE_W<DAC1CFG0_SPEC> {
540 NEGATE_W::new(self, 28)
541 }
542 #[doc = "Bit 29 - Enable sign output of DAC1 pattern generator"]
543 #[inline(always)]
544 pub fn signen(&mut self) -> SIGNEN_W<DAC1CFG0_SPEC> {
545 SIGNEN_W::new(self, 29)
546 }
547 #[doc = "Bit 30 - Enable DAC1 service request interrupt generation"]
548 #[inline(always)]
549 pub fn sren(&mut self) -> SREN_W<DAC1CFG0_SPEC> {
550 SREN_W::new(self, 30)
551 }
552}
553#[doc = "DAC1 Configuration Register 0\n\nYou can [`read`](crate::Reg::read) this register and get [`dac1cfg0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dac1cfg0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
554pub struct DAC1CFG0_SPEC;
555impl crate::RegisterSpec for DAC1CFG0_SPEC {
556 type Ux = u32;
557}
558#[doc = "`read()` method returns [`dac1cfg0::R`](R) reader structure"]
559impl crate::Readable for DAC1CFG0_SPEC {}
560#[doc = "`write(|w| ..)` method takes [`dac1cfg0::W`](W) writer structure"]
561impl crate::Writable for DAC1CFG0_SPEC {
562 type Safety = crate::Unsafe;
563 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
564 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
565}
566#[doc = "`reset()` method sets DAC1CFG0 to value 0"]
567impl crate::Resettable for DAC1CFG0_SPEC {
568 const RESET_VALUE: u32 = 0;
569}