2021-01-26 14:31:45 -05:00
|
|
|
#pragma once
|
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <task.h>
|
|
|
|
#include <drivers/St7789.h>
|
|
|
|
#include <drivers/SpiMaster.h>
|
|
|
|
#include <bits/unique_ptr.h>
|
|
|
|
#include <queue.h>
|
|
|
|
#include "components/gfx/Gfx.h"
|
|
|
|
#include "drivers/Cst816s.h"
|
|
|
|
#include <date/date.h>
|
|
|
|
#include <drivers/Watchdog.h>
|
2021-04-20 07:31:40 -04:00
|
|
|
#include <components/motor/MotorController.h>
|
2021-10-28 21:38:59 -04:00
|
|
|
#include "BootErrors.h"
|
2021-10-13 16:08:35 -04:00
|
|
|
#include "displayapp/TouchEvents.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "displayapp/Messages.h"
|
|
|
|
#include "displayapp/DummyLittleVgl.h"
|
2021-01-26 14:31:45 -05:00
|
|
|
|
|
|
|
namespace Pinetime {
|
2021-09-13 14:35:51 -04:00
|
|
|
namespace Drivers {
|
|
|
|
class St7789;
|
|
|
|
class Cst816S;
|
|
|
|
class WatchdogView;
|
|
|
|
}
|
2023-01-07 15:23:15 -05:00
|
|
|
|
2021-08-28 09:23:13 -04:00
|
|
|
namespace Controllers {
|
2021-09-13 14:35:51 -04:00
|
|
|
class Settings;
|
|
|
|
class Battery;
|
|
|
|
class Ble;
|
|
|
|
class DateTime;
|
|
|
|
class NotificationManager;
|
|
|
|
class HeartRateController;
|
|
|
|
class MotionController;
|
2021-08-28 09:23:13 -04:00
|
|
|
class TouchHandler;
|
2021-09-13 14:35:51 -04:00
|
|
|
class MotorController;
|
|
|
|
class TimerController;
|
2021-09-18 11:20:33 -04:00
|
|
|
class AlarmController;
|
2022-01-30 08:31:13 -05:00
|
|
|
class BrightnessController;
|
2022-09-11 12:21:29 -04:00
|
|
|
class FS;
|
2021-08-28 09:23:13 -04:00
|
|
|
}
|
2021-09-13 14:35:51 -04:00
|
|
|
|
|
|
|
namespace System {
|
|
|
|
class SystemTask;
|
|
|
|
};
|
|
|
|
|
2021-01-26 14:31:45 -05:00
|
|
|
namespace Applications {
|
|
|
|
class DisplayApp {
|
2021-04-24 05:00:45 -04:00
|
|
|
public:
|
2021-04-18 13:28:14 -04:00
|
|
|
DisplayApp(Drivers::St7789& lcd,
|
|
|
|
Components::LittleVgl& lvgl,
|
2023-02-23 15:20:22 -05:00
|
|
|
const Drivers::Cst816S&,
|
2023-02-23 15:16:44 -05:00
|
|
|
const Controllers::Battery& batteryController,
|
2023-02-23 15:24:07 -05:00
|
|
|
const Controllers::Ble& bleController,
|
2021-04-18 13:28:14 -04:00
|
|
|
Controllers::DateTime& dateTimeController,
|
|
|
|
Drivers::WatchdogView& watchdog,
|
2021-01-26 14:31:45 -05:00
|
|
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
2021-03-20 06:41:49 -04:00
|
|
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
2021-05-21 05:56:50 -04:00
|
|
|
Controllers::Settings& settingsController,
|
2021-04-20 07:31:40 -04:00
|
|
|
Pinetime::Controllers::MotorController& motorController,
|
2021-05-21 05:56:50 -04:00
|
|
|
Pinetime::Controllers::MotionController& motionController,
|
2021-08-28 09:23:13 -04:00
|
|
|
Pinetime::Controllers::TimerController& timerController,
|
2021-09-18 11:20:33 -04:00
|
|
|
Pinetime::Controllers::AlarmController& alarmController,
|
2022-01-30 08:31:13 -05:00
|
|
|
Pinetime::Controllers::BrightnessController& brightnessController,
|
2022-09-11 12:21:29 -04:00
|
|
|
Pinetime::Controllers::TouchHandler& touchHandler,
|
|
|
|
Pinetime::Controllers::FS& filesystem);
|
2021-01-26 14:31:45 -05:00
|
|
|
void Start();
|
2023-01-07 15:23:15 -05:00
|
|
|
|
2022-05-09 11:16:08 -04:00
|
|
|
void Start(Pinetime::System::BootErrors) {
|
|
|
|
Start();
|
|
|
|
};
|
2023-01-07 15:23:15 -05:00
|
|
|
|
2021-01-26 14:31:45 -05:00
|
|
|
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
2021-06-06 14:20:55 -04:00
|
|
|
void Register(Pinetime::System::SystemTask* systemTask);
|
2021-01-26 14:31:45 -05:00
|
|
|
|
2021-04-24 05:00:45 -04:00
|
|
|
private:
|
2021-01-26 14:31:45 -05:00
|
|
|
TaskHandle_t taskHandle;
|
|
|
|
static void Process(void* instance);
|
|
|
|
void DisplayLogo(uint16_t color);
|
|
|
|
void DisplayOtaProgress(uint8_t percent, uint16_t color);
|
|
|
|
void InitHw();
|
|
|
|
void Refresh();
|
|
|
|
Pinetime::Drivers::St7789& lcd;
|
2023-02-23 15:24:07 -05:00
|
|
|
const Controllers::Ble& bleController;
|
2021-01-26 14:31:45 -05:00
|
|
|
|
|
|
|
static constexpr uint8_t queueSize = 10;
|
|
|
|
static constexpr uint8_t itemSize = 1;
|
|
|
|
QueueHandle_t msgQueue;
|
|
|
|
static constexpr uint8_t displayWidth = 240;
|
|
|
|
static constexpr uint8_t displayHeight = 240;
|
|
|
|
static constexpr uint8_t bytesPerPixel = 2;
|
|
|
|
|
|
|
|
static constexpr uint16_t colorWhite = 0xFFFF;
|
|
|
|
static constexpr uint16_t colorGreen = 0x07E0;
|
|
|
|
static constexpr uint16_t colorGreenSwapped = 0xE007;
|
|
|
|
static constexpr uint16_t colorBlue = 0x0000ff;
|
|
|
|
static constexpr uint16_t colorRed = 0xff00;
|
|
|
|
static constexpr uint16_t colorRedSwapped = 0x00ff;
|
|
|
|
static constexpr uint16_t colorBlack = 0x0000;
|
|
|
|
uint8_t displayBuffer[displayWidth * bytesPerPixel];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|