Files
2020-08-02 19:14:24 +02:00

86 lines
2.2 KiB
C

/**
* @file opst.h
* @author Pascal Lais (pascal_lais@gmx.de)
*
* @version 0.1
* @date 2020-08-02
*/
#ifndef OPST_H_INCLUDED
#define OPST_H_INCLUDED
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Defines
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Datatypes
//-----------------------------------------------------------------------------
typedef enum eagOpstState
{
OPST_STATE_NONE,
OPST_STATE_REPORT_TEMP,
OPST_STATE_REPORT_PRESSURE,
OPST_STATE_TEMP_FAULT,
OPST_STATE_PRESSURE_FAULT,
OPST_STATE_HARDWARE_FAULT,
}eOpstState;
//-----------------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function prototypes
//-----------------------------------------------------------------------------
/**
* Init opst handling
*
* @param pin The pin that connects to the output pin of the sensor. Only pin 2 or 3 can be used here.
*/
void opstInit(uint8_t pin);
/**
* OPS+T sensor pwm data handling. Call this in the loop function.
*/
void opstUpdate();
/**
* Get the current state of the sensor.
*
* @return One of eOpstState
*/
uint32_t opstGetState();
/**
* Get the temperature value.
*
* @return Temperature vale in 0.1 °C steps (ie 274 for 27.4 °C)
*/
int32_t opstGetTemp();
/**
* Get the pressure value
*
* @return Pressure in millibar
*/
int32_t opstGetPressure();
/**
* Check fifo for overruns. If overrun was detected increase fifo size.
*
* @return True if fifo overrun was detected at any time.
*/
bool opstFiFoOverrunDetected();
#endif //OPST_H_INCLUDED
//-----------------------------------------------------------------------------
// EOF
//-----------------------------------------------------------------------------