diff options
author | JF <jf@codingfield.com> | 2020-02-23 13:44:39 +0100 |
---|---|---|
committer | JF <jf@codingfield.com> | 2020-02-23 13:44:39 +0100 |
commit | 02772b996fb26146cf38fc6deccff7f43a49dfd6 (patch) | |
tree | f2ff90c577f68ccb44b6470621bf87e68a49aed8 /src/SystemTask/SystemTask.h | |
parent | 2bdff7ed2b490cb8ce5599341e12d707c0ba7fd0 (diff) |
Do not compile GFX and older fonts anymore.
Refactor SystemTask in its own class.
Refactor Screen to be able to close current screen and open a new one.
Re-enable sleep/wake up and propagate button event to Screens.
Diffstat (limited to 'src/SystemTask/SystemTask.h')
-rw-r--r-- | src/SystemTask/SystemTask.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h new file mode 100644 index 00000000..cb913545 --- /dev/null +++ b/src/SystemTask/SystemTask.h @@ -0,0 +1,60 @@ +#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> + +namespace Pinetime { + namespace System { + class SystemTask { + public: + enum class Messages {GoToSleep, GoToRunning}; + + SystemTask(Pinetime::Drivers::SpiMaster& spi, + Pinetime::Drivers::St7789& lcd, + Pinetime::Drivers::Cst816S& touchPanel, + Pinetime::Components::LittleVgl& lvgl, + Pinetime::Controllers::Battery& batteryController, + Pinetime::Controllers::Ble& bleController, + Pinetime::Controllers::DateTime& dateTimeController); + + + 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; + + + 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(); + + + }; + } +}
\ No newline at end of file |