efm32pg22_pac/efm32pg22c200/timer4_ns/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RUNNING` reader - Running"]
17pub type RUNNING_R = crate::BitReader<bool>;
18#[doc = "Field `DIR` reader - Direction"]
19pub type DIR_R = crate::BitReader<DIR_A>;
20#[doc = "Direction\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub enum DIR_A {
23    #[doc = "0: Counting up"]
24    UP = 0,
25    #[doc = "1: Counting down"]
26    DOWN = 1,
27}
28impl From<DIR_A> for bool {
29    #[inline(always)]
30    fn from(variant: DIR_A) -> Self {
31        variant as u8 != 0
32    }
33}
34impl DIR_R {
35    #[doc = "Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> DIR_A {
38        match self.bits {
39            false => DIR_A::UP,
40            true => DIR_A::DOWN,
41        }
42    }
43    #[doc = "Checks if the value of the field is `UP`"]
44    #[inline(always)]
45    pub fn is_up(&self) -> bool {
46        *self == DIR_A::UP
47    }
48    #[doc = "Checks if the value of the field is `DOWN`"]
49    #[inline(always)]
50    pub fn is_down(&self) -> bool {
51        *self == DIR_A::DOWN
52    }
53}
54#[doc = "Field `TOPBV` reader - TOP Buffer Valid"]
55pub type TOPBV_R = crate::BitReader<bool>;
56#[doc = "Field `TIMERLOCKSTATUS` reader - Timer lock status"]
57pub type TIMERLOCKSTATUS_R = crate::BitReader<TIMERLOCKSTATUS_A>;
58#[doc = "Timer lock status\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum TIMERLOCKSTATUS_A {
61    #[doc = "0: TIMER registers are unlocked"]
62    UNLOCKED = 0,
63    #[doc = "1: TIMER registers are locked"]
64    LOCKED = 1,
65}
66impl From<TIMERLOCKSTATUS_A> for bool {
67    #[inline(always)]
68    fn from(variant: TIMERLOCKSTATUS_A) -> Self {
69        variant as u8 != 0
70    }
71}
72impl TIMERLOCKSTATUS_R {
73    #[doc = "Get enumerated values variant"]
74    #[inline(always)]
75    pub fn variant(&self) -> TIMERLOCKSTATUS_A {
76        match self.bits {
77            false => TIMERLOCKSTATUS_A::UNLOCKED,
78            true => TIMERLOCKSTATUS_A::LOCKED,
79        }
80    }
81    #[doc = "Checks if the value of the field is `UNLOCKED`"]
82    #[inline(always)]
83    pub fn is_unlocked(&self) -> bool {
84        *self == TIMERLOCKSTATUS_A::UNLOCKED
85    }
86    #[doc = "Checks if the value of the field is `LOCKED`"]
87    #[inline(always)]
88    pub fn is_locked(&self) -> bool {
89        *self == TIMERLOCKSTATUS_A::LOCKED
90    }
91}
92#[doc = "Field `DTILOCKSTATUS` reader - DTI lock status"]
93pub type DTILOCKSTATUS_R = crate::BitReader<DTILOCKSTATUS_A>;
94#[doc = "DTI lock status\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
96pub enum DTILOCKSTATUS_A {
97    #[doc = "0: DTI registers are unlocked"]
98    UNLOCKED = 0,
99    #[doc = "1: DTI registers are locked"]
100    LOCKED = 1,
101}
102impl From<DTILOCKSTATUS_A> for bool {
103    #[inline(always)]
104    fn from(variant: DTILOCKSTATUS_A) -> Self {
105        variant as u8 != 0
106    }
107}
108impl DTILOCKSTATUS_R {
109    #[doc = "Get enumerated values variant"]
110    #[inline(always)]
111    pub fn variant(&self) -> DTILOCKSTATUS_A {
112        match self.bits {
113            false => DTILOCKSTATUS_A::UNLOCKED,
114            true => DTILOCKSTATUS_A::LOCKED,
115        }
116    }
117    #[doc = "Checks if the value of the field is `UNLOCKED`"]
118    #[inline(always)]
119    pub fn is_unlocked(&self) -> bool {
120        *self == DTILOCKSTATUS_A::UNLOCKED
121    }
122    #[doc = "Checks if the value of the field is `LOCKED`"]
123    #[inline(always)]
124    pub fn is_locked(&self) -> bool {
125        *self == DTILOCKSTATUS_A::LOCKED
126    }
127}
128#[doc = "Field `SYNCBUSY` reader - Sync Busy"]
129pub type SYNCBUSY_R = crate::BitReader<bool>;
130#[doc = "Field `OCBV0` reader - Output Compare Buffer Valid"]
131pub type OCBV0_R = crate::BitReader<bool>;
132#[doc = "Field `OCBV1` reader - Output Compare Buffer Valid"]
133pub type OCBV1_R = crate::BitReader<bool>;
134#[doc = "Field `OCBV2` reader - Output Compare Buffer Valid"]
135pub type OCBV2_R = crate::BitReader<bool>;
136#[doc = "Field `ICFEMPTY0` reader - Input capture fifo empty"]
137pub type ICFEMPTY0_R = crate::BitReader<bool>;
138#[doc = "Field `ICFEMPTY1` reader - Input capture fifo empty"]
139pub type ICFEMPTY1_R = crate::BitReader<bool>;
140#[doc = "Field `ICFEMPTY2` reader - Input capture fifo empty"]
141pub type ICFEMPTY2_R = crate::BitReader<bool>;
142#[doc = "Field `CCPOL0` reader - Compare/Capture Polarity"]
143pub type CCPOL0_R = crate::BitReader<CCPOL0_A>;
144#[doc = "Compare/Capture Polarity\n\nValue on reset: 0"]
145#[derive(Clone, Copy, Debug, PartialEq, Eq)]
146pub enum CCPOL0_A {
147    #[doc = "0: CCx polarity low level/rising edge"]
148    LOWRISE = 0,
149    #[doc = "1: CCx polarity high level/falling edge"]
150    HIGHFALL = 1,
151}
152impl From<CCPOL0_A> for bool {
153    #[inline(always)]
154    fn from(variant: CCPOL0_A) -> Self {
155        variant as u8 != 0
156    }
157}
158impl CCPOL0_R {
159    #[doc = "Get enumerated values variant"]
160    #[inline(always)]
161    pub fn variant(&self) -> CCPOL0_A {
162        match self.bits {
163            false => CCPOL0_A::LOWRISE,
164            true => CCPOL0_A::HIGHFALL,
165        }
166    }
167    #[doc = "Checks if the value of the field is `LOWRISE`"]
168    #[inline(always)]
169    pub fn is_lowrise(&self) -> bool {
170        *self == CCPOL0_A::LOWRISE
171    }
172    #[doc = "Checks if the value of the field is `HIGHFALL`"]
173    #[inline(always)]
174    pub fn is_highfall(&self) -> bool {
175        *self == CCPOL0_A::HIGHFALL
176    }
177}
178#[doc = "Field `CCPOL1` reader - Compare/Capture Polarity"]
179pub type CCPOL1_R = crate::BitReader<CCPOL1_A>;
180#[doc = "Compare/Capture Polarity\n\nValue on reset: 0"]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum CCPOL1_A {
183    #[doc = "0: CCx polarity low level/rising edge"]
184    LOWRISE = 0,
185    #[doc = "1: CCx polarity high level/falling edge"]
186    HIGHFALL = 1,
187}
188impl From<CCPOL1_A> for bool {
189    #[inline(always)]
190    fn from(variant: CCPOL1_A) -> Self {
191        variant as u8 != 0
192    }
193}
194impl CCPOL1_R {
195    #[doc = "Get enumerated values variant"]
196    #[inline(always)]
197    pub fn variant(&self) -> CCPOL1_A {
198        match self.bits {
199            false => CCPOL1_A::LOWRISE,
200            true => CCPOL1_A::HIGHFALL,
201        }
202    }
203    #[doc = "Checks if the value of the field is `LOWRISE`"]
204    #[inline(always)]
205    pub fn is_lowrise(&self) -> bool {
206        *self == CCPOL1_A::LOWRISE
207    }
208    #[doc = "Checks if the value of the field is `HIGHFALL`"]
209    #[inline(always)]
210    pub fn is_highfall(&self) -> bool {
211        *self == CCPOL1_A::HIGHFALL
212    }
213}
214#[doc = "Field `CCPOL2` reader - Compare/Capture Polarity"]
215pub type CCPOL2_R = crate::BitReader<CCPOL2_A>;
216#[doc = "Compare/Capture Polarity\n\nValue on reset: 0"]
217#[derive(Clone, Copy, Debug, PartialEq, Eq)]
218pub enum CCPOL2_A {
219    #[doc = "0: CCx polarity low level/rising edge"]
220    LOWRISE = 0,
221    #[doc = "1: CCx polarity high level/falling edge"]
222    HIGHFALL = 1,
223}
224impl From<CCPOL2_A> for bool {
225    #[inline(always)]
226    fn from(variant: CCPOL2_A) -> Self {
227        variant as u8 != 0
228    }
229}
230impl CCPOL2_R {
231    #[doc = "Get enumerated values variant"]
232    #[inline(always)]
233    pub fn variant(&self) -> CCPOL2_A {
234        match self.bits {
235            false => CCPOL2_A::LOWRISE,
236            true => CCPOL2_A::HIGHFALL,
237        }
238    }
239    #[doc = "Checks if the value of the field is `LOWRISE`"]
240    #[inline(always)]
241    pub fn is_lowrise(&self) -> bool {
242        *self == CCPOL2_A::LOWRISE
243    }
244    #[doc = "Checks if the value of the field is `HIGHFALL`"]
245    #[inline(always)]
246    pub fn is_highfall(&self) -> bool {
247        *self == CCPOL2_A::HIGHFALL
248    }
249}
250impl R {
251    #[doc = "Bit 0 - Running"]
252    #[inline(always)]
253    pub fn running(&self) -> RUNNING_R {
254        RUNNING_R::new((self.bits & 1) != 0)
255    }
256    #[doc = "Bit 1 - Direction"]
257    #[inline(always)]
258    pub fn dir(&self) -> DIR_R {
259        DIR_R::new(((self.bits >> 1) & 1) != 0)
260    }
261    #[doc = "Bit 2 - TOP Buffer Valid"]
262    #[inline(always)]
263    pub fn topbv(&self) -> TOPBV_R {
264        TOPBV_R::new(((self.bits >> 2) & 1) != 0)
265    }
266    #[doc = "Bit 4 - Timer lock status"]
267    #[inline(always)]
268    pub fn timerlockstatus(&self) -> TIMERLOCKSTATUS_R {
269        TIMERLOCKSTATUS_R::new(((self.bits >> 4) & 1) != 0)
270    }
271    #[doc = "Bit 5 - DTI lock status"]
272    #[inline(always)]
273    pub fn dtilockstatus(&self) -> DTILOCKSTATUS_R {
274        DTILOCKSTATUS_R::new(((self.bits >> 5) & 1) != 0)
275    }
276    #[doc = "Bit 6 - Sync Busy"]
277    #[inline(always)]
278    pub fn syncbusy(&self) -> SYNCBUSY_R {
279        SYNCBUSY_R::new(((self.bits >> 6) & 1) != 0)
280    }
281    #[doc = "Bit 8 - Output Compare Buffer Valid"]
282    #[inline(always)]
283    pub fn ocbv0(&self) -> OCBV0_R {
284        OCBV0_R::new(((self.bits >> 8) & 1) != 0)
285    }
286    #[doc = "Bit 9 - Output Compare Buffer Valid"]
287    #[inline(always)]
288    pub fn ocbv1(&self) -> OCBV1_R {
289        OCBV1_R::new(((self.bits >> 9) & 1) != 0)
290    }
291    #[doc = "Bit 10 - Output Compare Buffer Valid"]
292    #[inline(always)]
293    pub fn ocbv2(&self) -> OCBV2_R {
294        OCBV2_R::new(((self.bits >> 10) & 1) != 0)
295    }
296    #[doc = "Bit 16 - Input capture fifo empty"]
297    #[inline(always)]
298    pub fn icfempty0(&self) -> ICFEMPTY0_R {
299        ICFEMPTY0_R::new(((self.bits >> 16) & 1) != 0)
300    }
301    #[doc = "Bit 17 - Input capture fifo empty"]
302    #[inline(always)]
303    pub fn icfempty1(&self) -> ICFEMPTY1_R {
304        ICFEMPTY1_R::new(((self.bits >> 17) & 1) != 0)
305    }
306    #[doc = "Bit 18 - Input capture fifo empty"]
307    #[inline(always)]
308    pub fn icfempty2(&self) -> ICFEMPTY2_R {
309        ICFEMPTY2_R::new(((self.bits >> 18) & 1) != 0)
310    }
311    #[doc = "Bit 24 - Compare/Capture Polarity"]
312    #[inline(always)]
313    pub fn ccpol0(&self) -> CCPOL0_R {
314        CCPOL0_R::new(((self.bits >> 24) & 1) != 0)
315    }
316    #[doc = "Bit 25 - Compare/Capture Polarity"]
317    #[inline(always)]
318    pub fn ccpol1(&self) -> CCPOL1_R {
319        CCPOL1_R::new(((self.bits >> 25) & 1) != 0)
320    }
321    #[doc = "Bit 26 - Compare/Capture Polarity"]
322    #[inline(always)]
323    pub fn ccpol2(&self) -> CCPOL2_R {
324        CCPOL2_R::new(((self.bits >> 26) & 1) != 0)
325    }
326}
327#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"]
328pub struct STATUS_SPEC;
329impl crate::RegisterSpec for STATUS_SPEC {
330    type Ux = u32;
331}
332#[doc = "`read()` method returns [status::R](R) reader structure"]
333impl crate::Readable for STATUS_SPEC {
334    type Reader = R;
335}
336#[doc = "`reset()` method sets STATUS to value 0"]
337impl crate::Resettable for STATUS_SPEC {
338    const RESET_VALUE: Self::Ux = 0;
339}