From ca77dd65d9a73a3b81d31fe8f091bf7366687247 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Sun, 3 Apr 2022 14:46:05 +0300 Subject: [PATCH 1/3] Exti docs --- src/gpio/exti.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gpio/exti.rs b/src/gpio/exti.rs index 3464b261..05816cef 100644 --- a/src/gpio/exti.rs +++ b/src/gpio/exti.rs @@ -25,11 +25,22 @@ impl Pin { /// External Interrupt Pin pub trait ExtiPin { + /// Make corresponding EXTI line sensitive to this pin fn make_interrupt_source(&mut self, syscfg: &mut SysCfg); + + /// Generate interrupt on rising edge, falling edge or both fn trigger_on_edge(&mut self, exti: &mut EXTI, level: Edge); + + /// Enable external interrupts from this pin. fn enable_interrupt(&mut self, exti: &mut EXTI); + + /// Disable external interrupts from this pin fn disable_interrupt(&mut self, exti: &mut EXTI); + + /// Clear the interrupt pending bit for this pin fn clear_interrupt_pending_bit(&mut self); + + /// Reads the interrupt pending bit for this pin fn check_interrupt(&self) -> bool; } @@ -38,7 +49,6 @@ where PIN: PinExt, PIN::Mode: marker::Interruptable, { - /// Make corresponding EXTI line sensitive to this pin #[inline(always)] fn make_interrupt_source(&mut self, syscfg: &mut SysCfg) { let i = self.pin_id(); @@ -69,7 +79,6 @@ where } } - /// Generate interrupt on rising edge, falling edge or both #[inline(always)] fn trigger_on_edge(&mut self, exti: &mut EXTI, edge: Edge) { let i = self.pin_id(); @@ -95,27 +104,23 @@ where } } - /// Enable external interrupts from this pin. #[inline(always)] fn enable_interrupt(&mut self, exti: &mut EXTI) { exti.imr .modify(|r, w| unsafe { w.bits(r.bits() | (1 << self.pin_id())) }); } - /// Disable external interrupts from this pin #[inline(always)] fn disable_interrupt(&mut self, exti: &mut EXTI) { exti.imr .modify(|r, w| unsafe { w.bits(r.bits() & !(1 << self.pin_id())) }); } - /// Clear the interrupt pending bit for this pin #[inline(always)] fn clear_interrupt_pending_bit(&mut self) { unsafe { (*EXTI::ptr()).pr.write(|w| w.bits(1 << self.pin_id())) }; } - /// Reads the interrupt pending bit for this pin #[inline(always)] fn check_interrupt(&self) -> bool { unsafe { ((*EXTI::ptr()).pr.read().bits() & (1 << self.pin_id())) != 0 } From d64708f7682d59afdafb8b51680c094549cce894 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Sun, 3 Apr 2022 14:53:25 +0300 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9132bb2..949f7bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,31 +9,41 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed -- Add `Pin::interrupt()` helper method -- Add restriction for setting pins in alternate mode (`IntoAF`), add docs -- Explicit order for PINS, more smart aliases for peripherals -- Add `AFn` type aliases for `Alternate` -- CI updates + cache -- Add missing `embedded-hal 1.0` for `DynamicPin` -- Remove pull resistor from `Input` mode, use `Pull` enum instead, add universal `into_mode` pin converter +- Add `Pin::interrupt()` helper method [#476] +- Add restriction for setting pins in alternate mode (`IntoAF`), add docs [#474] +- Explicit order for PINS, more smart aliases for peripherals [#472] +- Add `AFn` type aliases for `Alternate` [#471] +- CI updates + cache [#468] +- Add missing `embedded-hal 1.0` for `DynamicPin` [#470] +- Remove pull resistor from `Input` mode, use `Pull` enum instead, add universal `into_mode` pin converter [#467] - Move pin mode at the end of generics, add defaults for modes, bump MSRV to 1.59 [#418] -- Move hd44780-driver to dev-dependencies +- Move hd44780-driver to dev-dependencies [#465] ### Fixed -- Fixed RCC example. +- Fixed RCC example [#473] - Enable the defmt feature on fugit when the defmt feature on the - crate is enabled + crate is enabled [#465] ### Added - Support eMMC peripherals using SDIO module [#458] -- `defmt::Format` derive on enums behind `defmt` feature +- `defmt::Format` derive on enums behind `defmt` feature [#460] - SPI transactional impl [#464] [#418]: https://github.com/stm32-rs/stm32f4xx-hal/pull/418 [#458]: https://github.com/stm32-rs/stm32f4xx-hal/pull/458 +[#460]: https://github.com/stm32-rs/stm32f4xx-hal/pull/460 [#464]: https://github.com/stm32-rs/stm32f4xx-hal/pull/464 +[#465]: https://github.com/stm32-rs/stm32f4xx-hal/pull/465 +[#467]: https://github.com/stm32-rs/stm32f4xx-hal/pull/467 +[#468]: https://github.com/stm32-rs/stm32f4xx-hal/pull/468 +[#470]: https://github.com/stm32-rs/stm32f4xx-hal/pull/470 +[#471]: https://github.com/stm32-rs/stm32f4xx-hal/pull/471 +[#472]: https://github.com/stm32-rs/stm32f4xx-hal/pull/472 +[#473]: https://github.com/stm32-rs/stm32f4xx-hal/pull/473 +[#474]: https://github.com/stm32-rs/stm32f4xx-hal/pull/474 +[#476]: https://github.com/stm32-rs/stm32f4xx-hal/pull/476 ## [v0.12.0] - 2022-02-23 From 05f498a9d04fe23ae45149bbfcb06066d49b3658 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Sun, 3 Apr 2022 15:07:43 +0300 Subject: [PATCH 3/3] deprecate rt feature --- .github/workflows/ci.yml | 2 +- .github/workflows/clippy.yml | 2 +- CHANGELOG.md | 1 + Cargo.toml | 16 ++++++++-------- examples/f413disco_lcd_ferris.rs | 2 +- examples/rng-display.rs | 4 ++-- examples/ssd1306-image.rs | 4 ++-- examples/st7789-lcd.rs | 2 +- .../stopwatch-with-ssd1306-and-interrupts.rs | 4 ++-- examples/timer-periph.rs | 2 +- examples/timer-syst.rs | 2 +- src/lib.rs | 1 - tools/check.py | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87619749..efd81b53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,4 +53,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: check - args: --features=${{ matrix.mcu }},rt,usb_fs,sdio-host,can,i2s,fsmc_lcd --examples + args: --features=${{ matrix.mcu }},usb_fs,sdio-host,can,i2s,fsmc_lcd --examples diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index c0c9b15c..bc8a7a27 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -26,4 +26,4 @@ jobs: - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --examples --features=stm32f479,rt,usb_fs,sdio-host + args: --examples --features=stm32f479,usb_fs,sdio-host diff --git a/CHANGELOG.md b/CHANGELOG.md index 949f7bba..5462c341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- Depracate "rt" feature as enabled by-default in `pac` [#476] - Add `Pin::interrupt()` helper method [#476] - Add restriction for setting pins in alternate mode (`IntoAF`), add docs [#474] - Explicit order for PINS, more smart aliases for peripherals [#472] diff --git a/Cargo.toml b/Cargo.toml index bdedcbbd..25e84bef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ repository = "https://github.com/stm32-rs/stm32f4xx-hal" version = "0.12.0" [package.metadata.docs.rs] -features = ["stm32f429", "rt", "usb_fs", "can", "i2s", "fsmc_lcd"] +features = ["stm32f429", "usb_fs", "can", "i2s", "fsmc_lcd"] targets = ["thumbv7em-none-eabihf"] [dependencies] @@ -88,7 +88,7 @@ features = ["macros"] [features] device-selected = [] -rt = ["stm32f4/rt"] +rt = [] # deprecated # Note: stm32f4 has only one feature for some very similar device families, # so it's intended for e.g. stm32f405/415 to both enable stm32f4/stm32f405. stm32f401 = ["stm32f4/stm32f401", "device-selected", "gpio-f401", @@ -355,7 +355,7 @@ uart8 = [] uart9 = [] uart10 = [] -rtic = ["rt", "rtic-monotonic"] +rtic = ["rtic-monotonic"] [profile.dev] debug = true @@ -368,7 +368,7 @@ opt-level = "s" [[example]] name = "blinky-timer-irq" -required-features = ["rt", "tim2"] # stm32f411 +required-features = ["tim2"] # stm32f411 [[example]] name = "usb_serial" @@ -396,11 +396,11 @@ required-features = ["device-selected"] # stm32f411 [[example]] name = "stopwatch-with-ssd1306-and-interrupts" -required-features = ["rt", "tim2"] # stm32f411 +required-features = ["tim2"] # stm32f411 [[example]] name = "analog-stopwatch-with-spi-ssd1306" -required-features = ["rt", "spi4", "tim2", "gpioe", "gpiog"] # stm32f429 +required-features = ["spi4", "tim2", "gpioe", "gpiog"] # stm32f429 [[example]] name = "rng-display" @@ -420,7 +420,7 @@ required-features = ["stm32f411", "i2s"] [[example]] name = "i2s-audio-out-dma" -required-features = ["stm32f411", "rt", "i2s"] +required-features = ["stm32f411", "i2s"] [[example]] name = "rtic" @@ -460,7 +460,7 @@ required-features = ["device-selected"] [[example]] name = "spi_dma" -required-features = ["rt", "stm32f411"] +required-features = ["stm32f411"] [[example]] name = "dynamic_gpio" diff --git a/examples/f413disco_lcd_ferris.rs b/examples/f413disco_lcd_ferris.rs index c8789983..3e02edc3 100644 --- a/examples/f413disco_lcd_ferris.rs +++ b/examples/f413disco_lcd_ferris.rs @@ -4,7 +4,7 @@ //! To run this feature you can (after installing `probe-run` use: //! //! ```bash -//! cargo run --release --example f413disco_lcd_ferris --features="stm32f413,rt,fsmc_lcd" +//! cargo run --release --example f413disco_lcd_ferris --features="stm32f413,fsmc_lcd" //! ``` #![no_main] diff --git a/examples/rng-display.rs b/examples/rng-display.rs index d7740342..9e48b37d 100644 --- a/examples/rng-display.rs +++ b/examples/rng-display.rs @@ -1,10 +1,10 @@ //! Generate random numbers using the RNG peripheral and display the values. //! This example is specifically tuned to run correctly on the //! stm32f4-discovery board (model STM32F407G-DISC1) -//! This example requires the `rt` feature to be enabled. For example: +//! For example: //! //! ```bash -//! cargo run --release --features stm32f407,rt --example rng-display +//! cargo run --release --features stm32f407 --example rng-display //! ``` //! //! Note that this example requires the `--release` build flag because it is too diff --git a/examples/ssd1306-image.rs b/examples/ssd1306-image.rs index 24b1da32..432f40f8 100644 --- a/examples/ssd1306-image.rs +++ b/examples/ssd1306-image.rs @@ -1,10 +1,10 @@ //! Draw Ferris the Rust mascot on an SSD1306 display //! -//! This example requires the `rt` feature to be enabled. For example, to run on an STM32F411 Nucleo +//! For example, to run on an STM32F411 Nucleo //! dev board, run the following: //! //! ```bash -//! cargo run --features stm32f411,rt --release --example ssd1306-image +//! cargo run --features stm32f411--release --example ssd1306-image //! ``` //! //! Note that `--release` is required to fix link errors for smaller devices. diff --git a/examples/st7789-lcd.rs b/examples/st7789-lcd.rs index 520d1321..a0cac9d3 100644 --- a/examples/st7789-lcd.rs +++ b/examples/st7789-lcd.rs @@ -6,7 +6,7 @@ //! //! Procedure: Compile this example, load it onto the microcontroller, and run it. //! -//! Example run command: `cargo run --release --features stm32f412,rt,fsmc_lcd --example st7789-lcd` +//! Example run command: `cargo run --release --features stm32f412,fsmc_lcd --example st7789-lcd` //! //! Expected behavior: The display shows a black background with four colored circles. Periodically, //! the color of each circle changes. diff --git a/examples/stopwatch-with-ssd1306-and-interrupts.rs b/examples/stopwatch-with-ssd1306-and-interrupts.rs index 6b7f1a45..600c3ac3 100644 --- a/examples/stopwatch-with-ssd1306-and-interrupts.rs +++ b/examples/stopwatch-with-ssd1306-and-interrupts.rs @@ -1,10 +1,10 @@ //! A simple stopwatch app running on an SSD1306 display //! -//! This example requires the `rt` feature to be enabled. For example, to run on an STM32F411 Nucleo +//! For example, to run on an STM32F411 Nucleo //! dev board, run the following: //! //! ```bash -//! cargo run --features stm32f411,rt --release --example stopwatch-with-ssd1306-and-interrupts +//! cargo run --features stm32f411 --release --example stopwatch-with-ssd1306-and-interrupts //! ``` //! //! Note that `--release` is required to fix link errors for smaller devices. diff --git a/examples/timer-periph.rs b/examples/timer-periph.rs index 57a92236..d6022e67 100644 --- a/examples/timer-periph.rs +++ b/examples/timer-periph.rs @@ -4,7 +4,7 @@ //! stm32f4-discovery board (model STM32F407G-DISC1). //! //! ```bash -//! cargo run --release --features stm32f407,rt --example timer-periph +//! cargo run --release --features stm32f407 --example timer-periph //! ``` #![no_std] diff --git a/examples/timer-syst.rs b/examples/timer-syst.rs index adab8097..58858e19 100644 --- a/examples/timer-syst.rs +++ b/examples/timer-syst.rs @@ -4,7 +4,7 @@ //! stm32f4-discovery board (model STM32F407G-DISC1). //! //! ```bash -//! cargo run --release --features stm32f407,rt --example timer-syst +//! cargo run --release --features stm32f407 --example timer-syst //! ``` #![no_std] diff --git a/src/lib.rs b/src/lib.rs index fce16dc9..ad903ad9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,7 +103,6 @@ pub use stm32f4::stm32f469 as pac; pub use stm32f4::stm32f469 as pac; // Enable use of interrupt macro -#[cfg(feature = "rt")] pub use crate::pac::interrupt; #[cfg(feature = "device-selected")] diff --git a/tools/check.py b/tools/check.py index d3db3de8..3e0ac305 100755 --- a/tools/check.py +++ b/tools/check.py @@ -28,7 +28,7 @@ def main(): crate_info = cargo_meta["packages"][0] - features = ["{},rt,usb_fs,can,i2s,fsmc_lcd".format(x) + features = ["{},usb_fs,can,i2s,fsmc_lcd".format(x) for x in crate_info["features"].keys() if x.startswith("stm32f4")]