-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDS1820.h
51 lines (51 loc) · 1.36 KB
/
DS1820.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef DS1820_H
#define DS1820_H
//-----------------------------------------------------------------------------
#include "../avr-misc/avr-misc.h"
//-----------------------------------------------------------------------------
#define BAD_TEMP 0x8000
//-----------------------------------------------------------------------------
class AllSensorsDS1820
{
public:
void measure();
// void setResolution(BYTE resolution);
};
//-----------------------------------------------------------------------------
class BusDS1820
{
public:
BYTE searchDevices();
const QWORD& getFirstDeviceAddress();
const QWORD& getNextDeviceAddress();
AllSensorsDS1820 allSensors;
private:
BYTE m_nextID = 0;
BYTE m_devicesCount = 0;
QWORD* m_addresses = NULL;
};
//-----------------------------------------------------------------------------
class SensorDS1820
{
public:
SensorDS1820(QWORD& address);
bool available();
void measure();
int readTempC();
int readTempF();
int readTempK();
int readRawTemp();
BYTE getModelCode();
QWORD& getAddress();
// void setResolution(BYTE resolution);
void* operator new(size_t count);
void operator delete(void* ptr);
private:
union
{
QWORD m_address;
BYTE m_modelCode;
};
};
//-----------------------------------------------------------------------------
#endif