GY-63_MS5611/libraries/MS5611/MS5611.h

53 lines
996 B
C
Raw Normal View History

2014-10-19 06:54:35 -04:00
//
// FILE: MS5611.h
// AUTHOR: Rob Tillaart
// Erni - testing/fixes
2015-03-06 14:25:48 -05:00
// VERSION: 0.1.05
2014-10-19 06:54:35 -04:00
// PURPOSE: MS5611 Temperature & Pressure library for Arduino
// URL:
//
// HISTORY:
// see MS5611.cpp file
//
#ifndef MS5611_h
#define MS5611_h
#if ARDUINO < 100
#error "VERSION NOT SUPPPORTED"
2014-10-19 06:54:35 -04:00
#else
#include <Arduino.h>
#endif
2015-03-06 14:25:48 -05:00
#define MS5611_LIB_VERSION (F("0.1.05"))
#define MS5611_READ_OK 0
2014-10-19 06:54:35 -04:00
class MS5611
{
public:
2015-03-06 14:25:48 -05:00
MS5611(uint8_t deviceAddress);
2014-10-19 06:54:35 -04:00
void init();
2014-10-19 06:55:45 -04:00
int read(uint8_t bits = 8);
inline int32_t getTemperature() { return _temperature; };
inline int32_t getPressure() { return _pressure; };
inline int getLastResult() { return _result; };
2014-10-19 06:54:35 -04:00
private:
void reset();
2015-03-06 14:25:48 -05:00
void convert(uint8_t addr, uint8_t bits);
uint32_t readADC();
2014-10-19 06:54:35 -04:00
uint16_t readProm(uint8_t reg);
2015-03-06 14:25:48 -05:00
void command(const uint8_t command);
2014-10-19 06:54:35 -04:00
uint8_t _address;
int32_t _temperature;
int32_t _pressure;
2014-10-19 06:54:35 -04:00
int _result;
double C[7];
2014-10-19 06:54:35 -04:00
};
#endif
//
// END OF FILE
//