diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c2ab0a..dc75059f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix wrong timer frequency calculation and unexpected panics ([#338]) +### Changed + +- The PWM implementation was deprecated. There is not yet an alternative + implementation, but it is hard to maintain the current implementation + and not easy to verify if it is really a safe implementation. + It is also not consistent with the rest of the crates API. ([#352]) + ## [v0.9.2] - 2023-02-20 ### Added @@ -599,6 +606,7 @@ let clocks = rcc [defmt]: https://github.com/knurling-rs/defmt [filter]: https://defmt.ferrous-systems.com/filtering.html +[#352]: https://github.com/stm32-rs/stm32f3xx-hal/pull/352 [#345]: https://github.com/stm32-rs/stm32f3xx-hal/pull/345 [#346]: https://github.com/stm32-rs/stm32f3xx-hal/pull/346 [#347]: https://github.com/stm32-rs/stm32f3xx-hal/pull/347 diff --git a/examples/pwm.rs b/examples/pwm.rs index 3a00c49d..a354c91e 100644 --- a/examples/pwm.rs +++ b/examples/pwm.rs @@ -17,6 +17,7 @@ use hal::flash::FlashExt; use hal::gpio::GpioExt; use hal::pac; use hal::prelude::*; +#[allow(deprecated)] use hal::pwm::{tim16, tim2, tim3, tim8}; use hal::rcc::RccExt; @@ -70,6 +71,7 @@ fn main() -> ! { // TIM3 // // A four channel general purpose timer that's broadly available + #[allow(deprecated)] let tim3_channels = tim3( dp.TIM3, 1280, // resolution of duty cycle @@ -119,6 +121,7 @@ fn main() -> ! { // TIM2 // // A 32-bit timer, so we can set a larger resolution + #[allow(deprecated)] let tim2_channels = tim2( dp.TIM2, 160000, // resolution of duty cycle @@ -134,6 +137,7 @@ fn main() -> ! { // // A single channel timer, so it doesn't return a tuple. We can // just use it directly + #[allow(deprecated)] let mut tim16_ch1 = tim16( dp.TIM16, 1280, // resolution of duty cycle @@ -148,6 +152,7 @@ fn main() -> ! { // // An advanced timer with complementary outputs, so we can output // to complementary pins (works just like standard pins) + #[allow(deprecated)] let tim8_channels = tim8( dp.TIM8, 1280, // resolution of duty cycle diff --git a/src/pwm.rs b/src/pwm.rs index cd5518ee..dc4bece8 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -282,6 +282,7 @@ macro_rules! pwm_timer_private { /// of exactly one degree. #[allow(unused_parens)] #[must_use] + #[deprecated(since = "0.10.0", note = "needs refactoring and might violate safety rules conflicting with the timer API")] pub fn $timx(tim: $TIMx, res: $res, freq: Hertz, clocks: &Clocks) -> ($(PwmChannel<$TIMx_CHy, NoPins>),+) { // Power the timer and reset it to ensure a clean state // We use unsafe here to abstract away this implementation detail