py32f0/py32f040/tim16/
sr.rs

1///Register `SR` reader
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16///Register `SR` writer
17pub struct W(crate::W<SR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SR_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<SR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37///Field `UIF` reader - desc UIF
38pub type UIF_R = crate::BitReader<UIFR_A>;
39/**desc UIF
40
41Value on reset: 0*/
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum UIFR_A {
44    ///1: Update event waiting for response
45    Update = 1,
46}
47impl From<UIFR_A> for bool {
48    #[inline(always)]
49    fn from(variant: UIFR_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl UIF_R {
54    ///Get enumerated values variant
55    #[inline(always)]
56    pub fn variant(&self) -> Option<UIFR_A> {
57        match self.bits {
58            true => Some(UIFR_A::Update),
59            _ => None,
60        }
61    }
62    ///Checks if the value of the field is `Update`
63    #[inline(always)]
64    pub fn is_update(&self) -> bool {
65        *self == UIFR_A::Update
66    }
67}
68/**desc UIF
69
70Value on reset: 0*/
71#[derive(Clone, Copy, Debug, PartialEq, Eq)]
72pub enum UIFW_AW {
73    ///0: Clear flag
74    Clear = 0,
75}
76impl From<UIFW_AW> for bool {
77    #[inline(always)]
78    fn from(variant: UIFW_AW) -> Self {
79        variant as u8 != 0
80    }
81}
82///Field `UIF` writer - desc UIF
83pub type UIF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, UIFW_AW, O>;
84impl<'a, const O: u8> UIF_W<'a, O> {
85    ///Clear flag
86    #[inline(always)]
87    pub fn clear(self) -> &'a mut W {
88        self.variant(UIFW_AW::Clear)
89    }
90}
91///Field `CC1IF` reader - desc CC1IF
92pub type CC1IF_R = crate::BitReader<CC1IFR_A>;
93/**desc CC1IF
94
95Value on reset: 0*/
96#[derive(Clone, Copy, Debug, PartialEq, Eq)]
97pub enum CC1IFR_A {
98    ///1: The counter value has been captured in TIMx_CCRx register while CCxIF flag was already set
99    Overcapture = 1,
100}
101impl From<CC1IFR_A> for bool {
102    #[inline(always)]
103    fn from(variant: CC1IFR_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl CC1IF_R {
108    ///Get enumerated values variant
109    #[inline(always)]
110    pub fn variant(&self) -> Option<CC1IFR_A> {
111        match self.bits {
112            true => Some(CC1IFR_A::Overcapture),
113            _ => None,
114        }
115    }
116    ///Checks if the value of the field is `Overcapture`
117    #[inline(always)]
118    pub fn is_overcapture(&self) -> bool {
119        *self == CC1IFR_A::Overcapture
120    }
121}
122/**desc CC1IF
123
124Value on reset: 0*/
125#[derive(Clone, Copy, Debug, PartialEq, Eq)]
126pub enum CC1IFW_AW {
127    ///0: Clear flag
128    Clear = 0,
129}
130impl From<CC1IFW_AW> for bool {
131    #[inline(always)]
132    fn from(variant: CC1IFW_AW) -> Self {
133        variant as u8 != 0
134    }
135}
136///Field `CC1IF` writer - desc CC1IF
137pub type CC1IF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, CC1IFW_AW, O>;
138impl<'a, const O: u8> CC1IF_W<'a, O> {
139    ///Clear flag
140    #[inline(always)]
141    pub fn clear(self) -> &'a mut W {
142        self.variant(CC1IFW_AW::Clear)
143    }
144}
145///Field `CC2IF` reader - desc CC2IF
146pub use CC1IF_R as CC2IF_R;
147///Field `CC3IF` reader - desc CC3IF
148pub use CC1IF_R as CC3IF_R;
149///Field `CC4IF` reader - desc CC4IF
150pub use CC1IF_R as CC4IF_R;
151///Field `CC2IF` writer - desc CC2IF
152pub use CC1IF_W as CC2IF_W;
153///Field `CC3IF` writer - desc CC3IF
154pub use CC1IF_W as CC3IF_W;
155///Field `CC4IF` writer - desc CC4IF
156pub use CC1IF_W as CC4IF_W;
157///Field `COMIF` reader - desc COMIF
158pub type COMIF_R = crate::BitReader<bool>;
159///Field `COMIF` writer - desc COMIF
160pub type COMIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
161///Field `TIF` reader - desc TIF
162pub type TIF_R = crate::BitReader<TIFR_A>;
163/**desc TIF
164
165Value on reset: 0*/
166#[derive(Clone, Copy, Debug, PartialEq, Eq)]
167pub enum TIFR_A {
168    ///1: Valid edge detected at the TRGI input
169    Triggered = 1,
170}
171impl From<TIFR_A> for bool {
172    #[inline(always)]
173    fn from(variant: TIFR_A) -> Self {
174        variant as u8 != 0
175    }
176}
177impl TIF_R {
178    ///Get enumerated values variant
179    #[inline(always)]
180    pub fn variant(&self) -> Option<TIFR_A> {
181        match self.bits {
182            true => Some(TIFR_A::Triggered),
183            _ => None,
184        }
185    }
186    ///Checks if the value of the field is `Triggered`
187    #[inline(always)]
188    pub fn is_triggered(&self) -> bool {
189        *self == TIFR_A::Triggered
190    }
191}
192/**desc TIF
193
194Value on reset: 0*/
195#[derive(Clone, Copy, Debug, PartialEq, Eq)]
196pub enum TIFW_AW {
197    ///0: Clear flag
198    Clear = 0,
199}
200impl From<TIFW_AW> for bool {
201    #[inline(always)]
202    fn from(variant: TIFW_AW) -> Self {
203        variant as u8 != 0
204    }
205}
206///Field `TIF` writer - desc TIF
207pub type TIF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, TIFW_AW, O>;
208impl<'a, const O: u8> TIF_W<'a, O> {
209    ///Clear flag
210    #[inline(always)]
211    pub fn clear(self) -> &'a mut W {
212        self.variant(TIFW_AW::Clear)
213    }
214}
215///Field `BIF` reader - desc BIF
216pub type BIF_R = crate::BitReader<bool>;
217///Field `BIF` writer - desc BIF
218pub type BIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
219///Field `CC1OF` reader - desc CC1OF
220pub type CC1OF_R = crate::BitReader<CC1OFR_A>;
221/**desc CC1OF
222
223Value on reset: 0*/
224#[derive(Clone, Copy, Debug, PartialEq, Eq)]
225pub enum CC1OFR_A {
226    ///1: The counter value has been captured in TIMx_CCRx register while CCxOF flag was already set
227    Overcapture = 1,
228}
229impl From<CC1OFR_A> for bool {
230    #[inline(always)]
231    fn from(variant: CC1OFR_A) -> Self {
232        variant as u8 != 0
233    }
234}
235impl CC1OF_R {
236    ///Get enumerated values variant
237    #[inline(always)]
238    pub fn variant(&self) -> Option<CC1OFR_A> {
239        match self.bits {
240            true => Some(CC1OFR_A::Overcapture),
241            _ => None,
242        }
243    }
244    ///Checks if the value of the field is `Overcapture`
245    #[inline(always)]
246    pub fn is_overcapture(&self) -> bool {
247        *self == CC1OFR_A::Overcapture
248    }
249}
250/**desc CC1OF
251
252Value on reset: 0*/
253#[derive(Clone, Copy, Debug, PartialEq, Eq)]
254pub enum CC1OFW_AW {
255    ///0: Clear flag
256    Clear = 0,
257}
258impl From<CC1OFW_AW> for bool {
259    #[inline(always)]
260    fn from(variant: CC1OFW_AW) -> Self {
261        variant as u8 != 0
262    }
263}
264///Field `CC1OF` writer - desc CC1OF
265pub type CC1OF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, CC1OFW_AW, O>;
266impl<'a, const O: u8> CC1OF_W<'a, O> {
267    ///Clear flag
268    #[inline(always)]
269    pub fn clear(self) -> &'a mut W {
270        self.variant(CC1OFW_AW::Clear)
271    }
272}
273///Field `CC2OF` reader - desc CC2OF
274pub use CC1OF_R as CC2OF_R;
275///Field `CC3OF` reader - desc CC3OF
276pub use CC1OF_R as CC3OF_R;
277///Field `CC4OF` reader - desc CC4OF
278pub use CC1OF_R as CC4OF_R;
279///Field `CC2OF` writer - desc CC2OF
280pub use CC1OF_W as CC2OF_W;
281///Field `CC3OF` writer - desc CC3OF
282pub use CC1OF_W as CC3OF_W;
283///Field `CC4OF` writer - desc CC4OF
284pub use CC1OF_W as CC4OF_W;
285///Field `IC1IR` reader - desc IC1IR
286pub type IC1IR_R = crate::BitReader<bool>;
287///Field `IC1IR` writer - desc IC1IR
288pub type IC1IR_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
289///Field `IC2IR` reader - desc IC2IR
290pub type IC2IR_R = crate::BitReader<bool>;
291///Field `IC2IR` writer - desc IC2IR
292pub type IC2IR_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
293///Field `IC3IR` reader - desc IC3IR
294pub type IC3IR_R = crate::BitReader<bool>;
295///Field `IC3IR` writer - desc IC3IR
296pub type IC3IR_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
297///Field `IC4IR` reader - desc IC3IR
298pub type IC4IR_R = crate::BitReader<bool>;
299///Field `IC4IR` writer - desc IC3IR
300pub type IC4IR_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
301///Field `IC1IF` reader - desc IC1IF
302pub type IC1IF_R = crate::BitReader<bool>;
303///Field `IC1IF` writer - desc IC1IF
304pub type IC1IF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
305///Field `IC2IF` reader - desc IC2IF
306pub type IC2IF_R = crate::BitReader<bool>;
307///Field `IC2IF` writer - desc IC2IF
308pub type IC2IF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
309///Field `IC3IF` reader - desc IC3IF
310pub type IC3IF_R = crate::BitReader<bool>;
311///Field `IC3IF` writer - desc IC3IF
312pub type IC3IF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
313///Field `IC4IF` reader - desc IC3IF
314pub type IC4IF_R = crate::BitReader<bool>;
315///Field `IC4IF` writer - desc IC3IF
316pub type IC4IF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
317impl R {
318    ///Bit 0 - desc UIF
319    #[inline(always)]
320    pub fn uif(&self) -> UIF_R {
321        UIF_R::new((self.bits & 1) != 0)
322    }
323    ///Bit 1 - desc CC1IF
324    #[inline(always)]
325    pub fn cc1if(&self) -> CC1IF_R {
326        CC1IF_R::new(((self.bits >> 1) & 1) != 0)
327    }
328    ///Bit 2 - desc CC2IF
329    #[inline(always)]
330    pub fn cc2if(&self) -> CC2IF_R {
331        CC2IF_R::new(((self.bits >> 2) & 1) != 0)
332    }
333    ///Bit 3 - desc CC3IF
334    #[inline(always)]
335    pub fn cc3if(&self) -> CC3IF_R {
336        CC3IF_R::new(((self.bits >> 3) & 1) != 0)
337    }
338    ///Bit 4 - desc CC4IF
339    #[inline(always)]
340    pub fn cc4if(&self) -> CC4IF_R {
341        CC4IF_R::new(((self.bits >> 4) & 1) != 0)
342    }
343    ///Bit 5 - desc COMIF
344    #[inline(always)]
345    pub fn comif(&self) -> COMIF_R {
346        COMIF_R::new(((self.bits >> 5) & 1) != 0)
347    }
348    ///Bit 6 - desc TIF
349    #[inline(always)]
350    pub fn tif(&self) -> TIF_R {
351        TIF_R::new(((self.bits >> 6) & 1) != 0)
352    }
353    ///Bit 7 - desc BIF
354    #[inline(always)]
355    pub fn bif(&self) -> BIF_R {
356        BIF_R::new(((self.bits >> 7) & 1) != 0)
357    }
358    ///Bit 9 - desc CC1OF
359    #[inline(always)]
360    pub fn cc1of(&self) -> CC1OF_R {
361        CC1OF_R::new(((self.bits >> 9) & 1) != 0)
362    }
363    ///Bit 10 - desc CC2OF
364    #[inline(always)]
365    pub fn cc2of(&self) -> CC2OF_R {
366        CC2OF_R::new(((self.bits >> 10) & 1) != 0)
367    }
368    ///Bit 11 - desc CC3OF
369    #[inline(always)]
370    pub fn cc3of(&self) -> CC3OF_R {
371        CC3OF_R::new(((self.bits >> 11) & 1) != 0)
372    }
373    ///Bit 12 - desc CC4OF
374    #[inline(always)]
375    pub fn cc4of(&self) -> CC4OF_R {
376        CC4OF_R::new(((self.bits >> 12) & 1) != 0)
377    }
378    ///Bit 16 - desc IC1IR
379    #[inline(always)]
380    pub fn ic1ir(&self) -> IC1IR_R {
381        IC1IR_R::new(((self.bits >> 16) & 1) != 0)
382    }
383    ///Bit 17 - desc IC2IR
384    #[inline(always)]
385    pub fn ic2ir(&self) -> IC2IR_R {
386        IC2IR_R::new(((self.bits >> 17) & 1) != 0)
387    }
388    ///Bit 18 - desc IC3IR
389    #[inline(always)]
390    pub fn ic3ir(&self) -> IC3IR_R {
391        IC3IR_R::new(((self.bits >> 18) & 1) != 0)
392    }
393    ///Bit 19 - desc IC3IR
394    #[inline(always)]
395    pub fn ic4ir(&self) -> IC4IR_R {
396        IC4IR_R::new(((self.bits >> 19) & 1) != 0)
397    }
398    ///Bit 20 - desc IC1IF
399    #[inline(always)]
400    pub fn ic1if(&self) -> IC1IF_R {
401        IC1IF_R::new(((self.bits >> 20) & 1) != 0)
402    }
403    ///Bit 21 - desc IC2IF
404    #[inline(always)]
405    pub fn ic2if(&self) -> IC2IF_R {
406        IC2IF_R::new(((self.bits >> 21) & 1) != 0)
407    }
408    ///Bit 22 - desc IC3IF
409    #[inline(always)]
410    pub fn ic3if(&self) -> IC3IF_R {
411        IC3IF_R::new(((self.bits >> 22) & 1) != 0)
412    }
413    ///Bit 23 - desc IC3IF
414    #[inline(always)]
415    pub fn ic4if(&self) -> IC4IF_R {
416        IC4IF_R::new(((self.bits >> 23) & 1) != 0)
417    }
418}
419impl W {
420    ///Bit 0 - desc UIF
421    #[inline(always)]
422    #[must_use]
423    pub fn uif(&mut self) -> UIF_W<0> {
424        UIF_W::new(self)
425    }
426    ///Bit 1 - desc CC1IF
427    #[inline(always)]
428    #[must_use]
429    pub fn cc1if(&mut self) -> CC1IF_W<1> {
430        CC1IF_W::new(self)
431    }
432    ///Bit 2 - desc CC2IF
433    #[inline(always)]
434    #[must_use]
435    pub fn cc2if(&mut self) -> CC2IF_W<2> {
436        CC2IF_W::new(self)
437    }
438    ///Bit 3 - desc CC3IF
439    #[inline(always)]
440    #[must_use]
441    pub fn cc3if(&mut self) -> CC3IF_W<3> {
442        CC3IF_W::new(self)
443    }
444    ///Bit 4 - desc CC4IF
445    #[inline(always)]
446    #[must_use]
447    pub fn cc4if(&mut self) -> CC4IF_W<4> {
448        CC4IF_W::new(self)
449    }
450    ///Bit 5 - desc COMIF
451    #[inline(always)]
452    #[must_use]
453    pub fn comif(&mut self) -> COMIF_W<5> {
454        COMIF_W::new(self)
455    }
456    ///Bit 6 - desc TIF
457    #[inline(always)]
458    #[must_use]
459    pub fn tif(&mut self) -> TIF_W<6> {
460        TIF_W::new(self)
461    }
462    ///Bit 7 - desc BIF
463    #[inline(always)]
464    #[must_use]
465    pub fn bif(&mut self) -> BIF_W<7> {
466        BIF_W::new(self)
467    }
468    ///Bit 9 - desc CC1OF
469    #[inline(always)]
470    #[must_use]
471    pub fn cc1of(&mut self) -> CC1OF_W<9> {
472        CC1OF_W::new(self)
473    }
474    ///Bit 10 - desc CC2OF
475    #[inline(always)]
476    #[must_use]
477    pub fn cc2of(&mut self) -> CC2OF_W<10> {
478        CC2OF_W::new(self)
479    }
480    ///Bit 11 - desc CC3OF
481    #[inline(always)]
482    #[must_use]
483    pub fn cc3of(&mut self) -> CC3OF_W<11> {
484        CC3OF_W::new(self)
485    }
486    ///Bit 12 - desc CC4OF
487    #[inline(always)]
488    #[must_use]
489    pub fn cc4of(&mut self) -> CC4OF_W<12> {
490        CC4OF_W::new(self)
491    }
492    ///Bit 16 - desc IC1IR
493    #[inline(always)]
494    #[must_use]
495    pub fn ic1ir(&mut self) -> IC1IR_W<16> {
496        IC1IR_W::new(self)
497    }
498    ///Bit 17 - desc IC2IR
499    #[inline(always)]
500    #[must_use]
501    pub fn ic2ir(&mut self) -> IC2IR_W<17> {
502        IC2IR_W::new(self)
503    }
504    ///Bit 18 - desc IC3IR
505    #[inline(always)]
506    #[must_use]
507    pub fn ic3ir(&mut self) -> IC3IR_W<18> {
508        IC3IR_W::new(self)
509    }
510    ///Bit 19 - desc IC3IR
511    #[inline(always)]
512    #[must_use]
513    pub fn ic4ir(&mut self) -> IC4IR_W<19> {
514        IC4IR_W::new(self)
515    }
516    ///Bit 20 - desc IC1IF
517    #[inline(always)]
518    #[must_use]
519    pub fn ic1if(&mut self) -> IC1IF_W<20> {
520        IC1IF_W::new(self)
521    }
522    ///Bit 21 - desc IC2IF
523    #[inline(always)]
524    #[must_use]
525    pub fn ic2if(&mut self) -> IC2IF_W<21> {
526        IC2IF_W::new(self)
527    }
528    ///Bit 22 - desc IC3IF
529    #[inline(always)]
530    #[must_use]
531    pub fn ic3if(&mut self) -> IC3IF_W<22> {
532        IC3IF_W::new(self)
533    }
534    ///Bit 23 - desc IC3IF
535    #[inline(always)]
536    #[must_use]
537    pub fn ic4if(&mut self) -> IC4IF_W<23> {
538        IC4IF_W::new(self)
539    }
540    ///Writes raw bits to the register.
541    #[inline(always)]
542    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
543        self.0.bits(bits);
544        self
545    }
546}
547/**desc SR
548
549This 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).
550
551For information about available fields see [sr](index.html) module*/
552pub struct SR_SPEC;
553impl crate::RegisterSpec for SR_SPEC {
554    type Ux = u32;
555}
556///`read()` method returns [sr::R](R) reader structure
557impl crate::Readable for SR_SPEC {
558    type Reader = R;
559}
560///`write(|w| ..)` method takes [sr::W](W) writer structure
561impl crate::Writable for SR_SPEC {
562    type Writer = W;
563    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x1e5f;
564    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
565}
566///`reset()` method sets SR to value 0
567impl crate::Resettable for SR_SPEC {
568    const RESET_VALUE: Self::Ux = 0;
569}