|
|
@ -4,6 +4,7 @@
|
|
|
|
#include <libraries/log/nrf_log.h>
|
|
|
|
#include <libraries/log/nrf_log.h>
|
|
|
|
#include <boards.h>
|
|
|
|
#include <boards.h>
|
|
|
|
#include <nrf_font.h>
|
|
|
|
#include <nrf_font.h>
|
|
|
|
|
|
|
|
#include <hal/nrf_rtc.h>
|
|
|
|
#include "Components/Gfx/Gfx.h"
|
|
|
|
#include "Components/Gfx/Gfx.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Pinetime::Applications;
|
|
|
|
using namespace Pinetime::Applications;
|
|
|
@ -21,6 +22,9 @@ void DisplayApp::Process(void *instance) {
|
|
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
while (1) {
|
|
|
|
NRF_LOG_INFO("BlinkApp task running!");
|
|
|
|
NRF_LOG_INFO("BlinkApp task running!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app->Refresh();
|
|
|
|
|
|
|
|
|
|
|
|
vTaskDelay(1000);
|
|
|
|
vTaskDelay(1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -48,17 +52,57 @@ void DisplayApp::InitHw() {
|
|
|
|
gfx->ClearScreen();
|
|
|
|
gfx->ClearScreen();
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t x = 7;
|
|
|
|
uint8_t x = 7;
|
|
|
|
gfx->DrawChar(&largeFont , '0', &x, 78, 0x0);
|
|
|
|
gfx->DrawChar(&largeFont , '0', &x, 78, 0xffff);
|
|
|
|
|
|
|
|
|
|
|
|
x = 61;
|
|
|
|
x = 61;
|
|
|
|
gfx->DrawChar(&largeFont, '1', &x, 78, 0x0);
|
|
|
|
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
|
|
|
|
|
|
|
|
|
|
|
x = 115;
|
|
|
|
x = 94;
|
|
|
|
gfx->DrawChar(&largeFont, ':', &x, 78, 0x0);
|
|
|
|
gfx->DrawChar(&largeFont, ':', &x, 78, 0xffff);
|
|
|
|
|
|
|
|
|
|
|
|
x = 127;
|
|
|
|
x = 127;
|
|
|
|
gfx->DrawChar(&largeFont, '2', &x, 78, 0x0);
|
|
|
|
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
|
|
|
|
|
|
|
|
|
|
|
x = 181;
|
|
|
|
x = 181;
|
|
|
|
gfx->DrawChar(&largeFont, '3', &x, 78, 0x0);
|
|
|
|
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DisplayApp::Refresh() {
|
|
|
|
|
|
|
|
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
|
|
|
|
|
|
|
|
auto raw = systick_counter / 1000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO make this better!
|
|
|
|
|
|
|
|
minutes = raw / 60;
|
|
|
|
|
|
|
|
seconds = raw - (minutes*60);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char secondChar[3];
|
|
|
|
|
|
|
|
sprintf(secondChar, "%02d", seconds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char minutesChar[3];
|
|
|
|
|
|
|
|
sprintf(minutesChar, "%02d", minutes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t x = 7;
|
|
|
|
|
|
|
|
if(minutesChar[0] != currentChar[0]) {
|
|
|
|
|
|
|
|
gfx->DrawChar(&largeFont, minutesChar[0], &x, 78, 0xffff);
|
|
|
|
|
|
|
|
currentChar[0] = minutesChar[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x = 61;
|
|
|
|
|
|
|
|
if(minutesChar[1] != currentChar[1]) {
|
|
|
|
|
|
|
|
gfx->DrawChar(&largeFont, minutesChar[1], &x, 78, 0xffff);
|
|
|
|
|
|
|
|
currentChar[1] = minutesChar[1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x = 127;
|
|
|
|
|
|
|
|
if(secondChar[0] != currentChar[2]) {
|
|
|
|
|
|
|
|
gfx->DrawChar(&largeFont, secondChar[0], &x, 78, 0xffff);
|
|
|
|
|
|
|
|
currentChar[2] = secondChar[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x = 181;
|
|
|
|
|
|
|
|
if(secondChar[1] != currentChar[3]) {
|
|
|
|
|
|
|
|
gfx->DrawChar(&largeFont, secondChar[1], &x, 78, 0xffff);
|
|
|
|
|
|
|
|
currentChar[3] = secondChar[1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|