From 89421de606aecabb0b66c4ec065b57d6693aee1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Wed, 28 Dec 2022 18:12:32 +0100 Subject: [PATCH] Refactor St7789 as a generic Display class. --- src/CMakeLists.txt | 8 +-- src/components/gfx/Gfx.cpp | 4 +- src/components/gfx/Gfx.h | 8 +-- src/displayapp/DisplayApp.cpp | 4 +- src/displayapp/DisplayApp.h | 5 +- src/displayapp/DisplayAppRecovery.cpp | 2 +- src/displayapp/DisplayAppRecovery.h | 7 ++- src/displayapp/DummyLittleVgl.h | 5 +- src/displayapp/LittleVgl.cpp | 3 +- src/displayapp/LittleVgl.h | 9 ++-- src/drivers/Display.h | 68 +++++++++++++++++++++++ src/drivers/St7789.h | 77 -------------------------- src/drivers/{ => displays}/St7789.cpp | 4 +- src/drivers/displays/St7789.h | 78 +++++++++++++++++++++++++++ src/main.cpp | 6 ++- src/port/Display.h | 16 ++++++ src/recoveryLoader.cpp | 4 +- src/systemtask/SystemTask.cpp | 4 +- src/systemtask/SystemTask.h | 8 ++- 19 files changed, 199 insertions(+), 121 deletions(-) create mode 100644 src/drivers/Display.h delete mode 100644 src/drivers/St7789.h rename src/drivers/{ => displays}/St7789.cpp (98%) create mode 100644 src/drivers/displays/St7789.h create mode 100644 src/port/Display.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3942e463..31b5cb2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -435,7 +435,7 @@ list(APPEND SOURCE_FILES ## main.cpp - drivers/St7789.cpp + drivers/displays/St7789.cpp drivers/nrf52/SpiMaster.cpp drivers/nrf52/Spi.cpp drivers/nrf52/TwiMaster.cpp @@ -502,7 +502,7 @@ list(APPEND RECOVERY_SOURCE_FILES displayapp/DisplayAppRecovery.cpp main.cpp - drivers/St7789.cpp + drivers/displays/St7789.cpp drivers/nrf52/SpiMaster.cpp drivers/nrf52/Spi.cpp drivers/nrf52/TwiMaster.cpp @@ -575,7 +575,7 @@ list(APPEND RECOVERYLOADER_SOURCE_FILES components/rle/RleDecoder.cpp components/gfx/Gfx.cpp - drivers/St7789.cpp + drivers/displays/St7789.cpp components/brightness/BrightnessController.cpp recoveryLoader.cpp @@ -618,7 +618,7 @@ set(INCLUDE_FILES displayapp/widgets/Counter.h displayapp/widgets/PageIndicator.h displayapp/widgets/StatusIcons.h - drivers/St7789.h + drivers/displays/St7789.h drivers/SpiNorFlash.h drivers/nrf52/SpiMaster.h drivers/nrf52/Spi.h diff --git a/src/components/gfx/Gfx.cpp b/src/components/gfx/Gfx.cpp index 3eaaa3fe..6c51a1cd 100644 --- a/src/components/gfx/Gfx.cpp +++ b/src/components/gfx/Gfx.cpp @@ -1,8 +1,8 @@ #include "components/gfx/Gfx.h" -#include "drivers/St7789.h" +#include "drivers/displays/St7789.h" using namespace Pinetime::Components; -Gfx::Gfx(Pinetime::Drivers::St7789& lcd) : lcd {lcd} { +Gfx::Gfx(Pinetime::Drivers::Displays::St7789& lcd) : lcd {lcd} { } void Gfx::Init() { diff --git a/src/components/gfx/Gfx.h b/src/components/gfx/Gfx.h index 54c4a8b7..51fcdfe9 100644 --- a/src/components/gfx/Gfx.h +++ b/src/components/gfx/Gfx.h @@ -8,12 +8,14 @@ namespace Pinetime { namespace Drivers { - class St7789; + namespace Displays { + class St7789; + } } namespace Components { class Gfx : public Pinetime::Drivers::BufferProvider { public: - explicit Gfx(Drivers::St7789& lcd); + explicit Gfx(Drivers::Displays::St7789& lcd); void Init(); void ClearScreen(); void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO* p_font, bool wrap); @@ -49,7 +51,7 @@ namespace Pinetime { volatile State state; uint16_t buffer[width]; // 1 line buffer - Drivers::St7789& lcd; + Drivers::Displays::St7789& lcd; void SetBackgroundColor(uint16_t color); void WaitTransferFinished() const; diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 68ea3923..a6003d9e 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -30,8 +30,6 @@ #include "displayapp/screens/PassKey.h" #include "displayapp/screens/Error.h" -#include "drivers/St7789.h" -#include "drivers/Watchdog.h" #include "systemtask/SystemTask.h" #include "systemtask/Messages.h" @@ -59,7 +57,7 @@ namespace { } } -DisplayApp::DisplayApp(Drivers::St7789& lcd, +DisplayApp::DisplayApp(Drivers::Display& lcd, Components::LittleVgl& lvgl, Pinetime::Drivers::TouchPanel& touchPanel, Controllers::Battery& batteryController, diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 972b490c..b6ac6db0 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -23,7 +23,6 @@ namespace Pinetime { namespace Drivers { - class St7789; class WatchdogView; } namespace Controllers { @@ -46,7 +45,7 @@ namespace Pinetime { enum class States { Idle, Running }; enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; - DisplayApp(Drivers::St7789& lcd, + DisplayApp(Drivers::Display& lcd, Components::LittleVgl& lvgl, Pinetime::Drivers::TouchPanel&, Controllers::Battery& batteryController, @@ -73,7 +72,7 @@ namespace Pinetime { void Register(Pinetime::System::SystemTask* systemTask); private: - Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::Display& lcd; Pinetime::Components::LittleVgl& lvgl; Pinetime::Drivers::TouchPanel& touchPanel; Pinetime::Controllers::Battery& batteryController; diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index cf1f416f..00b9fe07 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -10,7 +10,7 @@ using namespace Pinetime::Applications; -DisplayApp::DisplayApp(Drivers::St7789& lcd, +DisplayApp::DisplayApp(Drivers::Display& lcd, Components::LittleVgl& lvgl, Drivers::TouchPanel& touchPanel, Controllers::Battery& batteryController, diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 00f6d19a..55826ae3 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -1,7 +1,6 @@ #pragma once #include #include -#include #include #include #include @@ -15,10 +14,10 @@ #include "displayapp/Messages.h" #include "displayapp/DummyLittleVgl.h" #include "port/TouchPanel.h" +#include "port/Display.h" namespace Pinetime { namespace Drivers { - class St7789; class WatchdogView; } namespace Controllers { @@ -44,7 +43,7 @@ namespace Pinetime { namespace Applications { class DisplayApp { public: - DisplayApp(Drivers::St7789& lcd, + DisplayApp(Drivers::Display& lcd, Components::LittleVgl& lvgl, Drivers::TouchPanel&, Controllers::Battery& batteryController, @@ -75,7 +74,7 @@ namespace Pinetime { void DisplayOtaProgress(uint8_t percent, uint16_t color); void InitHw(); void Refresh(); - Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::Display& lcd; Controllers::Ble& bleController; static constexpr uint8_t queueSize = 10; diff --git a/src/displayapp/DummyLittleVgl.h b/src/displayapp/DummyLittleVgl.h index 7ca2de83..baab7e59 100644 --- a/src/displayapp/DummyLittleVgl.h +++ b/src/displayapp/DummyLittleVgl.h @@ -3,15 +3,16 @@ #include #include #include -#include + #include "port/TouchPanel.h" +#include "port/Display.h" namespace Pinetime { namespace Components { class LittleVgl { public: enum class FullRefreshDirections { None, Up, Down }; - LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::TouchPanel & touchPanel) { + LittleVgl(Pinetime::Drivers::Display& lcd, Pinetime::Drivers::TouchPanel & touchPanel) { } LittleVgl(const LittleVgl&) = delete; diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index 143defcf..7eef8510 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -4,7 +4,6 @@ #include #include //#include -#include "drivers/St7789.h" using namespace Pinetime::Components; @@ -30,7 +29,7 @@ bool touchpad_read(lv_indev_drv_t* indev_drv, lv_indev_data_t* data) { return lvgl->GetTouchPadInfo(data); } -LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::TouchPanel& touchPanel) : lcd {lcd}, touchPanel {touchPanel} { +LittleVgl::LittleVgl(Pinetime::Drivers::Display& lcd, Pinetime::Drivers::TouchPanel& touchPanel) : lcd {lcd}, touchPanel {touchPanel} { } void LittleVgl::Init() { diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h index 09c709d3..d6db792e 100644 --- a/src/displayapp/LittleVgl.h +++ b/src/displayapp/LittleVgl.h @@ -2,17 +2,14 @@ #include #include "port/TouchPanel.h" +#include "port/Display.h" namespace Pinetime { - namespace Drivers { - class St7789; - } - namespace Components { class LittleVgl { public: enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; - LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::TouchPanel& touchPanel); + LittleVgl(Pinetime::Drivers::Display& lcd, Pinetime::Drivers::TouchPanel& touchPanel); LittleVgl(const LittleVgl&) = delete; LittleVgl& operator=(const LittleVgl&) = delete; @@ -39,7 +36,7 @@ namespace Pinetime { void InitTouchpad(); void InitTheme(); - Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::Display& lcd; Pinetime::Drivers::TouchPanel& touchPanel; lv_disp_buf_t disp_buf_2; diff --git a/src/drivers/Display.h b/src/drivers/Display.h new file mode 100644 index 00000000..06a7116c --- /dev/null +++ b/src/drivers/Display.h @@ -0,0 +1,68 @@ +#pragma once +#include +#include +#include + +namespace Pinetime { + namespace Drivers { + template + concept IsDisplay = requires(DisplayImpl display, uint16_t line, uint16_t coord, uint32_t color, uint16_t dimension, const uint8_t* data, size_t size) { + { display.Init() }; + { display.Uninit() }; + { display.DrawPixel(coord, coord, color) }; + { display.VerticalScrollDefinition(line, line, line) }; + { display.VerticalScrollStartAddress(line) }; + { display.DrawBuffer(coord, coord, dimension, dimension, data, size) }; + { display.Sleep() }; + { display.Wakeup() }; + }; + + namespace Interface { + template + requires IsDisplay + class Display { + public: + explicit Display(T& impl) : impl {impl} {} + Display(const Display&) = delete; + Display& operator=(const Display&) = delete; + Display(Display&&) = delete; + Display& operator=(Display&&) = delete; + + void Init() { + impl.Init(); + } + + void Uninit() { + impl.Uninit(); + } + + void DrawPixel(uint16_t x, uint16_t y, uint32_t color) { + impl.DrawPixel(x, y, color); + } + + void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { + impl.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); + } + + void VerticalScrollStartAddress(uint16_t line) { + impl.VerticalScrollStartAddress(line); + } + + void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size) { + impl.DrawBuffer(x, y, width, height, data, size); + } + + void Sleep() { + impl.Sleep(); + } + + void Wakeup() { + impl.Wakeup(); + } + + private: + T& impl; + }; + } + } +} diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h deleted file mode 100644 index 5cca48ae..00000000 --- a/src/drivers/St7789.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once -#include "drivers/Spi.h" -#include -#include -#include "port/Spi.h" - -namespace Pinetime { - namespace Drivers { - - class St7789 { - public: - explicit St7789(Spi& spi, uint8_t pinDataCommand); - St7789(const St7789&) = delete; - St7789& operator=(const St7789&) = delete; - St7789(St7789&&) = delete; - St7789& operator=(St7789&&) = delete; - - void Init(); - void Uninit(); - void DrawPixel(uint16_t x, uint16_t y, uint32_t color); - - void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); - void VerticalScrollStartAddress(uint16_t line); - - void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size); - - void Sleep(); - void Wakeup(); - - private: - Spi& spi; - uint8_t pinDataCommand; - uint8_t verticalScrollingStartAddress = 0; - - void HardwareReset(); - void SoftwareReset(); - void SleepOut(); - void SleepIn(); - void ColMod(); - void MemoryDataAccessControl(); - void DisplayInversionOn(); - void NormalModeOn(); - void WriteToRam(); - void DisplayOn(); - void DisplayOff(); - - void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); - void SetVdv(); - void WriteCommand(uint8_t cmd); - void WriteSpi(const uint8_t* data, size_t size); - - enum class Commands : uint8_t { - SoftwareReset = 0x01, - SleepIn = 0x10, - SleepOut = 0x11, - NormalModeOn = 0x13, - DisplayInversionOn = 0x21, - DisplayOff = 0x28, - DisplayOn = 0x29, - ColumnAddressSet = 0x2a, - RowAddressSet = 0x2b, - WriteToRam = 0x2c, - MemoryDataAccessControl = 0x36, - VerticalScrollDefinition = 0x33, - VerticalScrollStartAddress = 0x37, - ColMod = 0x3a, - VdvSet = 0xc4, - }; - void WriteData(uint8_t data); - void ColumnAddressSet(); - - static constexpr uint16_t Width = 240; - static constexpr uint16_t Height = 320; - void RowAddressSet(); - }; - } -} diff --git a/src/drivers/St7789.cpp b/src/drivers/displays/St7789.cpp similarity index 98% rename from src/drivers/St7789.cpp rename to src/drivers/displays/St7789.cpp index cfd5bd2c..32328125 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/displays/St7789.cpp @@ -1,10 +1,10 @@ -#include "drivers/St7789.h" +#include "St7789.h" #include #include #include #include "drivers/Spi.h" -using namespace Pinetime::Drivers; +using namespace Pinetime::Drivers::Displays; St7789::St7789(Spi& spi, uint8_t pinDataCommand) : spi {spi}, pinDataCommand {pinDataCommand} { } diff --git a/src/drivers/displays/St7789.h b/src/drivers/displays/St7789.h new file mode 100644 index 00000000..09db5ee6 --- /dev/null +++ b/src/drivers/displays/St7789.h @@ -0,0 +1,78 @@ +#pragma once +#include "drivers/Spi.h" +#include +#include +#include "port/Spi.h" + +namespace Pinetime { + namespace Drivers { + namespace Displays { + class St7789 { + public: + explicit St7789(Spi& spi, uint8_t pinDataCommand); + St7789(const St7789&) = delete; + St7789& operator=(const St7789&) = delete; + St7789(St7789&&) = delete; + St7789& operator=(St7789&&) = delete; + + void Init(); + void Uninit(); + void DrawPixel(uint16_t x, uint16_t y, uint32_t color); + + void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); + void VerticalScrollStartAddress(uint16_t line); + + void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size); + + void Sleep(); + void Wakeup(); + + private: + Spi& spi; + uint8_t pinDataCommand; + uint8_t verticalScrollingStartAddress = 0; + + void HardwareReset(); + void SoftwareReset(); + void SleepOut(); + void SleepIn(); + void ColMod(); + void MemoryDataAccessControl(); + void DisplayInversionOn(); + void NormalModeOn(); + void WriteToRam(); + void DisplayOn(); + void DisplayOff(); + + void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); + void SetVdv(); + void WriteCommand(uint8_t cmd); + void WriteSpi(const uint8_t* data, size_t size); + + enum class Commands : uint8_t { + SoftwareReset = 0x01, + SleepIn = 0x10, + SleepOut = 0x11, + NormalModeOn = 0x13, + DisplayInversionOn = 0x21, + DisplayOff = 0x28, + DisplayOn = 0x29, + ColumnAddressSet = 0x2a, + RowAddressSet = 0x2b, + WriteToRam = 0x2c, + MemoryDataAccessControl = 0x36, + VerticalScrollDefinition = 0x33, + VerticalScrollStartAddress = 0x37, + ColMod = 0x3a, + VdvSet = 0xc4, + }; + void WriteData(uint8_t data); + void ColumnAddressSet(); + + static constexpr uint16_t Width = 240; + static constexpr uint16_t Height = 320; + void RowAddressSet(); + }; + } + } +} diff --git a/src/main.cpp b/src/main.cpp index c1287de8..1e4da37b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,7 @@ #include "drivers/nrf52/Spi.h" #include "drivers/nrf52/SpiMaster.h" #include "drivers/SpiNorFlash.h" -#include "drivers/St7789.h" +#include "drivers/displays/St7789.h" #include "drivers/TwiMaster.h" #include "drivers/touchpanels/Cst816s.h" #include "drivers/PinMap.h" @@ -63,6 +63,7 @@ Pinetime::Logging::DummyLogger logger; #include "port/MotionSensor.h" #include "port/HeartRateSensor.h" #include "port/Watchdog.h" +#include "port/Display.h" static constexpr uint8_t touchPanelTwiAddress = 0x15; static constexpr uint8_t motionSensorTwiAddress = 0x18; @@ -80,7 +81,8 @@ Pinetime::Drivers::SpiMaster spi {spiImpl}; Pinetime::Drivers::Nrf52::Spi lcdSpiIpmpl {spiImpl, Pinetime::PinMap::SpiLcdCsn}; Pinetime::Drivers::Spi lcdSpi {lcdSpiIpmpl}; -Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; +Pinetime::Drivers::Displays::St7789 lcdImpl {lcdSpi, Pinetime::PinMap::LcdDataCommand}; +Pinetime::Drivers::Display lcd{lcdImpl}; Pinetime::Drivers::Nrf52::Spi flashSpiImpl {spiImpl, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::Spi flashSpi {flashSpiImpl}; diff --git a/src/port/Display.h b/src/port/Display.h new file mode 100644 index 00000000..f7151272 --- /dev/null +++ b/src/port/Display.h @@ -0,0 +1,16 @@ +#pragma once +#include "drivers/Display.h" + +#ifdef TARGET_DEVICE_PINETIME + #include +#endif + +namespace Pinetime { + namespace Drivers { +#ifdef TARGET_DEVICE_PINETIME + using Display = Interface::Display; +#else + #error "No target device specified!" +#endif + } +} diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index 792442d0..9ad2c1d4 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include "recoveryImage.h" @@ -51,7 +51,7 @@ Pinetime::Drivers::SpiMaster spi {spiImpl}; Pinetime::Drivers::Nrf52::Spi lcdSpiIpmpl {spiImpl, Pinetime::PinMap::SpiLcdCsn}; Pinetime::Drivers::Spi lcdSpi {lcdSpiIpmpl}; -Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; +Pinetime::Drivers::Displays::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; Pinetime::Drivers::Nrf52::Spi flashSpiImpl {spiImpl, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::Spi flashSpi {flashSpiImpl}; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 5d91b6f1..6265df15 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -6,8 +6,6 @@ #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "displayapp/TouchEvents.h" -#include "drivers/St7789.h" -#include "drivers/heartRateSensors/Hrs3300.h" #include "drivers/PinMap.h" #include "main.h" #include "BootErrors.h" @@ -40,7 +38,7 @@ void MeasureBatteryTimerCallback(TimerHandle_t xTimer) { } SystemTask::SystemTask(Drivers::SpiMaster& spi, - Drivers::St7789& lcd, + Drivers::Display& lcd, Pinetime::Drivers::SpiNorFlash& spiNorFlash, Drivers::TwiMaster& twiMaster, Pinetime::Drivers::TouchPanel& touchPanel, diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 33584116..d42a1ed4 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -39,12 +39,10 @@ #include "port/MotionSensor.h" #include "port/HeartRateSensor.h" #include "port/Watchdog.h" +#include "port/Display.h" extern std::chrono::time_point NoInit_BackUpTime; namespace Pinetime { - namespace Drivers { - class St7789; - } namespace Controllers { class Battery; class TouchHandler; @@ -55,7 +53,7 @@ namespace Pinetime { public: enum class SystemTaskState { Sleeping, Running, GoingToSleep, WakingUp }; SystemTask(Drivers::SpiMaster& spi, - Drivers::St7789& lcd, + Drivers::Display& lcd, Pinetime::Drivers::SpiNorFlash& spiNorFlash, Drivers::TwiMaster& twiMaster, Pinetime::Drivers::TouchPanel& touchPanel, @@ -99,7 +97,7 @@ namespace Pinetime { TaskHandle_t taskHandle; Pinetime::Drivers::SpiMaster& spi; - Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::Display& lcd; Pinetime::Drivers::SpiNorFlash& spiNorFlash; Pinetime::Drivers::TwiMaster& twiMaster; Pinetime::Drivers::TouchPanel& touchPanel;