Added libraries for SPI flash, BMP180 and Si7021

This commit is contained in:
Thomas Mørch
2015-02-05 19:10:52 +01:00
parent 08221e6567
commit e462bc214c
16 changed files with 2028 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
/*
Copyright 2014 Marcus Sorensen <marcus@electron14.com>
This program is licensed under the GNU GPL v2
*/
#ifndef si7021_h
#define si7021_h
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#ifdef __AVR_ATtiny85__
#include "TinyWireM.h"
#define Wire TinyWireM
#else
#include <avr/pgmspace.h>
#include <Wire.h>
#endif
typedef struct si7021_env {
int celsiusHundredths;
int fahrenheitHundredths;
unsigned int humidityBasisPoints;
} si7021_env;
class SI7021
{
public:
SI7021();
bool begin();
bool sensorExists();
int getFahrenheitHundredths();
int getCelsiusHundredths();
unsigned int getHumidityPercent();
unsigned int getHumidityBasisPoints();
struct si7021_env getHumidityAndTemperature();
int getSerialBytes(byte * buf);
int getDeviceId();
void setHeater(bool on);
private:
void _command(byte * cmd, byte * buf );
void _writeReg(byte * reg, int reglen);
int _readReg(byte * reg, int reglen);
int _getCelsiusPostHumidity();
};
#endif