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-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};
|
|
|
|
enum class Messages : uint8_t {GoToSleep, GoToRunning} ;
|
|
|
|
DisplayApp();
|
2019-12-05 21:19:47 +01:00
|
|
|
void Start();
|
2019-12-07 17:11:50 +01:00
|
|
|
|
2019-12-21 17:58:00 +01:00
|
|
|
void Minutes(uint8_t m);
|
|
|
|
void Hours(uint8_t h);
|
|
|
|
|
2019-12-21 22:31:06 +01:00
|
|
|
void SetTime(uint8_t minutes, uint8_t hours);
|
|
|
|
|
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();
|
|
|
|
Pinetime::Drivers::SpiMaster spi;
|
|
|
|
std::unique_ptr<Drivers::St7789> lcd;
|
|
|
|
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};
|
2019-12-07 19:15:33 +01:00
|
|
|
void Refresh();
|
|
|
|
|
|
|
|
uint8_t seconds = 0;
|
|
|
|
uint8_t minutes = 0;
|
|
|
|
uint8_t hours = 0;
|
|
|
|
char currentChar[4];
|
2019-12-21 22:31:06 +01:00
|
|
|
uint32_t deltaSeconds = 0;
|
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-05 21:19:47 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|