Skip to content

Commit 8729e57

Browse files
authored
Wasm support + release (#23)
* Remove std dependency * wasm module * Cleanup * Simplify CI * Version bump * Review fixes
1 parent 736ff0e commit 8729e57

File tree

10 files changed

+138
-129
lines changed

10 files changed

+138
-129
lines changed

.github/workflows/rust.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,11 @@ jobs:
1919
- name: Format
2020
run: cargo fmt --check
2121

22-
- name: Clippy std
23-
run: cargo clippy --features std --tests -- -D warnings
24-
- name: Clippy embassy
25-
run: cargo clippy --features embassy -- -D warnings
26-
- name: Clippy embedded_hal
27-
run: |
28-
cargo clippy --features embedded_hal -- -D warnings
29-
cargo clippy --features embedded_hal_old -- -D warnings
30-
- name: Clippy wasm
31-
run: cargo clippy --features wasm -- -D warnings
32-
- name: Clippy default
22+
- name: Clippy common
23+
run: cargo clippy --features std,wasm,embassy,embedded_hal --tests -- -D warnings
24+
- name: Clippy embedded_hal_old
25+
run: cargo clippy --features embedded_hal_old -- -D warnings
26+
- name: Clippy no default
3327
run: cargo clippy --no-default-features -- -D warnings
3428

3529
- name: Install dependencies
@@ -45,7 +39,7 @@ jobs:
4539
run: cargo clippy -- -D warnings
4640
- name: Build example wasm
4741
working-directory: examples/wasm
48-
run: cargo build --target wasm32-unknown-unknown --release
42+
run: cargo build --target wasm32-unknown-unknown
4943

5044
- name: Tests
5145
run: cargo test tests --features std

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"rust-analyzer.cargo.features": ["std"]
2+
"rust-analyzer.cargo.features": [
3+
"std",
4+
"embedded_hal",
5+
"wasm",
6+
"embassy"
7+
]
38
}

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "button-driver"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
edition = "2021"
55
authors = ["maxwase", "Max T <max.vvase@gmail.com>"]
66
description = "Advanced button handling crate"
@@ -12,15 +12,15 @@ readme = "README.md"
1212
exclude = [".*"]
1313

1414
[package.metadata.docs.rs]
15-
features = ["std"]
15+
features = ["std", "embassy", "embedded_hal", "wasm"]
1616

1717
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1818

1919
[dependencies]
2020
embassy-time = { version = "0.5.0", optional = true }
2121
embedded-hal-old = { package = "embedded-hal", version = "0.2.7", optional = true }
2222
embedded-hal = { version = "1.0.0", optional = true }
23-
js-sys = { version = "0.3", optional = true }
23+
js-sys = { version = "0.3", default-features = false, optional = true }
2424

2525
[dev-dependencies]
2626
parking_lot = "0.12.4"
@@ -32,4 +32,4 @@ embedded_hal_old = ["dep:embedded-hal-old", "embedded-hal-old/unproven"]
3232
esp = ["dep:embedded-hal"]
3333
embedded_hal = ["dep:embedded-hal"]
3434
std = []
35-
wasm = ["dep:js-sys", "std"]
35+
wasm = ["dep:js-sys"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Button driver
44
[![doc](https://img.shields.io/docsrs/button-driver?style=for-the-badge)](https://docs.rs/button-driver/latest/)
55

66
This crate is a button driver for embedded Rust projects.
7-
It offers various usage scenarios, supports ESP, `embedded_hal`, `embassy` and `no_std` targets.
7+
It offers various usage scenarios, supports ESP, `embedded_hal`, `embassy`, `wasm` and `no_std` targets.
88

99
This crate aims to be as flexible as possible to support various HALs and use-cases.
1010

1111
## Examples
1212

1313
For more examples consider looking into the [examples](https://github.com/maxwase/button-driver/tree/master/examples) folder.
14-
You can easily flash them using `cargo run` command!
14+
You can easily flash/run them using `cargo run` command! Use `trunk serve` to run the wasm example.
1515

1616
For **ESP32C3** with std:
1717

examples/stm32-embassy/Cargo.lock

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/stm32/Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)