-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscrolling_sprites.ino
37 lines (27 loc) · 1.05 KB
/
scrolling_sprites.ino
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
// This file has the code that executes to scroll the sprites
#include "globalInclude.h"
#include <TFT_eSPI.h>
//==========================================================================================
void spriteMgr( void * parameter) {
vTaskDelay(2000 / portTICK_PERIOD_MS); // let the other task get going
if ( esp_task_wdt_add(NULL) != ESP_OK) { // add task to WDT
Serial.println("spriteMgr: Unable to add spriteMgr to taskWDT!");
}
TickType_t xLastWakeTime;
const TickType_t xFrequency = 40 / portTICK_PERIOD_MS;
xLastWakeTime = xTaskGetTickCount();
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for ( ;; )
{
if (disp.getSpriteEnable()) {
sprite1.drawSprite();
sprite2.drawSprite();
sprite3.drawSprite();
}
if (esp_task_wdt_reset() != ESP_OK) {
Serial.println("spriteMgr: Unable to reset spriteMgr taskWDT!");
}
vTaskDelayUntil( &xLastWakeTime, xFrequency ); // Wait for the next cycle.
}
}