30#include "../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_TOUCH_HI8561
44 uint8_t buffer[POINT_BUFFER_SIZE] = {0};
48 uint8_t numPoints = 0;
49 if (!makePacketThenRead(
REG_INFO, buffer, 1)) {
53 numPoints = buffer[0];
60 if (!makePacketThenRead(
REG_POINT, buffer, expectedBytes)) {
64 for (uint8_t
i = 0;
i < numPoints;
i++) {
66 uint16_t
x = buffer[offset + 1] | (buffer[offset + 0] << 8);
67 uint16_t
y = buffer[offset + 3] | (buffer[offset + 2] << 8);
68 uint8_t
pressure = buffer[offset + 4];
70 if (
x == UINT16_MAX ||
y == UINT16_MAX) {
71 SENSORLIB_LOG_E(
"Edge trigger detected, id %d set to invalid coordinates",
i);
87bool TouchDrvHI8561::initImpl(uint8_t)
97 uint32_t reg = buffer[0] + (buffer[1] << 8) + (buffer[2] << 16) + (buffer[3] << 24);
#define SENSORLIB_LOG_E(...)
#define SENSORLIB_LOG_D(...)
SensorPressure pressure(bhy)
static constexpr uint32_t REG_SECTION_INFO
static constexpr uint32_t REG_INFO
const TouchPoints & getTouchPoints() override
Get the touch points.
void sleep() override
Puts the touch driver to sleep.
static constexpr uint8_t BYTES_PER_POINT
static constexpr uint32_t REG_POINT
const char * getModelName() override
Get the model name.
static constexpr uint8_t MAX_FINGER_NUM
uint32_t _chipID
Chip identification value.
virtual void updateXY(TouchPoints &points) const
Apply coordinate transformations (swap, scale, mirror) to all touch points.
TouchPoints _touchPoints
Touch points data.
Container for touch point data and optional gesture information.
bool addPoint(uint16_t x, uint16_t y, uint16_t pressure=0, uint8_t id=0, uint8_t event=0)
Adds a touch point to the container.
void clear()
Clears all stored touch points and gesture.