2019-12-05 21:19:47 +01:00
|
|
|
#pragma once
|
|
|
|
#include <FreeRTOS.h>
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <date/date.h>
|
2019-12-26 18:33:40 +01:00
|
|
|
#include <queue.h>
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <task.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "Apps.h"
|
|
|
|
#include "LittleVgl.h"
|
|
|
|
#include "TouchEvents.h"
|
2020-10-02 21:16:48 +02:00
|
|
|
#include "components/brightness/BrightnessController.h"
|
|
|
|
#include "components/firmwarevalidator/FirmwareValidator.h"
|
2021-02-24 20:40:24 +01:00
|
|
|
#include "components/settings/Settings.h"
|
2021-02-01 13:14:49 +01:00
|
|
|
#include "displayapp/screens/Screen.h"
|
2021-01-26 20:31:45 +01:00
|
|
|
#include "Messages.h"
|
2019-12-05 21:19:47 +01:00
|
|
|
|
|
|
|
namespace Pinetime {
|
2020-11-15 16:49:36 +01:00
|
|
|
|
|
|
|
namespace Drivers {
|
|
|
|
class St7789;
|
|
|
|
class Cst816S;
|
|
|
|
class WatchdogView;
|
|
|
|
}
|
|
|
|
namespace Controllers {
|
2021-02-24 20:40:24 +01:00
|
|
|
class Settings;
|
2020-11-15 16:49:36 +01:00
|
|
|
class Battery;
|
|
|
|
class Ble;
|
|
|
|
class DateTime;
|
|
|
|
class NotificationManager;
|
2021-01-10 17:57:26 +01:00
|
|
|
class HeartRateController;
|
2020-11-15 16:49:36 +01:00
|
|
|
}
|
|
|
|
|
2020-02-23 13:44:39 +01:00
|
|
|
namespace System {
|
|
|
|
class SystemTask;
|
|
|
|
};
|
2019-12-05 21:19:47 +01:00
|
|
|
namespace Applications {
|
|
|
|
class DisplayApp {
|
|
|
|
public:
|
2019-12-26 18:33:40 +01:00
|
|
|
enum class States {Idle, Running};
|
2021-04-04 04:08:51 +02:00
|
|
|
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
|
2020-08-20 21:09:45 +02:00
|
|
|
enum class TouchModes { Gestures, Polling };
|
2020-03-15 21:01:24 +01:00
|
|
|
|
2020-03-28 19:05:28 +01:00
|
|
|
DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &,
|
|
|
|
Controllers::Battery &batteryController, Controllers::Ble &bleController,
|
|
|
|
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
|
|
|
|
System::SystemTask &systemTask,
|
2021-01-10 17:57:26 +01:00
|
|
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
2021-02-24 20:40:24 +01:00
|
|
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
|
|
|
Controllers::Settings &settingsController
|
|
|
|
);
|
2019-12-05 21:19:47 +01:00
|
|
|
void Start();
|
2021-01-26 20:31:45 +01:00
|
|
|
void PushMessage(Display::Messages msg);
|
2019-12-26 18:33:40 +01:00
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
|
2020-02-23 13:44:39 +01:00
|
|
|
|
2020-03-22 12:03:17 +01:00
|
|
|
void SetFullRefresh(FullRefreshDirections direction);
|
2020-08-20 21:09:45 +02:00
|
|
|
void SetTouchMode(TouchModes mode);
|
|
|
|
|
2019-12-05 21:19:47 +01:00
|
|
|
private:
|
2021-04-04 04:08:51 +02:00
|
|
|
|
2020-01-26 13:37:10 +01:00
|
|
|
Pinetime::Drivers::St7789& lcd;
|
2020-03-08 21:38:11 +01:00
|
|
|
Pinetime::Components::LittleVgl& lvgl;
|
2021-04-04 04:08:51 +02:00
|
|
|
Pinetime::Drivers::Cst816S& touchPanel;
|
|
|
|
Pinetime::Controllers::Battery &batteryController;
|
|
|
|
Pinetime::Controllers::Ble &bleController;
|
|
|
|
Pinetime::Controllers::DateTime& dateTimeController;
|
|
|
|
Pinetime::Drivers::WatchdogView& watchdog;
|
|
|
|
Pinetime::System::SystemTask& systemTask;
|
|
|
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
|
|
|
Pinetime::Controllers::HeartRateController& heartRateController;
|
|
|
|
Pinetime::Controllers::Settings& settingsController;
|
|
|
|
|
|
|
|
Pinetime::Controllers::FirmwareValidator validator;
|
|
|
|
Controllers::BrightnessController brightnessController;
|
|
|
|
|
|
|
|
TaskHandle_t taskHandle;
|
2019-12-07 19:15:33 +01:00
|
|
|
|
2019-12-26 18:33:40 +01:00
|
|
|
States state = States::Running;
|
|
|
|
QueueHandle_t msgQueue;
|
|
|
|
|
|
|
|
static constexpr uint8_t queueSize = 10;
|
|
|
|
static constexpr uint8_t itemSize = 1;
|
|
|
|
|
2020-02-16 18:32:36 +01:00
|
|
|
std::unique_ptr<Screens::Screen> currentScreen;
|
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
Apps currentApp = Apps::None;
|
|
|
|
Apps returnToApp = Apps::None;
|
|
|
|
FullRefreshDirections returnDirection = FullRefreshDirections::None;
|
|
|
|
TouchEvents returnTouchEvent = TouchEvents::None;
|
2020-02-23 13:44:39 +01:00
|
|
|
|
2020-08-20 21:09:45 +02:00
|
|
|
TouchModes touchMode = TouchModes::Gestures;
|
2021-04-04 04:08:51 +02:00
|
|
|
|
|
|
|
TouchEvents OnTouchEvent();
|
|
|
|
void RunningState();
|
|
|
|
void IdleState();
|
|
|
|
static void Process(void* instance);
|
|
|
|
void InitHw();
|
|
|
|
void Refresh();
|
|
|
|
void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent);
|
|
|
|
void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction);
|
|
|
|
|
2019-12-05 21:19:47 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|