Reverted a few changes but fixed a few issues

This commit is contained in:
dario
2024-05-17 00:42:53 +02:00
parent cdb9b4a1d2
commit c0eb36fbe0
2 changed files with 67 additions and 35 deletions

View File

@@ -35,6 +35,16 @@ namespace sta
*/
using DelayUsFunc = void (*)(uint32_t);
/**
* @brief Represents the two different supported sensors.
*
*/
enum Version
{
_MS5611,
_MS5607
};
/**
* @brief Different OSR levels for the sensor
*
@@ -81,6 +91,10 @@ namespace sta
ADC_RESULT = 0x00
};
/**
* @brief Represents the two datatypes available for this sensor.
*
*/
enum DataType
{
PRESSURE,
@@ -91,23 +105,25 @@ namespace sta
* @brief SPI driver for the MS56xx pressure sensor series.
*
* @param device The SPI device for bus communication.
* @param version The version of the sensor that the driver is used for.
* @param delay Function for triggering microsecond delays.
* @param osr The oversampling rate for the sensor.
*
* @note Set PS pin to low for SPI. Maximum SPI frequency 20MHz, mode 0 and 3 are supported.
*/
MS56xx(SPIDevice * device, DelayUsFunc delay, OsrLevel osr = OsrLevel::_1024);
MS56xx(SPIDevice * device, Version version, DelayUsFunc delay, OsrLevel osr = OsrLevel::_1024);
/**
* @brief I2C driver for the MS56xx pressure sensor series.
*
* @param device The I2C device for bus communication.
* @param version The version of the sensor that the driver is used for.
* @param delay Function for triggering microsecond delays.
* @param osr The oversampling rate for the sensor.
*
* @note Set PS pin to high for I2C. Chip select pin represents LSB of address.
*/
MS56xx(I2CDevice * device, DelayUsFunc delay, OsrLevel osr = OsrLevel::_1024);
MS56xx(I2CDevice * device, Version version, DelayUsFunc delay, OsrLevel osr = OsrLevel::_1024);
/**
* @brief Initialize the driver. Computes the pressure value at altitude 0.
@@ -125,18 +141,6 @@ namespace sta
*/
void setOsr(OsrLevel osr);
/**
* @brief
*
* @param type
* @param blocking
*/
void requestData(DataType type);
void requestPressure();
void requestTemperature();
/**
* @brief Reads the current pressure value from the sensor. Obtains the temperature value from the interal sensor.
*
@@ -176,6 +180,13 @@ namespace sta
*/
void reset();
/**
* @brief Request an ADC readout from the sensor.
*
* @param type The type of data to read.
*/
void requestData(DataType type);
/**
* @brief Read all constants from the PROM
*
@@ -235,6 +246,8 @@ namespace sta
private:
// STA internal object for SPi abstraction
Device * device_;
Version version_;
Version type_;
DelayUsFunc delay_;
OsrLevel osr_;
Intf intf_;