Add linux example

pull/4/head
Diego Barrios Romero 2018-10-28 10:32:41 +01:00
parent 5e613bec35
commit 23df1cfa99
1 changed files with 12 additions and 0 deletions

12
examples/linux.rs 100644
View File

@ -0,0 +1,12 @@
extern crate embedded_hal;
extern crate linux_embedded_hal;
extern crate ds323x;
use linux_embedded_hal::I2cdev;
use ds323x::Ds323x;
fn main() {
let dev = I2cdev::new("/dev/i2c-1").unwrap();
let mut rtc = Ds323x::new_ds3231(dev);
println!("Seconds: {}", rtc.get_seconds().unwrap());
}