stm32l4x2_pac/tim1/
ccmr1_input.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CCMR1_INPUT {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct IC2FR {
47 bits: u8,
48}
49impl IC2FR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u8 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct IC2PSCR {
58 bits: u8,
59}
60impl IC2PSCR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct CC2SR {
69 bits: u8,
70}
71impl CC2SR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u8 {
75 self.bits
76 }
77}
78#[doc = r" Value of the field"]
79pub struct IC1FR {
80 bits: u8,
81}
82impl IC1FR {
83 #[doc = r" Value of the field as raw bits"]
84 #[inline]
85 pub fn bits(&self) -> u8 {
86 self.bits
87 }
88}
89#[doc = r" Value of the field"]
90pub struct IC1PSCR {
91 bits: u8,
92}
93impl IC1PSCR {
94 #[doc = r" Value of the field as raw bits"]
95 #[inline]
96 pub fn bits(&self) -> u8 {
97 self.bits
98 }
99}
100#[doc = r" Value of the field"]
101pub struct CC1SR {
102 bits: u8,
103}
104impl CC1SR {
105 #[doc = r" Value of the field as raw bits"]
106 #[inline]
107 pub fn bits(&self) -> u8 {
108 self.bits
109 }
110}
111#[doc = r" Proxy"]
112pub struct _IC2FW<'a> {
113 w: &'a mut W,
114}
115impl<'a> _IC2FW<'a> {
116 #[doc = r" Writes raw bits to the field"]
117 #[inline]
118 pub unsafe fn bits(self, value: u8) -> &'a mut W {
119 const MASK: u8 = 15;
120 const OFFSET: u8 = 12;
121 self.w.bits &= !((MASK as u32) << OFFSET);
122 self.w.bits |= ((value & MASK) as u32) << OFFSET;
123 self.w
124 }
125}
126#[doc = r" Proxy"]
127pub struct _IC2PSCW<'a> {
128 w: &'a mut W,
129}
130impl<'a> _IC2PSCW<'a> {
131 #[doc = r" Writes raw bits to the field"]
132 #[inline]
133 pub unsafe fn bits(self, value: u8) -> &'a mut W {
134 const MASK: u8 = 3;
135 const OFFSET: u8 = 10;
136 self.w.bits &= !((MASK as u32) << OFFSET);
137 self.w.bits |= ((value & MASK) as u32) << OFFSET;
138 self.w
139 }
140}
141#[doc = r" Proxy"]
142pub struct _CC2SW<'a> {
143 w: &'a mut W,
144}
145impl<'a> _CC2SW<'a> {
146 #[doc = r" Writes raw bits to the field"]
147 #[inline]
148 pub unsafe fn bits(self, value: u8) -> &'a mut W {
149 const MASK: u8 = 3;
150 const OFFSET: u8 = 8;
151 self.w.bits &= !((MASK as u32) << OFFSET);
152 self.w.bits |= ((value & MASK) as u32) << OFFSET;
153 self.w
154 }
155}
156#[doc = r" Proxy"]
157pub struct _IC1FW<'a> {
158 w: &'a mut W,
159}
160impl<'a> _IC1FW<'a> {
161 #[doc = r" Writes raw bits to the field"]
162 #[inline]
163 pub unsafe fn bits(self, value: u8) -> &'a mut W {
164 const MASK: u8 = 15;
165 const OFFSET: u8 = 4;
166 self.w.bits &= !((MASK as u32) << OFFSET);
167 self.w.bits |= ((value & MASK) as u32) << OFFSET;
168 self.w
169 }
170}
171#[doc = r" Proxy"]
172pub struct _IC1PSCW<'a> {
173 w: &'a mut W,
174}
175impl<'a> _IC1PSCW<'a> {
176 #[doc = r" Writes raw bits to the field"]
177 #[inline]
178 pub unsafe fn bits(self, value: u8) -> &'a mut W {
179 const MASK: u8 = 3;
180 const OFFSET: u8 = 2;
181 self.w.bits &= !((MASK as u32) << OFFSET);
182 self.w.bits |= ((value & MASK) as u32) << OFFSET;
183 self.w
184 }
185}
186#[doc = r" Proxy"]
187pub struct _CC1SW<'a> {
188 w: &'a mut W,
189}
190impl<'a> _CC1SW<'a> {
191 #[doc = r" Writes raw bits to the field"]
192 #[inline]
193 pub unsafe fn bits(self, value: u8) -> &'a mut W {
194 const MASK: u8 = 3;
195 const OFFSET: u8 = 0;
196 self.w.bits &= !((MASK as u32) << OFFSET);
197 self.w.bits |= ((value & MASK) as u32) << OFFSET;
198 self.w
199 }
200}
201impl R {
202 #[doc = r" Value of the register as raw bits"]
203 #[inline]
204 pub fn bits(&self) -> u32 {
205 self.bits
206 }
207 #[doc = "Bits 12:15 - Input capture 2 filter"]
208 #[inline]
209 pub fn ic2f(&self) -> IC2FR {
210 let bits = {
211 const MASK: u8 = 15;
212 const OFFSET: u8 = 12;
213 ((self.bits >> OFFSET) & MASK as u32) as u8
214 };
215 IC2FR { bits }
216 }
217 #[doc = "Bits 10:11 - Input capture 2 prescaler"]
218 #[inline]
219 pub fn ic2psc(&self) -> IC2PSCR {
220 let bits = {
221 const MASK: u8 = 3;
222 const OFFSET: u8 = 10;
223 ((self.bits >> OFFSET) & MASK as u32) as u8
224 };
225 IC2PSCR { bits }
226 }
227 #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
228 #[inline]
229 pub fn cc2s(&self) -> CC2SR {
230 let bits = {
231 const MASK: u8 = 3;
232 const OFFSET: u8 = 8;
233 ((self.bits >> OFFSET) & MASK as u32) as u8
234 };
235 CC2SR { bits }
236 }
237 #[doc = "Bits 4:7 - Input capture 1 filter"]
238 #[inline]
239 pub fn ic1f(&self) -> IC1FR {
240 let bits = {
241 const MASK: u8 = 15;
242 const OFFSET: u8 = 4;
243 ((self.bits >> OFFSET) & MASK as u32) as u8
244 };
245 IC1FR { bits }
246 }
247 #[doc = "Bits 2:3 - Input capture 1 prescaler"]
248 #[inline]
249 pub fn ic1psc(&self) -> IC1PSCR {
250 let bits = {
251 const MASK: u8 = 3;
252 const OFFSET: u8 = 2;
253 ((self.bits >> OFFSET) & MASK as u32) as u8
254 };
255 IC1PSCR { bits }
256 }
257 #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
258 #[inline]
259 pub fn cc1s(&self) -> CC1SR {
260 let bits = {
261 const MASK: u8 = 3;
262 const OFFSET: u8 = 0;
263 ((self.bits >> OFFSET) & MASK as u32) as u8
264 };
265 CC1SR { bits }
266 }
267}
268impl W {
269 #[doc = r" Reset value of the register"]
270 #[inline]
271 pub fn reset_value() -> W {
272 W { bits: 0 }
273 }
274 #[doc = r" Writes raw bits to the register"]
275 #[inline]
276 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
277 self.bits = bits;
278 self
279 }
280 #[doc = "Bits 12:15 - Input capture 2 filter"]
281 #[inline]
282 pub fn ic2f(&mut self) -> _IC2FW {
283 _IC2FW { w: self }
284 }
285 #[doc = "Bits 10:11 - Input capture 2 prescaler"]
286 #[inline]
287 pub fn ic2psc(&mut self) -> _IC2PSCW {
288 _IC2PSCW { w: self }
289 }
290 #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
291 #[inline]
292 pub fn cc2s(&mut self) -> _CC2SW {
293 _CC2SW { w: self }
294 }
295 #[doc = "Bits 4:7 - Input capture 1 filter"]
296 #[inline]
297 pub fn ic1f(&mut self) -> _IC1FW {
298 _IC1FW { w: self }
299 }
300 #[doc = "Bits 2:3 - Input capture 1 prescaler"]
301 #[inline]
302 pub fn ic1psc(&mut self) -> _IC1PSCW {
303 _IC1PSCW { w: self }
304 }
305 #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
306 #[inline]
307 pub fn cc1s(&mut self) -> _CC1SW {
308 _CC1SW { w: self }
309 }
310}