Skip to content

Commit 4ddbc24

Browse files
committed
Rework examples for RM0468 devices
1 parent 69a4533 commit 4ddbc24

File tree

8 files changed

+27
-19
lines changed

8 files changed

+27
-19
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ required-features = ["rt"]
131131

132132
[[example]]
133133
name = "rtic_timers"
134-
required-features = ["rt"]
134+
required-features = ["rt", "rm0433"]
135135

136136
[[example]]
137137
name = "vos0"
138138
required-features = ["revision_v", "rm0433"]
139139

140140
[[example]]
141141
name = "fmc"
142-
required-features = ["fmc"]
142+
required-features = ["fmc", "rm0399"]
143143

144144
[[example]]
145145
name = "qspi"

examples/fmc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! FMC Example
2+
//!
3+
//! Tested on a STM32H747I-DISCO
4+
25
#![no_main]
36
#![no_std]
47

examples/prec_kernel_clocks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
mod utilities;
77

88
use cortex_m_rt::entry;
9-
use stm32h7xx_hal::rcc::{rec, rec::I2c123ClkSel, ResetEnable};
9+
use stm32h7xx_hal::rcc::{rec, rec::Spi123ClkSel, ResetEnable};
1010
use stm32h7xx_hal::{pac, prelude::*};
1111

1212
fn enable_fdcan(rec: rec::Fdcan) {
@@ -34,8 +34,8 @@ fn main() -> ! {
3434
.pll3_r_ck(4.mhz())
3535
.freeze(pwrcfg, &dp.SYSCFG);
3636

37-
// Set group kernel clock to PLL3 R CK. Needs mutable ccdr
38-
ccdr.peripheral.kernel_i2c123_clk_mux(I2c123ClkSel::PLL3_R);
37+
// Set group kernel clock to PLL3 P CK. Needs mutable ccdr
38+
ccdr.peripheral.kernel_spi123_clk_mux(Spi123ClkSel::PLL3_P);
3939

4040
// (now ccdr can be immutable)
4141

examples/rtic.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate rtic;
88
use stm32h7xx_hal::hal::digital::v2::ToggleableOutputPin;
99

1010
use rtic::app;
11-
use stm32h7xx_hal::gpio::{gpioc::PC13, gpioi::PI13};
11+
use stm32h7xx_hal::gpio::gpioc::{PC13, PC3};
1212
use stm32h7xx_hal::gpio::{Edge, ExtiPin, Floating, Input};
1313
use stm32h7xx_hal::gpio::{Output, PushPull};
1414
use stm32h7xx_hal::prelude::*;
@@ -23,7 +23,7 @@ use panic_halt as _;
2323
const APP: () = {
2424
struct Resources {
2525
button: PC13<Input<Floating>>,
26-
led: PI13<Output<PushPull>>,
26+
led: PC3<Output<PushPull>>,
2727
}
2828

2929
#[init]
@@ -37,7 +37,6 @@ const APP: () = {
3737

3838
// GPIO
3939
let gpioc = ctx.device.GPIOC.split(ccdr.peripheral.GPIOC);
40-
let gpioi = ctx.device.GPIOI.split(ccdr.peripheral.GPIOI);
4140

4241
// Button
4342
let mut button = gpioc.pc13.into_floating_input();
@@ -47,7 +46,7 @@ const APP: () = {
4746

4847
init::LateResources {
4948
button,
50-
led: gpioi.pi13.into_push_pull_output(),
49+
led: gpioc.pc3.into_push_pull_output(),
5150
}
5251
}
5352

examples/rtic_low_power.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern crate rtic;
2525
use stm32h7xx_hal::hal::digital::v2::{OutputPin, ToggleableOutputPin};
2626

2727
use rtic::app;
28-
use stm32h7xx_hal::gpio::gpioi::{PI12, PI13, PI14};
28+
use stm32h7xx_hal::gpio::gpioc::{PC2, PC3, PC4};
2929
use stm32h7xx_hal::gpio::{Edge, ExtiPin, Output, PushPull};
3030
use stm32h7xx_hal::prelude::*;
3131
use stm32h7xx_hal::rcc::LowPowerMode;
@@ -35,9 +35,9 @@ use stm32h7xx_hal::timer::{Enabled, Event, LpTimer, Timer};
3535
#[app(device = stm32h7xx_hal::stm32, peripherals = true)]
3636
const APP: () = {
3737
struct Resources {
38-
led1: PI12<Output<PushPull>>,
39-
led2: PI13<Output<PushPull>>,
40-
led3: PI14<Output<PushPull>>,
38+
led1: PC2<Output<PushPull>>,
39+
led2: PC3<Output<PushPull>>,
40+
led3: PC4<Output<PushPull>>,
4141
timer1: Timer<TIM1>,
4242
timer2: Timer<TIM2>,
4343
timer3: LpTimer<LPTIM3, Enabled>,
@@ -96,7 +96,6 @@ const APP: () = {
9696

9797
// GPIO
9898
let gpioc = ctx.device.GPIOC.split(ccdr.peripheral.GPIOC);
99-
let gpioi = ctx.device.GPIOI.split(ccdr.peripheral.GPIOI);
10099

101100
// Enter CStop mode
102101
let mut scb = ctx.core.SCB;
@@ -110,9 +109,9 @@ const APP: () = {
110109
wakeup.enable_interrupt(&mut exti);
111110

112111
// LEDs
113-
let mut led1 = gpioi.pi12.into_push_pull_output();
114-
let mut led2 = gpioi.pi13.into_push_pull_output();
115-
let mut led3 = gpioi.pi14.into_push_pull_output();
112+
let mut led1 = gpioc.pc2.into_push_pull_output();
113+
let mut led2 = gpioc.pc3.into_push_pull_output();
114+
let mut led3 = gpioc.pc4.into_push_pull_output();
116115

117116
led1.set_high().ok();
118117
led2.set_high().ok();

examples/watchdog.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ fn main() -> ! {
3333
#[cfg(all(feature = "rm0399", feature = "cm4"))]
3434
let mut watchdog = SystemWindowWatchdog::new(dp.WWDG2, &ccdr);
3535

36+
// RM0468
37+
#[cfg(all(feature = "rm0468"))]
38+
let mut watchdog = SystemWindowWatchdog::new(dp.WWDG1, &ccdr);
39+
3640
info!("");
3741
info!("stm32h7xx-hal example - Watchdog");
3842
info!("");

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub mod qei;
177177
#[cfg(all(
178178
feature = "device-selected",
179179
feature = "quadspi",
180-
not(feature = "rm0455")
180+
not(any(feature = "rm0455", feature = "rm0468"))
181181
))]
182182
pub mod qspi;
183183
#[cfg(feature = "device-selected")]

src/prelude.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ pub use crate::i2c::I2cExt as _stm32h7xx_hal_i2c_I2cExt;
1515
pub use crate::pwm::PwmAdvExt as _stm32_hal_pwm_PwmAdvExt;
1616
pub use crate::pwm::PwmExt as _stm32_hal_pwm_PwmExt;
1717
pub use crate::pwr::PwrExt as _stm32h7xx_hal_pwr_PwrExt;
18-
#[cfg(all(feature = "quadspi", not(feature = "rm0455")))]
18+
#[cfg(all(
19+
feature = "quadspi",
20+
not(any(feature = "rm0455", feature = "rm0468"))
21+
))]
1922
pub use crate::qspi::QspiExt as _stm32h7xx_hal_qspi_QspiExt;
2023
pub use crate::rcc::RccExt as _stm32h7xx_hal_rcc_RccExt;
2124
pub use crate::rng::RngCore as _stm32h7xx_hal_rng_RngCore;

0 commit comments

Comments
 (0)