Giter VIP home page Giter VIP logo

scd4x-rs's Introduction

Hi there ๐Ÿ‘‹

Fell free to checkout my biolink or read into my blog oxidt!

scd4x-rs's People

Contributors

aectaan avatar hauju avatar kwiesmueller avatar patcher-ms avatar ryankurte avatar t-moe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

scd4x-rs's Issues

`embedded_hal_async` support

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!

Panic: attempt to multiply with overflow

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.

CRC error

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?

linux-embedded-hal shouldnt be a default dependancy

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.