BMP085 Sparkfun class
BMP085.h@0:2ae3dabe45e8, 2013-10-02 (annotated)
- Committer:
- mr63
- Date:
- Wed Oct 02 14:02:29 2013 +0000
- Revision:
- 0:2ae3dabe45e8
This is a class for the BMP085 Pressure Temperature sensor from Sparkfun. I believe that the sensor I have does not work, so if this doesn't work let me know.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr63 | 0:2ae3dabe45e8 | 1 | #include "mbed.h" |
mr63 | 0:2ae3dabe45e8 | 2 | |
mr63 | 0:2ae3dabe45e8 | 3 | #define Temp 0x2E |
mr63 | 0:2ae3dabe45e8 | 4 | #define Pressure 0x34 |
mr63 | 0:2ae3dabe45e8 | 5 | |
mr63 | 0:2ae3dabe45e8 | 6 | |
mr63 | 0:2ae3dabe45e8 | 7 | class BMP085 { |
mr63 | 0:2ae3dabe45e8 | 8 | public: |
mr63 | 0:2ae3dabe45e8 | 9 | |
mr63 | 0:2ae3dabe45e8 | 10 | BMP085(int SlaveAddress, PinName sda, PinName scl, PinName EOC); |
mr63 | 0:2ae3dabe45e8 | 11 | |
mr63 | 0:2ae3dabe45e8 | 12 | int Read_ConversionValue(unsigned char type); |
mr63 | 0:2ae3dabe45e8 | 13 | void GetCalibrationData(); |
mr63 | 0:2ae3dabe45e8 | 14 | int calculate_tempc(); |
mr63 | 0:2ae3dabe45e8 | 15 | int calculate_pressure(); |
mr63 | 0:2ae3dabe45e8 | 16 | |
mr63 | 0:2ae3dabe45e8 | 17 | private: |
mr63 | 0:2ae3dabe45e8 | 18 | I2C _i2c; |
mr63 | 0:2ae3dabe45e8 | 19 | DigitalIn _eoc; |
mr63 | 0:2ae3dabe45e8 | 20 | int return16bit(int Reg); |
mr63 | 0:2ae3dabe45e8 | 21 | int Write_Register (char regnum, char data); |
mr63 | 0:2ae3dabe45e8 | 22 | int Read_Register (char regnum, int numbofbytes); |
mr63 | 0:2ae3dabe45e8 | 23 | }; |
mr63 | 0:2ae3dabe45e8 | 24 | |
mr63 | 0:2ae3dabe45e8 | 25 |