-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLEDController.h
105 lines (82 loc) · 2.92 KB
/
LEDController.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
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
99
100
101
102
103
104
105
#ifndef LEDController_h
#define LEDController_h
#include "Arduino.h"
extern "C" {
#include "user_interface.h"
}
#include "language.h"
#include "A_config.h"
#include "Settings.h"
#include "Attack.h"
#include "Scan.h"
#include <Adafruit_NeoPixel.h>
extern Settings settings;
extern Attack attack;
extern Scan scan;
extern Stations stations;
class LEDController {
public:
enum LED_MODE { OFF = 0, SCAN = 1, ATTACK = 2, DEAUTH = 3, IDLE = 4 };
LEDController();
~LEDController();
void setup();
void update();
void setMode(uint8_t mode, bool force);
void setColor(uint8_t r, uint8_t g, uint8_t b, bool output);
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output);
void tempEnable();
void tempDisable();
bool getTempEnabled();
private:
class StatusLED {
public:
virtual ~StatusLED() = default;
virtual void setup() = 0;
virtual void setColor(uint8_t r, uint8_t g, uint8_t b) = 0;
virtual void setBrightness(uint8_t brightness) = 0;
};
class DigitalLED : public StatusLED {
public:
DigitalLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, bool anode);
~DigitalLED();
void setup();
void setColor(uint8_t r, uint8_t g, uint8_t b);
void setBrightness(uint8_t brightness);
void setMode(uint8_t mode, bool force);
private:
bool anode = true;
uint8_t rPin = 255;
uint8_t gPin = 255;
uint8_t bPin = 255;
};
class AnalogRGBLED : public StatusLED {
public:
AnalogRGBLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, uint8_t brightness, bool anode);
~AnalogRGBLED();
void setup();
void setColor(uint8_t r, uint8_t g, uint8_t b);
void setBrightness(uint8_t brightness);
void setMode(uint8_t mode, bool force);
private:
bool anode = true;
uint8_t rPin = 255;
uint8_t gPin = 255;
uint8_t bPin = 255;
uint8_t brightness = 0;
};
class NeopixelLED : public StatusLED {
public:
NeopixelLED(int num, uint8_t dataPin, uint8_t brightness);
~NeopixelLED();
void setup();
void setColor(uint8_t r, uint8_t g, uint8_t b);
void setBrightness(uint8_t brightness);
void setMode(uint8_t mode, bool force);
private:
Adafruit_NeoPixel* strip;
};
bool tempEnabled = true;
uint8_t mode = LED_MODE::OFF;
StatusLED* led = NULL;
};
#endif // ifndef LEDController_h