50c0a14a93
- Added kernel base drivers for: display, pointer (touch, mouse, etc.), keyboard, adc, power supply and backlight - Implement new kernel driver modules: `st7789-module` and `gt911-module` - Implement ESP32 ADC "oneshot" kernel driver - Implement ESP32 backlight kernel driver with ledc API - Implemented `battery-sense` driver that allows for voltage measurement and creates a power supply child device - Updated github actions - Updated flash scripts - Fix for esp32 legacy driver conflict with ADC - Created separate `lilygo-tdeck` and `lilygo-tdeck-plus` devices - Created `lilygo-module` with LilyGO kernel drivers - Fix for intermittent errors in build related to code generation of `devicetree.c` - `lvgl-module` can now map kernel drivers onto LVGL devices - Created `KernelDisplayApp` as a mirror of `HalDisplayApp` (formerly `DisplayApp`) - Removed `struct` and `enum` prefix in a lot of kernel driver cpp source files - `lilygo-tdeck` and `lilygo-tdeck-plus` are now fully relying on kernel drivers and don't use any of the old HAL
25 lines
813 B
C++
25 lines
813 B
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <Tactility/hal/touch/KernelTouchDriver.h>
|
|
|
|
#include <tactility/drivers/pointer.h>
|
|
|
|
#include <cassert>
|
|
|
|
namespace tt::hal::touch {
|
|
|
|
// Bus reads are expected to complete quickly; bound the wait so a stalled controller can't block the LVGL indev poll.
|
|
static constexpr TickType_t READ_TIMEOUT = pdMS_TO_TICKS(10);
|
|
|
|
KernelTouchDriver::KernelTouchDriver(::Device* device) : device(device) {
|
|
assert(device_get_type(device) == &POINTER_TYPE);
|
|
}
|
|
|
|
bool KernelTouchDriver::getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) {
|
|
if (pointer_read_data(device, READ_TIMEOUT) != ERROR_NONE) {
|
|
return false;
|
|
}
|
|
return pointer_get_touched_points(device, x, y, strength, pointCount, maxPointCount);
|
|
}
|
|
|
|
}
|