From 650db10d694bf483c4cb670982cfd9f9799e2520 Mon Sep 17 00:00:00 2001 From: marcelbuesing Date: Thu, 31 May 2018 12:10:34 +0200 Subject: [PATCH] Reduce struct visibility where not required --- src/calc.rs | 2 +- src/lib.rs | 9 ++++++--- src/settings.rs | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/calc.rs b/src/calc.rs index cc1a62d..8f05fa0 100644 --- a/src/calc.rs +++ b/src/calc.rs @@ -1,5 +1,5 @@ -use CalibData; use core::time::Duration; +use CalibData; pub struct Calc {} diff --git a/src/lib.rs b/src/lib.rs index a5e76a1..17291a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,6 +118,7 @@ pub enum Error { BoundaryCheckFailure(&'static str), } +/// Abbreviates `std::result::Result` type pub type Result = result::Result>; /// @@ -181,6 +182,7 @@ impl Default for I2CAddress { } } +/// Calibration data used during initalization #[derive(Debug, Default, Copy)] #[repr(C)] pub struct CalibData { @@ -218,6 +220,7 @@ impl Clone for CalibData { } } +/// Contains read sensors values e.g. temperature, pressure, humidity etc. #[derive(Debug, Default, Copy)] #[repr(C)] pub struct FieldData { @@ -260,8 +263,7 @@ impl FieldData { } } -/// aka new_fields - BME680_NEW_DATA_MSK -/// +/// Shows if new data is available #[derive(Debug)] pub enum FieldDataCondition { /// @@ -274,7 +276,7 @@ pub enum FieldDataCondition { Unchanged, } -pub struct I2CUtil {} +struct I2CUtil {} impl I2CUtil { pub fn read_byte( @@ -315,6 +317,7 @@ impl I2CUtil { } } +/// Driver for the BME680 environmental sensor #[repr(C)] pub struct Bme680_dev { i2c: I2C, diff --git a/src/settings.rs b/src/settings.rs index 6a08307..de142dc 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -116,6 +116,8 @@ impl Clone for SensorSettings { } bitflags! { + /// Flags that determine what settings are to be set and what settings are to be read. + /// Use the `SettingsBuilder` to initialize an instance when setting the settings. #[derive(Default)] pub struct DesiredSensorSettings: u16 { /// To set temperature oversampling @@ -158,6 +160,7 @@ pub struct SettingsBuilder { sensor_settings: SensorSettings, } +/// Tuple of desired sensor settings flags and sensor settings pub type Settings = (SensorSettings, DesiredSensorSettings); impl SettingsBuilder {