2020-02-10 21:05:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <lvgl/lvgl.h>
|
2020-02-10 21:05:33 +01:00
|
|
|
|
|
|
|
namespace Pinetime {
|
2020-11-15 16:49:36 +01:00
|
|
|
namespace Drivers {
|
|
|
|
class Cst816S;
|
|
|
|
class St7789;
|
|
|
|
}
|
|
|
|
|
2020-02-10 21:05:33 +01:00
|
|
|
namespace Components {
|
|
|
|
class LittleVgl {
|
|
|
|
public:
|
2020-03-09 21:29:12 +01:00
|
|
|
enum class FullRefreshDirections { None, Up, Down };
|
2020-02-16 18:32:36 +01:00
|
|
|
LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel);
|
2020-02-10 21:05:33 +01:00
|
|
|
|
2020-03-08 21:46:25 +01:00
|
|
|
LittleVgl(const LittleVgl&) = delete;
|
|
|
|
LittleVgl& operator=(const LittleVgl&) = delete;
|
|
|
|
LittleVgl(LittleVgl&&) = delete;
|
|
|
|
LittleVgl& operator=(LittleVgl&&) = delete;
|
2020-02-10 21:05:33 +01:00
|
|
|
|
2020-03-08 21:46:25 +01:00
|
|
|
void FlushDisplay(const lv_area_t * area, lv_color_t * color_p);
|
2020-02-16 18:32:36 +01:00
|
|
|
bool GetTouchPadInfo(lv_indev_data_t *ptr);
|
2020-03-09 21:29:12 +01:00
|
|
|
void SetFullRefresh(FullRefreshDirections direction);
|
|
|
|
void SetNewTapEvent(uint16_t x, uint16_t y);
|
|
|
|
|
2020-02-10 21:05:33 +01:00
|
|
|
private:
|
2020-02-16 18:32:36 +01:00
|
|
|
void InitDisplay();
|
|
|
|
void InitTouchpad();
|
2020-03-01 15:59:17 +01:00
|
|
|
void InitTheme();
|
2021-01-28 18:13:28 +01:00
|
|
|
|
2020-02-16 18:32:36 +01:00
|
|
|
|
2020-02-10 21:05:33 +01:00
|
|
|
Pinetime::Drivers::St7789& lcd;
|
2020-02-16 18:32:36 +01:00
|
|
|
Pinetime::Drivers::Cst816S& touchPanel;
|
|
|
|
|
2020-02-10 21:05:33 +01:00
|
|
|
|
|
|
|
lv_disp_buf_t disp_buf_2;
|
2020-03-01 15:59:17 +01:00
|
|
|
lv_color_t buf2_1[LV_HOR_RES_MAX * 4];
|
|
|
|
lv_color_t buf2_2[LV_HOR_RES_MAX * 4];
|
2020-02-10 21:05:33 +01:00
|
|
|
|
|
|
|
lv_disp_drv_t disp_drv;
|
2020-02-16 18:32:36 +01:00
|
|
|
lv_point_t previousClick;
|
|
|
|
|
2020-03-02 20:48:58 +01:00
|
|
|
bool firstTouch = true;
|
2020-03-08 21:46:25 +01:00
|
|
|
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; }
|
2020-03-09 21:29:12 +01:00
|
|
|
FullRefreshDirections scrollDirection = FullRefreshDirections::None;
|
2020-03-08 21:46:25 +01:00
|
|
|
uint16_t writeOffset = 0;
|
|
|
|
uint16_t scrollOffset = 0;
|
2020-03-09 21:29:12 +01:00
|
|
|
|
|
|
|
uint16_t tap_x = 0;
|
|
|
|
uint16_t tap_y = 0;
|
|
|
|
bool tapped = false;
|
2020-02-10 21:05:33 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|