Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etiennetremel/sds011-nostd-rs
Rust SDS011 driver no_std environments compatible
https://github.com/etiennetremel/sds011-nostd-rs
nostd sds011
Last synced: about 19 hours ago
JSON representation
Rust SDS011 driver no_std environments compatible
- Host: GitHub
- URL: https://github.com/etiennetremel/sds011-nostd-rs
- Owner: etiennetremel
- License: mit
- Created: 2024-05-28T17:14:20.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-05-28T18:08:26.000Z (5 months ago)
- Last Synced: 2024-05-29T08:22:56.142Z (5 months ago)
- Topics: nostd, sds011
- Language: Rust
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rust SDS011 driver no_std environments compatible
This library provide an interface of the SDS011 air quality sensor using
asynchronous I/O traits compatible with no_std environments.## Getting started
Below is an example demonstrating how to initialize the SDS011 sensor, set it
up, and read air quality data from it:```rust
#![no_std]// ...
use sds011_nostd_rs::Sds011
// ...
let uart = ...
// Initialize the sensor configuration
let config = Config {
id: DeviceID {
id1: 0xFF,
id2: 0xFF,
},
mode: DeviceMode::Passive,
};// Create a new instance of the sensor
let mut sds011 = Sds011::new(uart, config);// Initialize the sensor
sds011.init().await.unwrap();// Read a sample from the sensor
let sample = sds011.read_sample().await.unwrap();// Print the sample values
println!("PM2.5: {} µg/m³, PM10: {} µg/m³", sample.pm2_5, sample.pm10);
```## References
- [SDS011 Control Protocol][control-protocol]
[control-protocol]: https://cdn.sparkfun.com/assets/parts/1/2/2/7/5/Laser_Dust_Sensor_Control_Protocol_V1.3.pdf