Skip to content

Commit a1aac2c

Browse files
committed
added sequenceDone() method to return finished state
1 parent d8e213f commit a1aac2c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
cores/arduino/mydebug.cpp
33
libraries/Storage/.development
44
cores/arduino/mydebug.cpp.donotuse
5+
.DS_Store
6+
.DS_Store?

libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class ArduinoLEDMatrix {
175175
}
176176
if(_callBack != nullptr){
177177
_callBack();
178+
_sequenceDone = true;
178179
}
179180
}
180181
memcpy(framebuffer, (uint32_t*)frame, sizeof(frame));
@@ -193,14 +194,22 @@ class ArduinoLEDMatrix {
193194
}
194195
void play(bool loop = false){
195196
_loop = loop;
197+
_sequenceDone = false;
196198
next();
197199
}
200+
bool sequenceDone(){
201+
if(_sequenceDone){
202+
_sequenceDone = false;
203+
return true;
204+
}
205+
return false;
206+
}
198207
void loadWrapper(const uint32_t frames[][4], uint32_t howMany) {
199208
_currentFrame = 0;
200209
_frames = (uint32_t*)frames;
201210
_framesCount = (howMany / 4) / sizeof(uint32_t);
202211
}
203-
212+
// WARNING: callbacks are fired from ISR. The execution time will be limited.
204213
void setCallback(voidFuncPtr callBack){
205214
_callBack = callBack;
206215
}
@@ -213,6 +222,7 @@ class ArduinoLEDMatrix {
213222
uint32_t _lastInterval = 0;
214223
bool _loop = false;
215224
FspTimer _ledTimer;
225+
bool _sequenceDone = false;
216226
voidFuncPtr _callBack;
217227

218228
static void turnOnLedISR(timer_callback_args_t *arg) {

0 commit comments

Comments
 (0)