stm32f1/stm32f103/tim10/
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 = "Field `CC1OF` reader - Capture/Compare 1 overcapture flag"]
38pub type CC1OF_R = crate::BitReader<bool>;
39#[doc = "Field `CC1OF` writer - Capture/Compare 1 overcapture flag"]
40pub type CC1OF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
41#[doc = "Field `CC1IF` reader - Capture/compare 1 interrupt flag"]
42pub type CC1IF_R = crate::BitReader<bool>;
43#[doc = "Field `CC1IF` writer - Capture/compare 1 interrupt flag"]
44pub type CC1IF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
45#[doc = "Update interrupt flag\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum UIF_A {
48    #[doc = "0: No update occurred"]
49    Clear = 0,
50    #[doc = "1: Update interrupt pending."]
51    UpdatePending = 1,
52}
53impl From<UIF_A> for bool {
54    #[inline(always)]
55    fn from(variant: UIF_A) -> Self {
56        variant as u8 != 0
57    }
58}
59#[doc = "Field `UIF` reader - Update interrupt flag"]
60pub type UIF_R = crate::BitReader<UIF_A>;
61impl UIF_R {
62    #[doc = "Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> UIF_A {
65        match self.bits {
66            false => UIF_A::Clear,
67            true => UIF_A::UpdatePending,
68        }
69    }
70    #[doc = "Checks if the value of the field is `Clear`"]
71    #[inline(always)]
72    pub fn is_clear(&self) -> bool {
73        *self == UIF_A::Clear
74    }
75    #[doc = "Checks if the value of the field is `UpdatePending`"]
76    #[inline(always)]
77    pub fn is_update_pending(&self) -> bool {
78        *self == UIF_A::UpdatePending
79    }
80}
81#[doc = "Field `UIF` writer - Update interrupt flag"]
82pub type UIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, UIF_A, O>;
83impl<'a, const O: u8> UIF_W<'a, O> {
84    #[doc = "No update occurred"]
85    #[inline(always)]
86    pub fn clear(self) -> &'a mut W {
87        self.variant(UIF_A::Clear)
88    }
89    #[doc = "Update interrupt pending."]
90    #[inline(always)]
91    pub fn update_pending(self) -> &'a mut W {
92        self.variant(UIF_A::UpdatePending)
93    }
94}
95impl R {
96    #[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
97    #[inline(always)]
98    pub fn cc1of(&self) -> CC1OF_R {
99        CC1OF_R::new(((self.bits >> 9) & 1) != 0)
100    }
101    #[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
102    #[inline(always)]
103    pub fn cc1if(&self) -> CC1IF_R {
104        CC1IF_R::new(((self.bits >> 1) & 1) != 0)
105    }
106    #[doc = "Bit 0 - Update interrupt flag"]
107    #[inline(always)]
108    pub fn uif(&self) -> UIF_R {
109        UIF_R::new((self.bits & 1) != 0)
110    }
111}
112impl W {
113    #[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
114    #[inline(always)]
115    pub fn cc1of(&mut self) -> CC1OF_W<9> {
116        CC1OF_W::new(self)
117    }
118    #[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
119    #[inline(always)]
120    pub fn cc1if(&mut self) -> CC1IF_W<1> {
121        CC1IF_W::new(self)
122    }
123    #[doc = "Bit 0 - Update interrupt flag"]
124    #[inline(always)]
125    pub fn uif(&mut self) -> UIF_W<0> {
126        UIF_W::new(self)
127    }
128    #[doc = "Writes raw bits to the register."]
129    #[inline(always)]
130    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
131        self.0.bits(bits);
132        self
133    }
134}
135#[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"]
136pub struct SR_SPEC;
137impl crate::RegisterSpec for SR_SPEC {
138    type Ux = u32;
139}
140#[doc = "`read()` method returns [sr::R](R) reader structure"]
141impl crate::Readable for SR_SPEC {
142    type Reader = R;
143}
144#[doc = "`write(|w| ..)` method takes [sr::W](W) writer structure"]
145impl crate::Writable for SR_SPEC {
146    type Writer = W;
147}
148#[doc = "`reset()` method sets SR to value 0"]
149impl crate::Resettable for SR_SPEC {
150    #[inline(always)]
151    fn reset_value() -> Self::Ux {
152        0
153    }
154}