1
0
Fork 0

Move pointing device driver code (#24445)

Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
Dasky 2024-10-25 18:11:51 +01:00 committed by GitHub
parent 5c85271e48
commit f5b495e06e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 544 additions and 546 deletions

View file

@ -21,6 +21,7 @@
#include "wait.h"
#include "debug.h"
#include "gpio.h"
#include "pointing_device_internal.h"
// Registers
// clang-format off
@ -45,6 +46,13 @@
#define REG_MOTION_BURST 0x63
// clang-format on
const pointing_device_driver_t adns5050_pointing_device_driver = {
.init = adns5050_init,
.get_report = adns5050_get_report,
.set_cpi = adns5050_set_cpi,
.get_cpi = adns5050_get_cpi,
};
static bool powered_down = false;
void adns5050_init(void) {
@ -226,3 +234,15 @@ void adns5050_power_down(void) {
adns5050_write_reg(REG_MOUSE_CONTROL, 0b10);
}
}
report_mouse_t adns5050_get_report(report_mouse_t mouse_report) {
report_adns5050_t data = adns5050_read_burst();
if (data.dx != 0 || data.dy != 0) {
pd_dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
mouse_report.x = (mouse_xy_report_t)data.dx;
mouse_report.y = (mouse_xy_report_t)data.dy;
}
return mouse_report;
}