2020-02-23 12:44:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <task.h>
|
|
|
|
#include <memory>
|
|
|
|
#include <drivers/SpiMaster.h>
|
|
|
|
#include <drivers/St7789.h>
|
|
|
|
#include <Components/Battery/BatteryController.h>
|
|
|
|
#include <DisplayApp/DisplayApp.h>
|
2020-02-23 20:09:11 +00:00
|
|
|
#include <drivers/Watchdog.h>
|
2020-04-19 19:26:09 +00:00
|
|
|
#include <Components/Ble/NimbleController.h>
|
2020-02-23 12:44:39 +00:00
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace System {
|
|
|
|
class SystemTask {
|
|
|
|
public:
|
2020-03-25 20:23:40 +00:00
|
|
|
enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification
|
|
|
|
};
|
2020-02-23 12:44:39 +00:00
|
|
|
|
2020-03-28 18:05:28 +00:00
|
|
|
SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, Drivers::Cst816S &touchPanel,
|
|
|
|
Components::LittleVgl &lvgl,
|
|
|
|
Controllers::Battery &batteryController, Controllers::Ble &bleController,
|
|
|
|
Controllers::DateTime &dateTimeController,
|
|
|
|
Pinetime::Controllers::NotificationManager& manager);
|
2020-02-23 12:44:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
void PushMessage(Messages msg);
|
|
|
|
|
|
|
|
void OnButtonPushed();
|
|
|
|
void OnTouchEvent();
|
|
|
|
private:
|
|
|
|
TaskHandle_t taskHandle;
|
|
|
|
|
|
|
|
Pinetime::Drivers::SpiMaster& spi;
|
|
|
|
Pinetime::Drivers::St7789& lcd;
|
|
|
|
Pinetime::Drivers::Cst816S& touchPanel;
|
|
|
|
Pinetime::Components::LittleVgl& lvgl;
|
|
|
|
Pinetime::Controllers::Battery& batteryController;
|
|
|
|
std::unique_ptr<Pinetime::Applications::DisplayApp> displayApp;
|
|
|
|
Pinetime::Controllers::Ble& bleController;
|
|
|
|
Pinetime::Controllers::DateTime& dateTimeController;
|
|
|
|
QueueHandle_t systemTaksMsgQueue;
|
|
|
|
bool isSleeping = false;
|
2020-02-23 20:09:11 +00:00
|
|
|
Pinetime::Drivers::Watchdog watchdog;
|
2020-03-22 11:03:17 +00:00
|
|
|
Pinetime::Drivers::WatchdogView watchdogView;
|
2020-03-28 18:05:28 +00:00
|
|
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
2020-04-19 19:26:09 +00:00
|
|
|
Pinetime::Controllers::NimbleController nimbleController;
|
2020-02-23 12:44:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
static constexpr uint8_t pinSpiSck = 2;
|
|
|
|
static constexpr uint8_t pinSpiMosi = 3;
|
|
|
|
static constexpr uint8_t pinSpiMiso = 4;
|
|
|
|
static constexpr uint8_t pinSpiCsn = 25;
|
|
|
|
static constexpr uint8_t pinLcdDataCommand = 18;
|
|
|
|
static constexpr uint8_t pinButton = 13;
|
|
|
|
static constexpr uint8_t pinTouchIrq = 28;
|
|
|
|
|
|
|
|
static void Process(void* instance);
|
|
|
|
void Work();
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|