tm4c123x/adc0/
spc.rs

1#[doc = "Reader of register SPC"]
2pub type R = crate::R<u32, super::SPC>;
3#[doc = "Writer for register SPC"]
4pub type W = crate::W<u32, super::SPC>;
5#[doc = "Register SPC `reset()`'s with value 0"]
6impl crate::ResetValue for super::SPC {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Phase Difference\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum PHASE_A {
17    #[doc = "0: ADC sample lags by 0.0"]
18    _0 = 0,
19    #[doc = "1: ADC sample lags by 22.5"]
20    _22_5 = 1,
21    #[doc = "2: ADC sample lags by 45.0"]
22    _45 = 2,
23    #[doc = "3: ADC sample lags by 67.5"]
24    _67_5 = 3,
25    #[doc = "4: ADC sample lags by 90.0"]
26    _90 = 4,
27    #[doc = "5: ADC sample lags by 112.5"]
28    _112_5 = 5,
29    #[doc = "6: ADC sample lags by 135.0"]
30    _135 = 6,
31    #[doc = "7: ADC sample lags by 157.5"]
32    _157_5 = 7,
33    #[doc = "8: ADC sample lags by 180.0"]
34    _180 = 8,
35    #[doc = "9: ADC sample lags by 202.5"]
36    _202_5 = 9,
37    #[doc = "10: ADC sample lags by 225.0"]
38    _225 = 10,
39    #[doc = "11: ADC sample lags by 247.5"]
40    _247_5 = 11,
41    #[doc = "12: ADC sample lags by 270.0"]
42    _270 = 12,
43    #[doc = "13: ADC sample lags by 292.5"]
44    _292_5 = 13,
45    #[doc = "14: ADC sample lags by 315.0"]
46    _315 = 14,
47    #[doc = "15: ADC sample lags by 337.5"]
48    _337_5 = 15,
49}
50impl From<PHASE_A> for u8 {
51    #[inline(always)]
52    fn from(variant: PHASE_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Reader of field `PHASE`"]
57pub type PHASE_R = crate::R<u8, PHASE_A>;
58impl PHASE_R {
59    #[doc = r"Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> PHASE_A {
62        match self.bits {
63            0 => PHASE_A::_0,
64            1 => PHASE_A::_22_5,
65            2 => PHASE_A::_45,
66            3 => PHASE_A::_67_5,
67            4 => PHASE_A::_90,
68            5 => PHASE_A::_112_5,
69            6 => PHASE_A::_135,
70            7 => PHASE_A::_157_5,
71            8 => PHASE_A::_180,
72            9 => PHASE_A::_202_5,
73            10 => PHASE_A::_225,
74            11 => PHASE_A::_247_5,
75            12 => PHASE_A::_270,
76            13 => PHASE_A::_292_5,
77            14 => PHASE_A::_315,
78            15 => PHASE_A::_337_5,
79            _ => unreachable!(),
80        }
81    }
82    #[doc = "Checks if the value of the field is `_0`"]
83    #[inline(always)]
84    pub fn is_0(&self) -> bool {
85        *self == PHASE_A::_0
86    }
87    #[doc = "Checks if the value of the field is `_22_5`"]
88    #[inline(always)]
89    pub fn is_22_5(&self) -> bool {
90        *self == PHASE_A::_22_5
91    }
92    #[doc = "Checks if the value of the field is `_45`"]
93    #[inline(always)]
94    pub fn is_45(&self) -> bool {
95        *self == PHASE_A::_45
96    }
97    #[doc = "Checks if the value of the field is `_67_5`"]
98    #[inline(always)]
99    pub fn is_67_5(&self) -> bool {
100        *self == PHASE_A::_67_5
101    }
102    #[doc = "Checks if the value of the field is `_90`"]
103    #[inline(always)]
104    pub fn is_90(&self) -> bool {
105        *self == PHASE_A::_90
106    }
107    #[doc = "Checks if the value of the field is `_112_5`"]
108    #[inline(always)]
109    pub fn is_112_5(&self) -> bool {
110        *self == PHASE_A::_112_5
111    }
112    #[doc = "Checks if the value of the field is `_135`"]
113    #[inline(always)]
114    pub fn is_135(&self) -> bool {
115        *self == PHASE_A::_135
116    }
117    #[doc = "Checks if the value of the field is `_157_5`"]
118    #[inline(always)]
119    pub fn is_157_5(&self) -> bool {
120        *self == PHASE_A::_157_5
121    }
122    #[doc = "Checks if the value of the field is `_180`"]
123    #[inline(always)]
124    pub fn is_180(&self) -> bool {
125        *self == PHASE_A::_180
126    }
127    #[doc = "Checks if the value of the field is `_202_5`"]
128    #[inline(always)]
129    pub fn is_202_5(&self) -> bool {
130        *self == PHASE_A::_202_5
131    }
132    #[doc = "Checks if the value of the field is `_225`"]
133    #[inline(always)]
134    pub fn is_225(&self) -> bool {
135        *self == PHASE_A::_225
136    }
137    #[doc = "Checks if the value of the field is `_247_5`"]
138    #[inline(always)]
139    pub fn is_247_5(&self) -> bool {
140        *self == PHASE_A::_247_5
141    }
142    #[doc = "Checks if the value of the field is `_270`"]
143    #[inline(always)]
144    pub fn is_270(&self) -> bool {
145        *self == PHASE_A::_270
146    }
147    #[doc = "Checks if the value of the field is `_292_5`"]
148    #[inline(always)]
149    pub fn is_292_5(&self) -> bool {
150        *self == PHASE_A::_292_5
151    }
152    #[doc = "Checks if the value of the field is `_315`"]
153    #[inline(always)]
154    pub fn is_315(&self) -> bool {
155        *self == PHASE_A::_315
156    }
157    #[doc = "Checks if the value of the field is `_337_5`"]
158    #[inline(always)]
159    pub fn is_337_5(&self) -> bool {
160        *self == PHASE_A::_337_5
161    }
162}
163#[doc = "Write proxy for field `PHASE`"]
164pub struct PHASE_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> PHASE_W<'a> {
168    #[doc = r"Writes `variant` to the field"]
169    #[inline(always)]
170    pub fn variant(self, variant: PHASE_A) -> &'a mut W {
171        {
172            self.bits(variant.into())
173        }
174    }
175    #[doc = "ADC sample lags by 0.0"]
176    #[inline(always)]
177    pub fn _0(self) -> &'a mut W {
178        self.variant(PHASE_A::_0)
179    }
180    #[doc = "ADC sample lags by 22.5"]
181    #[inline(always)]
182    pub fn _22_5(self) -> &'a mut W {
183        self.variant(PHASE_A::_22_5)
184    }
185    #[doc = "ADC sample lags by 45.0"]
186    #[inline(always)]
187    pub fn _45(self) -> &'a mut W {
188        self.variant(PHASE_A::_45)
189    }
190    #[doc = "ADC sample lags by 67.5"]
191    #[inline(always)]
192    pub fn _67_5(self) -> &'a mut W {
193        self.variant(PHASE_A::_67_5)
194    }
195    #[doc = "ADC sample lags by 90.0"]
196    #[inline(always)]
197    pub fn _90(self) -> &'a mut W {
198        self.variant(PHASE_A::_90)
199    }
200    #[doc = "ADC sample lags by 112.5"]
201    #[inline(always)]
202    pub fn _112_5(self) -> &'a mut W {
203        self.variant(PHASE_A::_112_5)
204    }
205    #[doc = "ADC sample lags by 135.0"]
206    #[inline(always)]
207    pub fn _135(self) -> &'a mut W {
208        self.variant(PHASE_A::_135)
209    }
210    #[doc = "ADC sample lags by 157.5"]
211    #[inline(always)]
212    pub fn _157_5(self) -> &'a mut W {
213        self.variant(PHASE_A::_157_5)
214    }
215    #[doc = "ADC sample lags by 180.0"]
216    #[inline(always)]
217    pub fn _180(self) -> &'a mut W {
218        self.variant(PHASE_A::_180)
219    }
220    #[doc = "ADC sample lags by 202.5"]
221    #[inline(always)]
222    pub fn _202_5(self) -> &'a mut W {
223        self.variant(PHASE_A::_202_5)
224    }
225    #[doc = "ADC sample lags by 225.0"]
226    #[inline(always)]
227    pub fn _225(self) -> &'a mut W {
228        self.variant(PHASE_A::_225)
229    }
230    #[doc = "ADC sample lags by 247.5"]
231    #[inline(always)]
232    pub fn _247_5(self) -> &'a mut W {
233        self.variant(PHASE_A::_247_5)
234    }
235    #[doc = "ADC sample lags by 270.0"]
236    #[inline(always)]
237    pub fn _270(self) -> &'a mut W {
238        self.variant(PHASE_A::_270)
239    }
240    #[doc = "ADC sample lags by 292.5"]
241    #[inline(always)]
242    pub fn _292_5(self) -> &'a mut W {
243        self.variant(PHASE_A::_292_5)
244    }
245    #[doc = "ADC sample lags by 315.0"]
246    #[inline(always)]
247    pub fn _315(self) -> &'a mut W {
248        self.variant(PHASE_A::_315)
249    }
250    #[doc = "ADC sample lags by 337.5"]
251    #[inline(always)]
252    pub fn _337_5(self) -> &'a mut W {
253        self.variant(PHASE_A::_337_5)
254    }
255    #[doc = r"Writes raw bits to the field"]
256    #[inline(always)]
257    pub fn bits(self, value: u8) -> &'a mut W {
258        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
259        self.w
260    }
261}
262impl R {
263    #[doc = "Bits 0:3 - Phase Difference"]
264    #[inline(always)]
265    pub fn phase(&self) -> PHASE_R {
266        PHASE_R::new((self.bits & 0x0f) as u8)
267    }
268}
269impl W {
270    #[doc = "Bits 0:3 - Phase Difference"]
271    #[inline(always)]
272    pub fn phase(&mut self) -> PHASE_W {
273        PHASE_W { w: self }
274    }
275}