ESP32-PaxCounter/include/bmesensor.h

60 lines
1.4 KiB
C
Raw Permalink Normal View History

2019-03-13 21:15:28 +01:00
#ifndef _BMESENSOR_H
#define _BMESENSOR_H
2018-11-22 23:37:53 +01:00
2022-02-22 13:11:46 +01:00
#if (HAS_BME)
2018-11-22 23:37:53 +01:00
#include <Wire.h>
2019-03-13 21:15:28 +01:00
2020-03-29 18:08:52 +02:00
#include "globals.h"
#include "irqhandler.h"
#include "configmanager.h"
2019-03-13 21:15:28 +01:00
#ifdef HAS_BME680
2020-01-28 21:49:24 +01:00
#include <bsec.h>
2019-03-13 21:15:28 +01:00
#elif defined HAS_BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
2019-12-08 12:58:12 +01:00
#elif defined HAS_BMP180
#include <Adafruit_BMP085.h>
2019-03-13 21:15:28 +01:00
#endif
2018-11-25 20:56:14 +01:00
extern Ticker bmecycler;
2018-11-22 23:37:53 +01:00
extern bmeStatus_t
bme_status; // Make struct for storing gps data globally available
2020-11-21 20:38:17 +01:00
// --- Bosch BSEC library configuration ---
// We use 3,3V supply voltage; 3s max time between sensor_control calls; 4 days
2018-12-26 23:01:54 +01:00
// calibration. Change this const if not applicable for your application (see
2020-11-21 20:38:17 +01:00
// BME680 datasheet) Note: 3s max time must not exceed BMECYCLE frequency set in
// paxcounter.conf!
const uint8_t bsec_config_iaq[] = {
#include "config/generic_33v_3s_4d/bsec_iaq.txt"
};
/* Configure the BSEC library with information about the sensor
18v/33v = Voltage at Vdd. 1.8V or 3.3V
3s/300s = BSEC operating mode, BSEC_SAMPLE_RATE_LP or BSEC_SAMPLE_RATE_ULP
4d/28d = Operating age of the sensor in days
generic_18v_3s_4d
generic_18v_3s_28d
generic_18v_300s_4d
generic_18v_300s_28d
generic_33v_3s_4d
generic_33v_3s_28d
generic_33v_300s_4d
generic_33v_300s_28d
*/
2018-12-26 23:01:54 +01:00
// Helper functions declarations
2018-11-25 11:48:03 +01:00
int bme_init();
void setBMEIRQ(void);
void bme_storedata(bmeStatus_t *bme_store);
2018-12-26 23:01:54 +01:00
int checkIaqSensorStatus(void);
void loadState(void);
void updateState(void);
2018-11-25 11:48:03 +01:00
2022-02-22 13:11:46 +01:00
#endif
2018-11-22 23:37:53 +01:00
#endif