InfiniSim/sim/displayapp/LittleVgl.h

71 lines
1.9 KiB
C
Raw Normal View History

2022-02-16 20:42:29 +00:00
#pragma once
#include <lvgl/lvgl.h>
#include <components/fs/FS.h>
2022-02-16 20:42:29 +00:00
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::Controllers::FS& filesystem);
2022-02-16 20:42:29 +00:00
LittleVgl(const LittleVgl&) = delete;
LittleVgl& operator=(const LittleVgl&) = delete;
LittleVgl(LittleVgl&&) = delete;
LittleVgl& operator=(LittleVgl&&) = delete;
void Init();
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p);
bool GetTouchPadInfo(lv_indev_data_t* ptr);
void SetFullRefresh(FullRefreshDirections direction);
2023-02-24 16:11:26 +00:00
void SetNewTouchPoint(int16_t x, int16_t y, bool contact);
void CancelTap();
2022-06-11 20:24:50 +00:00
bool GetFullRefresh() {
bool returnValue = fullRefresh;
if (fullRefresh) {
fullRefresh = false;
}
return returnValue;
}
private:
void InitDisplay();
2022-02-16 20:42:29 +00:00
void InitTouchpad();
void InitFileSystem();
2022-02-16 20:42:29 +00:00
Pinetime::Drivers::St7789& lcd;
Pinetime::Controllers::FS& filesystem;
2022-02-16 20:42:29 +00:00
2022-06-11 20:24:50 +00:00
lv_disp_buf_t disp_buf_2;
lv_color_t buf2_1[LV_HOR_RES_MAX * 4];
lv_color_t buf2_2[LV_HOR_RES_MAX * 4];
2022-02-16 20:42:29 +00:00
lv_disp_drv_t disp_drv;
2022-06-11 20:24:50 +00:00
bool fullRefresh = false;
2022-02-16 20:42:29 +00:00
static constexpr uint8_t nbWriteLines = 4;
static constexpr uint16_t totalNbLines = 320;
static constexpr uint16_t visibleNbLines = 240;
2022-02-16 20:42:29 +00:00
static constexpr uint8_t MaxScrollOffset() {
return LV_VER_RES_MAX - nbWriteLines;
}
2022-02-16 20:42:29 +00:00
FullRefreshDirections scrollDirection = FullRefreshDirections::None;
uint16_t writeOffset = 0;
uint16_t scrollOffset = 0;
2023-02-24 16:11:26 +00:00
lv_point_t touchPoint = {};
2022-02-16 20:42:29 +00:00
bool tapped = false;
2023-02-24 16:11:26 +00:00
bool isCancelled = false;
2022-02-16 20:42:29 +00:00
};
}
}