Skip to content

Commit bac857e

Browse files
committed
Remove AlfFn from PwmBinding
1 parent e8cbf7b commit bac857e

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/pwm.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,23 @@
22
33
use crate::gpio;
44
use crate::timer;
5-
use core::marker::PhantomData;
65
use hal;
76

87
/// pwm
9-
pub struct PwmBinding<P: gpio::GPIOPin,
10-
C: timer::TimerChannel,
11-
AF: gpio::AltFnNum>
12-
{
8+
pub struct PwmBinding<P: gpio::GPIOPin, C: timer::TimerChannel> {
139
pin: P,
1410
channel: C,
15-
_af: PhantomData<AF>,
1611
}
1712

18-
impl<P: gpio::GPIOPin, C: timer::TimerChannel, AF: gpio::AltFnNum>
19-
PwmBinding<P, C, AF>
20-
{
13+
impl<P: gpio::GPIOPin, C: timer::TimerChannel> PwmBinding<P, C> {
2114
/// Consumes PwmBinding returning pin and channel
2215
pub fn release(self) -> (P, C) {
2316
(self.pin, self.channel)
2417
}
2518
}
2619

27-
impl<P: gpio::GPIOPin, C: timer::TimerChannel, AF: gpio::AltFnNum> hal::PwmPin
28-
for PwmBinding<P, C, AF>
20+
impl<P: gpio::GPIOPin, C: timer::TimerChannel> hal::PwmPin
21+
for PwmBinding<P, C>
2922
{
3023
type Duty = u32;
3124
fn disable(&mut self) {
@@ -77,8 +70,7 @@ macro_rules! pwm {
7770
gpio::$PIN<PT, gpio::AltFn<gpio::$AF, gpio::$PP, SP>>;
7871
type Output = PwmBinding<Self::OutputPin,
7972
timer::$TIM::Channel<timer::$CHN,
80-
timer::Pwm1>,
81-
gpio::$AF>;
73+
timer::Pwm1>>;
8274
fn to_pwm(self,
8375
channel: timer::$TIM::Channel<timer::$CHN, CM>,
8476
sp: SP)
@@ -89,16 +81,13 @@ macro_rules! pwm {
8981
.alt_fn(gpio::$AF);
9082
let mut channel = channel.mode(timer::Pwm1);
9183
channel.preload($CHPE);
92-
PwmBinding { pin,
93-
channel,
94-
_af: PhantomData }
84+
PwmBinding { pin, channel }
9585
}
9686
}
9787

9888
impl<PT: gpio::PullType, PM: gpio::PinMode, CM: timer::ChMode>
9989
PwmBinding<gpio::$PIN<PT, PM>,
100-
timer::$TIM::Channel<timer::$CHN, CM>,
101-
gpio::$AF>
90+
timer::$TIM::Channel<timer::$CHN, CM>>
10291
{
10392
/// Modify channel's preload
10493
pub fn channel_preload(&mut self, enabled: bool) {

0 commit comments

Comments
 (0)