stm32f1_hal/afio/
timer_remap.rs

1#![allow(unused_variables)]
2use super::*;
3use crate::{gpio::*, pac::*};
4
5// table
6// Do NOT manually modify the code.
7// It's generated by scripts/generate_remap_table.py from scripts/table/stm32f1_remap_peripheral.csv
8
9// Binder types ------------------
10
11pub trait TimBkinPin<REMAP> {
12    #[inline(always)]
13    fn is_pin(&self) -> bool {
14        true
15    }
16}
17impl<T> TimBkinPin<T> for NonePin {
18    #[inline(always)]
19    fn is_pin(&self) -> bool {
20        false
21    }
22}
23pub trait TimCh1Pin<REMAP> {
24    #[inline(always)]
25    fn is_pin(&self) -> bool {
26        true
27    }
28}
29impl<T> TimCh1Pin<T> for NonePin {
30    #[inline(always)]
31    fn is_pin(&self) -> bool {
32        false
33    }
34}
35pub trait TimCh1nPin<REMAP> {
36    #[inline(always)]
37    fn is_pin(&self) -> bool {
38        true
39    }
40}
41impl<T> TimCh1nPin<T> for NonePin {
42    #[inline(always)]
43    fn is_pin(&self) -> bool {
44        false
45    }
46}
47pub trait TimCh2Pin<REMAP> {
48    #[inline(always)]
49    fn is_pin(&self) -> bool {
50        true
51    }
52}
53impl<T> TimCh2Pin<T> for NonePin {
54    #[inline(always)]
55    fn is_pin(&self) -> bool {
56        false
57    }
58}
59pub trait TimCh2nPin<REMAP> {
60    #[inline(always)]
61    fn is_pin(&self) -> bool {
62        true
63    }
64}
65impl<T> TimCh2nPin<T> for NonePin {
66    #[inline(always)]
67    fn is_pin(&self) -> bool {
68        false
69    }
70}
71pub trait TimCh3Pin<REMAP> {
72    #[inline(always)]
73    fn is_pin(&self) -> bool {
74        true
75    }
76}
77impl<T> TimCh3Pin<T> for NonePin {
78    #[inline(always)]
79    fn is_pin(&self) -> bool {
80        false
81    }
82}
83pub trait TimCh3nPin<REMAP> {
84    #[inline(always)]
85    fn is_pin(&self) -> bool {
86        true
87    }
88}
89impl<T> TimCh3nPin<T> for NonePin {
90    #[inline(always)]
91    fn is_pin(&self) -> bool {
92        false
93    }
94}
95pub trait TimCh4Pin<REMAP> {
96    #[inline(always)]
97    fn is_pin(&self) -> bool {
98        true
99    }
100}
101impl<T> TimCh4Pin<T> for NonePin {
102    #[inline(always)]
103    fn is_pin(&self) -> bool {
104        false
105    }
106}
107pub trait TimEtrPin<REMAP> {
108    #[inline(always)]
109    fn is_pin(&self) -> bool {
110        true
111    }
112}
113impl<T> TimEtrPin<T> for NonePin {
114    #[inline(always)]
115    fn is_pin(&self) -> bool {
116        false
117    }
118}
119
120// Bind pins ---------------------
121
122#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
123impl TimCh1Pin<RemapDefault<TIM1>> for PA8<Alternate<PushPull>> {}
124#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
125impl TimCh2Pin<RemapDefault<TIM1>> for PA9<Alternate<PushPull>> {}
126#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
127impl TimCh3Pin<RemapDefault<TIM1>> for PA10<Alternate<PushPull>> {}
128#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
129impl TimCh4Pin<RemapDefault<TIM1>> for PA11<Alternate<PushPull>> {}
130#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
131impl TimCh1Pin<RemapFull<TIM1>> for PE9<Alternate<PushPull>> {}
132#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
133impl TimCh2Pin<RemapFull<TIM1>> for PE11<Alternate<PushPull>> {}
134#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
135impl TimCh3Pin<RemapFull<TIM1>> for PE13<Alternate<PushPull>> {}
136#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
137impl TimCh4Pin<RemapFull<TIM1>> for PE14<Alternate<PushPull>> {}
138#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
139impl TimCh1Pin<RemapPartial1<TIM1>> for PA8<Alternate<PushPull>> {}
140#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
141impl TimCh2Pin<RemapPartial1<TIM1>> for PA9<Alternate<PushPull>> {}
142#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
143impl TimCh3Pin<RemapPartial1<TIM1>> for PA10<Alternate<PushPull>> {}
144#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
145impl TimCh4Pin<RemapPartial1<TIM1>> for PA11<Alternate<PushPull>> {}
146#[cfg(feature = "xl")]
147impl TimCh1Pin<RemapDefault<TIM10>> for PB8<Alternate<PushPull>> {}
148#[cfg(feature = "xl")]
149impl TimCh1Pin<RemapFull<TIM10>> for PF6<Alternate<PushPull>> {}
150#[cfg(feature = "xl")]
151impl TimCh1Pin<RemapDefault<TIM11>> for PB9<Alternate<PushPull>> {}
152#[cfg(feature = "xl")]
153impl TimCh1Pin<RemapFull<TIM11>> for PF7<Alternate<PushPull>> {}
154#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
155impl TimCh1Pin<RemapDefault<TIM12>> for PB14<Alternate<PushPull>> {}
156#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
157impl TimCh2Pin<RemapDefault<TIM12>> for PB15<Alternate<PushPull>> {}
158#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
159impl TimCh1Pin<RemapDefault<TIM13>> for PA6<Alternate<PushPull>> {}
160#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
161impl TimCh1Pin<RemapFull<TIM13>> for PF8<Alternate<PushPull>> {}
162#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
163impl TimCh1Pin<RemapDefault<TIM14>> for PA7<Alternate<PushPull>> {}
164#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
165impl TimCh1Pin<RemapFull<TIM14>> for PF9<Alternate<PushPull>> {}
166impl TimCh1Pin<RemapDefault<TIM2>> for PA0<Alternate<PushPull>> {}
167impl TimCh2Pin<RemapDefault<TIM2>> for PA1<Alternate<PushPull>> {}
168impl TimCh3Pin<RemapDefault<TIM2>> for PA2<Alternate<PushPull>> {}
169impl TimCh4Pin<RemapDefault<TIM2>> for PA3<Alternate<PushPull>> {}
170impl TimCh1Pin<RemapFull<TIM2>> for PA15<Alternate<PushPull>> {}
171impl TimCh2Pin<RemapFull<TIM2>> for PB3<Alternate<PushPull>> {}
172impl TimCh3Pin<RemapFull<TIM2>> for PB10<Alternate<PushPull>> {}
173impl TimCh4Pin<RemapFull<TIM2>> for PB11<Alternate<PushPull>> {}
174impl TimCh1Pin<RemapPartial1<TIM2>> for PA15<Alternate<PushPull>> {}
175impl TimCh2Pin<RemapPartial1<TIM2>> for PB3<Alternate<PushPull>> {}
176impl TimCh3Pin<RemapPartial1<TIM2>> for PA2<Alternate<PushPull>> {}
177impl TimCh4Pin<RemapPartial1<TIM2>> for PA3<Alternate<PushPull>> {}
178impl TimCh1Pin<RemapPartial2<TIM2>> for PA0<Alternate<PushPull>> {}
179impl TimCh2Pin<RemapPartial2<TIM2>> for PA1<Alternate<PushPull>> {}
180impl TimCh3Pin<RemapPartial2<TIM2>> for PB10<Alternate<PushPull>> {}
181impl TimCh4Pin<RemapPartial2<TIM2>> for PB11<Alternate<PushPull>> {}
182impl TimCh1Pin<RemapDefault<TIM3>> for PA6<Alternate<PushPull>> {}
183impl TimCh2Pin<RemapDefault<TIM3>> for PA7<Alternate<PushPull>> {}
184impl TimCh3Pin<RemapDefault<TIM3>> for PB0<Alternate<PushPull>> {}
185impl TimCh4Pin<RemapDefault<TIM3>> for PB1<Alternate<PushPull>> {}
186impl TimCh1Pin<RemapFull<TIM3>> for PC6<Alternate<PushPull>> {}
187impl TimCh2Pin<RemapFull<TIM3>> for PC7<Alternate<PushPull>> {}
188impl TimCh3Pin<RemapFull<TIM3>> for PC8<Alternate<PushPull>> {}
189impl TimCh4Pin<RemapFull<TIM3>> for PC9<Alternate<PushPull>> {}
190impl TimCh1Pin<RemapPartial1<TIM3>> for PB4<Alternate<PushPull>> {}
191impl TimCh2Pin<RemapPartial1<TIM3>> for PB5<Alternate<PushPull>> {}
192impl TimCh3Pin<RemapPartial1<TIM3>> for PB0<Alternate<PushPull>> {}
193impl TimCh4Pin<RemapPartial1<TIM3>> for PB1<Alternate<PushPull>> {}
194#[cfg(feature = "medium")]
195impl TimCh1Pin<RemapDefault<TIM4>> for PB6<Alternate<PushPull>> {}
196#[cfg(feature = "medium")]
197impl TimCh2Pin<RemapDefault<TIM4>> for PB7<Alternate<PushPull>> {}
198#[cfg(feature = "medium")]
199impl TimCh3Pin<RemapDefault<TIM4>> for PB8<Alternate<PushPull>> {}
200#[cfg(feature = "medium")]
201impl TimCh4Pin<RemapDefault<TIM4>> for PB9<Alternate<PushPull>> {}
202#[cfg(feature = "medium")]
203impl TimCh1Pin<RemapFull<TIM4>> for PD12<Alternate<PushPull>> {}
204#[cfg(feature = "medium")]
205impl TimCh2Pin<RemapFull<TIM4>> for PD13<Alternate<PushPull>> {}
206#[cfg(feature = "medium")]
207impl TimCh3Pin<RemapFull<TIM4>> for PD14<Alternate<PushPull>> {}
208#[cfg(feature = "medium")]
209impl TimCh4Pin<RemapFull<TIM4>> for PD15<Alternate<PushPull>> {}
210#[cfg(any(feature = "high", feature = "connectivity"))]
211impl TimCh1Pin<RemapDefault<TIM5>> for PA0<Alternate<PushPull>> {}
212#[cfg(any(feature = "high", feature = "connectivity"))]
213impl TimCh2Pin<RemapDefault<TIM5>> for PA1<Alternate<PushPull>> {}
214#[cfg(any(feature = "high", feature = "connectivity"))]
215impl TimCh3Pin<RemapDefault<TIM5>> for PA2<Alternate<PushPull>> {}
216#[cfg(any(feature = "high", feature = "connectivity"))]
217impl TimCh4Pin<RemapDefault<TIM5>> for PA3<Alternate<PushPull>> {}
218#[cfg(any(feature = "high", feature = "connectivity"))]
219impl TimCh1Pin<RemapFull<TIM5>> for PA0<Alternate<PushPull>> {}
220#[cfg(any(feature = "high", feature = "connectivity"))]
221impl TimCh2Pin<RemapFull<TIM5>> for PA1<Alternate<PushPull>> {}
222#[cfg(any(feature = "high", feature = "connectivity"))]
223impl TimCh3Pin<RemapFull<TIM5>> for PA2<Alternate<PushPull>> {}
224#[cfg(all(feature = "f103", feature = "high"))]
225impl TimCh1Pin<RemapDefault<TIM8>> for PC6<Alternate<PushPull>> {}
226#[cfg(all(feature = "f103", feature = "high"))]
227impl TimCh2Pin<RemapDefault<TIM8>> for PC7<Alternate<PushPull>> {}
228#[cfg(all(feature = "f103", feature = "high"))]
229impl TimCh3Pin<RemapDefault<TIM8>> for PC8<Alternate<PushPull>> {}
230#[cfg(all(feature = "f103", feature = "high"))]
231impl TimCh4Pin<RemapDefault<TIM8>> for PC9<Alternate<PushPull>> {}
232#[cfg(feature = "xl")]
233impl TimCh1Pin<RemapDefault<TIM9>> for PA2<Alternate<PushPull>> {}
234#[cfg(feature = "xl")]
235impl TimCh2Pin<RemapDefault<TIM9>> for PA3<Alternate<PushPull>> {}
236#[cfg(feature = "xl")]
237impl TimCh1Pin<RemapFull<TIM9>> for PE5<Alternate<PushPull>> {}
238#[cfg(feature = "xl")]
239impl TimCh2Pin<RemapFull<TIM9>> for PE6<Alternate<PushPull>> {}
240
241// Register operations ------------
242
243#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
244impl RemapMode<TIM1> for RemapDefault<TIM1> {
245    fn remap(afio: &mut Afio) {
246        afio.mapr
247            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b00) });
248    }
249}
250#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
251impl RemapMode<TIM1> for RemapFull<TIM1> {
252    fn remap(afio: &mut Afio) {
253        afio.mapr
254            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b11) });
255    }
256}
257#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
258impl RemapMode<TIM1> for RemapPartial1<TIM1> {
259    fn remap(afio: &mut Afio) {
260        afio.mapr
261            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b01) });
262    }
263}
264#[cfg(feature = "xl")]
265impl RemapMode<TIM10> for RemapDefault<TIM10> {
266    fn remap(afio: &mut Afio) {
267        afio.mapr2.modify_mapr(|_, w| w.tim10_remap().clear_bit());
268    }
269}
270#[cfg(feature = "xl")]
271impl RemapMode<TIM10> for RemapFull<TIM10> {
272    fn remap(afio: &mut Afio) {
273        afio.mapr2.modify_mapr(|_, w| w.tim10_remap().set_bit());
274    }
275}
276#[cfg(feature = "xl")]
277impl RemapMode<TIM11> for RemapDefault<TIM11> {
278    fn remap(afio: &mut Afio) {
279        afio.mapr2.modify_mapr(|_, w| w.tim11_remap().clear_bit());
280    }
281}
282#[cfg(feature = "xl")]
283impl RemapMode<TIM11> for RemapFull<TIM11> {
284    fn remap(afio: &mut Afio) {
285        afio.mapr2.modify_mapr(|_, w| w.tim11_remap().set_bit());
286    }
287}
288#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
289impl RemapMode<TIM12> for RemapDefault<TIM12> {
290    fn remap(afio: &mut Afio) {}
291}
292#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
293impl RemapMode<TIM13> for RemapDefault<TIM13> {
294    fn remap(afio: &mut Afio) {
295        afio.mapr2.modify_mapr(|_, w| w.tim13_remap().clear_bit());
296    }
297}
298#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
299impl RemapMode<TIM13> for RemapFull<TIM13> {
300    fn remap(afio: &mut Afio) {
301        afio.mapr2.modify_mapr(|_, w| w.tim13_remap().set_bit());
302    }
303}
304#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
305impl RemapMode<TIM14> for RemapDefault<TIM14> {
306    fn remap(afio: &mut Afio) {
307        afio.mapr2.modify_mapr(|_, w| w.tim14_remap().clear_bit());
308    }
309}
310#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
311impl RemapMode<TIM14> for RemapFull<TIM14> {
312    fn remap(afio: &mut Afio) {
313        afio.mapr2.modify_mapr(|_, w| w.tim14_remap().set_bit());
314    }
315}
316impl RemapMode<TIM2> for RemapDefault<TIM2> {
317    fn remap(afio: &mut Afio) {
318        afio.mapr
319            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b00) });
320    }
321}
322impl RemapMode<TIM2> for RemapFull<TIM2> {
323    fn remap(afio: &mut Afio) {
324        afio.mapr
325            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b11) });
326    }
327}
328impl RemapMode<TIM2> for RemapPartial1<TIM2> {
329    fn remap(afio: &mut Afio) {
330        afio.mapr
331            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b01) });
332    }
333}
334impl RemapMode<TIM2> for RemapPartial2<TIM2> {
335    fn remap(afio: &mut Afio) {
336        afio.mapr
337            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b10) });
338    }
339}
340impl RemapMode<TIM3> for RemapDefault<TIM3> {
341    fn remap(afio: &mut Afio) {
342        afio.mapr
343            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b00) });
344    }
345}
346impl RemapMode<TIM3> for RemapFull<TIM3> {
347    fn remap(afio: &mut Afio) {
348        afio.mapr
349            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b11) });
350    }
351}
352impl RemapMode<TIM3> for RemapPartial1<TIM3> {
353    fn remap(afio: &mut Afio) {
354        afio.mapr
355            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b10) });
356    }
357}
358#[cfg(feature = "medium")]
359impl RemapMode<TIM4> for RemapDefault<TIM4> {
360    fn remap(afio: &mut Afio) {
361        afio.mapr.modify_mapr(|_, w| w.tim4_remap().clear_bit());
362    }
363}
364#[cfg(feature = "medium")]
365impl RemapMode<TIM4> for RemapFull<TIM4> {
366    fn remap(afio: &mut Afio) {
367        afio.mapr.modify_mapr(|_, w| w.tim4_remap().set_bit());
368    }
369}
370#[cfg(any(feature = "high", feature = "connectivity"))]
371impl RemapMode<TIM5> for RemapDefault<TIM5> {
372    fn remap(afio: &mut Afio) {
373        afio.mapr.modify_mapr(|_, w| w.tim5ch4_iremap().clear_bit());
374    }
375}
376#[cfg(any(feature = "high", feature = "connectivity"))]
377impl RemapMode<TIM5> for RemapFull<TIM5> {
378    fn remap(afio: &mut Afio) {
379        afio.mapr.modify_mapr(|_, w| w.tim5ch4_iremap().set_bit());
380    }
381}
382#[cfg(all(feature = "f103", feature = "high"))]
383impl RemapMode<TIM8> for RemapDefault<TIM8> {
384    fn remap(afio: &mut Afio) {}
385}
386#[cfg(feature = "xl")]
387impl RemapMode<TIM9> for RemapDefault<TIM9> {
388    fn remap(afio: &mut Afio) {
389        afio.mapr2.modify_mapr(|_, w| w.tim9_remap().clear_bit());
390    }
391}
392#[cfg(feature = "xl")]
393impl RemapMode<TIM9> for RemapFull<TIM9> {
394    fn remap(afio: &mut Afio) {
395        afio.mapr2.modify_mapr(|_, w| w.tim9_remap().set_bit());
396    }
397}