summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-07-19 17:46:22 -0700
committerGitHub <noreply@github.com>2022-07-19 17:46:22 -0700
commit12eb6444c67456d522c815120de8eed431ead2f8 (patch)
tree50445a98e7f06d531cefd2648455ca6ce2576b84 /quantum
parent6992efb2291f8b78cb5feb5c750bab616640045d (diff)
Add support for PAW3204 Optical Sensor (#17669)
Co-authored-by: gompa <gompa@h-bomb.nl> Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Diffstat (limited to 'quantum')
-rw-r--r--quantum/pointing_device.h2
-rw-r--r--quantum/pointing_device_drivers.c21
2 files changed, 23 insertions, 0 deletions
diff --git a/quantum/pointing_device.h b/quantum/pointing_device.h
index a8e8e75e87..77db5471ea 100644
--- a/quantum/pointing_device.h
+++ b/quantum/pointing_device.h
@@ -33,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "drivers/sensors/cirque_pinnacle.h"
# include "drivers/sensors/cirque_pinnacle_gestures.h"
# include "pointing_device_gestures.h"
+#elif defined(POINTING_DEVICE_DRIVER_paw3204)
+# include "drivers/sensors/paw3204.h"
#elif defined(POINTING_DEVICE_DRIVER_pimoroni_trackball)
# include "i2c_master.h"
# include "drivers/sensors/pimoroni_trackball.h"
diff --git a/quantum/pointing_device_drivers.c b/quantum/pointing_device_drivers.c
index b7e98e897e..d0b545d22d 100644
--- a/quantum/pointing_device_drivers.c
+++ b/quantum/pointing_device_drivers.c
@@ -26,6 +26,7 @@
#define CONSTRAIN_HID_XY(amt) ((amt) < XY_REPORT_MIN ? XY_REPORT_MIN : ((amt) > XY_REPORT_MAX ? XY_REPORT_MAX : (amt)))
// get_report functions should probably be moved to their respective drivers.
+
#if defined(POINTING_DEVICE_DRIVER_adns5050)
report_mouse_t adns5050_get_report(report_mouse_t mouse_report) {
report_adns5050_t data = adns5050_read_burst();
@@ -198,7 +199,27 @@ const pointing_device_driver_t pointing_device_driver = {
.get_cpi = cirque_pinnacle_get_cpi
};
// clang-format on
+#elif defined(POINTING_DEVICE_DRIVER_paw3204)
+
+report_mouse_t paw3204_get_report(report_mouse_t mouse_report) {
+ report_paw3204_t data = paw3204_read();
+ if (data.isMotion) {
+# ifdef CONSOLE_ENABLE
+ dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
+# endif
+
+ mouse_report.x = data.x;
+ mouse_report.y = data.y;
+ }
+ return mouse_report;
+}
+const pointing_device_driver_t pointing_device_driver = {
+ .init = paw3204_init,
+ .get_report = paw3204_get_report,
+ .set_cpi = paw3204_set_cpi,
+ .get_cpi = paw3204_get_cpi,
+};
#elif defined(POINTING_DEVICE_DRIVER_pimoroni_trackball)
mouse_xy_report_t pimoroni_trackball_adapt_values(clamp_range_t* offset) {