2019-12-05 21:19:47 +01:00
|
|
|
#pragma once
|
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <task.h>
|
2019-12-07 17:11:50 +01:00
|
|
|
#include <drivers/St7789.h>
|
|
|
|
#include <drivers/SpiMaster.h>
|
|
|
|
#include <Components/Gfx/Gfx.h>
|
|
|
|
#include <bits/unique_ptr.h>
|
2019-12-26 18:33:40 +01:00
|
|
|
#include <queue.h>
|
2019-12-27 16:05:35 +01:00
|
|
|
#include <Components/Battery/BatteryController.h>
|
2019-12-27 17:05:49 +01:00
|
|
|
#include <Components/Ble/BleController.h>
|
2019-12-28 14:34:50 +01:00
|
|
|
#include <Components/DateTime/DateTimeController.h>
|
2020-01-18 18:17:52 +01:00
|
|
|
#include "Fonts/lcdfont14.h"
|
2020-01-03 16:32:31 +01:00
|
|
|
#include "../drivers/Cst816s.h"
|
2020-01-11 17:14:12 +01:00
|
|
|
#include <date/date.h>
|
2020-01-18 18:17:52 +01:00
|
|
|
#include <DisplayApp/Screens/Clock.h>
|
|
|
|
#include <DisplayApp/Screens/Message.h>
|
2019-12-07 17:11:50 +01:00
|
|
|
|
|
|
|
extern const FONT_INFO lCD_70ptFontInfo;
|
2019-12-05 21:19:47 +01:00
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
|
|
class DisplayApp {
|
|
|
|
public:
|
2019-12-26 18:33:40 +01:00
|
|
|
enum class States {Idle, Running};
|
2020-01-03 16:32:31 +01:00
|
|
|
enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent} ;
|
2020-01-26 13:37:10 +01:00
|
|
|
DisplayApp(Pinetime::Drivers::St7789& lcd,
|
|
|
|
Pinetime::Components::Gfx& gfx,
|
|
|
|
Pinetime::Drivers::Cst816S&,
|
|
|
|
Controllers::Battery &batteryController,
|
2019-12-28 14:34:50 +01:00
|
|
|
Controllers::Ble &bleController,
|
|
|
|
Controllers::DateTime& dateTimeController);
|
2019-12-05 21:19:47 +01:00
|
|
|
void Start();
|
2019-12-26 18:33:40 +01:00
|
|
|
void PushMessage(Messages msg);
|
|
|
|
|
2019-12-05 21:19:47 +01:00
|
|
|
private:
|
|
|
|
TaskHandle_t taskHandle;
|
|
|
|
static void Process(void* instance);
|
2019-12-07 17:11:50 +01:00
|
|
|
void InitHw();
|
2020-01-26 13:37:10 +01:00
|
|
|
Pinetime::Drivers::St7789& lcd;
|
|
|
|
Pinetime::Components::Gfx& gfx;
|
2019-12-07 17:11:50 +01:00
|
|
|
const FONT_INFO largeFont {lCD_70ptFontInfo.height, lCD_70ptFontInfo.startChar, lCD_70ptFontInfo.endChar, lCD_70ptFontInfo.spacePixels, lCD_70ptFontInfo.charInfo, lCD_70ptFontInfo.data};
|
2019-12-27 15:12:09 +01:00
|
|
|
const FONT_INFO smallFont {lCD_14ptFontInfo.height, lCD_14ptFontInfo.startChar, lCD_14ptFontInfo.endChar, lCD_14ptFontInfo.spacePixels, lCD_14ptFontInfo.charInfo, lCD_14ptFontInfo.data};
|
2019-12-07 19:15:33 +01:00
|
|
|
void Refresh();
|
|
|
|
|
2019-12-26 18:33:40 +01:00
|
|
|
States state = States::Running;
|
|
|
|
void RunningState();
|
|
|
|
void IdleState();
|
|
|
|
QueueHandle_t msgQueue;
|
|
|
|
|
|
|
|
static constexpr uint8_t queueSize = 10;
|
|
|
|
static constexpr uint8_t itemSize = 1;
|
|
|
|
|
2019-12-27 16:05:35 +01:00
|
|
|
Pinetime::Controllers::Battery &batteryController;
|
2019-12-27 17:05:49 +01:00
|
|
|
Pinetime::Controllers::Ble &bleController;
|
2019-12-28 14:34:50 +01:00
|
|
|
Pinetime::Controllers::DateTime& dateTimeController;
|
2019-12-27 16:05:35 +01:00
|
|
|
|
2020-01-26 13:37:10 +01:00
|
|
|
Pinetime::Drivers::Cst816S& touchPanel;
|
2020-01-03 16:32:31 +01:00
|
|
|
void OnTouchEvent();
|
2020-01-18 18:17:52 +01:00
|
|
|
|
|
|
|
Screens::Clock clockScreen;
|
2020-02-08 18:01:02 +01:00
|
|
|
Screens::Message messageScreen;
|
2020-01-18 18:17:52 +01:00
|
|
|
Screens::Screen* currentScreen = nullptr;
|
2020-01-18 20:53:32 +01:00
|
|
|
static constexpr uint8_t pinLcdBacklight1 = 14;
|
|
|
|
static constexpr uint8_t pinLcdBacklight2 = 22;
|
|
|
|
static constexpr uint8_t pinLcdBacklight3 = 23;
|
2019-12-05 21:19:47 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|