tm4c129x/adc0/
dcctl5.rs

1#[doc = "Reader of register DCCTL5"]
2pub type R = crate::R<u32, super::DCCTL5>;
3#[doc = "Writer for register DCCTL5"]
4pub type W = crate::W<u32, super::DCCTL5>;
5#[doc = "Register DCCTL5 `reset()`'s with value 0"]
6impl crate::ResetValue for super::DCCTL5 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Comparison Interrupt Mode\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum CIM_A {
17    #[doc = "0: Always"]
18    ALWAYS = 0,
19    #[doc = "1: Once"]
20    ONCE = 1,
21    #[doc = "2: Hysteresis Always"]
22    HALWAYS = 2,
23    #[doc = "3: Hysteresis Once"]
24    HONCE = 3,
25}
26impl From<CIM_A> for u8 {
27    #[inline(always)]
28    fn from(variant: CIM_A) -> Self {
29        variant as _
30    }
31}
32#[doc = "Reader of field `CIM`"]
33pub type CIM_R = crate::R<u8, CIM_A>;
34impl CIM_R {
35    #[doc = r"Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> CIM_A {
38        match self.bits {
39            0 => CIM_A::ALWAYS,
40            1 => CIM_A::ONCE,
41            2 => CIM_A::HALWAYS,
42            3 => CIM_A::HONCE,
43            _ => unreachable!(),
44        }
45    }
46    #[doc = "Checks if the value of the field is `ALWAYS`"]
47    #[inline(always)]
48    pub fn is_always(&self) -> bool {
49        *self == CIM_A::ALWAYS
50    }
51    #[doc = "Checks if the value of the field is `ONCE`"]
52    #[inline(always)]
53    pub fn is_once(&self) -> bool {
54        *self == CIM_A::ONCE
55    }
56    #[doc = "Checks if the value of the field is `HALWAYS`"]
57    #[inline(always)]
58    pub fn is_halways(&self) -> bool {
59        *self == CIM_A::HALWAYS
60    }
61    #[doc = "Checks if the value of the field is `HONCE`"]
62    #[inline(always)]
63    pub fn is_honce(&self) -> bool {
64        *self == CIM_A::HONCE
65    }
66}
67#[doc = "Write proxy for field `CIM`"]
68pub struct CIM_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> CIM_W<'a> {
72    #[doc = r"Writes `variant` to the field"]
73    #[inline(always)]
74    pub fn variant(self, variant: CIM_A) -> &'a mut W {
75        {
76            self.bits(variant.into())
77        }
78    }
79    #[doc = "Always"]
80    #[inline(always)]
81    pub fn always(self) -> &'a mut W {
82        self.variant(CIM_A::ALWAYS)
83    }
84    #[doc = "Once"]
85    #[inline(always)]
86    pub fn once(self) -> &'a mut W {
87        self.variant(CIM_A::ONCE)
88    }
89    #[doc = "Hysteresis Always"]
90    #[inline(always)]
91    pub fn halways(self) -> &'a mut W {
92        self.variant(CIM_A::HALWAYS)
93    }
94    #[doc = "Hysteresis Once"]
95    #[inline(always)]
96    pub fn honce(self) -> &'a mut W {
97        self.variant(CIM_A::HONCE)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
103        self.w
104    }
105}
106#[doc = "Comparison Interrupt Condition\n\nValue on reset: 0"]
107#[derive(Clone, Copy, Debug, PartialEq)]
108#[repr(u8)]
109pub enum CIC_A {
110    #[doc = "0: Low Band"]
111    LOW = 0,
112    #[doc = "1: Mid Band"]
113    MID = 1,
114    #[doc = "3: High Band"]
115    HIGH = 3,
116}
117impl From<CIC_A> for u8 {
118    #[inline(always)]
119    fn from(variant: CIC_A) -> Self {
120        variant as _
121    }
122}
123#[doc = "Reader of field `CIC`"]
124pub type CIC_R = crate::R<u8, CIC_A>;
125impl CIC_R {
126    #[doc = r"Get enumerated values variant"]
127    #[inline(always)]
128    pub fn variant(&self) -> crate::Variant<u8, CIC_A> {
129        use crate::Variant::*;
130        match self.bits {
131            0 => Val(CIC_A::LOW),
132            1 => Val(CIC_A::MID),
133            3 => Val(CIC_A::HIGH),
134            i => Res(i),
135        }
136    }
137    #[doc = "Checks if the value of the field is `LOW`"]
138    #[inline(always)]
139    pub fn is_low(&self) -> bool {
140        *self == CIC_A::LOW
141    }
142    #[doc = "Checks if the value of the field is `MID`"]
143    #[inline(always)]
144    pub fn is_mid(&self) -> bool {
145        *self == CIC_A::MID
146    }
147    #[doc = "Checks if the value of the field is `HIGH`"]
148    #[inline(always)]
149    pub fn is_high(&self) -> bool {
150        *self == CIC_A::HIGH
151    }
152}
153#[doc = "Write proxy for field `CIC`"]
154pub struct CIC_W<'a> {
155    w: &'a mut W,
156}
157impl<'a> CIC_W<'a> {
158    #[doc = r"Writes `variant` to the field"]
159    #[inline(always)]
160    pub fn variant(self, variant: CIC_A) -> &'a mut W {
161        unsafe { self.bits(variant.into()) }
162    }
163    #[doc = "Low Band"]
164    #[inline(always)]
165    pub fn low(self) -> &'a mut W {
166        self.variant(CIC_A::LOW)
167    }
168    #[doc = "Mid Band"]
169    #[inline(always)]
170    pub fn mid(self) -> &'a mut W {
171        self.variant(CIC_A::MID)
172    }
173    #[doc = "High Band"]
174    #[inline(always)]
175    pub fn high(self) -> &'a mut W {
176        self.variant(CIC_A::HIGH)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub unsafe fn bits(self, value: u8) -> &'a mut W {
181        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
182        self.w
183    }
184}
185#[doc = "Reader of field `CIE`"]
186pub type CIE_R = crate::R<bool, bool>;
187#[doc = "Write proxy for field `CIE`"]
188pub struct CIE_W<'a> {
189    w: &'a mut W,
190}
191impl<'a> CIE_W<'a> {
192    #[doc = r"Sets the field bit"]
193    #[inline(always)]
194    pub fn set_bit(self) -> &'a mut W {
195        self.bit(true)
196    }
197    #[doc = r"Clears the field bit"]
198    #[inline(always)]
199    pub fn clear_bit(self) -> &'a mut W {
200        self.bit(false)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub fn bit(self, value: bool) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
206        self.w
207    }
208}
209#[doc = "Comparison Trigger Mode\n\nValue on reset: 0"]
210#[derive(Clone, Copy, Debug, PartialEq)]
211#[repr(u8)]
212pub enum CTM_A {
213    #[doc = "0: Always"]
214    ALWAYS = 0,
215    #[doc = "1: Once"]
216    ONCE = 1,
217    #[doc = "2: Hysteresis Always"]
218    HALWAYS = 2,
219    #[doc = "3: Hysteresis Once"]
220    HONCE = 3,
221}
222impl From<CTM_A> for u8 {
223    #[inline(always)]
224    fn from(variant: CTM_A) -> Self {
225        variant as _
226    }
227}
228#[doc = "Reader of field `CTM`"]
229pub type CTM_R = crate::R<u8, CTM_A>;
230impl CTM_R {
231    #[doc = r"Get enumerated values variant"]
232    #[inline(always)]
233    pub fn variant(&self) -> CTM_A {
234        match self.bits {
235            0 => CTM_A::ALWAYS,
236            1 => CTM_A::ONCE,
237            2 => CTM_A::HALWAYS,
238            3 => CTM_A::HONCE,
239            _ => unreachable!(),
240        }
241    }
242    #[doc = "Checks if the value of the field is `ALWAYS`"]
243    #[inline(always)]
244    pub fn is_always(&self) -> bool {
245        *self == CTM_A::ALWAYS
246    }
247    #[doc = "Checks if the value of the field is `ONCE`"]
248    #[inline(always)]
249    pub fn is_once(&self) -> bool {
250        *self == CTM_A::ONCE
251    }
252    #[doc = "Checks if the value of the field is `HALWAYS`"]
253    #[inline(always)]
254    pub fn is_halways(&self) -> bool {
255        *self == CTM_A::HALWAYS
256    }
257    #[doc = "Checks if the value of the field is `HONCE`"]
258    #[inline(always)]
259    pub fn is_honce(&self) -> bool {
260        *self == CTM_A::HONCE
261    }
262}
263#[doc = "Write proxy for field `CTM`"]
264pub struct CTM_W<'a> {
265    w: &'a mut W,
266}
267impl<'a> CTM_W<'a> {
268    #[doc = r"Writes `variant` to the field"]
269    #[inline(always)]
270    pub fn variant(self, variant: CTM_A) -> &'a mut W {
271        {
272            self.bits(variant.into())
273        }
274    }
275    #[doc = "Always"]
276    #[inline(always)]
277    pub fn always(self) -> &'a mut W {
278        self.variant(CTM_A::ALWAYS)
279    }
280    #[doc = "Once"]
281    #[inline(always)]
282    pub fn once(self) -> &'a mut W {
283        self.variant(CTM_A::ONCE)
284    }
285    #[doc = "Hysteresis Always"]
286    #[inline(always)]
287    pub fn halways(self) -> &'a mut W {
288        self.variant(CTM_A::HALWAYS)
289    }
290    #[doc = "Hysteresis Once"]
291    #[inline(always)]
292    pub fn honce(self) -> &'a mut W {
293        self.variant(CTM_A::HONCE)
294    }
295    #[doc = r"Writes raw bits to the field"]
296    #[inline(always)]
297    pub fn bits(self, value: u8) -> &'a mut W {
298        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
299        self.w
300    }
301}
302#[doc = "Comparison Trigger Condition\n\nValue on reset: 0"]
303#[derive(Clone, Copy, Debug, PartialEq)]
304#[repr(u8)]
305pub enum CTC_A {
306    #[doc = "0: Low Band"]
307    LOW = 0,
308    #[doc = "1: Mid Band"]
309    MID = 1,
310    #[doc = "3: High Band"]
311    HIGH = 3,
312}
313impl From<CTC_A> for u8 {
314    #[inline(always)]
315    fn from(variant: CTC_A) -> Self {
316        variant as _
317    }
318}
319#[doc = "Reader of field `CTC`"]
320pub type CTC_R = crate::R<u8, CTC_A>;
321impl CTC_R {
322    #[doc = r"Get enumerated values variant"]
323    #[inline(always)]
324    pub fn variant(&self) -> crate::Variant<u8, CTC_A> {
325        use crate::Variant::*;
326        match self.bits {
327            0 => Val(CTC_A::LOW),
328            1 => Val(CTC_A::MID),
329            3 => Val(CTC_A::HIGH),
330            i => Res(i),
331        }
332    }
333    #[doc = "Checks if the value of the field is `LOW`"]
334    #[inline(always)]
335    pub fn is_low(&self) -> bool {
336        *self == CTC_A::LOW
337    }
338    #[doc = "Checks if the value of the field is `MID`"]
339    #[inline(always)]
340    pub fn is_mid(&self) -> bool {
341        *self == CTC_A::MID
342    }
343    #[doc = "Checks if the value of the field is `HIGH`"]
344    #[inline(always)]
345    pub fn is_high(&self) -> bool {
346        *self == CTC_A::HIGH
347    }
348}
349#[doc = "Write proxy for field `CTC`"]
350pub struct CTC_W<'a> {
351    w: &'a mut W,
352}
353impl<'a> CTC_W<'a> {
354    #[doc = r"Writes `variant` to the field"]
355    #[inline(always)]
356    pub fn variant(self, variant: CTC_A) -> &'a mut W {
357        unsafe { self.bits(variant.into()) }
358    }
359    #[doc = "Low Band"]
360    #[inline(always)]
361    pub fn low(self) -> &'a mut W {
362        self.variant(CTC_A::LOW)
363    }
364    #[doc = "Mid Band"]
365    #[inline(always)]
366    pub fn mid(self) -> &'a mut W {
367        self.variant(CTC_A::MID)
368    }
369    #[doc = "High Band"]
370    #[inline(always)]
371    pub fn high(self) -> &'a mut W {
372        self.variant(CTC_A::HIGH)
373    }
374    #[doc = r"Writes raw bits to the field"]
375    #[inline(always)]
376    pub unsafe fn bits(self, value: u8) -> &'a mut W {
377        self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
378        self.w
379    }
380}
381#[doc = "Reader of field `CTE`"]
382pub type CTE_R = crate::R<bool, bool>;
383#[doc = "Write proxy for field `CTE`"]
384pub struct CTE_W<'a> {
385    w: &'a mut W,
386}
387impl<'a> CTE_W<'a> {
388    #[doc = r"Sets the field bit"]
389    #[inline(always)]
390    pub fn set_bit(self) -> &'a mut W {
391        self.bit(true)
392    }
393    #[doc = r"Clears the field bit"]
394    #[inline(always)]
395    pub fn clear_bit(self) -> &'a mut W {
396        self.bit(false)
397    }
398    #[doc = r"Writes raw bits to the field"]
399    #[inline(always)]
400    pub fn bit(self, value: bool) -> &'a mut W {
401        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
402        self.w
403    }
404}
405impl R {
406    #[doc = "Bits 0:1 - Comparison Interrupt Mode"]
407    #[inline(always)]
408    pub fn cim(&self) -> CIM_R {
409        CIM_R::new((self.bits & 0x03) as u8)
410    }
411    #[doc = "Bits 2:3 - Comparison Interrupt Condition"]
412    #[inline(always)]
413    pub fn cic(&self) -> CIC_R {
414        CIC_R::new(((self.bits >> 2) & 0x03) as u8)
415    }
416    #[doc = "Bit 4 - Comparison Interrupt Enable"]
417    #[inline(always)]
418    pub fn cie(&self) -> CIE_R {
419        CIE_R::new(((self.bits >> 4) & 0x01) != 0)
420    }
421    #[doc = "Bits 8:9 - Comparison Trigger Mode"]
422    #[inline(always)]
423    pub fn ctm(&self) -> CTM_R {
424        CTM_R::new(((self.bits >> 8) & 0x03) as u8)
425    }
426    #[doc = "Bits 10:11 - Comparison Trigger Condition"]
427    #[inline(always)]
428    pub fn ctc(&self) -> CTC_R {
429        CTC_R::new(((self.bits >> 10) & 0x03) as u8)
430    }
431    #[doc = "Bit 12 - Comparison Trigger Enable"]
432    #[inline(always)]
433    pub fn cte(&self) -> CTE_R {
434        CTE_R::new(((self.bits >> 12) & 0x01) != 0)
435    }
436}
437impl W {
438    #[doc = "Bits 0:1 - Comparison Interrupt Mode"]
439    #[inline(always)]
440    pub fn cim(&mut self) -> CIM_W {
441        CIM_W { w: self }
442    }
443    #[doc = "Bits 2:3 - Comparison Interrupt Condition"]
444    #[inline(always)]
445    pub fn cic(&mut self) -> CIC_W {
446        CIC_W { w: self }
447    }
448    #[doc = "Bit 4 - Comparison Interrupt Enable"]
449    #[inline(always)]
450    pub fn cie(&mut self) -> CIE_W {
451        CIE_W { w: self }
452    }
453    #[doc = "Bits 8:9 - Comparison Trigger Mode"]
454    #[inline(always)]
455    pub fn ctm(&mut self) -> CTM_W {
456        CTM_W { w: self }
457    }
458    #[doc = "Bits 10:11 - Comparison Trigger Condition"]
459    #[inline(always)]
460    pub fn ctc(&mut self) -> CTC_W {
461        CTC_W { w: self }
462    }
463    #[doc = "Bit 12 - Comparison Trigger Enable"]
464    #[inline(always)]
465    pub fn cte(&mut self) -> CTE_W {
466        CTE_W { w: self }
467    }
468}