-
Notifications
You must be signed in to change notification settings - Fork 5
/
LED.h
103 lines (85 loc) · 1.96 KB
/
LED.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
//
// Created by enrico on 09/07/15.
//
#ifndef GALILEO_TERREMOTI_LED_H
#define GALILEO_TERREMOTI_LED_H
#include <stdint.h>
class LED {
public:
/**
* Init LED class with led pins
* @param greenLedPin Green LED pin number
* @param yellowLedPin Yellow LED pin number
* @param redLedPin Red LED pin number
*/
static void init(uint8_t greenLedPin, uint8_t yellowLedPin, uint8_t redLedPin);
/**
* On/Off GREEN LED
* @param s True will set LED on, false will set LED off
*/
static void green(bool s);
/**
* On/Off RED LED
* @param s True will set LED on, false will set LED off
*/
static void red(bool s);
/**
* On/Off YELLOW LED
* @param s True will set LED on, false will set LED off
*/
static void yellow(bool s);
/**
* Startup blink procedure
*/
static void startupBlink();
/**
* LED tick (if threads are not available)
*/
static void tick();
/**
* Set if global LED animation
* @param s True if animation should run, false will set LED to previous status
*/
static void setLedAnimation(bool s);
/**
* Check if LED animation is running
* @return True if LED animation is running, false otherwise
*/
static bool getLedAnimation();
/**
* Clear all resources
*/
static void dispose();
/**
* Set status of a single LED
* @param pin PIN number
* @param isOn True=ON, False=Off
*/
static void set(uint8_t pin, bool isOn);
/**
* Blink a LED
* @param pin PIN number
*/
static void setLedBlinking(uint8_t pin);
/**
* Clear all LED blinking status
*/
static void clearLedBlinking();
/**
* Clear blinking status for pin
* @param pin LED to shut off
*/
static void clearLedBlinking(uint8_t pin);
/**
* Get PIN status
* @param pin LED PIN number
* @return True if LED is ON, false if LED is OFF
*/
static bool get(uint8_t pin);
private:
static uint8_t greenLedPin;
static uint8_t yellowLedPin;
static uint8_t redLedPin;
static volatile bool ledAnimation;
};
#endif //GALILEO_TERREMOTI_LED_H