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

@ -20,6 +20,14 @@
#include "wait.h"
#include "timer.h"
#include <stdlib.h>
#include "pointing_device_internal.h"
const pointing_device_driver_t analog_joystick_pointing_device_driver = {
.init = analog_joystick_init,
.get_report = analog_joystick_get_report,
.set_cpi = NULL,
.get_cpi = NULL,
};
// Set Parameters
#ifndef ANALOG_JOYSTICK_AUTO_AXIS
@ -145,3 +153,16 @@ void analog_joystick_init(void) {
maxAxisValues[1] = yOrigin + 100;
#endif
}
report_mouse_t analog_joystick_get_report(report_mouse_t mouse_report) {
report_analog_joystick_t data = analog_joystick_read();
pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
mouse_report.x = data.x;
mouse_report.y = data.y;
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, data.button, POINTING_DEVICE_BUTTON1);
return mouse_report;
}