Skip to content

Commit b6a04ca

Browse files
committed
Add functions to enable/disable all channels for a timer
1 parent 9aa46aa commit b6a04ca

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/pwm.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
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!() }
42+
/// # fn try_disable(&mut self) -> Result<(), Self::Error> { unimplemented!() }
43+
/// # fn try_enable(&mut self) -> Result<(), Self::Error> { unimplemented!() }
44+
/// # fn try_disable_channel(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() }
45+
/// # fn try_enable_channel(&mut self, _: Channel) -> Result<(), Self::Error> { unimplemented!() }
4446
/// # fn try_get_duty(&self, _: Channel) -> Result<u16, Self::Error> { unimplemented!() }
4547
/// # fn try_get_max_duty(&self) -> Result<u16, Self::Error> { Ok(0) }
4648
/// # fn try_set_duty(&mut self, _: Channel, _: u16) -> Result<(), Self::Error> { Ok(()) }
@@ -69,11 +71,17 @@ pub trait Pwm {
6971
/// (e.g. `0.0 .. 1.0`) or an integer representation (e.g. `0 .. 65535`)
7072
type Duty;
7173

74+
/// Disables all channels on the timer
75+
fn try_disable(&mut self) -> Result<(), Self::Error>;
76+
77+
/// Enables all channels on the timer
78+
fn try_enable(&mut self) -> Result<(), Self::Error>;
79+
7280
/// Disables a PWM `channel`
73-
fn try_disable(&mut self, channel: Self::Channel) -> Result<(), Self::Error>;
81+
fn try_disable_channel(&mut self, channel: Self::Channel) -> Result<(), Self::Error>;
7482

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

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

0 commit comments

Comments
 (0)