-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The implementation is behind the `sync` feature.
- Loading branch information
Showing
8 changed files
with
952 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"rust-analyzer.cargo.features": "all" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use bmp390::{sync::Bmp390, Address, Configuration}; | ||
use linux_embedded_hal::{Delay, I2cdev}; | ||
use uom::si::length::meter; | ||
|
||
fn main() { | ||
let i2c = I2cdev::new("/dev/i2c-1") | ||
.map_err(bmp390::Error::I2c) | ||
.expect("Failed to create I2C device"); | ||
let mut delay = Delay; | ||
|
||
let config = Configuration::default(); | ||
let mut sensor = Bmp390::try_new(i2c, Address::Up, &mut delay, &config) | ||
.expect("Failed to initialize BMP390 sensor"); | ||
|
||
let measurement = sensor.measure().expect("Failed to measure BMP390 data"); | ||
|
||
println!( | ||
"Measurement: Pressure: {} hPa, Temperature: {} °C, Altitude: {} m", | ||
measurement.pressure.get::<uom::si::pressure::hectopascal>(), | ||
measurement | ||
.temperature | ||
.get::<uom::si::thermodynamic_temperature::degree_celsius>(), | ||
measurement.altitude.get::<meter>() | ||
); | ||
} |
Oops, something went wrong.