mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
added status checking functions
This commit is contained in:
parent
9d0c06f5ad
commit
c736d5d23f
@ -1,12 +1,13 @@
|
||||
//
|
||||
// FILE: MAX31855.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.9
|
||||
// VERSION: 0.1.10
|
||||
// PURPOSE: MAX31855 - Thermocouple
|
||||
// DATE: 2014-01-01
|
||||
// URL: http://forum.arduino.cc/index.php?topic=208061
|
||||
//
|
||||
// HISTORY:
|
||||
// 0.1.10 2019-07-31 add 3 inline functions to test errors + demo sketch
|
||||
// 0.1.9 2017-07-27 reverted double -> float (issue33)
|
||||
// 0.1.08 2015-12-06 replaced all temperature calls with one TCfactor + update demos.
|
||||
// 0.1.07 2015-12-06 updated TC factors from the MAX31855 datasheet
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: MAX31855.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.9
|
||||
// VERSION: 0.1.10
|
||||
// PURPOSE: MAX31855 - Thermocouple
|
||||
// DATE: 2014-01-01
|
||||
// URL: http://forum.arduino.cc/index.php?topic=208061
|
||||
@ -17,12 +17,13 @@
|
||||
#include "Arduino.h"
|
||||
#endif
|
||||
|
||||
#define MAX31855_VERSION "0.1.9"
|
||||
#define MAX31855_VERSION "0.1.10"
|
||||
|
||||
#define STATUS_OK 0x00
|
||||
#define STATUS_OPEN_CIRCUIT 0x01
|
||||
#define STATUS_SHORT_TO_GND 0x02
|
||||
#define STATUS_SHORT_TO_VCC 0x04
|
||||
#define STATUS_ERROR 0x07
|
||||
#define STATUS_NOREAD 0x80
|
||||
|
||||
// Thermocouples working is based upon Seebeck effect.
|
||||
@ -59,10 +60,15 @@ public:
|
||||
|
||||
uint8_t read();
|
||||
|
||||
float getInternal(void) const { return _internal; };
|
||||
float getTemperature(void) const { return _temperature * _TCfactor; }
|
||||
float getInternal(void) const { return _internal; }
|
||||
float getTemperature(void) const { return _temperature * _TCfactor; };
|
||||
|
||||
uint8_t getStatus(void) const { return _status; };
|
||||
// next 4 applies to last read
|
||||
inline bool statusError() { return (_status & STATUS_ERROR) != 0; };
|
||||
inline bool shortToGND() { return (_status & STATUS_SHORT_TO_GND) != 0; };
|
||||
inline bool shortToVCC() { return (_status & STATUS_SHORT_TO_VCC) != 0; };
|
||||
inline bool openCircuit() { return (_status & STATUS_OPEN_CIRCUIT) != 0; };
|
||||
|
||||
void setOffset(const float t) { _offset = t; };
|
||||
float getOffset() const { return _offset; };
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/Arduino.git"
|
||||
},
|
||||
"version":"0.1.9",
|
||||
"version":"0.1.10",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
"export": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=MAX31855
|
||||
version=0.1.9
|
||||
version=0.1.10
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Library for MAX31855 Thermocouple.
|
||||
|
Loading…
Reference in New Issue
Block a user