-
Notifications
You must be signed in to change notification settings - Fork 7
/
hardwareInterface.ino
79 lines (55 loc) · 1.48 KB
/
hardwareInterface.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
/* Hardware Interface module */
void hardwareInterface_showOnDisplay(String s1, String s2, String s3) {
}
void hardwareInterface_initDisplay(void) {
}
int hardwareInterface_sanityCheck() {
return 0; /* 0 is OK */
}
uint16_t hwIf_simulatedSoc_0p1;
void hardwareInterface_simulatePreCharge(void) {
}
void hardwareInterface_simulateCharging(void) {
if (hwIf_simulatedSoc_0p1<1000) {
/* simulate increasing SOC */
hwIf_simulatedSoc_0p1++;
}
}
int16_t hardwareInterface_getInletVoltage(void) {
return 219;
}
int16_t hardwareInterface_getAccuVoltage(void) {
return 222;
}
int16_t hardwareInterface_getChargingTargetVoltage(void) {
return 229;
}
int16_t hardwareInterface_getChargingTargetCurrent(void) {
return 5;
}
uint8_t hardwareInterface_getSoc(void) {
/* SOC in percent */
return hwIf_simulatedSoc_0p1/10;
}
uint8_t hardwareInterface_getIsAccuFull(void) {
return (hwIf_simulatedSoc_0p1/10)>95;
}
void hardwareInterface_setPowerRelayOn(void) {
digitalWrite(PIN_POWER_RELAIS, LOW); /* relais is low-active */
}
void hardwareInterface_setPowerRelayOff(void) {
digitalWrite(PIN_POWER_RELAIS, HIGH); /* relais is low-active */
}
void hardwareInterface_setRelay2On(void) {
}
void hardwareInterface_setRelay2Off(void) {
}
void hardwareInterface_setStateB(void) {
digitalWrite(PIN_STATE_C, LOW);
}
void hardwareInterface_setStateC(void) {
digitalWrite(PIN_STATE_C, HIGH);
}
void hardwareInterface_resetSimulation(void) {
hwIf_simulatedSoc_0p1 = 200; /* 20% */
}