32 lines
499 B
C++
32 lines
499 B
C++
#ifndef __NTC_H
|
|
#define __NTC_H
|
|
|
|
#ifndef rRef
|
|
#define rRef 10000
|
|
#endif
|
|
|
|
#define NTC_COUNT 32
|
|
#define NTC_MASK (NTC_COUNT - 1)
|
|
|
|
class NTC_10K {
|
|
private:
|
|
//lookup table
|
|
//float resistance[64];
|
|
//int16_t temp_C[64];
|
|
int16_t temps[NTC_COUNT];
|
|
int16_t temp_sum;
|
|
int16_t temp_idx;
|
|
|
|
float _vRef;
|
|
int _RESO;
|
|
bool m_bNegativePolarity;
|
|
int16_t m_nTemp;
|
|
|
|
public:
|
|
void setup(bool bNegativePolarity);
|
|
void readSensor();
|
|
inline int16_t getTemp() { return m_nTemp; };
|
|
};
|
|
|
|
extern NTC_10K ntc;
|
|
#endif |