2014-10-19 06:54:35 -04:00
|
|
|
//
|
|
|
|
// FILE: MS5611.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2014-10-19 07:01:09 -04:00
|
|
|
// Erni - testing/fixes
|
|
|
|
// VERSION: 0.1.03
|
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
|
2014-10-19 07:00:16 -04:00
|
|
|
#error "VERSION NOT SUPPPORTED"
|
2014-10-19 06:54:35 -04:00
|
|
|
#include <WProgram.h>
|
|
|
|
#else
|
|
|
|
#include <Arduino.h>
|
|
|
|
#endif
|
|
|
|
|
2014-10-19 07:01:09 -04:00
|
|
|
#define MS5611_LIB_VERSION "0.1.03"
|
2014-10-19 07:00:16 -04:00
|
|
|
|
|
|
|
#define MS5611_READ_OK 0
|
2014-10-19 06:54:35 -04:00
|
|
|
|
|
|
|
class MS5611
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MS5611(uint8_t address);
|
|
|
|
|
|
|
|
void init();
|
2014-10-19 06:55:45 -04:00
|
|
|
int read(uint8_t bits = 8);
|
2014-10-19 07:00:16 -04:00
|
|
|
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();
|
2014-10-19 07:00:16 -04:00
|
|
|
void convert(uint8_t ADDR, uint8_t bits);
|
2014-10-19 06:54:35 -04:00
|
|
|
int32_t readADC();
|
|
|
|
uint16_t readProm(uint8_t reg);
|
|
|
|
void command(uint8_t command);
|
|
|
|
|
|
|
|
uint8_t _address;
|
2014-10-19 07:00:16 -04:00
|
|
|
int32_t _temperature;
|
|
|
|
int32_t _pressure;
|
2014-10-19 06:54:35 -04:00
|
|
|
int _result;
|
2014-10-19 07:01:09 -04:00
|
|
|
float C[8];
|
2014-10-19 06:54:35 -04:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
//
|
|
|
|
// END OF FILE
|
|
|
|
//
|