Skip to content

Commit

Permalink
Formatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster committed Jul 7, 2018
1 parent f07a2e6 commit 875d504
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/hts221.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! * Driver for the HTS221 humidity sensor
//! See `http://www.st.com/content/st_com/en/products/mems-and-sensors/humidity-sensors/hts221.html`
use i2cdev::core::I2CDevice;
use byteorder::{ByteOrder, LittleEndian};
use i2cdev::core::I2CDevice;

pub const REG_AV_CONF: u8 = 0x10;
pub const REG_CTRL1: u8 = 0x20;
Expand Down
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ extern crate libc;
#[cfg(feature = "led-matrix")]
extern crate sensehat_screen;

mod rh;
mod hts221;
mod lps25h;
mod rh;

pub use measurements::Temperature;
pub use measurements::Pressure;
pub use measurements::Angle;
pub use measurements::Pressure;
pub use measurements::Temperature;
pub use rh::RelativeHumidity;

use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError};
Expand Down Expand Up @@ -99,8 +99,9 @@ impl<'a> SenseHat<'a> {
pub fn get_temperature_from_pressure(&mut self) -> SenseHatResult<Temperature> {
let status = self.pressure_chip.status()?;
if (status & 1) != 0 {
Ok(Temperature::from_celsius(self.pressure_chip
.get_temp_celcius()?))
Ok(Temperature::from_celsius(
self.pressure_chip.get_temp_celcius()?
))
} else {
Err(SenseHatError::NotReady)
}
Expand All @@ -110,8 +111,9 @@ impl<'a> SenseHat<'a> {
pub fn get_pressure(&mut self) -> SenseHatResult<Pressure> {
let status = self.pressure_chip.status()?;
if (status & 2) != 0 {
Ok(Pressure::from_hectopascals(self.pressure_chip
.get_pressure_hpa()?))
Ok(Pressure::from_hectopascals(
self.pressure_chip.get_pressure_hpa()?
))
} else {
Err(SenseHatError::NotReady)
}
Expand Down
5 changes: 3 additions & 2 deletions src/lps25h.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! * Driver for the LPS25H Pressure sensor
//! See <http://www.st.com/en/mems-and-sensors/lps25h.html>
use i2cdev::core::I2CDevice;
use byteorder::{ByteOrder, LittleEndian};
use i2cdev::core::I2CDevice;

pub const REG_RES_CONF: u8 = 0x10;
pub const REG_CTRL_REG_1: u8 = 0x20;
Expand Down Expand Up @@ -50,7 +50,8 @@ where

/// Obtain the temperature reading from the chip in deg C.
pub fn get_temp_celcius(&mut self) -> Result<f64, T::Error> {
self.get_temp().and_then(|c| Ok((f64::from(c) / 480.0) + 42.5))
self.get_temp()
.and_then(|c| Ok((f64::from(c) / 480.0) + 42.5))
}

/// Obtain the pressure reading from the chip.
Expand Down

0 comments on commit 875d504

Please sign in to comment.