blob: c68790e9adee67e4158bfb1e99bfea08ddd8a028 (
plain)
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
|
#include "driverSharp.h"
#include "rtc.hpp"
constexpr unsigned int SHARP_SCK = 12;
constexpr unsigned int SHARP_MOSI = 13;
constexpr unsigned int SHARP_SS = 14;
Adafruit_SharpMem Sharp::display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
TaskHandle_t Sharp::taskHandle;
bool Sharp::holdRendering = false;
#define BLACK 0
#define WHITE 1
void Sharp::begin(void)
{
display.begin();
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(BLACK, WHITE);
xTaskCreate(updateTask, "sharp", 512, nullptr, TASK_PRIO_LOW,
&taskHandle);
}
void Sharp::updateTask([[maybe_unused]] void *arg)
{
static auto old = RTC::ticks();
while (1) {
do {
delay(300);
} while (holdRendering);
if (auto t = RTC::ticks(); t != old) {
old = t;
display.setCursor(0, 60);
display.printf("%2d:%02d", t / 60, t % 60);
display.refresh();
}
}
}
|