Skip to content

Commit be9bf31

Browse files
committed
Make adc optional
1 parent 604174b commit be9bf31

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
logger:
2424
- log
2525
- defmt
26+
adc:
27+
- adc
28+
-
2629
env: # Peripheral Feature flags
2730
FLAGS: rt
2831

@@ -45,6 +48,6 @@ jobs:
4548
- name: Install thumbv8m rust target
4649
run: rustup target add thumbv8m.main-none-eabihf
4750
- name: Build
48-
run: cargo build --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ matrix.logger }},${{ env.FLAGS }}
51+
run: cargo build --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ matrix.logger }},${{ matrix.adc }},${{ env.FLAGS }}
4952
- name: Test
50-
run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ matrix.logger }},${{ env.FLAGS }}
53+
run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ matrix.logger }},${{ matrix.adc }},${{ env.FLAGS }}

Cargo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,22 @@ defmt = [
6767
"stm32h5/defmt",
6868
]
6969

70+
adc = ["dep:embedded-hal-02", "dep:nb"]
71+
7072
[dependencies]
7173
cortex-m = { version = "^0.7.7", features = ["critical-section-single-core"] }
7274
stm32h5 = { package = "stm32h5", version = "0.16.0" }
7375
fugit = "0.3.7"
7476
embedded-dma = "0.2"
7577
embedded-hal = "1.0.0"
76-
embedded-hal-02 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] }
78+
embedded-hal-02 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"], optional = true }
7779

7880
defmt = { version = "1.0.0", optional = true }
7981
paste = "1.0.15"
8082
log = { version = "0.4.20", optional = true}
8183
futures-util = { version = "0.3", default-features = false, features = ["async-await-macro"], optional = true}
8284
stm32-usbd = "0.8.0"
83-
nb = "1.1.0"
85+
nb = { version = "1.1.0", optional = true }
8486

8587
[dev-dependencies]
8688
log = { version = "0.4.20"}
@@ -119,3 +121,12 @@ required-features = ["stm32h503"]
119121
[[example]]
120122
name = "i2c_target_manual_ack"
121123
required-features = ["stm32h503"]
124+
125+
[[example]]
126+
name = "adc"
127+
required-features = ["adc"]
128+
129+
[[example]]
130+
name = "adc12"
131+
required-features = ["adc", "rm0481"]
132+

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub mod prelude;
5252
#[macro_use]
5353
mod macros;
5454

55-
#[cfg(feature = "device-selected")]
55+
#[cfg(all(feature = "device-selected", feature = "adc"))]
5656
pub mod adc;
5757

5858
#[cfg(feature = "device-selected")]

0 commit comments

Comments
 (0)