Skip to content

Commit a823f21

Browse files
committed
HRTIM: Create feature for all devices supporting hrtim
1 parent 8a7e208 commit a823f21

File tree

10 files changed

+17
-71
lines changed

10 files changed

+17
-71
lines changed

Cargo.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ stm32g431 = ["stm32g4/stm32g431"]
8080
stm32g441 = ["stm32g4/stm32g441"]
8181
stm32g471 = ["stm32g4/stm32g471"]
8282
stm32g473 = ["stm32g4/stm32g473"]
83-
stm32g474 = ["stm32g4/stm32g474"]
83+
stm32g474 = ["stm32g4/stm32g474", "hrtim"]
8484
stm32g483 = ["stm32g4/stm32g483"]
85-
stm32g484 = ["stm32g4/stm32g484"]
85+
stm32g484 = ["stm32g4/stm32g484", "hrtim"]
8686
stm32g491 = ["stm32g4/stm32g491"]
8787
stm32g4a1 = ["stm32g4/stm32g4a1"]
88+
hrtim = []
8889
log-itm = ["cortex-m-log/itm"]
8990
log-rtt = []
9091
log-semihost = ["cortex-m-log/semihosting"]
@@ -108,32 +109,45 @@ required-features = ["stm32g474"]
108109

109110
[[example]]
110111
name = "hrtim-adc-trigger"
112+
required-features = ["hrtim"]
111113
path = "examples/hrtim/adc-trigger.rs"
112114

115+
[[example]]
116+
name = "hrtim-capture"
117+
required-features = ["hrtim"]
118+
path = "examples/hrtim/capture.rs"
119+
113120
[[example]]
114121
name = "hrtim-eev-comp"
122+
required-features = ["hrtim"]
115123
path = "examples/hrtim/eev-comp.rs"
116124

117125
[[example]]
118126
name = "hrtim-eev"
127+
required-features = ["hrtim"]
119128
path = "examples/hrtim/eev.rs"
120129

121130
[[example]]
122131
name = "hrtim-flt-comp"
132+
required-features = ["hrtim"]
123133
path = "examples/hrtim/flt-comp.rs"
124134

125135
[[example]]
126136
name = "hrtim-flt"
137+
required-features = ["hrtim"]
127138
path = "examples/hrtim/flt.rs"
128139

129140
[[example]]
130141
name = "hrtim"
142+
required-features = ["hrtim"]
131143
path = "examples/hrtim/hrtim.rs"
132144

133145
[[example]]
134146
name = "hrtim-master"
147+
required-features = ["hrtim"]
135148
path = "examples/hrtim/master.rs"
136149

137150
[[example]]
138151
name = "hrtim-simple"
152+
required-features = ["hrtim"]
139153
path = "examples/hrtim/simple.rs"

examples/hrtim/adc-trigger.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ use cortex_m_rt::entry;
66
use defmt_rtt as _; // global logger
77
use panic_probe as _;
88

9-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
10-
#[entry]
11-
fn main() -> ! {
12-
#[allow(clippy::empty_loop)]
13-
loop {}
14-
}
15-
16-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
179
#[entry]
1810
fn main() -> ! {
1911
use hal::adc;

examples/hrtim/eev-comp.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ use cortex_m_rt::entry;
77
use defmt_rtt as _; // global logger
88
use panic_probe as _;
99

10-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
11-
#[entry]
12-
fn main() -> ! {
13-
#[allow(clippy::empty_loop)]
14-
loop {}
15-
}
16-
17-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
1810
#[entry]
1911
fn main() -> ! {
2012
use hal::comparator;

examples/hrtim/eev.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ use cortex_m_rt::entry;
99
use defmt_rtt as _; // global logger
1010
use panic_probe as _;
1111

12-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
13-
#[entry]
14-
fn main() -> ! {
15-
#[allow(clippy::empty_loop)]
16-
loop {}
17-
}
18-
19-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
2012
#[entry]
2113
fn main() -> ! {
2214
use hal::gpio::gpioa::PA8;

examples/hrtim/flt-comp.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ use cortex_m_rt::entry;
88
use defmt_rtt as _; // global logger
99
use panic_probe as _;
1010

11-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
12-
#[entry]
13-
fn main() -> ! {
14-
#[allow(clippy::empty_loop)]
15-
loop {}
16-
}
17-
18-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
1911
#[entry]
2012
fn main() -> ! {
2113
use hal::comparator::{ComparatorExt, ComparatorSplit, Config, Hysteresis};

examples/hrtim/flt.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ use cortex_m_rt::entry;
88
use defmt_rtt as _; // global logger
99
use panic_probe as _;
1010

11-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
12-
#[entry]
13-
fn main() -> ! {
14-
#[allow(clippy::empty_loop)]
15-
loop {}
16-
}
17-
18-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
1911
#[entry]
2012
fn main() -> ! {
2113
use hal::gpio::gpioa::PA8;

examples/hrtim/hrtim.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ use cortex_m_rt::entry;
77
use defmt_rtt as _; // global logger
88
use panic_probe as _;
99

10-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
11-
#[entry]
12-
fn main() -> ! {
13-
#[allow(clippy::empty_loop)]
14-
loop {}
15-
}
16-
17-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
1810
#[entry]
1911
fn main() -> ! {
2012
use fugit::ExtU32;

examples/hrtim/master.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44

55
use cortex_m_rt::entry;
66

7-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
8-
#[entry]
9-
fn main() -> ! {
10-
#[allow(clippy::empty_loop)]
11-
loop {}
12-
}
13-
14-
use defmt_rtt as _; // global logger
15-
use panic_probe as _;
16-
17-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
187
#[entry]
198
fn main() -> ! {
209
use fugit::ExtU32;

examples/hrtim/simple.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ use cortex_m_rt::entry;
99
use defmt_rtt as _; // global logger
1010
use panic_probe as _;
1111

12-
#[cfg(not(any(feature = "stm32g474", feature = "stm32g484")))]
13-
#[entry]
14-
fn main() -> ! {
15-
#[allow(clippy::empty_loop)]
16-
loop {}
17-
}
18-
19-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
2012
#[entry]
2113
fn main() -> ! {
2214
use hal::gpio::gpioa::PA8;

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
feature = "stm32g491",
1313
feature = "stm32g4a1"
1414
)))]
15-
1615
compile_error!(
1716
"This crate requires one of the following features enabled:
1817
stm32g431
@@ -82,7 +81,7 @@ pub mod exti;
8281
pub mod flash;
8382
pub mod gpio;
8483

85-
#[cfg(any(feature = "stm32g474", feature = "stm32g484"))]
84+
#[cfg(feature = "hrtim")]
8685
pub mod hrtim;
8786
pub mod i2c;
8887
pub mod opamp;

0 commit comments

Comments
 (0)