mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-01-09 23:22:30 +00:00
Make mouse reporting user configurable
This commit is contained in:
@@ -26,17 +26,22 @@ bool touchpad_init[2];
|
||||
|
||||
void print_byte(uint8_t byte) { xprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
|
||||
|
||||
__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
|
||||
mouse_report->x = x;
|
||||
mouse_report->y = y;
|
||||
}
|
||||
void pointing_device_task(void) {
|
||||
report_mouse_t mouse_report = pointing_device_get_report();
|
||||
#if 1
|
||||
static uint16_t x = 0, y = 0;
|
||||
int8_t report_x = 0, report_y = 0;
|
||||
|
||||
Pinnacle_GetAbsolute(&touchData);
|
||||
ScaleData(&touchData, 256, 256); // Scale coordinates to arbitrary X, Y resolution
|
||||
ScaleData(&touchData, 1024, 1024); // Scale coordinates to arbitrary X, Y resolution
|
||||
|
||||
if (x && y && touchData.xValue && touchData.yValue) {
|
||||
mouse_report.x = (int8_t)(touchData.xValue - x);
|
||||
mouse_report.y = (int8_t)(touchData.yValue - y);
|
||||
report_x = (int8_t)(touchData.xValue - x);
|
||||
report_y = (int8_t)(touchData.yValue - y);
|
||||
}
|
||||
x = touchData.xValue;
|
||||
y = touchData.yValue;
|
||||
@@ -67,6 +72,7 @@ void pointing_device_task(void) {
|
||||
rTouchData.xValue = 0;
|
||||
rTouchData.yValue = 0;
|
||||
#endif
|
||||
process_mouse_user(&report, report_x, report_y);
|
||||
pointing_device_set_report(mouse_report);
|
||||
pointing_device_send();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count);
|
||||
void RAP_Write(uint8_t address, uint8_t data);
|
||||
void ClipCoordinates(absData_t* coordinates);
|
||||
void ScaleData(absData_t* coordinates, uint16_t xResolution, uint16_t yResolution);
|
||||
void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
|
||||
|
||||
// Cirque's 7-bit I2C Slave Address
|
||||
#define SLAVE_ADDR 0x2A
|
||||
|
||||
Reference in New Issue
Block a user