-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLed_Controller.cpp
More file actions
35 lines (31 loc) · 909 Bytes
/
Led_Controller.cpp
File metadata and controls
35 lines (31 loc) · 909 Bytes
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
#include "Led_Controller.h"
#include "Pins.h"
void Led_Controller::begin(){
pinMode(HV_LED_PIN, OUTPUT);
pinMode(RTD_LED_PIN, OUTPUT);
pinMode(IMD_LED_PIN, OUTPUT);
pinMode(AMS_LED_PIN, OUTPUT);
setLight(HV, LED_OFF);
setLight(RTD, LED_OFF);
setLight(IMD, LED_OFF);
setLight(AMS, LED_OFF);
}
void Led_Controller::setLight(LightType type, LedLightState state) {
switch (type) {
case HV:
setLightHardware(HV_LED_PIN, state);
break;
case RTD:
setLightHardware(RTD_LED_PIN, state);
break;
case IMD:
setLightHardware(IMD_LED_PIN, state);
break;
case AMS:
setLightHardware(AMS_LED_PIN, state);
break;
}
}
void Led_Controller::setLightHardware(uint8_t lightPin, LedLightState state){
digitalWrite(lightPin, state == LED_ON ? HIGH : LOW);
}