Add small font, display date, Ble connection and battery power in display app (hard-coded values for now).

This commit is contained in:
JF 2019-12-27 15:12:09 +01:00
parent b5b3c4270b
commit 11d5403558
7 changed files with 1733 additions and 3 deletions

View file

@ -31,7 +31,8 @@ list(APPEND SOURCE_FILES
Logging/NrfLogger.cpp Logging/NrfLogger.cpp
BlinkApp/BlinkApp.cpp BlinkApp/BlinkApp.cpp
DisplayApp/DisplayApp.cpp DisplayApp/DisplayApp.cpp
DisplayApp/lcdfont.c DisplayApp/lcdfont70.c
DisplayApp/lcdfont14.c
main.cpp main.cpp
drivers/St7789.cpp drivers/St7789.cpp
drivers/SpiMaster.cpp drivers/SpiMaster.cpp
@ -44,7 +45,8 @@ set(INCLUDE_FILES
Logging/NrfLogger.h Logging/NrfLogger.h
BlinkApp/BlinkApp.h BlinkApp/BlinkApp.h
DisplayApp/DisplayApp.h DisplayApp/DisplayApp.h
DisplayApp/lcdfont.h DisplayApp/lcdfont70.h
DisplayApp/lcdfont14.h
drivers/St7789.h drivers/St7789.h
drivers/SpiMaster.h drivers/SpiMaster.h
Components/Gfx/Gfx.h Components/Gfx/Gfx.h

View file

@ -13,7 +13,6 @@ using namespace Pinetime::Applications;
void DisplayApp::Start() { void DisplayApp::Start() {
if (pdPASS != xTaskCreate(DisplayApp::Process, "DisplayApp", 256, this, 0, &taskHandle)) if (pdPASS != xTaskCreate(DisplayApp::Process, "DisplayApp", 256, this, 0, &taskHandle))
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
} }
void DisplayApp::Process(void *instance) { void DisplayApp::Process(void *instance) {
@ -117,6 +116,10 @@ void DisplayApp::SetTime(uint8_t minutes, uint8_t hours) {
void DisplayApp::RunningState() { void DisplayApp::RunningState() {
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
gfx->DrawString(10, 0, 0xffff, "BLE", &smallFont, false);
gfx->DrawString((240-96), 0, 0xffff, "BAT: 58%", &smallFont, false);
gfx->DrawString(20, 160, 0xffff, "FRIDAY 27 DEC 2019", &smallFont, false);
auto raw = systick_counter / 1000; auto raw = systick_counter / 1000;
auto currentDeltaSeconds = raw - deltaSeconds; auto currentDeltaSeconds = raw - deltaSeconds;

View file

@ -6,6 +6,7 @@
#include <Components/Gfx/Gfx.h> #include <Components/Gfx/Gfx.h>
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <queue.h> #include <queue.h>
#include "lcdfont14.h"
extern const FONT_INFO lCD_70ptFontInfo; extern const FONT_INFO lCD_70ptFontInfo;
@ -33,6 +34,7 @@ namespace Pinetime {
std::unique_ptr<Drivers::St7789> lcd; std::unique_ptr<Drivers::St7789> lcd;
std::unique_ptr<Components::Gfx> gfx; std::unique_ptr<Components::Gfx> gfx;
const FONT_INFO largeFont {lCD_70ptFontInfo.height, lCD_70ptFontInfo.startChar, lCD_70ptFontInfo.endChar, lCD_70ptFontInfo.spacePixels, lCD_70ptFontInfo.charInfo, lCD_70ptFontInfo.data}; const FONT_INFO largeFont {lCD_70ptFontInfo.height, lCD_70ptFontInfo.startChar, lCD_70ptFontInfo.endChar, lCD_70ptFontInfo.spacePixels, lCD_70ptFontInfo.charInfo, lCD_70ptFontInfo.data};
const FONT_INFO smallFont {lCD_14ptFontInfo.height, lCD_14ptFontInfo.startChar, lCD_14ptFontInfo.endChar, lCD_14ptFontInfo.spacePixels, lCD_14ptFontInfo.charInfo, lCD_14ptFontInfo.data};
void Refresh(); void Refresh();
uint8_t seconds = 0; uint8_t seconds = 0;

1718
src/DisplayApp/lcdfont14.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
// Font data for LCD 14pt
extern const uint8_t lCD_14ptBitmaps[];
extern const FONT_INFO lCD_14ptFontInfo;
extern const FONT_CHAR_INFO lCD_14ptDescriptors[];