Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exti docs, deprecate rt #476

Merged
merged 3 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 22 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,42 @@ 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<n>`
- 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
- 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]
- Add `AFn` type aliases for `Alternate<n>` [#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

Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -355,7 +355,7 @@ uart8 = []
uart9 = []
uart10 = []

rtic = ["rt", "rtic-monotonic"]
rtic = ["rtic-monotonic"]

[profile.dev]
debug = true
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -460,7 +460,7 @@ required-features = ["device-selected"]

[[example]]
name = "spi_dma"
required-features = ["rt", "stm32f411"]
required-features = ["stm32f411"]

[[example]]
name = "dynamic_gpio"
Expand Down
2 changes: 1 addition & 1 deletion examples/f413disco_lcd_ferris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions examples/rng-display.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/ssd1306-image.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/st7789-lcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/stopwatch-with-ssd1306-and-interrupts.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/timer-periph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion examples/timer-syst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
17 changes: 11 additions & 6 deletions src/gpio/exti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ impl<const P: char, const N: u8, MODE> Pin<P, N, MODE> {

/// 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;
}

Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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 }
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion tools/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down