Skip to content

Commit a046b73

Browse files
committed
Enable hrtim feature for devices with support, fix example etc
1 parent 7550dcf commit a046b73

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"rust-analyzer.check.allTargets": false,
33
"rust-analyzer.check.extraArgs": [
44
"--examples",
5+
"--bins",
56
],
67
"rust-analyzer.cargo.target": "thumbv7em-none-eabihf",
78
"rust-analyzer.cargo.features": [

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ usb = ["dep:stm32-usbd"]
8282
stm32g431 = ["stm32g4/stm32g431", "cat2"]
8383
stm32g441 = ["stm32g4/stm32g441", "cat2"]
8484
stm32g473 = ["stm32g4/stm32g473", "cat3", "adc3", "adc4", "adc5"]
85-
stm32g474 = ["stm32g4/stm32g474", "cat3", "adc3", "adc4", "adc5", "stm32-hrtim/stm32g474"]
85+
stm32g474 = ["stm32g4/stm32g474", "cat3", "adc3", "adc4", "adc5", "hrtim", "stm32-hrtim/stm32g474"]
8686
stm32g483 = ["stm32g4/stm32g483", "cat3", "adc3", "adc4", "adc5"]
87-
stm32g484 = ["stm32g4/stm32g484", "cat3", "adc3", "adc4", "adc5", "stm32-hrtim/stm32g484"]
87+
stm32g484 = ["stm32g4/stm32g484", "cat3", "adc3", "adc4", "adc5", "hrtim", "stm32-hrtim/stm32g484"]
8888
stm32g491 = ["stm32g4/stm32g491", "cat4", "adc3"]
8989
stm32g4a1 = ["stm32g4/stm32g4a1", "cat4", "adc3"]
9090
log-itm = ["cortex-m-log/itm"]
@@ -97,6 +97,7 @@ defmt = [
9797
"nb/defmt-0-3",
9898
"embedded-hal/defmt-03",
9999
"embedded-io/defmt-03",
100+
"stm32-hrtim/defmt"
100101
]
101102
cordic = ["dep:fixed"]
102103
adc3 = []

examples/hrtim/hrtim.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
33

4+
#[path ="../utils/mod.rs"]
5+
mod utils;
6+
47
use cortex_m_rt::entry;
58
use panic_probe as _;
69
use stm32_hrtim::{
@@ -87,6 +90,7 @@ fn main() -> ! {
8790

8891
out1.enable();
8992
out2.enable();
93+
timer.start(&mut hr_control.control);
9094

9195
loop {
9296
// Step frequency from 14.6kHz to about 146kHz(half of that when only looking at one pin)

examples/hrtim/master.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ fn main() -> ! {
104104
out1.enable();
105105
out2.enable();
106106

107+
mtimer.start(&mut hr_control.control);
108+
timer.start(&mut hr_control.control);
109+
107110
defmt::info!("Running");
108111

109112
loop {

0 commit comments

Comments
 (0)