ref: 0195ece317d15bcba7dfbd74b58bb8dbcd3bca0a
src/SystemTask/SystemTask.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
#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> #include <drivers/Watchdog.h> #include <Components/Ble/NimbleController.h> namespace Pinetime { namespace System { class SystemTask { public: enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification }; 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); 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; Pinetime::Drivers::Watchdog watchdog; Pinetime::Drivers::WatchdogView watchdogView; Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::NimbleController nimbleController; 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(); }; } } |