v3_firmware/lib/BME280/BME280.h

42 lines
1.1 KiB
C
Raw Permalink Normal View History

#ifndef BME280_H
#define BME280_H
2021-03-15 18:04:36 +00:00
#include "../../include/attsensor.h"
#include "../../include/debug.h"
#define BME280_I2CADDR 0x76
2021-03-15 18:04:36 +00:00
class BME280 : public AttSensor {
private:
// Variables for Calibration Values
uint8_t dig_H1, dig_H3;
int8_t dig_H6;
uint16_t dig_T1, dig_P1;
int16_t dig_T2, dig_T3, dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9, dig_H2, dig_H4, dig_H5;
// Helper Variable
int32_t t_fine;
// Functions for Calculation compensated Values
int32_t compensate_t(int32_t);
int32_t compensate_p(int32_t);
int32_t compensate_h(int32_t);
// Helper Functions for Reading / Writing I2C Data
uint8_t read8(uint8_t addr);
uint16_t read16(uint8_t addr);
uint16_t read16_LE(uint8_t addr);
int16_t readS16(uint8_t addr);
int16_t readS16_LE(uint8_t addr);
void write8(uint8_t addr, uint8_t data);
2021-03-15 18:04:36 +00:00
void getCalData(void);
public:
BME280(void);
2021-03-15 18:04:36 +00:00
uint8_t getSensorData(char *payload, uint8_t startbyte);
2021-03-31 18:15:13 +00:00
void calibrate(void) {};
2021-03-15 18:04:36 +00:00
void initialize(void) {getCalData();};
uint8_t numBytes(void) {return 12;};
};
#endif