msp432e4/adc0/
dccmp5.rs

1#[doc = r"Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r"Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::DCCMP5 {
10    #[doc = r"Modifies the contents of the register"]
11    #[inline(always)]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        self.register.set(f(&R { bits }, &mut W { bits }).bits);
18    }
19    #[doc = r"Reads the contents of the register"]
20    #[inline(always)]
21    pub fn read(&self) -> R {
22        R {
23            bits: self.register.get(),
24        }
25    }
26    #[doc = r"Writes to the register"]
27    #[inline(always)]
28    pub fn write<F>(&self, f: F)
29    where
30        F: FnOnce(&mut W) -> &mut W,
31    {
32        self.register.set(
33            f(&mut W {
34                bits: Self::reset_value(),
35            })
36            .bits,
37        );
38    }
39    #[doc = r"Reset value of the register"]
40    #[inline(always)]
41    pub const fn reset_value() -> u32 {
42        0
43    }
44    #[doc = r"Writes the reset value to the register"]
45    #[inline(always)]
46    pub fn reset(&self) {
47        self.register.set(Self::reset_value())
48    }
49}
50#[doc = r"Value of the field"]
51pub struct ADC_DCCMP5_COMP0R {
52    bits: u16,
53}
54impl ADC_DCCMP5_COMP0R {
55    #[doc = r"Value of the field as raw bits"]
56    #[inline(always)]
57    pub fn bits(&self) -> u16 {
58        self.bits
59    }
60}
61#[doc = r"Proxy"]
62pub struct _ADC_DCCMP5_COMP0W<'a> {
63    w: &'a mut W,
64}
65impl<'a> _ADC_DCCMP5_COMP0W<'a> {
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub unsafe fn bits(self, value: u16) -> &'a mut W {
69        self.w.bits &= !(4095 << 0);
70        self.w.bits |= ((value as u32) & 4095) << 0;
71        self.w
72    }
73}
74#[doc = r"Value of the field"]
75pub struct ADC_DCCMP5_COMP1R {
76    bits: u16,
77}
78impl ADC_DCCMP5_COMP1R {
79    #[doc = r"Value of the field as raw bits"]
80    #[inline(always)]
81    pub fn bits(&self) -> u16 {
82        self.bits
83    }
84}
85#[doc = r"Proxy"]
86pub struct _ADC_DCCMP5_COMP1W<'a> {
87    w: &'a mut W,
88}
89impl<'a> _ADC_DCCMP5_COMP1W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u16) -> &'a mut W {
93        self.w.bits &= !(4095 << 16);
94        self.w.bits |= ((value as u32) & 4095) << 16;
95        self.w
96    }
97}
98impl R {
99    #[doc = r"Value of the register as raw bits"]
100    #[inline(always)]
101    pub fn bits(&self) -> u32 {
102        self.bits
103    }
104    #[doc = "Bits 0:11 - Compare 0"]
105    #[inline(always)]
106    pub fn adc_dccmp5_comp0(&self) -> ADC_DCCMP5_COMP0R {
107        let bits = ((self.bits >> 0) & 4095) as u16;
108        ADC_DCCMP5_COMP0R { bits }
109    }
110    #[doc = "Bits 16:27 - Compare 1"]
111    #[inline(always)]
112    pub fn adc_dccmp5_comp1(&self) -> ADC_DCCMP5_COMP1R {
113        let bits = ((self.bits >> 16) & 4095) as u16;
114        ADC_DCCMP5_COMP1R { bits }
115    }
116}
117impl W {
118    #[doc = r"Writes raw bits to the register"]
119    #[inline(always)]
120    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
121        self.bits = bits;
122        self
123    }
124    #[doc = "Bits 0:11 - Compare 0"]
125    #[inline(always)]
126    pub fn adc_dccmp5_comp0(&mut self) -> _ADC_DCCMP5_COMP0W {
127        _ADC_DCCMP5_COMP0W { w: self }
128    }
129    #[doc = "Bits 16:27 - Compare 1"]
130    #[inline(always)]
131    pub fn adc_dccmp5_comp1(&mut self) -> _ADC_DCCMP5_COMP1W {
132        _ADC_DCCMP5_COMP1W { w: self }
133    }
134}