summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp84
1 files changed, 4 insertions, 80 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 018989b..c74eb71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,6 +9,7 @@
#include <libraries/gpiote/app_gpiote.h>
#include <libraries/gfx/nrf_lcd.h>
#include <drivers/st7789.h>
+#include <DisplayApp/DisplayApp.h>
#include "nrf_gfx.h"
@@ -21,8 +22,9 @@ Pinetime::Logging::DummyLogger logger;
#endif
Pinetime::Applications::BlinkApp blinkApp;
+Pinetime::Applications::DisplayApp displayApp;
TaskHandle_t systemThread;
-Pinetime::Drivers::st7789 lcd;
+//Pinetime::Drivers::st7789 lcd;
extern "C" {
void vApplicationIdleHook() {
@@ -46,86 +48,9 @@ static void bsp_event_handler(bsp_event_t event)
}
}
-ret_code_t lcd_init() {
- lcd.Init();
-}
-
-void lcd_dummy() {
-
-};
-
-void lcd_pixel_draw(uint16_t x, uint16_t y, uint32_t color) {
- lcd.DrawPixel(x, y, color);
-}
-
-
-void lcd_rectangle_draw(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t color) {
- lcd.FillRectangle(x, y, width, height, color);
-}
-
-void lcd_rotation_set(nrf_lcd_rotation_t rotation) {
-
-}
-
-void lcd_display_invert(bool invert) {
-}
-static lcd_cb_t st7789_cb = {
- .height = 240,
- .width = 240
-};
-
-const nrf_lcd_t nrf_lcd_st7789 = {
- .lcd_init = lcd_init,
- .lcd_uninit = lcd_dummy,
- .lcd_pixel_draw = lcd_pixel_draw,
- .lcd_rect_draw = lcd_rectangle_draw,
- .lcd_display = lcd_dummy,
- .lcd_rotation_set = lcd_rotation_set,
- .lcd_display_invert = lcd_display_invert,
- .p_lcd_cb = &st7789_cb
-};
-
-extern const FONT_INFO orkney_24ptFontInfo;
-static void gfx_initialization(void)
-{
- nrf_gpio_cfg_output(14);
- nrf_gpio_cfg_output(22);
- nrf_gpio_cfg_output(23);
- nrf_gpio_pin_clear(14);
- nrf_gpio_pin_set(22);
- nrf_gpio_pin_set(23);
-
- APP_ERROR_CHECK(nrf_gfx_init(&nrf_lcd_st7789));
- nrf_gfx_rect_t rect;
- rect.height = 240;
- rect.width = 240;
- rect.x = 0;
- rect.y = 0;
- nrf_gfx_rect_draw(&nrf_lcd_st7789, &rect, 2, 0xaaaaaaaa, true);
-
- nrf_gfx_point_t point;
- point.x = 10;
- point.y = 10;
-
- nrf_gfx_font_desc_t font;
- font.charInfo = orkney_24ptFontInfo.charInfo;
- font.data = orkney_24ptFontInfo.data;
- font.endChar = orkney_24ptFontInfo.endChar;
- font.height = orkney_24ptFontInfo.height;
- font.spacePixels = orkney_24ptFontInfo.spacePixels;
- font.startChar = orkney_24ptFontInfo.startChar;
-
-
- nrf_gfx_print(&nrf_lcd_st7789,
- &point,
- 0xffff,
- "#Pinetime\nRocks!",
- &font,
- true);
-}
void SystemTask(void *) {
APP_GPIOTE_INIT(2);
@@ -137,8 +62,6 @@ void SystemTask(void *) {
nrf_gpio_pin_clear(14);
nrf_gpio_pin_clear(22);
nrf_gpio_pin_clear(23);
-
- gfx_initialization();
// lcd.Init();
// lcd.FillRectangle(0,0,240,240,0xffaa);
// lcd.FillRectangle(10,10,50,50,0x011bb);
@@ -146,6 +69,7 @@ void SystemTask(void *) {
// lcd.FillRectangle(120,120,120,120,0x1212);
blinkApp.Start();
+ displayApp.Start();
while (1) {
vTaskSuspend(nullptr);