-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSimpleLed.h
53 lines (44 loc) · 997 Bytes
/
SimpleLed.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
/*
* SimpleLed.h
*
* Created on: 27/01/2013
* Author: Juan
*/
#ifndef SIMPLELED_H_
#define SIMPLELED_H_
#include "BaseOutputs.h"
#define SLED_OFF 0x00
#define SLED_ON 0xff
#define STATE_NORMAL 0
#define STATE_BLINKING 1
#define INFINITE_LOOP 2
typedef struct {
uint8_t times;
uint8_t counter;
uint16_t delay;
unsigned long lastChange;
uint8_t state;
} BlinkAtt;
class SimpleLed : public ActuatorBase {
private:
BlinkAtt *blinkAtt;
//uint8_t pin;
boolean pinIsPWM;
uint8_t ledState;
uint8_t level;
public:
SimpleLed();
virtual ~SimpleLed();
void initLed(uint8_t ledPin, boolean isPWM = true);
void setLevel(uint8_t newLevel);
virtual void emit(uint8_t level);
void on();
void off();
virtual void reset();
void staticBlink(uint16_t times, uint16_t period);
void dinamicTimedBlink(uint16_t howLong, uint16_t period);
void dinamicRepeatedBlink(uint16_t times, uint16_t period);
void dinamicBlink(uint16_t period);
void update();
};
#endif /* SIMPLELED_H_ */