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
|
@ -20,6 +20,7 @@
|
|||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "gpio.h"
|
||||
#include "pointing_device_internal.h"
|
||||
|
||||
#define REG_PID1 0x00
|
||||
#define REG_PID2 0x01
|
||||
|
@ -50,6 +51,13 @@ void paw3204_serial_write(uint8_t reg_addr);
|
|||
uint8_t paw3204_read_reg(uint8_t reg_addr);
|
||||
void paw3204_write_reg(uint8_t reg_addr, uint8_t data);
|
||||
|
||||
const pointing_device_driver_t paw3204_pointing_device_driver = {
|
||||
.init = paw3204_init,
|
||||
.get_report = paw3204_get_report,
|
||||
.set_cpi = paw3204_set_cpi,
|
||||
.get_cpi = paw3204_get_cpi,
|
||||
};
|
||||
|
||||
void paw3204_init(void) {
|
||||
gpio_set_pin_output(PAW3204_SCLK_PIN); // setclockpin to output
|
||||
gpio_set_pin_input_high(PAW3204_SDIO_PIN); // set datapin input high
|
||||
|
@ -170,3 +178,15 @@ uint16_t paw3204_get_cpi(void) {
|
|||
uint8_t read_pid_paw3204(void) {
|
||||
return paw3204_read_reg(REG_PID1);
|
||||
}
|
||||
|
||||
report_mouse_t paw3204_get_report(report_mouse_t mouse_report) {
|
||||
report_paw3204_t data = paw3204_read();
|
||||
if (data.isMotion) {
|
||||
pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
|
||||
|
||||
mouse_report.x = data.x;
|
||||
mouse_report.y = data.y;
|
||||
}
|
||||
|
||||
return mouse_report;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue