-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLEDS.cpp
More file actions
46 lines (37 loc) · 708 Bytes
/
Copy pathLEDS.cpp
File metadata and controls
46 lines (37 loc) · 708 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
36
37
38
39
40
41
42
43
44
45
46
/***** LEDS.C *****/
/***** Button.cpp *****/
/* Adapted from an in-class implementation of a debounced button
Debounce state transition formulated by Andrew Mcpherson
*/
#include "LEDS.h"
LEDS::LEDS() {
curIndex = 0;
ledPulseTime = 60;
}
void LEDS::pulse(BelaContext* context, int frame) {
digitalWrite(context, frame, ledPins[curIndex], ledStates[curIndex]);
}
void LEDS::next()
{
curIndex = (curIndex + 1) % NUM_LEDS;
}
void LEDS::setCurrent()
{
ledStates[curIndex] = HIGH;
}
void LEDS::unsetCurrent()
{
ledStates[curIndex] = LOW;
}
int LEDS::getPulseTime()
{
return ledPulseTime;
}
int LEDS::getNumLEDS()
{
return NUM_LEDS;
}
int LEDS::getPin(int index)
{
return ledPins[index];
}