-
Notifications
You must be signed in to change notification settings - Fork 0
/
regtable.ino
101 lines (79 loc) · 2.37 KB
/
regtable.ino
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <EEPROM.h>
#include "product.h"
#include "panstamp.h"
#include "regtable.h"
#include "sensor.h"
DECLARE_COMMON_CALLBACKS()
DEFINE_COMMON_REGISTERS()
REGISTER regRoomTemp(RoomTemp, sizeof(RoomTemp), &updtRoomTemp, NULL);
REGISTER regHeating(Heating, sizeof(Heating), NULL, &setHeating);
REGISTER regSrvHeating(SrvHeating, sizeof(SrvHeating), &updtSrvHeating, NULL);
REGISTER regDesiredTemp(DesiredTemp, sizeof(DesiredTemp), NULL, &setDesiredTemp);
REGISTER regTolerance(Tolerance, sizeof(Tolerance), NULL, &setTolerance);
REGISTER regOutdoorTemp(OutdoorTemp, sizeof(OutdoorTemp), NULL, &setOutdoorTemp);
REGISTER regOutdoorHum(OutdoorHum, sizeof(OutdoorHum), NULL, &setOutdoorHum);
REGISTER regOutdoorWind(OutdoorWind, sizeof(OutdoorWind), NULL, &setOutdoorWind);
REGISTER regResyncInterval(ResyncInterval, sizeof(ResyncInterval), NULL, &setResyncInterval);
REGISTER regManual(Manual, sizeof(Manual), NULL, &setManual);
DECLARE_REGISTERS_START()
®RoomTemp,
®Heating,
®SrvHeating,
®DesiredTemp,
®Tolerance,
®OutdoorTemp,
®OutdoorHum,
®OutdoorWind,
®ResyncInterval,
®Manual
DECLARE_REGISTERS_END()
DEFINE_COMMON_CALLBACKS()
const void updtRoomTemp(byte rId)
{
room_temp = SensorReadTemp();
RoomTemp[0] = (room_temp >> 8) & 0xFF;
RoomTemp[1] = room_temp & 0xFF;
}
const void setHeating(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
if ( value == 0x0 )
{
setRelay(LOW);
} else {
setRelay(HIGH);
}
//digitalWrite(PIN_HEATING, *value);
}
const void updtSrvHeating(byte rId)
{
memcpy(regTable[rId]->value, Heating, sizeof(Heating));
}
const void setDesiredTemp(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setTolerance(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setOutdoorTemp(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setOutdoorHum(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setOutdoorWind(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setResyncInterval(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}
const void setManual(byte rId, byte *value)
{
memcpy(regTable[rId]->value, value, sizeof(value));
}