1
Fork 0

separate linux example from core

This commit is contained in:
Julian Gaal 2019-04-16 00:58:34 +02:00
parent 5afe9dfbc1
commit a02bf301cd
433 changed files with 1071 additions and 2 deletions

View file

@ -11,7 +11,5 @@ keywords = ["mpu6050", "imu", "embedded"]
license = "MIT"
[dependencies]
i2cdev = "0.4.1"
embedded-hal = "0.2.2"
linux-embedded-hal = "0.2.2"
libm = "0.1.2"

2
example/.cargo/config Normal file
View file

@ -0,0 +1,2 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

10
example/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "example"
version = "0.1.0"
authors = ["Julian Gaal <juliangaal@protonmail.com>"]
edition = "2018"
[dependencies]
mpu6050 = "0.1.0"
i2cdev = "0.4.1"
linux-embedded-hal = "0.2.2"

48
example/src/main.rs Normal file
View file

@ -0,0 +1,48 @@
use mpu6050::*;
use linux_embedded_hal::{I2cdev, Delay};
use i2cdev::linux::LinuxI2CError;
fn main() -> Result<(), Error<LinuxI2CError>> {
let i2c = I2cdev::new("/dev/i2c-1")
.map_err(Error::I2c)?;
let delay = Delay;
let mut mpu = Mpu6050::new(i2c, delay);
mpu.init()?;
//mpu.soft_calib(200)?;
loop {
// get roll and pitch estimate
match mpu.get_acc_angles() {
Ok(r) => {
println!("r/p: {:?}", r);
},
Err(_) => {} ,
}
// get temp
match mpu.get_temp() {
Ok(r) => {
println!("temp: {}c", r);
},
Err(_) => {} ,
}
// get gyro data, scaled with sensitivity
match mpu.get_gyro() {
Ok(r) => {
println!("gyro: {:?}", r);
},
Err(_) => {} ,
}
// get accelerometer data, scaled with sensitivity
match mpu.get_acc() {
Ok(r) => {
println!("acc: {:?}", r);
},
Err(_) => {} ,
}
}
}

View file

@ -0,0 +1 @@
{"rustc_fingerprint":8910120218037566707,"outputs":{"1164083562126845933":["rustc 1.33.0 (2aa4c46cf 2019-02-28)\nbinary: rustc\ncommit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858\ncommit-date: 2019-02-28\nhost: x86_64-unknown-linux-gnu\nrelease: 1.33.0\nLLVM version: 8.0\n",""],"1700439893137984060":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/julian/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"arm\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"32\"\ntarget_vendor=\"unknown\"\nunix\n",""],"15337506775154344876":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/julian/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n",""],"1617349019360157463":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/julian/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n",""]},"successes":{}}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[\"default\"]","target":6279408803383612735,"profile":11870183705523825133,"path":10606878967782862455,"deps":[],"local":[{"Precalculated":"1.0.4"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6279408803383612735,"profile":11870183705523825133,"path":17427132433695158890,"deps":[],"local":[{"Precalculated":"0.4.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6279408803383612735,"profile":11870183705523825133,"path":5943171097463195476,"deps":[],"local":[{"Precalculated":"0.3.3"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[\"default\", \"std\"]","target":3379401082915848265,"profile":11870183705523825133,"path":9745575622455250394,"deps":[],"local":[{"Precalculated":"1.3.1"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"","target":0,"profile":0,"path":0,"deps":[],"local":[{"Precalculated":"1.3.1"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":15537707812324464965,"profile":11870183705523825133,"path":609780401603415449,"deps":[["byteorder v1.3.1","byteorder",7784368879535230189],["iovec v0.1.2","iovec",9282517593461376176]],"local":[{"Precalculated":"0.4.12"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":8866895067430174505,"profile":11870183705523825133,"path":9808958079356095173,"deps":[],"local":[{"Precalculated":"0.2.2"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":1132199316714279215,"profile":11870183705523825133,"path":11587077605825350744,"deps":[],"local":[{"Precalculated":"0.1.7"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[\"nb\", \"unproven\"]","target":7425827377249578513,"profile":11870183705523825133,"path":3883287070163597272,"deps":[["nb v0.1.1","nb",12174447287279596312],["void v1.0.2","void",10081166221060720888]],"local":[{"Precalculated":"0.2.2"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":9526320908495898785,"profile":4624441407002136820,"path":1036222786711178230,"deps":[["i2cdev v0.4.1","i2cdev",14311013685820451180],["linux-embedded-hal v0.2.2","linux_embedded_hal",401545745281941616],["mpu6050 v0.1.0","mpu6050",9889611720145379396]],"local":[{"MtimeBased":[[1555369008,948756575],"/home/julian/dev/mpu6050/example/target/armv7-unknown-linux-gnueabihf/debug/.fingerprint/example-ac36b0b6b57e9ba1/dep-bin-example-ac36b0b6b57e9ba1"]}],"rustflags":[],"edition":"Edition2018"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":1153274382376995995,"profile":11870183705523825133,"path":12713802978200893768,"deps":[["bitflags v1.0.4","bitflags",934318704317169200],["byteorder v1.3.1","byteorder",7784368879535230189],["libc v0.2.51","libc",5057449048500589236],["nix v0.11.0","nix",3870337915543840576]],"local":[{"Precalculated":"0.4.1"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":16145238134555351286,"profile":11870183705523825133,"path":15687680222298898475,"deps":[["libc v0.2.51","libc",5057449048500589236]],"local":[{"Precalculated":"0.1.2"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"","target":0,"profile":0,"path":0,"deps":[],"local":[{"Precalculated":"0.2.51"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[\"default\", \"use_std\"]","target":8333697966133126704,"profile":11870183705523825133,"path":17319734422051546254,"deps":[],"local":[{"Precalculated":"0.2.51"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":15506424757968313579,"profile":11870183705523825133,"path":8569163767405211548,"deps":[],"local":[{"Precalculated":"0.1.2"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":3870417309747665998,"profile":11870183705523825133,"path":8712256874598455179,"deps":[["cast v0.2.2","cast",15769423956224590499],["embedded-hal v0.2.2","embedded_hal",13504063908486449555],["i2cdev v0.4.1","i2cdev",14311013685820451180],["spidev v0.3.0","spidev",10708004514309093676],["sysfs_gpio v0.5.3","sysfs_gpio",13694482503876262433]],"local":[{"Precalculated":"0.2.2"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":17497220414327866641,"profile":11870183705523825133,"path":16505115342879680773,"deps":[["embedded-hal v0.2.2","embedded_hal",13504063908486449555],["i2cdev v0.4.1","i2cdev",14311013685820451180],["libm v0.1.2","libm",1525643711271683210],["linux-embedded-hal v0.2.2","linux_embedded_hal",401545745281941616]],"local":[{"Precalculated":"0.1.0"}],"rustflags":[],"edition":"Edition2018"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[\"unstable\"]","target":14314058455958697544,"profile":11870183705523825133,"path":496395260087698553,"deps":[],"local":[{"Precalculated":"0.1.1"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"","target":0,"profile":0,"path":0,"deps":[],"local":[{"Precalculated":"0.10.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"","target":0,"profile":0,"path":0,"deps":[],"local":[{"Precalculated":"0.6.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6152895407404458763,"profile":11870183705523825133,"path":13444546824305547783,"deps":[["bitflags v0.4.0","bitflags",7762180295858894528],["cfg-if v0.1.7","cfg_if",7765683860871043308],["libc v0.2.51","libc",5057449048500589236],["void v1.0.2","void",10081166221060720888]],"local":[{"Precalculated":"0.6.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6152895407404458763,"profile":11870183705523825133,"path":978806733795926278,"deps":[["bitflags v1.0.4","bitflags",934318704317169200],["bytes v0.4.12","bytes",15217292670799721299],["cfg-if v0.1.7","cfg_if",7765683860871043308],["libc v0.2.51","libc",5057449048500589236],["void v1.0.2","void",10081166221060720888]],"local":[{"Precalculated":"0.10.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"","target":0,"profile":0,"path":0,"deps":[],"local":[{"Precalculated":"0.11.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6152895407404458763,"profile":11870183705523825133,"path":14131361263981436465,"deps":[["bitflags v1.0.4","bitflags",934318704317169200],["cfg-if v0.1.7","cfg_if",7765683860871043308],["libc v0.2.51","libc",5057449048500589236],["void v1.0.2","void",10081166221060720888]],"local":[{"Precalculated":"0.11.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":12629438318946667567,"profile":11870183705523825133,"path":6292389699830187271,"deps":[["bitflags v0.3.3","bitflags",13694096865569422961],["libc v0.2.51","libc",5057449048500589236],["nix v0.6.0","nix",15140177531569456046]],"local":[{"Precalculated":"0.3.0"}],"rustflags":[],"edition":"Edition2015"}

View file

@ -0,0 +1 @@
This file has an mtime of when this was started.

View file

@ -0,0 +1 @@
{"rustc":14715343205281380114,"features":"[]","target":6657338920780644898,"profile":11870183705523825133,"path":10872482741887733392,"deps":[["nix v0.10.0","nix",11120516229420934437]],"local":[{"Precalculated":"0.5.3"}],"rustflags":[],"edition":"Edition2015"}

Some files were not shown because too many files have changed in this diff Show more