Merge pull request #48 from espHorst/master
changed private to protected and added doc for protected members
This commit is contained in:
commit
799dae5f0a
|
|
@ -138,11 +138,11 @@ class Adafruit_BME280_Unified : public Adafruit_Sensor
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
class Adafruit_BME280 {
|
class Adafruit_BME280 {
|
||||||
public:
|
public:
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief sampling rates
|
@brief sampling rates
|
||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
enum sensor_sampling {
|
enum sensor_sampling {
|
||||||
SAMPLING_NONE = 0b000,
|
SAMPLING_NONE = 0b000,
|
||||||
SAMPLING_X1 = 0b001,
|
SAMPLING_X1 = 0b001,
|
||||||
|
|
@ -220,9 +220,9 @@ class Adafruit_BME280 {
|
||||||
float seaLevelForAltitude(float altitude, float pressure);
|
float seaLevelForAltitude(float altitude, float pressure);
|
||||||
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
TwoWire *_wire;
|
TwoWire *_wire; //!< pointer to a TwoWire object
|
||||||
void readCoefficients(void);
|
void readCoefficients(void);
|
||||||
bool isReadingCalibration(void);
|
bool isReadingCalibration(void);
|
||||||
uint8_t spixfer(uint8_t x);
|
uint8_t spixfer(uint8_t x);
|
||||||
|
|
||||||
|
|
@ -234,15 +234,23 @@ class Adafruit_BME280 {
|
||||||
uint16_t read16_LE(byte reg); // little endian
|
uint16_t read16_LE(byte reg); // little endian
|
||||||
int16_t readS16_LE(byte reg); // little endian
|
int16_t readS16_LE(byte reg); // little endian
|
||||||
|
|
||||||
uint8_t _i2caddr;
|
uint8_t _i2caddr; //!< I2C addr for the TwoWire interface
|
||||||
int32_t _sensorID;
|
int32_t _sensorID; //!< ID of the BME Sensor
|
||||||
int32_t t_fine;
|
int32_t t_fine; //!< temperature with high resolution, stored as an attribute as this is used for temperature compensation reading humidity and pressure
|
||||||
|
|
||||||
int8_t _cs, _mosi, _miso, _sck;
|
int8_t _cs; //!< for the SPI interface
|
||||||
|
int8_t _mosi; //!< for the SPI interface
|
||||||
|
int8_t _miso; //!< for the SPI interface
|
||||||
|
int8_t _sck; //!< for the SPI interface
|
||||||
|
|
||||||
bme280_calib_data _bme280_calib;
|
bme280_calib_data _bme280_calib; //!< here calibration data is stored
|
||||||
|
|
||||||
// The config register
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief config register
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
struct config {
|
struct config {
|
||||||
// inactive duration (standby time) in normal mode
|
// inactive duration (standby time) in normal mode
|
||||||
// 000 = 0.5 ms
|
// 000 = 0.5 ms
|
||||||
|
|
@ -253,7 +261,7 @@ class Adafruit_BME280 {
|
||||||
// 101 = 1000 ms
|
// 101 = 1000 ms
|
||||||
// 110 = 10 ms
|
// 110 = 10 ms
|
||||||
// 111 = 20 ms
|
// 111 = 20 ms
|
||||||
unsigned int t_sb : 3;
|
unsigned int t_sb : 3; ///< inactive duration (standby time) in normal mode
|
||||||
|
|
||||||
// filter settings
|
// filter settings
|
||||||
// 000 = filter off
|
// 000 = filter off
|
||||||
|
|
@ -261,20 +269,25 @@ class Adafruit_BME280 {
|
||||||
// 010 = 4x filter
|
// 010 = 4x filter
|
||||||
// 011 = 8x filter
|
// 011 = 8x filter
|
||||||
// 100 and above = 16x filter
|
// 100 and above = 16x filter
|
||||||
unsigned int filter : 3;
|
unsigned int filter : 3; ///< filter settings
|
||||||
|
|
||||||
// unused - don't set
|
// unused - don't set
|
||||||
unsigned int none : 1;
|
unsigned int none : 1; ///< unused - don't set
|
||||||
unsigned int spi3w_en : 1;
|
unsigned int spi3w_en : 1; ///< unused - don't set
|
||||||
|
|
||||||
|
/// @return combined config register
|
||||||
unsigned int get() {
|
unsigned int get() {
|
||||||
return (t_sb << 5) | (filter << 2) | spi3w_en;
|
return (t_sb << 5) | (filter << 2) | spi3w_en;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
config _configReg;
|
config _configReg; //!< config register object
|
||||||
|
|
||||||
|
|
||||||
// The ctrl_meas register
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief ctrl_meas register
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
struct ctrl_meas {
|
struct ctrl_meas {
|
||||||
// temperature oversampling
|
// temperature oversampling
|
||||||
// 000 = skipped
|
// 000 = skipped
|
||||||
|
|
@ -283,7 +296,7 @@ class Adafruit_BME280 {
|
||||||
// 011 = x4
|
// 011 = x4
|
||||||
// 100 = x8
|
// 100 = x8
|
||||||
// 101 and above = x16
|
// 101 and above = x16
|
||||||
unsigned int osrs_t : 3;
|
unsigned int osrs_t : 3; ///< temperature oversampling
|
||||||
|
|
||||||
// pressure oversampling
|
// pressure oversampling
|
||||||
// 000 = skipped
|
// 000 = skipped
|
||||||
|
|
@ -292,24 +305,29 @@ class Adafruit_BME280 {
|
||||||
// 011 = x4
|
// 011 = x4
|
||||||
// 100 = x8
|
// 100 = x8
|
||||||
// 101 and above = x16
|
// 101 and above = x16
|
||||||
unsigned int osrs_p : 3;
|
unsigned int osrs_p : 3; ///< pressure oversampling
|
||||||
|
|
||||||
// device mode
|
// device mode
|
||||||
// 00 = sleep
|
// 00 = sleep
|
||||||
// 01 or 10 = forced
|
// 01 or 10 = forced
|
||||||
// 11 = normal
|
// 11 = normal
|
||||||
unsigned int mode : 2;
|
unsigned int mode : 2; ///< device mode
|
||||||
|
|
||||||
|
/// @return combined ctrl register
|
||||||
unsigned int get() {
|
unsigned int get() {
|
||||||
return (osrs_t << 5) | (osrs_p << 2) | mode;
|
return (osrs_t << 5) | (osrs_p << 2) | mode;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ctrl_meas _measReg;
|
ctrl_meas _measReg; //!< measurement register object
|
||||||
|
|
||||||
|
|
||||||
// The ctrl_hum register
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief ctrl_hum register
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
struct ctrl_hum {
|
struct ctrl_hum {
|
||||||
// unused - don't set
|
/// unused - don't set
|
||||||
unsigned int none : 5;
|
unsigned int none : 5;
|
||||||
|
|
||||||
// pressure oversampling
|
// pressure oversampling
|
||||||
|
|
@ -319,13 +337,14 @@ class Adafruit_BME280 {
|
||||||
// 011 = x4
|
// 011 = x4
|
||||||
// 100 = x8
|
// 100 = x8
|
||||||
// 101 and above = x16
|
// 101 and above = x16
|
||||||
unsigned int osrs_h : 3;
|
unsigned int osrs_h : 3; ///< pressure oversampling
|
||||||
|
|
||||||
|
/// @return combined ctrl hum register
|
||||||
unsigned int get() {
|
unsigned int get() {
|
||||||
return (osrs_h);
|
return (osrs_h);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ctrl_hum _humReg;
|
ctrl_hum _humReg; //!< hum register object
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue