Move pointing device driver code (#24445)
Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
parent
5c85271e48
commit
f5b495e06e
23 changed files with 544 additions and 546 deletions
|
@ -21,6 +21,14 @@
|
|||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
const pointing_device_driver_t pmw3320_pointing_device_drivera = {
|
||||
.init = pmw3320_init,
|
||||
.get_report = pmw3320_get_report,
|
||||
.set_cpi = pmw3320_set_cpi,
|
||||
.get_cpi = pmw3320_get_cpi,
|
||||
};
|
||||
|
||||
void pmw3320_init(void) {
|
||||
// Initialize sensor serial pins.
|
||||
|
@ -190,3 +198,15 @@ bool pmw3320_check_signature(void) {
|
|||
|
||||
return (pid == 0x3b && pid2 == 0xc4);
|
||||
}
|
||||
|
||||
report_mouse_t pmw3320_get_report(report_mouse_t mouse_report) {
|
||||
report_pmw3320_t data = pmw3320_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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue