-
Notifications
You must be signed in to change notification settings - Fork 9
/
FancyLED.h
87 lines (58 loc) · 1.69 KB
/
FancyLED.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
/*
FancyLED.h - - FancyLED library for Wiring/Arduino - Version 0.1
Original library (0.1) by Carlyn Maw.
*/
// ensure this library description is only included once
#ifndef FancyLED_h
#define FancyLED_h
// include types & constants of Wiring core API
#include "WProgram.h"
// library interface description
class FancyLED {
// user-accessible "public" interface
public:
// constructors:
FancyLED(int myPin, bool myMode);
FancyLED(int myBit, bool myMode, unsigned char *myRegister);
//char* version(void); // get the library version
//unsigned char getRegisterValue(void);
void setCurrentTime(unsigned long);
void update(unsigned long);
void update(void);
int getState(void);
void turnOn(void);
void turnOff(void);
void toggle(void);
void pulse(char);
void pulse(char, int, int);
void pulse(void);
void fusedPulse(long myFuseLength, int myPulseTimes);
int getDutyCycle(void);
void setDutyCycle(int);
long getFullPeriod(void);
void setFullPeriod(long);
// library-accessible "private" interface
private:
int _myPin;
int _myBit;
unsigned char *_myRegister;
unsigned char _registerValue;
bool _type; //direct pin or shift register
bool _mode; //HIGH == pressed (1) or LOW == pressed (0)
int _lastState;
int _currentState;
bool _pinState;
long _fuseTimer;
int _onPeriod;
int _offPeriod;
int _dutyCycle;
long _fullPeriod;
//long _longHolder;
bool _pulseFlag;
unsigned long int _flipTime;
unsigned long int _currentTime;
int _currentPulseCount;
int _goalPulseCount;
void updatePin(bool);
};
#endif