pressure: create state for reading pressure

This commit is contained in:
Vasily Davydov
2022-10-24 16:16:49 +03:00
parent cf8d491516
commit 7871953fe6
4 changed files with 89 additions and 43 deletions

View File

@@ -13,16 +13,16 @@
#define ADDRESS 0x40
/**
* @brief structure to hold a raw data from
* the pressure sensor
*/
typedef struct _PRESSURE{
uint8_t rBuffer[2];
uint8_t crc;
}PRESSURE_DATA;
typedef struct _PRESSURE
{
uint8_t rBuffer[2];
uint8_t crc;
} PRESSURE_DATA;
class PressureWrapper
{
@@ -33,11 +33,25 @@ public:
*/
int getPressure ();
/**
* @brief Check if sensor is ready
*
* @return true if awake
* @return false if asleep
*/
bool isAwake ();
/**
* @brief Wake the sensor up
*
*/
void wakeUp ();
virtual ~PressureWrapper ();
private:
I2C *i2c;
PRESSURE_DATA data = {{0, 0}, 0};
PRESSURE_DATA data = { { 0, 0 }, 0 };
/*
* @return struct with pressure data in
* rBuffer and CRC check in crc

View File

@@ -132,6 +132,7 @@ private:
LiquidCrystal *_lcd;
ModbusRegister *A01;
PressureWrapper *pressure;
bool pressure_status;
Timer *state_timer;
/* CO2 sensor object */
GMP252 co2;