File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ embedded-hal = "1.0.0"
1616[dev-dependencies ]
1717embedded-hal-mock = " 0.11.1"
1818
19+ [features ]
20+ dht11 = []
21+ dht20 = []
22+ dht22 = []
23+ default = []
24+
1925[lib ]
2026doctest = false
2127
Original file line number Diff line number Diff line change @@ -24,12 +24,24 @@ Here are some general tutorials that provide brief introductions to embedded pro
2424- ** Part 3 (DHT11 Library)** - [ Building a Rust library for DHT11 sensor] ( https://rust-dd.com/post/building-a-rust-library-for-dht11-sensor-a-step-by-step-guide )
2525
2626
27- ### Example - ESP32
27+ ### Install
28+
29+
30+ To include the ` dht11 ` feature:
2831
2932``` rust
3033cargo add embedded - dht - rs
3134```
3235
36+ To include all features (` dht11 ` , ` dht20 ` , and ` dht22 ` ):
37+
38+ ``` rust
39+ cargo add embedded - dht - rs -- features " dht11,dht20,dht22"
40+ ```
41+
42+ ### Example - ESP32
43+
44+
3345``` rust
3446#![no_std]
3547#![no_main]
Original file line number Diff line number Diff line change 11#![ no_std]
22
33mod dht;
4+
5+ #[ cfg( feature = "dht11" ) ]
46pub mod dht11;
7+
8+ #[ cfg( feature = "dht20" ) ]
59pub mod dht20;
10+
11+ #[ cfg( feature = "dht22" ) ]
612pub mod dht22;
713
814/// Represents a reading from the sensor.
You can’t perform that action at this time.
0 commit comments