py32f0/py32f030/tim3/
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 `TIF` reader - Trigger interrupt flag
108pub type TIF_R = crate::BitReader<TIFR_A>;
109/**Trigger interrupt flag
110
111Value on reset: 0*/
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum TIFR_A {
114    ///0: No trigger event occurred
115    NoTrigger = 0,
116    ///1: Trigger interrupt pending
117    Trigger = 1,
118}
119impl From<TIFR_A> for bool {
120    #[inline(always)]
121    fn from(variant: TIFR_A) -> Self {
122        variant as u8 != 0
123    }
124}
125impl TIF_R {
126    ///Get enumerated values variant
127    #[inline(always)]
128    pub fn variant(&self) -> TIFR_A {
129        match self.bits {
130            false => TIFR_A::NoTrigger,
131            true => TIFR_A::Trigger,
132        }
133    }
134    ///Checks if the value of the field is `NoTrigger`
135    #[inline(always)]
136    pub fn is_no_trigger(&self) -> bool {
137        *self == TIFR_A::NoTrigger
138    }
139    ///Checks if the value of the field is `Trigger`
140    #[inline(always)]
141    pub fn is_trigger(&self) -> bool {
142        *self == TIFR_A::Trigger
143    }
144}
145/**Trigger interrupt flag
146
147Value on reset: 0*/
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum TIFW_AW {
150    ///0: Clear flag
151    Clear = 0,
152}
153impl From<TIFW_AW> for bool {
154    #[inline(always)]
155    fn from(variant: TIFW_AW) -> Self {
156        variant as u8 != 0
157    }
158}
159///Field `TIF` writer - Trigger interrupt flag
160pub type TIF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, TIFW_AW, O>;
161impl<'a, const O: u8> TIF_W<'a, O> {
162    ///Clear flag
163    #[inline(always)]
164    pub fn clear(self) -> &'a mut W {
165        self.variant(TIFW_AW::Clear)
166    }
167}
168///Field `CC1OF` reader - Capture/Compare 1 overcapture flag
169pub type CC1OF_R = crate::BitReader<CC1OFR_A>;
170/**Capture/Compare 1 overcapture flag
171
172Value on reset: 0*/
173#[derive(Clone, Copy, Debug, PartialEq, Eq)]
174pub enum CC1OFR_A {
175    ///1: The counter value has been captured in TIMx_CCRx register while CCxIF flag was already set
176    Overcapture = 1,
177}
178impl From<CC1OFR_A> for bool {
179    #[inline(always)]
180    fn from(variant: CC1OFR_A) -> Self {
181        variant as u8 != 0
182    }
183}
184impl CC1OF_R {
185    ///Get enumerated values variant
186    #[inline(always)]
187    pub fn variant(&self) -> Option<CC1OFR_A> {
188        match self.bits {
189            true => Some(CC1OFR_A::Overcapture),
190            _ => None,
191        }
192    }
193    ///Checks if the value of the field is `Overcapture`
194    #[inline(always)]
195    pub fn is_overcapture(&self) -> bool {
196        *self == CC1OFR_A::Overcapture
197    }
198}
199/**Capture/Compare 1 overcapture flag
200
201Value on reset: 0*/
202#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum CC1OFW_AW {
204    ///0: Clear flag
205    Clear = 0,
206}
207impl From<CC1OFW_AW> for bool {
208    #[inline(always)]
209    fn from(variant: CC1OFW_AW) -> Self {
210        variant as u8 != 0
211    }
212}
213///Field `CC1OF` writer - Capture/Compare 1 overcapture flag
214pub type CC1OF_W<'a, const O: u8> = crate::BitWriter0C<'a, u32, SR_SPEC, CC1OFW_AW, O>;
215impl<'a, const O: u8> CC1OF_W<'a, O> {
216    ///Clear flag
217    #[inline(always)]
218    pub fn clear(self) -> &'a mut W {
219        self.variant(CC1OFW_AW::Clear)
220    }
221}
222///Field `CC2OF` reader - Capture/compare 2 overcapture flag
223pub use CC1OF_R as CC2OF_R;
224///Field `CC3OF` reader - Capture/Compare 3 overcapture flag
225pub use CC1OF_R as CC3OF_R;
226///Field `CC4OF` reader - Capture/Compare 4 overcapture flag
227pub use CC1OF_R as CC4OF_R;
228///Field `CC2OF` writer - Capture/compare 2 overcapture flag
229pub use CC1OF_W as CC2OF_W;
230///Field `CC3OF` writer - Capture/Compare 3 overcapture flag
231pub use CC1OF_W as CC3OF_W;
232///Field `CC4OF` writer - Capture/Compare 4 overcapture flag
233pub use CC1OF_W as CC4OF_W;
234impl R {
235    ///Bit 0 - Update interrupt flag
236    #[inline(always)]
237    pub fn uif(&self) -> UIF_R {
238        UIF_R::new((self.bits & 1) != 0)
239    }
240    ///Bit 1 - Capture/compare 1 interrupt flag
241    #[inline(always)]
242    pub fn cc1if(&self) -> CC1IF_R {
243        CC1IF_R::new(((self.bits >> 1) & 1) != 0)
244    }
245    ///Bit 2 - Capture/Compare 2 interrupt flag
246    #[inline(always)]
247    pub fn cc2if(&self) -> CC2IF_R {
248        CC2IF_R::new(((self.bits >> 2) & 1) != 0)
249    }
250    ///Bit 3 - Capture/Compare 3 interrupt flag
251    #[inline(always)]
252    pub fn cc3if(&self) -> CC3IF_R {
253        CC3IF_R::new(((self.bits >> 3) & 1) != 0)
254    }
255    ///Bit 4 - Capture/Compare 4 interrupt flag
256    #[inline(always)]
257    pub fn cc4if(&self) -> CC4IF_R {
258        CC4IF_R::new(((self.bits >> 4) & 1) != 0)
259    }
260    ///Bit 6 - Trigger interrupt flag
261    #[inline(always)]
262    pub fn tif(&self) -> TIF_R {
263        TIF_R::new(((self.bits >> 6) & 1) != 0)
264    }
265    ///Bit 9 - Capture/Compare 1 overcapture flag
266    #[inline(always)]
267    pub fn cc1of(&self) -> CC1OF_R {
268        CC1OF_R::new(((self.bits >> 9) & 1) != 0)
269    }
270    ///Bit 10 - Capture/compare 2 overcapture flag
271    #[inline(always)]
272    pub fn cc2of(&self) -> CC2OF_R {
273        CC2OF_R::new(((self.bits >> 10) & 1) != 0)
274    }
275    ///Bit 11 - Capture/Compare 3 overcapture flag
276    #[inline(always)]
277    pub fn cc3of(&self) -> CC3OF_R {
278        CC3OF_R::new(((self.bits >> 11) & 1) != 0)
279    }
280    ///Bit 12 - Capture/Compare 4 overcapture flag
281    #[inline(always)]
282    pub fn cc4of(&self) -> CC4OF_R {
283        CC4OF_R::new(((self.bits >> 12) & 1) != 0)
284    }
285}
286impl W {
287    ///Bit 0 - Update interrupt flag
288    #[inline(always)]
289    #[must_use]
290    pub fn uif(&mut self) -> UIF_W<0> {
291        UIF_W::new(self)
292    }
293    ///Bit 1 - Capture/compare 1 interrupt flag
294    #[inline(always)]
295    #[must_use]
296    pub fn cc1if(&mut self) -> CC1IF_W<1> {
297        CC1IF_W::new(self)
298    }
299    ///Bit 2 - Capture/Compare 2 interrupt flag
300    #[inline(always)]
301    #[must_use]
302    pub fn cc2if(&mut self) -> CC2IF_W<2> {
303        CC2IF_W::new(self)
304    }
305    ///Bit 3 - Capture/Compare 3 interrupt flag
306    #[inline(always)]
307    #[must_use]
308    pub fn cc3if(&mut self) -> CC3IF_W<3> {
309        CC3IF_W::new(self)
310    }
311    ///Bit 4 - Capture/Compare 4 interrupt flag
312    #[inline(always)]
313    #[must_use]
314    pub fn cc4if(&mut self) -> CC4IF_W<4> {
315        CC4IF_W::new(self)
316    }
317    ///Bit 6 - Trigger interrupt flag
318    #[inline(always)]
319    #[must_use]
320    pub fn tif(&mut self) -> TIF_W<6> {
321        TIF_W::new(self)
322    }
323    ///Bit 9 - Capture/Compare 1 overcapture flag
324    #[inline(always)]
325    #[must_use]
326    pub fn cc1of(&mut self) -> CC1OF_W<9> {
327        CC1OF_W::new(self)
328    }
329    ///Bit 10 - Capture/compare 2 overcapture flag
330    #[inline(always)]
331    #[must_use]
332    pub fn cc2of(&mut self) -> CC2OF_W<10> {
333        CC2OF_W::new(self)
334    }
335    ///Bit 11 - Capture/Compare 3 overcapture flag
336    #[inline(always)]
337    #[must_use]
338    pub fn cc3of(&mut self) -> CC3OF_W<11> {
339        CC3OF_W::new(self)
340    }
341    ///Bit 12 - Capture/Compare 4 overcapture flag
342    #[inline(always)]
343    #[must_use]
344    pub fn cc4of(&mut self) -> CC4OF_W<12> {
345        CC4OF_W::new(self)
346    }
347    ///Writes raw bits to the register.
348    #[inline(always)]
349    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
350        self.0.bits(bits);
351        self
352    }
353}
354/**status register
355
356This 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).
357
358For information about available fields see [sr](index.html) module*/
359pub struct SR_SPEC;
360impl crate::RegisterSpec for SR_SPEC {
361    type Ux = u32;
362}
363///`read()` method returns [sr::R](R) reader structure
364impl crate::Readable for SR_SPEC {
365    type Reader = R;
366}
367///`write(|w| ..)` method takes [sr::W](W) writer structure
368impl crate::Writable for SR_SPEC {
369    type Writer = W;
370    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x1e5e;
371    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
372}
373///`reset()` method sets SR to value 0
374impl crate::Resettable for SR_SPEC {
375    const RESET_VALUE: Self::Ux = 0;
376}