Skip to content

Commit af0dbd1

Browse files
committed
can: Improve feature usage for examples
Previously the `can-loopback` example could not be built at all
1 parent 4037f42 commit af0dbd1

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ doc = []
7878
rt = ["stm32f1/rt"]
7979
stm32f100 = ["stm32f1/stm32f100", "device-selected"]
8080
stm32f101 = ["stm32f1/stm32f101", "device-selected"]
81-
stm32f103 = ["stm32f1/stm32f103", "device-selected"]
81+
stm32f103 = ["stm32f1/stm32f103", "device-selected", "has-can"]
8282
stm32f105 = ["stm32f1/stm32f107", "device-selected", "connectivity"]
8383
stm32f107 = ["stm32f1/stm32f107", "device-selected", "connectivity"]
8484

@@ -89,7 +89,9 @@ high = ["medium"]
8989
# Devices with 768 Kb ROM or more
9090
xl = ["high"]
9191
# Connectivity line devices (`stm32f105xx` and `stm32f107xx`)
92-
connectivity = ["medium"]
92+
connectivity = ["medium", "has-can"]
93+
# Devices with CAN interface
94+
has-can = []
9395

9496
[profile.dev]
9597
incremental = false
@@ -134,7 +136,7 @@ required-features = ["connectivity"]
134136

135137
[[example]]
136138
name = "can-loopback"
137-
required-features = ["stm32f103", "stm32f105", "stm32f107"]
139+
required-features = ["has-can"]
138140

139141
[[example]]
140142
name = "can-rtfm"

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ pub mod afio;
144144
pub mod backup_domain;
145145
#[cfg(feature = "device-selected")]
146146
pub mod bb;
147-
#[cfg(all(
148-
feature = "device-selected",
149-
any(feature = "stm32f103", feature = "connectivity")
150-
))]
147+
#[cfg(all(feature = "device-selected", feature = "has-can"))]
151148
pub mod can;
152149
#[cfg(feature = "device-selected")]
153150
pub mod crc;

0 commit comments

Comments
 (0)