Merged with fix/ms5607 branch and faster implementation

This commit is contained in:
dario
2024-05-16 22:12:29 +02:00
2 changed files with 52 additions and 72 deletions

View File

@@ -3,6 +3,7 @@
#include <sta/bus/spi/device.hpp>
#include <sta/bus/i2c/device.hpp>
#include <sta/time.hpp>
#include <sta/endian.hpp>
@@ -115,6 +116,8 @@ namespace sta
*/
bool init();
void delay();
/**
* @brief Set the oversampling rate.
*
@@ -128,14 +131,17 @@ namespace sta
* @param type
* @param blocking
*/
void requestData(DataType type, bool blocking = false);
void requestData(DataType type);
bool hasData(DataType type);
void requestPressure();
void requestTemperature();
/**
* @brief Reads the current pressure value from the sensor. Obtains the temperature value from the interal sensor.
*
* @param unit Specifies the unit for the pressure measurement. Default is hPa.
* @param cachedTemp Specifies if a cached temperature value should be used.
* @return int32_t The measured value in the specified unit.
*/
float getPressure(Unit unit = Unit::hPa);
@@ -146,7 +152,7 @@ namespace sta
* @return int32_t The measured temperature.
* @note There are better sensors for temperature measurements than the MS56xx.
*/
int32_t getTemperature();
float getTemperature();
/**
* @brief Provide a reference pressure value at a reference altitude in order to estimate the sealevel pressure.
@@ -182,7 +188,7 @@ namespace sta
* @note This code was taken from https://github.com/RobTillaart/MS5611
*
*/
void initConstants(bool mathMode = 0);
void initConstants();
/**
* @brief Convert the pressure value given in Pa to a different unit.
@@ -233,15 +239,20 @@ namespace sta
OsrLevel osr_;
Intf intf_;
float dT_;
float dTInit_;
bool pressReq_ = false;
bool tempReq_ = false;
// Pressure at sealevel. Use the standard atmosphere per default.
float sealevel_ = 1013.25;
// The different constants; Includes Offsets, references etc.
float C_[8];
float C_[8];
// Constants for waiting
const uint32_t RESET_DELAY = 2800; // in uS
};
}
#endif // ifndef STA_SENSORS_MS5607_HPP
#endif // ifndef STA_SENSORS_MS5607_HPP