stm32f3/stm32f303/tim3/
sr.rs

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