mk66f18/pdb0/
dacintc.rs

1#[doc = "Reader of register DACINTC%s"]
2pub type R = crate::R<u32, super::DACINTC>;
3#[doc = "Writer for register DACINTC%s"]
4pub type W = crate::W<u32, super::DACINTC>;
5#[doc = "Register DACINTC%s `reset()`'s with value 0"]
6impl crate::ResetValue for super::DACINTC {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "DAC Interval Trigger Enable\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum TOE_A {
16    #[doc = "0: DAC interval trigger disabled."]
17    _0,
18    #[doc = "1: DAC interval trigger enabled."]
19    _1,
20}
21impl From<TOE_A> for bool {
22    #[inline(always)]
23    fn from(variant: TOE_A) -> Self {
24        match variant {
25            TOE_A::_0 => false,
26            TOE_A::_1 => true,
27        }
28    }
29}
30#[doc = "Reader of field `TOE`"]
31pub type TOE_R = crate::R<bool, TOE_A>;
32impl TOE_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> TOE_A {
36        match self.bits {
37            false => TOE_A::_0,
38            true => TOE_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == TOE_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == TOE_A::_1
50    }
51}
52#[doc = "Write proxy for field `TOE`"]
53pub struct TOE_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> TOE_W<'a> {
57    #[doc = r"Writes `variant` to the field"]
58    #[inline(always)]
59    pub fn variant(self, variant: TOE_A) -> &'a mut W {
60        {
61            self.bit(variant.into())
62        }
63    }
64    #[doc = "DAC interval trigger disabled."]
65    #[inline(always)]
66    pub fn _0(self) -> &'a mut W {
67        self.variant(TOE_A::_0)
68    }
69    #[doc = "DAC interval trigger enabled."]
70    #[inline(always)]
71    pub fn _1(self) -> &'a mut W {
72        self.variant(TOE_A::_1)
73    }
74    #[doc = r"Sets the field bit"]
75    #[inline(always)]
76    pub fn set_bit(self) -> &'a mut W {
77        self.bit(true)
78    }
79    #[doc = r"Clears the field bit"]
80    #[inline(always)]
81    pub fn clear_bit(self) -> &'a mut W {
82        self.bit(false)
83    }
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub fn bit(self, value: bool) -> &'a mut W {
87        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
88        self.w
89    }
90}
91#[doc = "DAC External Trigger Input Enable\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum EXT_A {
94    #[doc = "0: DAC external trigger input disabled. DAC interval counter is reset and counting starts when a rising edge is detected on selected trigger input source or software trigger is selected and SWTRIG is written with 1."]
95    _0,
96    #[doc = "1: DAC external trigger input enabled. DAC interval counter is bypassed and DAC external trigger input triggers the DAC interval trigger."]
97    _1,
98}
99impl From<EXT_A> for bool {
100    #[inline(always)]
101    fn from(variant: EXT_A) -> Self {
102        match variant {
103            EXT_A::_0 => false,
104            EXT_A::_1 => true,
105        }
106    }
107}
108#[doc = "Reader of field `EXT`"]
109pub type EXT_R = crate::R<bool, EXT_A>;
110impl EXT_R {
111    #[doc = r"Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> EXT_A {
114        match self.bits {
115            false => EXT_A::_0,
116            true => EXT_A::_1,
117        }
118    }
119    #[doc = "Checks if the value of the field is `_0`"]
120    #[inline(always)]
121    pub fn is_0(&self) -> bool {
122        *self == EXT_A::_0
123    }
124    #[doc = "Checks if the value of the field is `_1`"]
125    #[inline(always)]
126    pub fn is_1(&self) -> bool {
127        *self == EXT_A::_1
128    }
129}
130#[doc = "Write proxy for field `EXT`"]
131pub struct EXT_W<'a> {
132    w: &'a mut W,
133}
134impl<'a> EXT_W<'a> {
135    #[doc = r"Writes `variant` to the field"]
136    #[inline(always)]
137    pub fn variant(self, variant: EXT_A) -> &'a mut W {
138        {
139            self.bit(variant.into())
140        }
141    }
142    #[doc = "DAC external trigger input disabled. DAC interval counter is reset and counting starts when a rising edge is detected on selected trigger input source or software trigger is selected and SWTRIG is written with 1."]
143    #[inline(always)]
144    pub fn _0(self) -> &'a mut W {
145        self.variant(EXT_A::_0)
146    }
147    #[doc = "DAC external trigger input enabled. DAC interval counter is bypassed and DAC external trigger input triggers the DAC interval trigger."]
148    #[inline(always)]
149    pub fn _1(self) -> &'a mut W {
150        self.variant(EXT_A::_1)
151    }
152    #[doc = r"Sets the field bit"]
153    #[inline(always)]
154    pub fn set_bit(self) -> &'a mut W {
155        self.bit(true)
156    }
157    #[doc = r"Clears the field bit"]
158    #[inline(always)]
159    pub fn clear_bit(self) -> &'a mut W {
160        self.bit(false)
161    }
162    #[doc = r"Writes raw bits to the field"]
163    #[inline(always)]
164    pub fn bit(self, value: bool) -> &'a mut W {
165        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
166        self.w
167    }
168}
169impl R {
170    #[doc = "Bit 0 - DAC Interval Trigger Enable"]
171    #[inline(always)]
172    pub fn toe(&self) -> TOE_R {
173        TOE_R::new((self.bits & 0x01) != 0)
174    }
175    #[doc = "Bit 1 - DAC External Trigger Input Enable"]
176    #[inline(always)]
177    pub fn ext(&self) -> EXT_R {
178        EXT_R::new(((self.bits >> 1) & 0x01) != 0)
179    }
180}
181impl W {
182    #[doc = "Bit 0 - DAC Interval Trigger Enable"]
183    #[inline(always)]
184    pub fn toe(&mut self) -> TOE_W {
185        TOE_W { w: self }
186    }
187    #[doc = "Bit 1 - DAC External Trigger Input Enable"]
188    #[inline(always)]
189    pub fn ext(&mut self) -> EXT_W {
190        EXT_W { w: self }
191    }
192}