use std::time::Duration;
use super::Pwm;
#[cfg(feature = "embedded-hal-0")]
impl embedded_hal_0::Pwm for Pwm {
type Duty = f64;
type Channel = ();
type Time = Duration;
fn disable(&mut self, _channel: Self::Channel) {
let _ = Pwm::disable(self);
}
fn enable(&mut self, _channel: Self::Channel) {
let _ = Pwm::enable(self);
}
fn get_period(&self) -> Self::Time {
self.period().unwrap_or_default()
}
fn get_duty(&self, _channel: Self::Channel) -> Self::Duty {
self.duty_cycle().unwrap_or_default()
}
fn get_max_duty(&self) -> Self::Duty {
1.0
}
fn set_duty(&mut self, _channel: Self::Channel, duty: Self::Duty) {
let _ = self.set_duty_cycle(duty);
}
fn set_period<P>(&mut self, period: P)
where
P: Into<Self::Time>,
{
let _ = Pwm::set_period(self, period.into());
}
}