From 41cf473a90d3c8499cc2ed003a71c12a91026221 Mon Sep 17 00:00:00 2001 From: Sh3Rm4n Date: Wed, 9 Dec 2020 10:49:59 +0100 Subject: [PATCH 1/3] Bump version to v0.6.0 --- CHANGELOG.md | 5 ++++- Cargo.toml | 2 +- src/adc.rs | 2 +- src/can.rs | 2 +- src/dma.rs | 2 +- src/gpio.rs | 4 ++-- src/i2c.rs | 2 +- src/pwm.rs | 2 +- src/spi.rs | 2 +- src/usb.rs | 2 +- src/watchdog.rs | 2 +- 11 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 029ed127c..e9758b53c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.6.0] - 2020-12-10 + ### Added - Support for 16-bit words with SPI ([#107](https://github.com/stm32-rs/stm32f3xx-hal/pull/107)) @@ -250,7 +252,8 @@ let clocks = rcc - Support `stm32f303` device -[Unreleased]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.5.0...HEAD +[Unreleased]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.6.0...HEAD +[v0.6.0]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.5.0...v0.6.0 [v0.5.0]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.4.3...v0.5.0 [v0.4.3]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.4.2...v0.4.3 [v0.4.2]: https://github.com/stm32-rs/stm32f3xx-hal/compare/v0.4.1...v0.4.2 diff --git a/Cargo.toml b/Cargo.toml index 1087d33e1..3cf0d00b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "stm32f3xx-hal" readme = "README.md" repository = "https://github.com/stm32-rs/stm32f3xx-hal" documentation = "https://docs.rs/stm32f3xx-hal" -version = "0.5.0" +version = "0.6.0" exclude = [ "codegen", ] diff --git a/src/adc.rs b/src/adc.rs index 1cb20bdc3..8aa5740d0 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -7,7 +7,7 @@ //! It can be built for the STM32F3Discovery running //! `cargo build --example adc --features=stm32f303xc` //! -//! [examples/adc.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/adc.rs +//! [examples/adc.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/adc.rs use crate::{ gpio::Analog, diff --git a/src/can.rs b/src/can.rs index 3d1b104a7..dfc0325e7 100644 --- a/src/can.rs +++ b/src/can.rs @@ -9,7 +9,7 @@ //! //! A usage example of the can peripheral can be found at [examples/can.rs] //! -//! [examples/can.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/can.rs +//! [examples/can.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/can.rs pub use embedded_hal_can::{self, Filter, Frame, Id, Receiver, Transmitter}; diff --git a/src/dma.rs b/src/dma.rs index 737fe6ba5..28c0f7554 100644 --- a/src/dma.rs +++ b/src/dma.rs @@ -4,7 +4,7 @@ //! //! An example how to use DMA for serial, can be found at [examples/serial_dma.rs] //! -//! [examples/serial_dma.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/serial_dma.rs +//! [examples/serial_dma.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/serial_dma.rs // To learn about most of the ideas implemented here, check out the DMA section // of the Embedonomicon: https://docs.rust-embedded.org/embedonomicon/dma.html diff --git a/src/gpio.rs b/src/gpio.rs index 46565c5cf..eea64ebdb 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -26,7 +26,7 @@ //! //! [InputPin]: embedded_hal::digital::v2::InputPin //! [OutputPin]: embedded_hal::digital::v2::OutputPin -//! [examples/toggle.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/toggle.rs +//! [examples/toggle.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/toggle.rs use core::convert::Infallible; use core::marker::PhantomData; @@ -163,7 +163,7 @@ macro_rules! gpio { /// /// See [examples/gpio_erased.rs] as an example. /// - /// [examples/gpio_erased.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/gpio_erased.rs + /// [examples/gpio_erased.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/gpio_erased.rs pub struct PXx { i: u8, gpio: Gpio, diff --git a/src/i2c.rs b/src/i2c.rs index 7a19682cf..ce7eb1c80 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -2,7 +2,7 @@ //! //! A usage example of the i2c peripheral can be found at [examples/i2c_scanner.rs] //! -//! [examples/i2c_scanner.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/i2c_scanner.rs +//! [examples/i2c_scanner.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/i2c_scanner.rs use core::convert::TryFrom; use core::ops::Deref; diff --git a/src/pwm.rs b/src/pwm.rs index 5574c7be3..c3978420d 100644 --- a/src/pwm.rs +++ b/src/pwm.rs @@ -152,7 +152,7 @@ A usage example can be found at [examples/pwm.rs] - [examples/pwm.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/pwm.rs + [examples/pwm.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/pwm.rs */ use crate::{ diff --git a/src/spi.rs b/src/spi.rs index 4f52cb139..ea86cf504 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -2,7 +2,7 @@ //! //! A usage example of the can peripheral can be found at [examples/spi.rs] //! -//! [examples/spi.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/spi.rs +//! [examples/spi.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/spi.rs use core::ptr; diff --git a/src/usb.rs b/src/usb.rs index 457962870..404fc420f 100644 --- a/src/usb.rs +++ b/src/usb.rs @@ -4,7 +4,7 @@ //! //! See [examples/usb_serial.rs] for a usage example. //! -//! [examples/usb_serial.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/usb_serial.rs +//! [examples/usb_serial.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/usb_serial.rs use crate::pac::{RCC, USB}; use stm32_usbd::UsbPeripheral; diff --git a/src/watchdog.rs b/src/watchdog.rs index 29e9372f8..ef723014a 100644 --- a/src/watchdog.rs +++ b/src/watchdog.rs @@ -2,7 +2,7 @@ //! //! A usage example of the watchdog can be found at [examples/can.rs] //! -//! [examples/can.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.5.0/examples/can.rs +//! [examples/can.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.6.0/examples/can.rs use crate::hal::watchdog::{Watchdog, WatchdogEnable}; From d15e318a006010347ce2033513f1159a09deacc6 Mon Sep 17 00:00:00 2001 From: Sh3Rm4n Date: Wed, 9 Dec 2020 10:50:13 +0100 Subject: [PATCH 2/3] Lint markdown files --- .github/workflows/ci.yml | 9 ++++ .markdownlint.yml | 2 + CHANGELOG.md | 20 +++++---- Cargo.toml | 1 + README.md | 90 ++++++++++++++++++++++------------------ codegen/README.md | 4 +- 6 files changed, 76 insertions(+), 50 deletions(-) create mode 100644 .markdownlint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8276cf16c..1529aa7b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,3 +138,12 @@ jobs: profile: minimal components: rustfmt - run: cd codegen && cargo check + + markdown-lint: + name: Markdown Lint + runs-on: ubuntu-latest + steps: + - uses: nosborn/github-action-markdown-cli@v1.1.1 + with: + files: . + ignore_files: "target/" diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 000000000..0430c79d6 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,2 @@ +md024: false +md014: false diff --git a/CHANGELOG.md b/CHANGELOG.md index e9758b53c..48ad69228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Introduced auto-generated GPIO mappings based on the STM32CubeMX database ([#129](https://github.com/stm32-rs/stm32f3xx-hal/pull/129)) - ### Fixed - Fixed [#151][] not being able to generate 72 MHz HCLK for stm32f303xc devices @@ -64,8 +63,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). not mean, that we guarantee any MSRV policy. It is rather for documentation purposes and if a new useful feature arises, we will increase the MSRV. ([#170](https://github.com/stm32-rs/stm32f3xx-hal/pull/170)) -- Removed I2C2 support for `stm32f303x6`, `stm32f303x8` and `stm32f328` targets. ([#164](https://github.com/stm32-rs/stm32f3xx-hal/pull/164)) -- `I2c::i2c1` and `I2c::i2c2` functions are renamed to `I2c::new`. ([#164](https://github.com/stm32-rs/stm32f3xx-hal/pull/164)) +- Removed I2C2 support for `stm32f303x6`, `stm32f303x8` and `stm32f328` targets. + ([#164](https://github.com/stm32-rs/stm32f3xx-hal/pull/164)) +- `I2c::i2c1` and `I2c::i2c2` functions are renamed to `I2c::new`. + ([#164](https://github.com/stm32-rs/stm32f3xx-hal/pull/164)) ## [v0.5.0] - 2020-07-21 @@ -85,6 +86,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - The system clock calculation is more fine grained now. ([#67](https://github.com/stm32-rs/stm32f3xx-hal/pull/67)) Now the system clock can be some value, like 14 MHz, which can not a be represented as a multiple of the oscillator clock: + ```rust let clocks = rcc .cfgr @@ -97,11 +99,11 @@ let clocks = rcc .use_hse(32.mhz()) .sysclk(72.mhz()) ``` + This is possible through utilizing the divider, which can divide the external oscillator clock on most devices. Some devices have even the possibility to divide the internal oscillator clock. - ### Breaking changes - The feature gate requires you to select a subvariant if possible. ([#75](https://github.com/stm32-rs/stm32f3xx-hal/pull/75)) @@ -159,15 +161,17 @@ let clocks = rcc - This allows using 72 MHz `sysclk` on the `stm32f303` - Analog gpio trait ([#33](https://github.com/stm32-rs/stm32f3xx-hal/pull/33)) - Add PWM Channels ([#34](https://github.com/stm32-rs/stm32f3xx-hal/pull/34)) -- SPI embedded hal modes are now public ([#35](https://github.com/stm32-rs/stm32f3xx-hal/pull/18)) +- SPI embedded hal modes are now public + ([#35](https://github.com/stm32-rs/stm32f3xx-hal/pull/18)) ### Breaking changes -- Alternate gpio functions are now **only** made available for devices, which have them. - ([#21](https://github.com/stm32-rs/stm32f3xx-hal/pull/21)) +- Alternate gpio functions are now **only** made available for devices, which + have them. ([#21](https://github.com/stm32-rs/stm32f3xx-hal/pull/21)) - `stm32f303` is now split into `stm32f303xd` and `stm32f303xe` as they provide different alternate gpio functions. `stm32f303` is still available. -- Bump `stm32f3` dependency to `0.9.0` ([#39](https://github.com/stm32-rs/stm32f3xx-hal/pull/39)) +- Bump `stm32f3` dependency to `0.9.0` + ([#39](https://github.com/stm32-rs/stm32f3xx-hal/pull/39)) ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 3cf0d00b1..9f482b276 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ documentation = "https://docs.rs/stm32f3xx-hal" version = "0.6.0" exclude = [ "codegen", + ".markdownlint.yml" ] [package.metadata.docs.rs] diff --git a/README.md b/README.md index cc89a69b4..7ac445efc 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,16 @@ peripheral access API for the STMicro STM32F3 series microcontrollers. The selection of the MCU is done by feature gates, typically specified by board support crates. Currently supported configurations are: -* stm32f301 ✔️ YES! -* stm32f318 ✔️ YES! -* stm32f302 ✔️ YES! -* stm32f303 ✔️ YES! -* stm32f373 ✔️ YES! -* stm32f378 ✔️ YES! -* stm32f334 ✔️ YES! -* stm32f328 ✔️ YES! -* stm32f358 ✔️ YES! -* stm32f398 ✔️ YES! +* stm32f301 +* stm32f318 +* stm32f302 +* stm32f303 +* stm32f373 +* stm32f378 +* stm32f334 +* stm32f328 +* stm32f358 +* stm32f398 The idea behind this crate is to gloss over the slight differences in the various peripherals available on those MCUs so a HAL can be written for all @@ -52,29 +52,30 @@ So you want to expand your call to `cargo` with `--features stm32f303xc`.* [comment]: # (Any changes here should be mirrored in src/lib.rs) Note: `x` denotes any character in [a-z] -* stm32f301xb -* stm32f301xc -* stm32f301xd -* stm32f301xe -* stm32f318 -* stm32f302xb -* stm32f302xc -* stm32f302xd -* stm32f302xe -* stm32f302x6 -* stm32f302x8 -* stm32f303xb -* stm32f303xc -* stm32f303xd -* stm32f303xe -* stm32f303x6 -* stm32f303x8 -* stm32f373 -* stm32f378 -* stm32f334 -* stm32f328 -* stm32f358 -* stm32f398 + +* stm32f301xb +* stm32f301xc +* stm32f301xd +* stm32f301xe +* stm32f318 +* stm32f302xb +* stm32f302xc +* stm32f302xd +* stm32f302xe +* stm32f302x6 +* stm32f302x8 +* stm32f303xb +* stm32f303xc +* stm32f303xd +* stm32f303xe +* stm32f303x6 +* stm32f303x8 +* stm32f373 +* stm32f378 +* stm32f334 +* stm32f328 +* stm32f358 +* stm32f398 ### Background @@ -95,21 +96,30 @@ expect it to do so.* ### Detailed steps to select the right chip -1. Get the full name of the chip you are using from your datasheet, user manual or other source. +1. Get the full name of the chip you are using from your datasheet, user manual + or other source. + + _Example_: - *Example: We want to use the STM32F3Discovery kit.* - *The [Usermanual][] tells us it's using a STM32F303VC chip.* + We want to use the STM32F3Discovery kit. + The [Usermanual][] tells us it's using a STM32F303VC chip. 2. Find your chip as a feature in the list above. - *Example: Looking for the right feature for our STM32F303VC chip we first find - `stm32f301xb`. This is the wrong chip, as we're not looking for `f301` but for `f303`.* + _Example_: - *Looking further we find `stm32f303xc`. This matches STM32F303VC (note that VC → xc).* + Looking for the right feature for our STM32F303VC chip we first find + `stm32f301xb`. This is the wrong chip, as we're not looking for `f301` but + for `f303`. + + Looking further we find `stm32f303xc`. This matches STM32F303VC + (note that VC → xc). 3. Add the chip name as a feature to your cargo call. - *Example: Using the STM32F303VC chip we run `cargo check --features stm32f303xc`.* + _Example_: + + Using the STM32F303VC chip we run `cargo check --features stm32f303xc`. [Usermanual]: https://www.st.com/content/ccc/resource/technical/document/user_manual/8a/56/97/63/8d/56/41/73/DM00063382.pdf/files/DM00063382.pdf/jcr:content/translations/en.DM00063382.pdf diff --git a/codegen/README.md b/codegen/README.md index e544c2773..662162d87 100644 --- a/codegen/README.md +++ b/codegen/README.md @@ -12,7 +12,7 @@ Because by default cargo tries to use the `x86_64-unknown-linux-gnu` target, when building `codegen`, due to what's specified in the `.cargo/config`, you need to manually specify your host's target if it differs from that, e.g.: -``` +```bash $ cargo run --target x86_64-apple-darwin -- help ``` @@ -26,7 +26,7 @@ Running `codegen`'s `gpio` subcommand generates the `gpio!` macro invocations at the end of `src/gpio.rs`. Re-generating those macro-invocations is simply a matter of deleting the old ones and then executing: -``` +```bash $ cargo run -- gpio $cubemx_db_path >> ../src/gpio.rs ``` From 2e7445a40895892524660a180620ca6999292d8e Mon Sep 17 00:00:00 2001 From: Sh3Rm4n Date: Thu, 10 Dec 2020 10:53:45 +0100 Subject: [PATCH 3/3] Increase delays in loops in examples --- examples/adc.rs | 2 ++ examples/gpio_erased.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/adc.rs b/examples/adc.rs index 4bbb1151e..88e6dcbac 100644 --- a/examples/adc.rs +++ b/examples/adc.rs @@ -5,6 +5,7 @@ use panic_semihosting as _; +use cortex_m::asm; use cortex_m_rt::entry; use cortex_m_semihosting::hprintln; @@ -55,5 +56,6 @@ fn main() -> ! { loop { let adc1_in1_data: u16 = adc1.read(&mut adc1_in1_pin).expect("Error reading adc1."); hprintln!("PA0 reads {}", adc1_in1_data).ok(); + asm::delay(2_000_000); } } diff --git a/examples/gpio_erased.rs b/examples/gpio_erased.rs index 5e298165e..e2ec9e535 100644 --- a/examples/gpio_erased.rs +++ b/examples/gpio_erased.rs @@ -50,7 +50,7 @@ fn main() -> ! { loop { for pin in pin_array.iter_mut() { hprintln!("Value is {}", pin.is_high().unwrap()).unwrap(); - asm::delay(1_000); + asm::delay(1_000_000); } } }