hrs3300 0.1.0

Platform-agnostic Rust driver for the HRS3300 heart rate sensor/monitor.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate hrs3300;
extern crate linux_embedded_hal as hal;
use hrs3300::Hrs3300;

fn main() {
    let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
    let mut sensor = Hrs3300::new(dev);
    sensor.init().unwrap();
    sensor.enable_hrs().unwrap();
    sensor.enable_oscillator().unwrap();
    loop {
        let hrs = sensor.read_hrs().unwrap();
        let als = sensor.read_als().unwrap();
        println!("HRS: {}, ALS: {}", hrs, als);
    }
}