stm32f1/stm32f107/tim9/
ccmr1_input.rs

1#[doc = "Register `CCMR1_Input` reader"]
2pub struct R(crate::R<CCMR1_INPUT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CCMR1_INPUT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CCMR1_INPUT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CCMR1_INPUT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CCMR1_Input` writer"]
17pub struct W(crate::W<CCMR1_INPUT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CCMR1_INPUT_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<CCMR1_INPUT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CCMR1_INPUT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `IC2F` reader - Input capture 2 filter"]
38pub type IC2F_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `IC2F` writer - Input capture 2 filter"]
40pub type IC2F_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 4, O>;
41#[doc = "Field `IC2PSC` reader - Input capture 2 prescaler"]
42pub type IC2PSC_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `IC2PSC` writer - Input capture 2 prescaler"]
44pub type IC2PSC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 2, O>;
45#[doc = "Field `CC2S` reader - Capture/Compare 2 selection"]
46pub type CC2S_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `CC2S` writer - Capture/Compare 2 selection"]
48pub type CC2S_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 2, O>;
49#[doc = "Field `IC1F` reader - Input capture 1 filter"]
50pub type IC1F_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `IC1F` writer - Input capture 1 filter"]
52pub type IC1F_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 4, O>;
53#[doc = "Field `IC1PSC` reader - Input capture 1 prescaler"]
54pub type IC1PSC_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `IC1PSC` writer - Input capture 1 prescaler"]
56pub type IC1PSC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 2, O>;
57#[doc = "Field `CC1S` reader - Capture/Compare 1 selection"]
58pub type CC1S_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `CC1S` writer - Capture/Compare 1 selection"]
60pub type CC1S_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CCMR1_INPUT_SPEC, u8, u8, 2, O>;
61impl R {
62    #[doc = "Bits 12:15 - Input capture 2 filter"]
63    #[inline(always)]
64    pub fn ic2f(&self) -> IC2F_R {
65        IC2F_R::new(((self.bits >> 12) & 0x0f) as u8)
66    }
67    #[doc = "Bits 10:11 - Input capture 2 prescaler"]
68    #[inline(always)]
69    pub fn ic2psc(&self) -> IC2PSC_R {
70        IC2PSC_R::new(((self.bits >> 10) & 3) as u8)
71    }
72    #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
73    #[inline(always)]
74    pub fn cc2s(&self) -> CC2S_R {
75        CC2S_R::new(((self.bits >> 8) & 3) as u8)
76    }
77    #[doc = "Bits 4:7 - Input capture 1 filter"]
78    #[inline(always)]
79    pub fn ic1f(&self) -> IC1F_R {
80        IC1F_R::new(((self.bits >> 4) & 0x0f) as u8)
81    }
82    #[doc = "Bits 2:3 - Input capture 1 prescaler"]
83    #[inline(always)]
84    pub fn ic1psc(&self) -> IC1PSC_R {
85        IC1PSC_R::new(((self.bits >> 2) & 3) as u8)
86    }
87    #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
88    #[inline(always)]
89    pub fn cc1s(&self) -> CC1S_R {
90        CC1S_R::new((self.bits & 3) as u8)
91    }
92}
93impl W {
94    #[doc = "Bits 12:15 - Input capture 2 filter"]
95    #[inline(always)]
96    pub fn ic2f(&mut self) -> IC2F_W<12> {
97        IC2F_W::new(self)
98    }
99    #[doc = "Bits 10:11 - Input capture 2 prescaler"]
100    #[inline(always)]
101    pub fn ic2psc(&mut self) -> IC2PSC_W<10> {
102        IC2PSC_W::new(self)
103    }
104    #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
105    #[inline(always)]
106    pub fn cc2s(&mut self) -> CC2S_W<8> {
107        CC2S_W::new(self)
108    }
109    #[doc = "Bits 4:7 - Input capture 1 filter"]
110    #[inline(always)]
111    pub fn ic1f(&mut self) -> IC1F_W<4> {
112        IC1F_W::new(self)
113    }
114    #[doc = "Bits 2:3 - Input capture 1 prescaler"]
115    #[inline(always)]
116    pub fn ic1psc(&mut self) -> IC1PSC_W<2> {
117        IC1PSC_W::new(self)
118    }
119    #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
120    #[inline(always)]
121    pub fn cc1s(&mut self) -> CC1S_W<0> {
122        CC1S_W::new(self)
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "capture/compare mode register 1 (input mode)\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 [ccmr1_input](index.html) module"]
132pub struct CCMR1_INPUT_SPEC;
133impl crate::RegisterSpec for CCMR1_INPUT_SPEC {
134    type Ux = u32;
135}
136#[doc = "`read()` method returns [ccmr1_input::R](R) reader structure"]
137impl crate::Readable for CCMR1_INPUT_SPEC {
138    type Reader = R;
139}
140#[doc = "`write(|w| ..)` method takes [ccmr1_input::W](W) writer structure"]
141impl crate::Writable for CCMR1_INPUT_SPEC {
142    type Writer = W;
143}
144#[doc = "`reset()` method sets CCMR1_Input to value 0"]
145impl crate::Resettable for CCMR1_INPUT_SPEC {
146    #[inline(always)]
147    fn reset_value() -> Self::Ux {
148        0
149    }
150}