rp: don't use SetConfig trait in PWM and PIO.
It was intended to allow changing baudrate on shared spi/i2c. There's no advantage in using it for PWM or PIO, and makes it less usable because you have to have `embassy-embedded-hal` as a dep to use it.
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
//! Pulse Width Modulation (PWM)
|
||||
|
||||
use embassy_embedded_hal::SetConfig;
|
||||
use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
|
||||
use fixed::traits::ToFixed;
|
||||
use fixed::FixedU16;
|
||||
@ -153,6 +152,10 @@ impl<'d, T: Channel> Pwm<'d, T> {
|
||||
Self::new_inner(inner, Some(a.map_into()), Some(b.map_into()), config, mode.into())
|
||||
}
|
||||
|
||||
pub fn set_config(&mut self, config: &Config) {
|
||||
Self::configure(self.inner.regs(), config);
|
||||
}
|
||||
|
||||
fn configure(p: pac::pwm::Channel, config: &Config) {
|
||||
if config.divider > FixedU16::<fixed::types::extra::U4>::from_bits(0xFF_F) {
|
||||
panic!("Requested divider is too large");
|
||||
@ -329,10 +332,3 @@ impl_pin!(PIN_26, PWM_CH5, PwmPinA);
|
||||
impl_pin!(PIN_27, PWM_CH5, PwmPinB);
|
||||
impl_pin!(PIN_28, PWM_CH6, PwmPinA);
|
||||
impl_pin!(PIN_29, PWM_CH6, PwmPinB);
|
||||
|
||||
impl<'d, T: Channel> SetConfig for Pwm<'d, T> {
|
||||
type Config = Config;
|
||||
fn set_config(&mut self, config: &Self::Config) {
|
||||
Self::configure(self.inner.regs(), config);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user