-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWire.h
66 lines (46 loc) · 1.48 KB
/
Wire.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <OneWire.h>
#include <DallasTemperature.h>
#include "Settings.h"
#ifndef WIRE_H_
#define WIRE_H_
#define WIRE_PIN 2 /* pin number of the OneWire bus */
#define WIRE_INTERVAL 30000 /* probing interval */
#define WIRE_MAX_DEVICES 8
class WireClass {
/* time structure */
typedef struct t {
unsigned long tStart;
unsigned long tTimeout;
};
private:
static float temp[WIRE_MAX_DEVICES];
static float temp1;
static float temp2;
static bool tempRead[WIRE_MAX_DEVICES];
static bool tempRead1;
static bool tempRead2;
/* interval variable controlling how often is the bus queried for values */
static t t_interval;
/* the sensors objects */
static OneWire oneWire;
static DallasTemperature sensors;
/* number of detected devices */
static byte deviceCount;
public:
/* Class constructor */
static byte WireClass::begin();
/* processing function for the main loop */
static byte WireClass::update();
/* check if it's the time to execute */
static bool WireClass::timeCheck(struct t *t);
/* reset time */
static void WireClass::timeRun(struct t *t);
/* get the latest Temperature value */
static float WireClass::getTemperature(byte devID);
/* returns if the latest value recorded have already been read */
static bool WireClass::isTemperatureRead(byte devID);
/* returns the amount of the devices detected */
static byte WireClass::getDeviceCount();
};
extern WireClass Wire;
#endif