Fell free to checkout my biolink or read into my blog oxidt!
hauju / scd4x-rs Goto Github PK
View Code? Open in Web Editor NEWRust driver for the Sensirion SCD4x sensors.
License: Apache License 2.0
Rust driver for the Sensirion SCD4x sensors.
License: Apache License 2.0
For users who are using the embedded-hal-async
crate, it would be nice to add a version of the SCD4x driver that uses the embedded-hal-async::i2c::I2c
and embedded-hal-async::delay::DelayNs
traits, rather than the blocking versions from embedded-hal
. This could be feature-flagged, so that users of the blocking embedded-hal
interface don't need to depend on embedded-hal-async
I'd be happy to add support for embedded-hal-async
, if there's interest!
When running the example i get
serial: [retracted]
Waiting for first measurement... (5 sec)
thread 'main' panicked at 'attempt to multiply with overflow', [retracted]/scd4x-rs/src/scd4x.rs:77:29
Seems like temperature: '((((21875 * temperature) >> 13) - 45000) as f32) / 1000.0' is not safe.
Hey, I'm trying to use SCD41 + ESP32 with this library, however, I'm getting a CRC error using this piece of code:
use esp_idf_hal::delay;
use esp_idf_hal::i2c;
use esp_idf_hal::peripherals::Peripherals;
use esp_idf_hal::prelude::*;
use scd4x::scd4x::Scd4x;
...
let peripherals = Peripherals::take().unwrap();
let i2c = peripherals.i2c1;
let sda = peripherals.pins.gpio21;
let scl = peripherals.pins.gpio22;
println!("Starting I2C test");
let config = <i2c::config::MasterConfig as Default>::default().baudrate(100.kHz().into());
let i2c = i2c::Master::<i2c::I2C1, _, _>::new(i2c, i2c::MasterPins { sda, scl }, config)?;
let mut delay = delay::FreeRtos;
let mut sensor = Scd4x::new(i2c, delay);
sensor.wake_up();
sensor.stop_periodic_measurement().unwrap();
let serial = sensor.serial_number().unwrap(); <------------------- this panics
println!("serial: {:#04x}", serial);
If I comment out this line https://github.com/Sensirion/sensirion-i2c-rs/blob/master/src/i2c.rs#L68 then it starts working, including reading the measures. Am I missing something? Can I opt-out of the CRC validation somehow?
Hi,
the library at the moment is not hal agnostic by default but instead requires overrides to remove linux-hal dependencies getting pulled in.
This results in broken builds by default on other hals until it can be diagnosed.
Can the util dependencies, or at least the linux dependency, be removed from default?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.