py32f0/py32f003/tim1/
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 - Update interrupt flag
38pub type UIF_R = crate::BitReader<bool>;
39///Field `UIF` writer - Update interrupt flag
40pub type UIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
41///Field `CC1IF` reader - Capture/compare 1 interrupt flag
42pub type CC1IF_R = crate::BitReader<CC1IFR_A>;
43/**Capture/compare 1 interrupt flag
44
45Value on reset: 0*/
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum CC1IFR_A {
48    ///1: If CC1 is an output: The content of the counter TIMx_CNT matches the content of the TIMx_CCR1 register. If CC1 is an input: The counter value has been captured in TIMx_CCR1 register.
49    Match = 1,
50}
51impl From<CC1IFR_A> for bool {
52    #[inline(always)]
53    fn from(variant: CC1IFR_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl CC1IF_R {
58    ///Get enumerated values variant
59    #[inline(always)]
60    pub fn variant(&self) -> Option<CC1IFR_A> {
61        match self.bits {
62            true => Some(CC1IFR_A::Match),
63            _ => None,
64        }
65    }
66    ///Checks if the value of the field is `Match`
67    #[inline(always)]
68    pub fn is_match(&self) -> bool {
69        *self == CC1IFR_A::Match
70    }
71}
72/**Capture/compare 1 interrupt flag
73
74Value on reset: 0*/
75#[derive(Clone, Copy, Debug, PartialEq, Eq)]
76pub enum CC1IFW_AW {
77    ///0: Clear flag
78    Clear = 0,
79}
80impl From<CC1IFW_AW> for bool {
81    #[inline(always)]
82    fn from(variant: CC1IFW_AW) -> Self {
83        variant as u8 != 0
84    }
85}
86///Field `CC1IF` writer - Capture/compare 1 interrupt flag
87pub type CC1IF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, CC1IFW_AW, O>;
88impl<'a, const O: u8> CC1IF_W<'a, O> {
89    ///Clear flag
90    #[inline(always)]
91    pub fn clear(self) -> &'a mut W {
92        self.variant(CC1IFW_AW::Clear)
93    }
94}
95///Field `CC2IF` reader - Capture/Compare 2 interrupt flag
96pub use CC1IF_R as CC2IF_R;
97///Field `CC3IF` reader - Capture/Compare 3 interrupt flag
98pub use CC1IF_R as CC3IF_R;
99///Field `CC4IF` reader - Capture/Compare 4 interrupt flag
100pub use CC1IF_R as CC4IF_R;
101///Field `CC2IF` writer - Capture/Compare 2 interrupt flag
102pub use CC1IF_W as CC2IF_W;
103///Field `CC3IF` writer - Capture/Compare 3 interrupt flag
104pub use CC1IF_W as CC3IF_W;
105///Field `CC4IF` writer - Capture/Compare 4 interrupt flag
106pub use CC1IF_W as CC4IF_W;
107///Field `COMIF` reader - COM interrupt flag
108pub type COMIF_R = crate::BitReader<bool>;
109///Field `COMIF` writer - COM interrupt flag
110pub type COMIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
111///Field `TIF` reader - Trigger interrupt flag
112pub type TIF_R = crate::BitReader<TIFR_A>;
113/**Trigger interrupt flag
114
115Value on reset: 0*/
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117pub enum TIFR_A {
118    ///0: No trigger event occurred
119    NoTrigger = 0,
120    ///1: Trigger interrupt pending
121    Trigger = 1,
122}
123impl From<TIFR_A> for bool {
124    #[inline(always)]
125    fn from(variant: TIFR_A) -> Self {
126        variant as u8 != 0
127    }
128}
129impl TIF_R {
130    ///Get enumerated values variant
131    #[inline(always)]
132    pub fn variant(&self) -> TIFR_A {
133        match self.bits {
134            false => TIFR_A::NoTrigger,
135            true => TIFR_A::Trigger,
136        }
137    }
138    ///Checks if the value of the field is `NoTrigger`
139    #[inline(always)]
140    pub fn is_no_trigger(&self) -> bool {
141        *self == TIFR_A::NoTrigger
142    }
143    ///Checks if the value of the field is `Trigger`
144    #[inline(always)]
145    pub fn is_trigger(&self) -> bool {
146        *self == TIFR_A::Trigger
147    }
148}
149/**Trigger interrupt flag
150
151Value on reset: 0*/
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153pub enum TIFW_AW {
154    ///0: Clear flag
155    Clear = 0,
156}
157impl From<TIFW_AW> for bool {
158    #[inline(always)]
159    fn from(variant: TIFW_AW) -> Self {
160        variant as u8 != 0
161    }
162}
163///Field `TIF` writer - Trigger interrupt flag
164pub type TIF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, TIFW_AW, O>;
165impl<'a, const O: u8> TIF_W<'a, O> {
166    ///Clear flag
167    #[inline(always)]
168    pub fn clear(self) -> &'a mut W {
169        self.variant(TIFW_AW::Clear)
170    }
171}
172///Field `BIF` reader - Break interrupt flag
173pub type BIF_R = crate::BitReader<bool>;
174///Field `BIF` writer - Break interrupt flag
175pub type BIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
176///Field `CC1OF` reader - Capture/Compare 1 overcapture flag
177pub type CC1OF_R = crate::BitReader<CC1OFR_A>;
178/**Capture/Compare 1 overcapture flag
179
180Value on reset: 0*/
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum CC1OFR_A {
183    ///1: The counter value has been captured in TIMx_CCRx register while CCxIF flag was already set
184    Overcapture = 1,
185}
186impl From<CC1OFR_A> for bool {
187    #[inline(always)]
188    fn from(variant: CC1OFR_A) -> Self {
189        variant as u8 != 0
190    }
191}
192impl CC1OF_R {
193    ///Get enumerated values variant
194    #[inline(always)]
195    pub fn variant(&self) -> Option<CC1OFR_A> {
196        match self.bits {
197            true => Some(CC1OFR_A::Overcapture),
198            _ => None,
199        }
200    }
201    ///Checks if the value of the field is `Overcapture`
202    #[inline(always)]
203    pub fn is_overcapture(&self) -> bool {
204        *self == CC1OFR_A::Overcapture
205    }
206}
207/**Capture/Compare 1 overcapture flag
208
209Value on reset: 0*/
210#[derive(Clone, Copy, Debug, PartialEq, Eq)]
211pub enum CC1OFW_AW {
212    ///0: Clear flag
213    Clear = 0,
214}
215impl From<CC1OFW_AW> for bool {
216    #[inline(always)]
217    fn from(variant: CC1OFW_AW) -> Self {
218        variant as u8 != 0
219    }
220}
221///Field `CC1OF` writer - Capture/Compare 1 overcapture flag
222pub type CC1OF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, CC1OFW_AW, O>;
223impl<'a, const O: u8> CC1OF_W<'a, O> {
224    ///Clear flag
225    #[inline(always)]
226    pub fn clear(self) -> &'a mut W {
227        self.variant(CC1OFW_AW::Clear)
228    }
229}
230///Field `CC2OF` reader - Capture/compare 2 overcapture flag
231pub use CC1OF_R as CC2OF_R;
232///Field `CC3OF` reader - Capture/Compare 3 overcapture flag
233pub use CC1OF_R as CC3OF_R;
234///Field `CC4OF` reader - Capture/Compare 4 overcapture flag
235pub use CC1OF_R as CC4OF_R;
236///Field `CC2OF` writer - Capture/compare 2 overcapture flag
237pub use CC1OF_W as CC2OF_W;
238///Field `CC3OF` writer - Capture/Compare 3 overcapture flag
239pub use CC1OF_W as CC3OF_W;
240///Field `CC4OF` writer - Capture/Compare 4 overcapture flag
241pub use CC1OF_W as CC4OF_W;
242impl R {
243    ///Bit 0 - Update interrupt flag
244    #[inline(always)]
245    pub fn uif(&self) -> UIF_R {
246        UIF_R::new((self.bits & 1) != 0)
247    }
248    ///Bit 1 - Capture/compare 1 interrupt flag
249    #[inline(always)]
250    pub fn cc1if(&self) -> CC1IF_R {
251        CC1IF_R::new(((self.bits >> 1) & 1) != 0)
252    }
253    ///Bit 2 - Capture/Compare 2 interrupt flag
254    #[inline(always)]
255    pub fn cc2if(&self) -> CC2IF_R {
256        CC2IF_R::new(((self.bits >> 2) & 1) != 0)
257    }
258    ///Bit 3 - Capture/Compare 3 interrupt flag
259    #[inline(always)]
260    pub fn cc3if(&self) -> CC3IF_R {
261        CC3IF_R::new(((self.bits >> 3) & 1) != 0)
262    }
263    ///Bit 4 - Capture/Compare 4 interrupt flag
264    #[inline(always)]
265    pub fn cc4if(&self) -> CC4IF_R {
266        CC4IF_R::new(((self.bits >> 4) & 1) != 0)
267    }
268    ///Bit 5 - COM interrupt flag
269    #[inline(always)]
270    pub fn comif(&self) -> COMIF_R {
271        COMIF_R::new(((self.bits >> 5) & 1) != 0)
272    }
273    ///Bit 6 - Trigger interrupt flag
274    #[inline(always)]
275    pub fn tif(&self) -> TIF_R {
276        TIF_R::new(((self.bits >> 6) & 1) != 0)
277    }
278    ///Bit 7 - Break interrupt flag
279    #[inline(always)]
280    pub fn bif(&self) -> BIF_R {
281        BIF_R::new(((self.bits >> 7) & 1) != 0)
282    }
283    ///Bit 9 - Capture/Compare 1 overcapture flag
284    #[inline(always)]
285    pub fn cc1of(&self) -> CC1OF_R {
286        CC1OF_R::new(((self.bits >> 9) & 1) != 0)
287    }
288    ///Bit 10 - Capture/compare 2 overcapture flag
289    #[inline(always)]
290    pub fn cc2of(&self) -> CC2OF_R {
291        CC2OF_R::new(((self.bits >> 10) & 1) != 0)
292    }
293    ///Bit 11 - Capture/Compare 3 overcapture flag
294    #[inline(always)]
295    pub fn cc3of(&self) -> CC3OF_R {
296        CC3OF_R::new(((self.bits >> 11) & 1) != 0)
297    }
298    ///Bit 12 - Capture/Compare 4 overcapture flag
299    #[inline(always)]
300    pub fn cc4of(&self) -> CC4OF_R {
301        CC4OF_R::new(((self.bits >> 12) & 1) != 0)
302    }
303}
304impl W {
305    ///Bit 0 - Update interrupt flag
306    #[inline(always)]
307    #[must_use]
308    pub fn uif(&mut self) -> UIF_W<0> {
309        UIF_W::new(self)
310    }
311    ///Bit 1 - Capture/compare 1 interrupt flag
312    #[inline(always)]
313    #[must_use]
314    pub fn cc1if(&mut self) -> CC1IF_W<1> {
315        CC1IF_W::new(self)
316    }
317    ///Bit 2 - Capture/Compare 2 interrupt flag
318    #[inline(always)]
319    #[must_use]
320    pub fn cc2if(&mut self) -> CC2IF_W<2> {
321        CC2IF_W::new(self)
322    }
323    ///Bit 3 - Capture/Compare 3 interrupt flag
324    #[inline(always)]
325    #[must_use]
326    pub fn cc3if(&mut self) -> CC3IF_W<3> {
327        CC3IF_W::new(self)
328    }
329    ///Bit 4 - Capture/Compare 4 interrupt flag
330    #[inline(always)]
331    #[must_use]
332    pub fn cc4if(&mut self) -> CC4IF_W<4> {
333        CC4IF_W::new(self)
334    }
335    ///Bit 5 - COM interrupt flag
336    #[inline(always)]
337    #[must_use]
338    pub fn comif(&mut self) -> COMIF_W<5> {
339        COMIF_W::new(self)
340    }
341    ///Bit 6 - Trigger interrupt flag
342    #[inline(always)]
343    #[must_use]
344    pub fn tif(&mut self) -> TIF_W<6> {
345        TIF_W::new(self)
346    }
347    ///Bit 7 - Break interrupt flag
348    #[inline(always)]
349    #[must_use]
350    pub fn bif(&mut self) -> BIF_W<7> {
351        BIF_W::new(self)
352    }
353    ///Bit 9 - Capture/Compare 1 overcapture flag
354    #[inline(always)]
355    #[must_use]
356    pub fn cc1of(&mut self) -> CC1OF_W<9> {
357        CC1OF_W::new(self)
358    }
359    ///Bit 10 - Capture/compare 2 overcapture flag
360    #[inline(always)]
361    #[must_use]
362    pub fn cc2of(&mut self) -> CC2OF_W<10> {
363        CC2OF_W::new(self)
364    }
365    ///Bit 11 - Capture/Compare 3 overcapture flag
366    #[inline(always)]
367    #[must_use]
368    pub fn cc3of(&mut self) -> CC3OF_W<11> {
369        CC3OF_W::new(self)
370    }
371    ///Bit 12 - Capture/Compare 4 overcapture flag
372    #[inline(always)]
373    #[must_use]
374    pub fn cc4of(&mut self) -> CC4OF_W<12> {
375        CC4OF_W::new(self)
376    }
377    ///Writes raw bits to the register.
378    #[inline(always)]
379    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
380        self.0.bits(bits);
381        self
382    }
383}
384/**status register
385
386This 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).
387
388For information about available fields see [sr](index.html) module*/
389pub struct SR_SPEC;
390impl crate::RegisterSpec for SR_SPEC {
391    type Ux = u32;
392}
393///`read()` method returns [sr::R](R) reader structure
394impl crate::Readable for SR_SPEC {
395    type Reader = R;
396}
397///`write(|w| ..)` method takes [sr::W](W) writer structure
398impl crate::Writable for SR_SPEC {
399    type Writer = W;
400    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x1e5e;
401    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
402}
403///`reset()` method sets SR to value 0
404impl crate::Resettable for SR_SPEC {
405    const RESET_VALUE: Self::Ux = 0;
406}