Skip to content

Commit

Permalink
docs: add full example
Browse files Browse the repository at this point in the history
  • Loading branch information
zeldan committed Oct 9, 2024
1 parent 84c8f93 commit 8d519ca
Show file tree
Hide file tree
Showing 11 changed files with 1,309 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Here are some general tutorials that provide brief introductions to embedded pro
To include the `dht11` feature:

```rust
cargo add embedded-dht-rs
cargo add embedded-dht-rs --features "dht11"
```

To include all features (`dht11`, `dht20`, and `dht22`):
Expand All @@ -41,6 +41,7 @@ cargo add embedded-dht-rs --features "dht11,dht20,dht22"

### Example - ESP32

You can find the full example in the [examples](./examples) folder.

```rust
#![no_std]
Expand Down Expand Up @@ -71,8 +72,7 @@ fn main() -> ! {
io.pins.gpio21,
io.pins.gpio22,
HertzU32::kHz(400),
&clocks,
None,
&clocks
);

let mut dht11 = Dht11::new(od_for_dht11, delay);
Expand Down
16 changes: 16 additions & 0 deletions examples/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[target.xtensa-esp32-none-elf]
runner = "espflash flash --monitor"


[env]
ESP_LOGLEVEL="INFO"

[build]
rustflags = [
"-C", "link-arg=-nostartfiles",
]

target = "xtensa-esp32-none-elf"

[unstable]
build-std = ["core"]
10 changes: 10 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
3 changes: 3 additions & 0 deletions examples/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.check.allTargets": false,
}
Loading

0 comments on commit 8d519ca

Please sign in to comment.