MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
MePressureSensor.h
1#ifndef MePressureSensor_H
2#define MePressureSensor_H
3
4#if (ARDUINO >= 100)
5 #include "Arduino.h"
6#else
7 #include "WProgram.h"
8#endif
9#include "MeConfig.h"
10
11#define BMP180_DEBUG 0
12
13#define BMP180_I2CADDR 0x77
14
15#define BMP180_ULTRALOWPOWER 0
16#define BMP180_STANDARD 1
17#define BMP180_HIGHRES 2
18#define BMP180_ULTRAHIGHRES 3
19#define BMP180_CAL_AC1 0xAA
20#define BMP180_CAL_AC2 0xAC
21#define BMP180_CAL_AC3 0xAE
22#define BMP180_CAL_AC4 0xB0
23#define BMP180_CAL_AC5 0xB2
24#define BMP180_CAL_AC6 0xB4
25#define BMP180_CAL_B1 0xB6
26#define BMP180_CAL_B2 0xB8
27#define BMP180_CAL_MB 0xBA
28#define BMP180_CAL_MC 0xBC
29#define BMP180_CAL_MD 0xBE
30
31#define BMP180_CONTROL 0xF4
32#define BMP180_TEMPDATA 0xF6
33#define BMP180_PRESSUREDATA 0xF6
34#define BMP180_READTEMPCMD 0x2E
35#define BMP180_READPRESSURECMD 0x34
36
37
38 class MePressureSensor {
39 public:
40 MePressureSensor();
41 boolean begin(uint8_t mode = BMP180_ULTRAHIGHRES);
42 float readTemperature(void);
43 int32_t readPressure(void);
44 int32_t readSealevelPressure(float altitude_meters = 0);
45 float readAltitude(float sealevelPressure = 101325);
46 uint16_t readRawTemperature(void);
47 uint32_t readRawPressure(void);
48
49 private:
50 int32_t computeB5(int32_t UT);
51 uint8_t readUInt8(uint8_t addr);
52 uint16_t readUInt16(uint8_t addr);
53 void writeUInt8(uint8_t addr, uint8_t data);
54
55 uint8_t oversampling;
56
57 int16_t ac1, ac2, ac3, b1, b2, mb, mc, md;
58 uint16_t ac4, ac5, ac6;
59};
60
61
62#endif
MeConfig.h
Configuration file of library.
MePressureSensor
Definition MePressureSensor.h:38