Skip to content

Commit 6e71ac9

Browse files
committed
qei pins
1 parent adc4651 commit 6e71ac9

File tree

4 files changed

+186
-161
lines changed

4 files changed

+186
-161
lines changed

src/gpio/alt.rs

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,20 @@ pub mod tim1 {
26952695
PG5<1>,
26962696
],
26972697
}
2698+
use crate::pac::TIM1 as TIM;
2699+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2700+
impl PinCh<C1> for TIM {
2701+
type Ch = Ch1;
2702+
}
2703+
impl PinCh<C2> for TIM {
2704+
type Ch = Ch2;
2705+
}
2706+
impl PinCh<C3> for TIM {
2707+
type Ch = Ch3;
2708+
}
2709+
impl PinCh<C4> for TIM {
2710+
type Ch = Ch4;
2711+
}
26982712
}
26992713

27002714
pub mod tim2 {
@@ -2723,6 +2737,20 @@ pub mod tim2 {
27232737
PA5<1>,
27242738
],
27252739
}
2740+
use crate::pac::TIM2 as TIM;
2741+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2742+
impl PinCh<C1> for TIM {
2743+
type Ch = Ch1;
2744+
}
2745+
impl PinCh<C2> for TIM {
2746+
type Ch = Ch2;
2747+
}
2748+
impl PinCh<C3> for TIM {
2749+
type Ch = Ch3;
2750+
}
2751+
impl PinCh<C4> for TIM {
2752+
type Ch = Ch4;
2753+
}
27262754
}
27272755

27282756
pub mod tim3 {
@@ -2750,6 +2778,20 @@ pub mod tim3 {
27502778
PD2<2>,
27512779
],
27522780
}
2781+
use crate::pac::TIM3 as TIM;
2782+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2783+
impl PinCh<C1> for TIM {
2784+
type Ch = Ch1;
2785+
}
2786+
impl PinCh<C2> for TIM {
2787+
type Ch = Ch2;
2788+
}
2789+
impl PinCh<C3> for TIM {
2790+
type Ch = Ch3;
2791+
}
2792+
impl PinCh<C4> for TIM {
2793+
type Ch = Ch4;
2794+
}
27532795
}
27542796

27552797
pub mod tim4 {
@@ -2775,6 +2817,20 @@ pub mod tim4 {
27752817
PE0<2>,
27762818
],
27772819
}
2820+
use crate::pac::TIM4 as TIM;
2821+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2822+
impl PinCh<C1> for TIM {
2823+
type Ch = Ch1;
2824+
}
2825+
impl PinCh<C2> for TIM {
2826+
type Ch = Ch2;
2827+
}
2828+
impl PinCh<C3> for TIM {
2829+
type Ch = Ch3;
2830+
}
2831+
impl PinCh<C4> for TIM {
2832+
type Ch = Ch4;
2833+
}
27782834
}
27792835

27802836
pub mod tim5 {
@@ -2803,6 +2859,20 @@ pub mod tim5 {
28032859
PH8<2>,
28042860
],
28052861
}
2862+
use crate::pac::TIM5 as TIM;
2863+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2864+
impl PinCh<C1> for TIM {
2865+
type Ch = Ch1;
2866+
}
2867+
impl PinCh<C2> for TIM {
2868+
type Ch = Ch2;
2869+
}
2870+
impl PinCh<C3> for TIM {
2871+
type Ch = Ch3;
2872+
}
2873+
impl PinCh<C4> for TIM {
2874+
type Ch = Ch4;
2875+
}
28062876
}
28072877

28082878
pub mod tim8 {
@@ -2911,6 +2981,20 @@ pub mod tim8 {
29112981
PI3<3>,
29122982
],
29132983
}
2984+
use crate::pac::TIM8 as TIM;
2985+
use crate::pwm::{PinCh, C1, C2, C3, C4};
2986+
impl PinCh<C1> for TIM {
2987+
type Ch = Ch1;
2988+
}
2989+
impl PinCh<C2> for TIM {
2990+
type Ch = Ch2;
2991+
}
2992+
impl PinCh<C3> for TIM {
2993+
type Ch = Ch3;
2994+
}
2995+
impl PinCh<C4> for TIM {
2996+
type Ch = Ch4;
2997+
}
29142998
}
29152999

29163000
pub mod tim12 {
@@ -2925,6 +3009,14 @@ pub mod tim12 {
29253009
PH9<2>,
29263010
],
29273011
}
3012+
use crate::pac::TIM12 as TIM;
3013+
use crate::pwm::{PinCh, C1, C2};
3014+
impl PinCh<C1> for TIM {
3015+
type Ch = Ch1;
3016+
}
3017+
impl PinCh<C2> for TIM {
3018+
type Ch = Ch2;
3019+
}
29283020
}
29293021

29303022
pub mod tim13 {
@@ -2935,6 +3027,11 @@ pub mod tim13 {
29353027
PF8<9>,
29363028
],
29373029
}
3030+
use crate::pac::TIM13 as TIM;
3031+
use crate::pwm::{PinCh, C1};
3032+
impl PinCh<C1> for TIM {
3033+
type Ch = Ch1;
3034+
}
29383035
}
29393036

29403037
pub mod tim14 {
@@ -2945,6 +3042,11 @@ pub mod tim14 {
29453042
PF9<9>,
29463043
],
29473044
}
3045+
use crate::pac::TIM14 as TIM;
3046+
use crate::pwm::{PinCh, C1};
3047+
impl PinCh<C1> for TIM {
3048+
type Ch = Ch1;
3049+
}
29483050
}
29493051

29503052
pub mod tim15 {
@@ -2973,6 +3075,14 @@ pub mod tim15 {
29733075
PE6<4>,
29743076
],
29753077
}
3078+
use crate::pac::TIM15 as TIM;
3079+
use crate::pwm::{PinCh, C1, C2};
3080+
impl PinCh<C1> for TIM {
3081+
type Ch = Ch1;
3082+
}
3083+
impl PinCh<C2> for TIM {
3084+
type Ch = Ch2;
3085+
}
29763086
}
29773087

29783088
pub mod tim16 {
@@ -2991,6 +3101,11 @@ pub mod tim16 {
29913101
PF8<1>,
29923102
],
29933103
}
3104+
use crate::pac::TIM16 as TIM;
3105+
use crate::pwm::{PinCh, C1};
3106+
impl PinCh<C1> for TIM {
3107+
type Ch = Ch1;
3108+
}
29943109
}
29953110

29963111
pub mod tim17 {
@@ -3009,6 +3124,11 @@ pub mod tim17 {
30093124
PF9<1>,
30103125
],
30113126
}
3127+
use crate::pac::TIM17 as TIM;
3128+
use crate::pwm::{PinCh, C1};
3129+
impl PinCh<C1> for TIM {
3130+
type Ch = Ch1;
3131+
}
30123132
}
30133133

30143134
#[cfg(feature = "gpio-h72")]
@@ -3039,6 +3159,20 @@ pub mod tim23 {
30393159
PG3<13>,
30403160
],
30413161
}
3162+
use crate::pac::TIM23 as TIM;
3163+
use crate::pwm::{PinCh, C1, C2, C3, C4};
3164+
impl PinCh<C1> for TIM {
3165+
type Ch = Ch1;
3166+
}
3167+
impl PinCh<C2> for TIM {
3168+
type Ch = Ch2;
3169+
}
3170+
impl PinCh<C3> for TIM {
3171+
type Ch = Ch3;
3172+
}
3173+
impl PinCh<C4> for TIM {
3174+
type Ch = Ch4;
3175+
}
30423176
}
30433177

30443178
#[cfg(feature = "gpio-h72")]
@@ -3062,6 +3196,20 @@ pub mod tim24 {
30623196
PG2<14>,
30633197
],
30643198
}
3199+
use crate::pac::TIM24 as TIM;
3200+
use crate::pwm::{PinCh, C1, C2, C3, C4};
3201+
impl PinCh<C1> for TIM {
3202+
type Ch = Ch1;
3203+
}
3204+
impl PinCh<C2> for TIM {
3205+
type Ch = Ch2;
3206+
}
3207+
impl PinCh<C3> for TIM {
3208+
type Ch = Ch3;
3209+
}
3210+
impl PinCh<C4> for TIM {
3211+
type Ch = Ch4;
3212+
}
30653213
}
30663214

30673215
#[cfg(any(feature = "gpio-h72", feature = "gpio-h747"))]

src/i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<I2C: Instance> I2c<I2C> {
288288
prec: I2C::Rec,
289289
clocks: &CoreClocks,
290290
) -> Self {
291-
let _pins = (pins.0.into(), pins.1.into());
291+
let _pins: (I2C::Scl, I2C::Sda) = (pins.0.into(), pins.1.into());
292292
Self::new_unchecked(i2c, frequency, prec, clocks)
293293
}
294294
/// Create and initialise a new I2C peripheral.

src/pwm.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
//! ```rust
1818
//! let gpioa = ..; // Set up and split GPIOA
1919
//! let pins = (
20-
//! gpioa.pa8.into_alternate_af1(),
21-
//! gpioa.pa9.into_alternate_af1(),
22-
//! gpioa.pa10.into_alternate_af1(),
23-
//! gpioa.pa11.into_alternate_af1(),
20+
//! gpioa.pa8.into_alternate(),
21+
//! gpioa.pa9.into_alternate(),
22+
//! gpioa.pa10.into_alternate(),
23+
//! gpioa.pa11.into_alternate(),
2424
//! );
2525
//! ```
2626
//!
@@ -56,10 +56,10 @@
5656
//! ```rust
5757
//! let gpioa = ..; // Set up and split GPIOA
5858
//! let pins = (
59-
//! gpioa.pa8.into_alternate_af1(),
60-
//! gpioa.pa9.into_alternate_af1(),
61-
//! gpioa.pa10.into_alternate_af1(),
62-
//! gpioa.pa11.into_alternate_af1(),
59+
//! gpioa.pa8.into_alternate(),
60+
//! gpioa.pa9.into_alternate(),
61+
//! gpioa.pa10.into_alternate(),
62+
//! gpioa.pa11.into_alternate(),
6363
//! );
6464
//! ```
6565
//!
@@ -203,6 +203,10 @@ pub trait FaultPins<TIM> {
203203
const INPUT: BreakInput;
204204
}
205205

206+
pub trait PinCh<const C: u8> {
207+
type Ch;
208+
}
209+
206210
/// Channel wrapper
207211
pub struct Ch<const C: u8>;
208212
impl<const C: u8> Ch<C> {

0 commit comments

Comments
 (0)