项目作者: eldruin

项目描述 :
Platform-agnostic Rust driver for the HRS3300 heart rate sensor / monitor.
高级语言: Rust
项目地址: git://github.com/eldruin/hrs3300-rs.git
创建时间: 2019-11-21T07:38:20Z
项目社区:https://github.com/eldruin/hrs3300-rs

开源协议:Other

下载


Rust HRS3300 Heart Rate Sensor Driver

crates.io
Docs
Build Status
Coverage Status

This is a platform agnostic Rust driver for the HRS3300 optical heart rate
sensor using the embedded-hal traits.

This driver allows you to:

  • Enable/disable heart rate sensor. See: enable_hrs().
  • Enable/disable oscillator. See: enable_oscillator().
  • Initialize the device. See: init().
  • Set the conversion delay. See: set_conversion_delay().
  • Set the gain. See: set_gain().
  • Set the ambient light sensor resolution. See: set_als_resolution().
  • Set the LED current. See: set_led_current().
  • Read the device id. See: device_id().
  • Read the last heart rate sensor measurement. See: read_hrs().
  • Read the last ambient light sensor measurement. See: read_als().
  • Write/Read a register with a custom value. See: write_register().

The device

HRSS3300 is an optical digital heart rate sensor/monitor featuring a 525nm
green LED and a reflection light detector for the PPG signal from the human
body.
The typical heart rate measurement samples the reflected PPG signal at
25Hz then the results can be read via the I2C bus.

Datasheet:

Usage

To use this driver, import this crate and an embedded_hal implementation,
then instantiate the device.

  1. extern crate hrs3300;
  2. extern crate linux_embedded_hal as hal;
  3. use hrs3300::Hrs3300;
  4. fn main() {
  5. let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
  6. let mut sensor = Hrs3300::new(dev);
  7. sensor.init().unwrap();
  8. sensor.enable_hrs().unwrap();
  9. sensor.enable_oscillator().unwrap();
  10. loop {
  11. let hrs = sensor.read_hrs().unwrap();
  12. let als = sensor.read_als().unwrap();
  13. println!("HRS: {}, ALS: {}", hrs, als);
  14. }
  15. }

Support

For questions, issues, feature requests, and other changes, please file an
issue in the github project.

License

Licensed under either of

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.