Skip to content

Commit 924e3bb

Browse files
committed
Swap PWM channel argument to reference per #244
1 parent f88ddc5 commit 924e3bb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/pwm.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
/// let max_duty = pwm.try_get_max_duty().unwrap();
2323
///
2424
/// // brightest LED
25-
/// pwm.try_set_duty(Channel::_1, max_duty).unwrap();
25+
/// pwm.try_set_duty(&Channel::_1, max_duty).unwrap();
2626
///
2727
/// // dimmer LED
28-
/// pwm.try_set_duty(Channel::_2, max_duty / 4).unwrap();
28+
/// pwm.try_set_duty(&Channel::_2, max_duty / 4).unwrap();
2929
/// }
3030
///
3131
/// # use core::convert::Infallible;
@@ -39,11 +39,11 @@
3939
/// # type Channel = Channel;
4040
/// # type Time = KiloHertz;
4141
/// # type Duty = u16;
42-
/// # fn try_disable(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() }
43-
/// # fn try_enable(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() }
44-
/// # fn try_get_duty(&self, _: Channel) -> Result<u16, Self::Error> { unimplemented!() }
42+
/// # fn try_disable(&mut self, _: &Channel) -> Result<(), Self::Error> { unimplemented!() }
43+
/// # fn try_enable(&mut self, _: &Channel) -> Result<(), Self::Error> { unimplemented!() }
44+
/// # fn try_get_duty(&self, _: &Channel) -> Result<u16, Self::Error> { unimplemented!() }
4545
/// # fn try_get_max_duty(&self) -> Result<u16, Self::Error> { Ok(0) }
46-
/// # fn try_set_duty(&mut self, _: Channel, _: u16) -> Result<(), Self::Error> { Ok(()) }
46+
/// # fn try_set_duty(&mut self, _: &Channel, _: u16) -> Result<(), Self::Error> { Ok(()) }
4747
/// # fn try_get_period(&self) -> Result<KiloHertz, Self::Error> { unimplemented!() }
4848
/// # fn try_set_period<T>(&mut self, _: T) -> Result<(), Self::Error> where T: Into<KiloHertz> { Ok(()) }
4949
/// # }
@@ -70,22 +70,22 @@ pub trait Pwm {
7070
type Duty;
7171

7272
/// Disables a PWM `channel`
73-
fn try_disable(&mut self, channel: Self::Channel) -> Result<(), Self::Error>;
73+
fn try_disable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>;
7474

7575
/// Enables a PWM `channel`
76-
fn try_enable(&mut self, channel: Self::Channel) -> Result<(), Self::Error>;
76+
fn try_enable(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>;
7777

7878
/// Returns the current PWM period
7979
fn try_get_period(&self) -> Result<Self::Time, Self::Error>;
8080

8181
/// Returns the current duty cycle
82-
fn try_get_duty(&self, channel: Self::Channel) -> Result<Self::Duty, Self::Error>;
82+
fn try_get_duty(&self, channel: &Self::Channel) -> Result<Self::Duty, Self::Error>;
8383

8484
/// Returns the maximum duty cycle value
8585
fn try_get_max_duty(&self) -> Result<Self::Duty, Self::Error>;
8686

8787
/// Sets a new duty cycle
88-
fn try_set_duty(&mut self, channel: Self::Channel, duty: Self::Duty)
88+
fn try_set_duty(&mut self, channel: &Self::Channel, duty: Self::Duty)
8989
-> Result<(), Self::Error>;
9090

9191
/// Sets a new PWM period

0 commit comments

Comments
 (0)