efm32pg22_pac/efm32pg22c200/letimer0_ns/
prsmode.rs

1#[doc = "Register `PRSMODE` reader"]
2pub struct R(crate::R<PRSMODE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PRSMODE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PRSMODE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PRSMODE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PRSMODE` writer"]
17pub struct W(crate::W<PRSMODE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PRSMODE_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<PRSMODE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PRSMODE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PRSSTARTMODE` reader - PRS Start Mode"]
38pub type PRSSTARTMODE_R = crate::FieldReader<u8, PRSSTARTMODE_A>;
39#[doc = "PRS Start Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PRSSTARTMODE_A {
43    #[doc = "0: PRS cannot start the LETIMER"]
44    NONE = 0,
45    #[doc = "1: Rising edge of selected PRS input can start the LETIMER"]
46    RISING = 1,
47    #[doc = "2: Falling edge of selected PRS input can start the LETIMER"]
48    FALLING = 2,
49    #[doc = "3: Both the rising or falling edge of the selected PRS input can start the LETIMER"]
50    BOTH = 3,
51}
52impl From<PRSSTARTMODE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: PRSSTARTMODE_A) -> Self {
55        variant as _
56    }
57}
58impl PRSSTARTMODE_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> PRSSTARTMODE_A {
62        match self.bits {
63            0 => PRSSTARTMODE_A::NONE,
64            1 => PRSSTARTMODE_A::RISING,
65            2 => PRSSTARTMODE_A::FALLING,
66            3 => PRSSTARTMODE_A::BOTH,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `NONE`"]
71    #[inline(always)]
72    pub fn is_none(&self) -> bool {
73        *self == PRSSTARTMODE_A::NONE
74    }
75    #[doc = "Checks if the value of the field is `RISING`"]
76    #[inline(always)]
77    pub fn is_rising(&self) -> bool {
78        *self == PRSSTARTMODE_A::RISING
79    }
80    #[doc = "Checks if the value of the field is `FALLING`"]
81    #[inline(always)]
82    pub fn is_falling(&self) -> bool {
83        *self == PRSSTARTMODE_A::FALLING
84    }
85    #[doc = "Checks if the value of the field is `BOTH`"]
86    #[inline(always)]
87    pub fn is_both(&self) -> bool {
88        *self == PRSSTARTMODE_A::BOTH
89    }
90}
91#[doc = "Field `PRSSTARTMODE` writer - PRS Start Mode"]
92pub type PRSSTARTMODE_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, PRSMODE_SPEC, u8, PRSSTARTMODE_A, 2, O>;
94impl<'a, const O: u8> PRSSTARTMODE_W<'a, O> {
95    #[doc = "PRS cannot start the LETIMER"]
96    #[inline(always)]
97    pub fn none(self) -> &'a mut W {
98        self.variant(PRSSTARTMODE_A::NONE)
99    }
100    #[doc = "Rising edge of selected PRS input can start the LETIMER"]
101    #[inline(always)]
102    pub fn rising(self) -> &'a mut W {
103        self.variant(PRSSTARTMODE_A::RISING)
104    }
105    #[doc = "Falling edge of selected PRS input can start the LETIMER"]
106    #[inline(always)]
107    pub fn falling(self) -> &'a mut W {
108        self.variant(PRSSTARTMODE_A::FALLING)
109    }
110    #[doc = "Both the rising or falling edge of the selected PRS input can start the LETIMER"]
111    #[inline(always)]
112    pub fn both(self) -> &'a mut W {
113        self.variant(PRSSTARTMODE_A::BOTH)
114    }
115}
116#[doc = "Field `PRSSTOPMODE` reader - PRS Stop Mode"]
117pub type PRSSTOPMODE_R = crate::FieldReader<u8, PRSSTOPMODE_A>;
118#[doc = "PRS Stop Mode\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum PRSSTOPMODE_A {
122    #[doc = "0: PRS cannot stop the LETIMER"]
123    NONE = 0,
124    #[doc = "1: Rising edge of selected PRS input can stop the LETIMER"]
125    RISING = 1,
126    #[doc = "2: Falling edge of selected PRS input can stop the LETIMER"]
127    FALLING = 2,
128    #[doc = "3: Both the rising or falling edge of the selected PRS input can stop the LETIMER"]
129    BOTH = 3,
130}
131impl From<PRSSTOPMODE_A> for u8 {
132    #[inline(always)]
133    fn from(variant: PRSSTOPMODE_A) -> Self {
134        variant as _
135    }
136}
137impl PRSSTOPMODE_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> PRSSTOPMODE_A {
141        match self.bits {
142            0 => PRSSTOPMODE_A::NONE,
143            1 => PRSSTOPMODE_A::RISING,
144            2 => PRSSTOPMODE_A::FALLING,
145            3 => PRSSTOPMODE_A::BOTH,
146            _ => unreachable!(),
147        }
148    }
149    #[doc = "Checks if the value of the field is `NONE`"]
150    #[inline(always)]
151    pub fn is_none(&self) -> bool {
152        *self == PRSSTOPMODE_A::NONE
153    }
154    #[doc = "Checks if the value of the field is `RISING`"]
155    #[inline(always)]
156    pub fn is_rising(&self) -> bool {
157        *self == PRSSTOPMODE_A::RISING
158    }
159    #[doc = "Checks if the value of the field is `FALLING`"]
160    #[inline(always)]
161    pub fn is_falling(&self) -> bool {
162        *self == PRSSTOPMODE_A::FALLING
163    }
164    #[doc = "Checks if the value of the field is `BOTH`"]
165    #[inline(always)]
166    pub fn is_both(&self) -> bool {
167        *self == PRSSTOPMODE_A::BOTH
168    }
169}
170#[doc = "Field `PRSSTOPMODE` writer - PRS Stop Mode"]
171pub type PRSSTOPMODE_W<'a, const O: u8> =
172    crate::FieldWriterSafe<'a, u32, PRSMODE_SPEC, u8, PRSSTOPMODE_A, 2, O>;
173impl<'a, const O: u8> PRSSTOPMODE_W<'a, O> {
174    #[doc = "PRS cannot stop the LETIMER"]
175    #[inline(always)]
176    pub fn none(self) -> &'a mut W {
177        self.variant(PRSSTOPMODE_A::NONE)
178    }
179    #[doc = "Rising edge of selected PRS input can stop the LETIMER"]
180    #[inline(always)]
181    pub fn rising(self) -> &'a mut W {
182        self.variant(PRSSTOPMODE_A::RISING)
183    }
184    #[doc = "Falling edge of selected PRS input can stop the LETIMER"]
185    #[inline(always)]
186    pub fn falling(self) -> &'a mut W {
187        self.variant(PRSSTOPMODE_A::FALLING)
188    }
189    #[doc = "Both the rising or falling edge of the selected PRS input can stop the LETIMER"]
190    #[inline(always)]
191    pub fn both(self) -> &'a mut W {
192        self.variant(PRSSTOPMODE_A::BOTH)
193    }
194}
195#[doc = "Field `PRSCLEARMODE` reader - PRS Clear Mode"]
196pub type PRSCLEARMODE_R = crate::FieldReader<u8, PRSCLEARMODE_A>;
197#[doc = "PRS Clear Mode\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum PRSCLEARMODE_A {
201    #[doc = "0: PRS cannot clear the LETIMER"]
202    NONE = 0,
203    #[doc = "1: Rising edge of selected PRS input can clear the LETIMER"]
204    RISING = 1,
205    #[doc = "2: Falling edge of selected PRS input can clear the LETIMER"]
206    FALLING = 2,
207    #[doc = "3: Both the rising or falling edge of the selected PRS input can clear the LETIMER"]
208    BOTH = 3,
209}
210impl From<PRSCLEARMODE_A> for u8 {
211    #[inline(always)]
212    fn from(variant: PRSCLEARMODE_A) -> Self {
213        variant as _
214    }
215}
216impl PRSCLEARMODE_R {
217    #[doc = "Get enumerated values variant"]
218    #[inline(always)]
219    pub fn variant(&self) -> PRSCLEARMODE_A {
220        match self.bits {
221            0 => PRSCLEARMODE_A::NONE,
222            1 => PRSCLEARMODE_A::RISING,
223            2 => PRSCLEARMODE_A::FALLING,
224            3 => PRSCLEARMODE_A::BOTH,
225            _ => unreachable!(),
226        }
227    }
228    #[doc = "Checks if the value of the field is `NONE`"]
229    #[inline(always)]
230    pub fn is_none(&self) -> bool {
231        *self == PRSCLEARMODE_A::NONE
232    }
233    #[doc = "Checks if the value of the field is `RISING`"]
234    #[inline(always)]
235    pub fn is_rising(&self) -> bool {
236        *self == PRSCLEARMODE_A::RISING
237    }
238    #[doc = "Checks if the value of the field is `FALLING`"]
239    #[inline(always)]
240    pub fn is_falling(&self) -> bool {
241        *self == PRSCLEARMODE_A::FALLING
242    }
243    #[doc = "Checks if the value of the field is `BOTH`"]
244    #[inline(always)]
245    pub fn is_both(&self) -> bool {
246        *self == PRSCLEARMODE_A::BOTH
247    }
248}
249#[doc = "Field `PRSCLEARMODE` writer - PRS Clear Mode"]
250pub type PRSCLEARMODE_W<'a, const O: u8> =
251    crate::FieldWriterSafe<'a, u32, PRSMODE_SPEC, u8, PRSCLEARMODE_A, 2, O>;
252impl<'a, const O: u8> PRSCLEARMODE_W<'a, O> {
253    #[doc = "PRS cannot clear the LETIMER"]
254    #[inline(always)]
255    pub fn none(self) -> &'a mut W {
256        self.variant(PRSCLEARMODE_A::NONE)
257    }
258    #[doc = "Rising edge of selected PRS input can clear the LETIMER"]
259    #[inline(always)]
260    pub fn rising(self) -> &'a mut W {
261        self.variant(PRSCLEARMODE_A::RISING)
262    }
263    #[doc = "Falling edge of selected PRS input can clear the LETIMER"]
264    #[inline(always)]
265    pub fn falling(self) -> &'a mut W {
266        self.variant(PRSCLEARMODE_A::FALLING)
267    }
268    #[doc = "Both the rising or falling edge of the selected PRS input can clear the LETIMER"]
269    #[inline(always)]
270    pub fn both(self) -> &'a mut W {
271        self.variant(PRSCLEARMODE_A::BOTH)
272    }
273}
274impl R {
275    #[doc = "Bits 18:19 - PRS Start Mode"]
276    #[inline(always)]
277    pub fn prsstartmode(&self) -> PRSSTARTMODE_R {
278        PRSSTARTMODE_R::new(((self.bits >> 18) & 3) as u8)
279    }
280    #[doc = "Bits 22:23 - PRS Stop Mode"]
281    #[inline(always)]
282    pub fn prsstopmode(&self) -> PRSSTOPMODE_R {
283        PRSSTOPMODE_R::new(((self.bits >> 22) & 3) as u8)
284    }
285    #[doc = "Bits 26:27 - PRS Clear Mode"]
286    #[inline(always)]
287    pub fn prsclearmode(&self) -> PRSCLEARMODE_R {
288        PRSCLEARMODE_R::new(((self.bits >> 26) & 3) as u8)
289    }
290}
291impl W {
292    #[doc = "Bits 18:19 - PRS Start Mode"]
293    #[inline(always)]
294    #[must_use]
295    pub fn prsstartmode(&mut self) -> PRSSTARTMODE_W<18> {
296        PRSSTARTMODE_W::new(self)
297    }
298    #[doc = "Bits 22:23 - PRS Stop Mode"]
299    #[inline(always)]
300    #[must_use]
301    pub fn prsstopmode(&mut self) -> PRSSTOPMODE_W<22> {
302        PRSSTOPMODE_W::new(self)
303    }
304    #[doc = "Bits 26:27 - PRS Clear Mode"]
305    #[inline(always)]
306    #[must_use]
307    pub fn prsclearmode(&mut self) -> PRSCLEARMODE_W<26> {
308        PRSCLEARMODE_W::new(self)
309    }
310    #[doc = "Writes raw bits to the register."]
311    #[inline(always)]
312    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
313        self.0.bits(bits);
314        self
315    }
316}
317#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [prsmode](index.html) module"]
318pub struct PRSMODE_SPEC;
319impl crate::RegisterSpec for PRSMODE_SPEC {
320    type Ux = u32;
321}
322#[doc = "`read()` method returns [prsmode::R](R) reader structure"]
323impl crate::Readable for PRSMODE_SPEC {
324    type Reader = R;
325}
326#[doc = "`write(|w| ..)` method takes [prsmode::W](W) writer structure"]
327impl crate::Writable for PRSMODE_SPEC {
328    type Writer = W;
329    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
330    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
331}
332#[doc = "`reset()` method sets PRSMODE to value 0"]
333impl crate::Resettable for PRSMODE_SPEC {
334    const RESET_VALUE: Self::Ux = 0;
335}