diff --git a/main.cpp b/main.cpp index fec0758..5b89ef0 100644 --- a/main.cpp +++ b/main.cpp @@ -330,7 +330,7 @@ Pinetime::Drivers::Cst816S touchPanel; // {twiMaster, touchPanelTwiAddress}; // #include "displayapp/LittleVgl.h" // #include "displayapp/DisplayApp.h" //#endif -Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; +Pinetime::Components::LittleVgl lvgl {lcd}; Pinetime::Drivers::Bma421 motionSensor {twiMaster, motionSensorTwiAddress}; Pinetime::Drivers::Hrs3300 heartRateSensor {twiMaster, heartRateSensorTwiAddress}; diff --git a/sim/displayapp/LittleVgl.cpp b/sim/displayapp/LittleVgl.cpp index c46284e..1e8c1a6 100644 --- a/sim/displayapp/LittleVgl.cpp +++ b/sim/displayapp/LittleVgl.cpp @@ -19,6 +19,12 @@ using namespace Pinetime::Components; +namespace { + void InitTheme() { + lv_theme_t* theme = lv_pinetime_theme_init(); + lv_theme_set_act(theme); + } +} lv_style_t* LabelBigStyle = nullptr; static void disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) { @@ -41,8 +47,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::Cst816S& touchPanel) - : lcd {lcd}, touchPanel {touchPanel} { +LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd) : lcd {lcd} { } void LittleVgl::Init() { @@ -304,10 +309,3 @@ bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) { } return false; } - -void LittleVgl::InitTheme() { - - lv_theme_t* th = lv_pinetime_theme_init(); - - lv_theme_set_act(th); -} diff --git a/sim/displayapp/LittleVgl.h b/sim/displayapp/LittleVgl.h index 4647534..38f1f00 100644 --- a/sim/displayapp/LittleVgl.h +++ b/sim/displayapp/LittleVgl.h @@ -4,7 +4,6 @@ namespace Pinetime { namespace Drivers { - class Cst816S; class St7789; } @@ -12,7 +11,7 @@ namespace Pinetime { class LittleVgl { public: enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; - LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel); + LittleVgl(Pinetime::Drivers::St7789& lcd); LittleVgl(const LittleVgl&) = delete; LittleVgl& operator=(const LittleVgl&) = delete; @@ -38,10 +37,8 @@ namespace Pinetime { private: void InitDisplay(); void InitTouchpad(); - void InitTheme(); Pinetime::Drivers::St7789& lcd; - Pinetime::Drivers::Cst816S& touchPanel; lv_disp_buf_t disp_buf_2; lv_color_t buf2_1[LV_HOR_RES_MAX * 4]; @@ -53,9 +50,11 @@ namespace Pinetime { static constexpr uint8_t nbWriteLines = 4; static constexpr uint16_t totalNbLines = 320; static constexpr uint16_t visibleNbLines = 240; + static constexpr uint8_t MaxScrollOffset() { return LV_VER_RES_MAX - nbWriteLines; } + FullRefreshDirections scrollDirection = FullRefreshDirections::None; uint16_t writeOffset = 0; uint16_t scrollOffset = 0;