43 lines
873 B
C
43 lines
873 B
C
#ifndef BME280_H
|
|
#define BME280_H
|
|
|
|
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
|
|
// I2C address for BME280 (default)
|
|
#define BME280_ADDRESS 0x76
|
|
|
|
// Register addresses from datasheet
|
|
#define BME280_REG_ID 0xD0
|
|
#define BME280_REG_RESET 0xE0
|
|
#define BME280_REG_CTRL_HUM 0xF2
|
|
#define BME280_REG_STATUS 0xF3
|
|
#define BME280_REG_CTRL_MEAS 0xF4
|
|
#define BME280_REG_CONFIG 0xF5
|
|
#define BME280_REG_PRESS_MSB 0xF7
|
|
#define BME280_REG_TEMP_MSB 0xFA
|
|
#define BME280_REG_HUM_MSB 0xFD
|
|
|
|
// Reset command
|
|
#define BME280_RESET_CMD 0xB6
|
|
|
|
// Function declarations
|
|
uint8_t BME280_GetID();
|
|
|
|
void BME280_Reset();
|
|
|
|
uint8_t BME280_CtrlHum();
|
|
|
|
void BME280_CtrlHum(uint8_t bitpattern);
|
|
|
|
uint8_t BME280_CtrlMeas();
|
|
|
|
void BME280_CtrlMeas(uint8_t bitpattern);
|
|
|
|
long BME280_ReadTemperature();
|
|
|
|
int BME280_ReadHumidity();
|
|
|
|
long BME280_ReadPressure();
|
|
|
|
#endif |