projet3_temperature/lib/LTC2439Lib/LTC2439.h

44 lines
1.1 KiB
C++

/**
* Anatole SCHRAMM-HENRY
* Tim THUREL
* Projet température de la ruche GROUPE 3
* Driver pour le LTC2439 fonctionne avec l'ESP8266
* Méthodes asynchrones disponibles
*
* Tout droits réservés
*/
#ifndef LTC2439_H
#define LTC2439_H
#include <Arduino.h>
#include <SPI.h>
class LTC2439
{
public:
LTC2439(uint8_t csPin, uint8_t sdoPin, double vref = 3300);
void setVref(double vref);
double getVref(){return _vref;};
int32_t sampleValue(uint8_t channel, boolean sgl = true);
int32_t sampleValue();
double sampleVoltage(uint8_t channel, boolean sgl = true);
double sampleVoltage();
//Methodes asynchrones
void startAsyncSample(uint8_t channel, boolean sgl = true, boolean force = false);
boolean asyncResultAvailable();
double convertToVoltage(int32_t value);
int32_t getAsyncValue();
protected:
private:
uint8_t _csPin, _statusPin;
boolean _sampleTriggered;
double _vref; //Delta de tension de la plage : vref-gnd en mV
uint8_t _adcRes;
double _quantum;
const uint8_t _channelMap[16];
const SPISettings _SPIsettings;
};
#endif //LTC2439_H