Skip to content

Commit

Permalink
Merge branch 'stm32-rs:master' into dsi-display
Browse files Browse the repository at this point in the history
  • Loading branch information
romixlab authored Dec 1, 2023
2 parents 7e8664a + cd7c125 commit 1553cdc
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 96 deletions.
23 changes: 7 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,22 @@ jobs:
FLAGS: rt,xspi,sdmmc,sdmmc-fatfs,fmc,usb_hs,rtc,ethernet,ltdc,crc,rand,can,defmt

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cache cargo registry and index
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-memory-${{ hashFiles('**/memory.x') }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --examples --target thumbv7em-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
targets: thumbv7em-none-eabihf
- run: cargo build --verbose --release --examples --target thumbv7em-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }}
- run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
12 changes: 5 additions & 7 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: 1.66.0
toolchain: 1.74.0
target: thumbv7em-none-eabihf
override: true
- uses: actions-rs/clippy-check@v1
components: clippy
- uses: clechasseur/rs-clippy-check@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --examples --target thumbv7em-none-eabihf --features=rt,stm32h743v -- -D warnings
24 changes: 7 additions & 17 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,21 @@ jobs:
FLAGS: rt,xspi,sdmmc,sdmmc-fatfs,fmc,usb_hs,rtc,ethernet,ltdc,crc,rand,can

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cache cargo registry and index
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-target-nightly-${{ hashFiles('**/Cargo.toml') }}-memory-${{ hashFiles('**/memory.x') }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
toolchain: nightly
target: thumbv7em-none-eabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --examples --target thumbv7em-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }},${{ matrix.logging }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
targets: thumbv7em-none-eabihf
- run: cargo build --verbose --release --examples --target thumbv7em-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }},${{ matrix.logging }}
- run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
13 changes: 4 additions & 9 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ jobs:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
components: rustfmt
- run: cargo fmt --all -- --check
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Bugfix, usb: On RM0455 and RM0468 parts, PA11/PA12 do not have an alternate function
(AF) for USB. Use `into_analog()` when passing pins to `USB1/2::new` on these parts [#464]
* [breaking] `usb-device` updated to v0.3.0

## [v0.15.0] 2023-10-09

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bare-metal = "1.0.0"
sdio-host = { version = "0.9", optional = true }
embedded-sdmmc = { version = "0.5", optional = true }
stm32-fmc = { version = "0.3", optional = true }
synopsys-usb-otg = { version = "^0.3.0", features = ["cortex-m"], optional = true }
synopsys-usb-otg = { version = "0.4", features = ["cortex-m"], optional = true }
embedded-display-controller = { version = "^0.1.0", optional = true }
log = { version = "0.4.14", optional = true} # see also the dev-dependencies section
fdcan = { version = "0.2", optional = true }
Expand Down Expand Up @@ -77,8 +77,8 @@ cortex-m-log = { version = "0.8.0", features = ["itm", "semihosting", "log-integ
cortex-m-semihosting = "0.5.0"
panic-itm = { version = "~0.4.1" }
panic-semihosting = "0.6"
usb-device = "0.2.5"
usbd-serial = "0.1.0"
usb-device = "0.3"
usbd-serial = "0.2.0"
numtoa = "0.2.3"
tinybmp = "0.5"
embedded-graphics = "0.8"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ stm32h7xx-hal
=============

[![docs.rs](https://docs.rs/stm32h7xx-hal/badge.svg)](https://docs.rs/stm32h7xx-hal)
[![Bors enabled](https://bors.tech/images/badge_small.svg)](https://app.bors.tech/repositories/12691)
[![CI](https://github.com/stm32-rs/stm32h7xx-hal/workflows/Continuous%20integration/badge.svg)](https://github.com/stm32-rs/stm32h7xx-hal/actions)
[![Crates.io](https://img.shields.io/crates/v/stm32h7xx-hal.svg)](https://crates.io/crates/stm32h7xx-hal)
![Minimum rustc version](https://img.shields.io/badge/rustc-1.65.0+-yellow.svg)
Expand Down
10 changes: 4 additions & 6 deletions examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ fn main() -> ! {
let mut delay = cp.SYST.delay(ccdr.clocks);

loop {
loop {
led.set_high();
delay.delay_ms(500_u16);
led.set_high();
delay.delay_ms(500_u16);

led.set_low();
delay.delay_ms(500_u16);
}
led.set_low();
delay.delay_ms(500_u16);
}
}
14 changes: 6 additions & 8 deletions examples/gpio_with_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ fn main() -> ! {
let mut delay = cp.SYST.delay(ccdr.clocks);

loop {
loop {
led.set_high();
delay.delay_ms(100_u16);
led.set_high();
delay.delay_ms(100_u16);

led.set_low();
delay.delay_ms(100_u16);
led.set_low();
delay.delay_ms(100_u16);

let is_high = led.with_input(|x| x.is_high());
info!("LED pin high? {}", is_high);
}
let is_high = led.with_input(|x| x.is_high());
info!("LED pin high? {}", is_high);
}
}
2 changes: 1 addition & 1 deletion examples/independent_watchdog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() -> ! {
let mut watchdog = IndependentWatchdog::new(dp.IWDG2);

// RM0468
#[cfg(all(feature = "rm0468"))]
#[cfg(feature = "rm0468")]
let mut watchdog = IndependentWatchdog::new(dp.IWDG1);

info!("");
Expand Down
2 changes: 1 addition & 1 deletion examples/system_watchdog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() -> ! {
let mut watchdog = SystemWindowWatchdog::new(dp.WWDG2, &ccdr);

// RM0468
#[cfg(all(feature = "rm0468"))]
#[cfg(feature = "rm0468")]
let mut watchdog = SystemWindowWatchdog::new(dp.WWDG1, &ccdr);

info!("");
Expand Down
16 changes: 10 additions & 6 deletions examples/usb_passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ fn main() -> ! {
let mut serial1 = usbd_serial::SerialPort::new(&usb1_bus);
let mut usb1_dev =
UsbDeviceBuilder::new(&usb1_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")])
.unwrap()
.device_class(usbd_serial::USB_CLASS_CDC)
.build();

Expand All @@ -84,9 +86,11 @@ fn main() -> ! {
let mut serial2 = usbd_serial::SerialPort::new(&usb2_bus);
let mut usb2_dev =
UsbDeviceBuilder::new(&usb2_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 2")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")])
.unwrap()
.device_class(usbd_serial::USB_CLASS_CDC)
.build();

Expand Down
9 changes: 6 additions & 3 deletions examples/usb_phy_serial_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ unsafe fn main() -> ! {
USB_BUS_ALLOCATOR.as_ref().unwrap(),
UsbVidPid(VID, PID),
)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")])
.unwrap()
.device_class(usbd_serial::USB_CLASS_CDC)
.max_packet_size_0(64)
.unwrap()
.build();

interrupt_free(|cs| {
Expand Down
8 changes: 5 additions & 3 deletions examples/usb_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ mod app {
.unwrap();
let serial = usbd_serial::SerialPort::new(usb_bus);
let usb_dev = UsbDeviceBuilder::new(usb_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")])
.unwrap()
.device_class(usbd_serial::USB_CLASS_CDC)
.build();
let usb = (usb_dev, serial);
Expand Down
8 changes: 5 additions & 3 deletions examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ fn main() -> ! {

let mut usb_dev =
UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.strings(&[usb_device::device::StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST PORT 1")])
.unwrap()
.device_class(usbd_serial::USB_CLASS_CDC)
.build();

Expand Down
6 changes: 2 additions & 4 deletions src/exti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ impl ExtiExt for EXTI {
let line = ev as u8;

match line {
0..=19 | 20 | 21 => {
reg_for_cpu!(self, pr1).read().bits() & (1 << line) != 0
}
0..=21 => reg_for_cpu!(self, pr1).read().bits() & (1 << line) != 0,
49 | 51 => {
reg_for_cpu!(self, pr2).read().bits() & (1 << (line - 32)) != 0
}
Expand All @@ -278,7 +276,7 @@ impl ExtiExt for EXTI {

unsafe {
match line {
0..=19 | 20 | 21 => {
0..=21 => {
reg_for_cpu!(self, pr1).write(|w| w.bits(1 << line));
let _ = reg_for_cpu!(self, pr1).read();
let _ = reg_for_cpu!(self, pr1).read(); // Delay 2 peripheral clocks
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ pub use stm32h7::stm32h743 as stm32;
pub use stm32h7::stm32h743v as stm32;

// Single core with crypto
#[cfg(any(feature = "stm32h753",))]
#[cfg(feature = "stm32h753")]
pub use stm32h7::stm32h753 as stm32;
#[cfg(any(feature = "stm32h753v",))]
#[cfg(feature = "stm32h753v")]
pub use stm32h7::stm32h753v as stm32;

// Dual core
#[cfg(any(feature = "stm32h747cm7",))]
#[cfg(feature = "stm32h747cm7")]
pub use stm32h7::stm32h747cm7 as stm32;
#[cfg(any(feature = "stm32h757cm7",))]
#[cfg(feature = "stm32h757cm7")]
pub use stm32h7::stm32h757cm7 as stm32;
// TODO(rm0399): soundness of PeripheralREC macro in rcc/rec.rs

Expand Down
2 changes: 1 addition & 1 deletion src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub use crate::timer::HalDisabledLpTimer as _stm32h7xx_hal_timer_HalDisabledLpTi
pub use crate::timer::HalEnabledLpTimer as _stm32h7xx_hal_timer_HalEnabledLpTimer;
pub use crate::timer::HalLpTimer as _stm32h7xx_hal_timer_HalLpTimer;
pub use crate::timer::TimerExt as _stm32h7xx_hal_timer_TimerExt;
#[cfg(all(feature = "xspi"))]
#[cfg(feature = "xspi")]
#[cfg_attr(docsrs, doc(cfg(feature = "xspi")))]
pub use crate::xspi::XspiExt as _stm32h7xx_hal_xspi_XspiExt;
pub use fugit::{ExtU32 as _, RateExtU32 as _};
6 changes: 3 additions & 3 deletions src/usb_hs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::rcc;
use crate::stm32;

use crate::gpio::{self, Alternate, Analog, Speed};
use crate::gpio::{self, Alternate, Speed};

use crate::time::Hertz;

Expand Down Expand Up @@ -50,8 +50,8 @@ impl USB1 {
usb_global: stm32::OTG1_HS_GLOBAL,
usb_device: stm32::OTG1_HS_DEVICE,
usb_pwrclk: stm32::OTG1_HS_PWRCLK,
_pin_dm: gpio::PA11<Analog>,
_pin_dp: gpio::PA12<Analog>,
_pin_dm: gpio::PA11<crate::gpio::Analog>,
_pin_dp: gpio::PA12<crate::gpio::Analog>,
prec: rcc::rec::Usb1Otg,
clocks: &rcc::CoreClocks,
) -> Self {
Expand Down

0 comments on commit 1553cdc

Please sign in to comment.