2020-02-10 15:05:33 -05:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-15 10:49:36 -05:00
|
|
|
#include <lvgl/lvgl.h>
|
2020-02-10 15:05:33 -05:00
|
|
|
|
|
|
|
namespace Pinetime {
|
2020-11-15 10:49:36 -05:00
|
|
|
namespace Drivers {
|
|
|
|
class St7789;
|
|
|
|
}
|
|
|
|
|
2020-02-10 15:05:33 -05:00
|
|
|
namespace Components {
|
|
|
|
class LittleVgl {
|
2021-04-24 05:00:45 -04:00
|
|
|
public:
|
2021-04-18 13:28:14 -04:00
|
|
|
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
|
2023-02-23 16:33:09 -05:00
|
|
|
LittleVgl(Pinetime::Drivers::St7789& lcd);
|
2021-04-18 13:28:14 -04:00
|
|
|
|
|
|
|
LittleVgl(const LittleVgl&) = delete;
|
|
|
|
LittleVgl& operator=(const LittleVgl&) = delete;
|
|
|
|
LittleVgl(LittleVgl&&) = delete;
|
|
|
|
LittleVgl& operator=(LittleVgl&&) = delete;
|
|
|
|
|
2021-06-12 04:58:28 -04:00
|
|
|
void Init();
|
|
|
|
|
2021-04-18 13:28:14 -04:00
|
|
|
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p);
|
|
|
|
bool GetTouchPadInfo(lv_indev_data_t* ptr);
|
|
|
|
void SetFullRefresh(FullRefreshDirections direction);
|
2021-07-15 17:07:55 -04:00
|
|
|
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact);
|
2021-04-18 13:28:14 -04:00
|
|
|
|
2022-04-20 05:21:35 -04:00
|
|
|
bool GetFullRefresh() {
|
|
|
|
bool returnValue = fullRefresh;
|
|
|
|
if (fullRefresh) {
|
|
|
|
fullRefresh = false;
|
|
|
|
}
|
|
|
|
return returnValue;
|
|
|
|
}
|
|
|
|
|
2021-04-24 05:00:45 -04:00
|
|
|
private:
|
2021-04-18 13:28:14 -04:00
|
|
|
void InitDisplay();
|
|
|
|
void InitTouchpad();
|
|
|
|
|
|
|
|
Pinetime::Drivers::St7789& lcd;
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
lv_disp_drv_t disp_drv;
|
|
|
|
|
2022-04-20 05:21:35 -04:00
|
|
|
bool fullRefresh = false;
|
2021-04-18 13:28:14 -04:00
|
|
|
static constexpr uint8_t nbWriteLines = 4;
|
|
|
|
static constexpr uint16_t totalNbLines = 320;
|
|
|
|
static constexpr uint16_t visibleNbLines = 240;
|
2023-01-07 15:23:15 -05:00
|
|
|
|
2021-04-18 13:28:14 -04:00
|
|
|
static constexpr uint8_t MaxScrollOffset() {
|
|
|
|
return LV_VER_RES_MAX - nbWriteLines;
|
|
|
|
}
|
2023-01-07 15:23:15 -05:00
|
|
|
|
2021-04-18 13:28:14 -04:00
|
|
|
FullRefreshDirections scrollDirection = FullRefreshDirections::None;
|
|
|
|
uint16_t writeOffset = 0;
|
|
|
|
uint16_t scrollOffset = 0;
|
|
|
|
|
|
|
|
uint16_t tap_x = 0;
|
|
|
|
uint16_t tap_y = 0;
|
|
|
|
bool tapped = false;
|
2020-02-10 15:05:33 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|