diff -r f8b0268c8d0a -r 1c9894662795 main/task_bmp280.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/task_bmp280.h Mon Mar 27 22:13:21 2023 +0200 @@ -0,0 +1,62 @@ +/** + * @file task_bmp280.h + * @brief The FreeRTOS task to query the BMP280 sensor connected to + * the I2C bus. + * The task will update the sensor state structures. + */ + +#ifndef _TASK_BMP280_H +#define _TASK_BMP280_H + +/* + * Error codes in this task + */ +#define BMP280_ERR_NONE 0 ///< No errors +//#define I2C_ERR_READ 1 ///< Generic read error + + +/** + * @brief BMP280 sensor + */ +typedef struct strBMP280 { + bool valid; ///< Valid measurement + bool fake; ///< Fake measurement + uint8_t address; ///< Device i2c address + float temperature; ///< Temperature in celsius + float humidity; + float pressure; ///< Pressure in hPa + int error; ///< Error result +} bmp280_tt; + + +/** + * @brief Structure containing the variables for the BMP280 task. + */ +typedef struct { + bmp280_tt bmp280; ///< Sensor results +} BMP280_State; + + + +/** + * @brief Request a new measurement from selected sensors. + */ +void request_bmp280(void); + + +/** + * @brief Check if results are ready + * @return true of results are ready, else false. + */ +bool ready_bmp280(void); + + +/** + * @brief The FreeRTOS task to update the BMP280 on request. + * @param pvParameters Parameters for the task. + */ +void task_bmp280(void *pvParameters); + + +#endif +