C++ conversion (#80)

Converted project to C++
This commit is contained in:
Ken Van Hoeylandt
2024-11-22 20:26:08 +01:00
committed by GitHub
parent 6d80144e12
commit 85e26636a3
488 changed files with 6017 additions and 39466 deletions
@@ -0,0 +1,29 @@
#include "M5Unified.hpp"
#include "lvgl.h"
#include "TactilityCore.h"
#define TAG "cores3_touch"
static void touch_read_callback(TT_UNUSED lv_indev_t* indev, lv_indev_data_t* data) {
lgfx::touch_point_t point; // Making it static makes it unreliable
bool touched = M5.Lcd.getTouch(&point) > 0;
if (!touched) {
data->state = LV_INDEV_STATE_REL;
} else {
data->state = LV_INDEV_STATE_PR;
data->point.x = point.x;
data->point.y = point.y;
}
}
_Nullable lv_indev_t* m5stack_lvgl_touch() {
static lv_indev_t* indev = lv_indev_create();
LV_ASSERT_MALLOC(indev)
if (indev == nullptr) {
return nullptr;
}
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, touch_read_callback);
return indev;
}