summaryrefslogtreecommitdiff
path: root/quantum/pointing_device
diff options
context:
space:
mode:
authorVladislav Marchenko <vladoseeg@gmail.com>2023-04-03 08:57:19 +0600
committerGitHub <noreply@github.com>2023-04-03 12:57:19 +1000
commit9a68472da87bea6eb9e209b8cf90de09211f23c8 (patch)
tree9c31dca73d52a5f7960c995dfced393218835a48 /quantum/pointing_device
parent162d6156d337016a568d42e88acb30eb558df69c (diff)
Added PMW3320 driver (#19543)
Diffstat (limited to 'quantum/pointing_device')
-rw-r--r--quantum/pointing_device/pointing_device.h3
-rw-r--r--quantum/pointing_device/pointing_device_drivers.c22
2 files changed, 25 insertions, 0 deletions
diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h
index eacc6418dd..afd653eaee 100644
--- a/quantum/pointing_device/pointing_device.h
+++ b/quantum/pointing_device/pointing_device.h
@@ -28,6 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(POINTING_DEVICE_DRIVER_adns5050)
# include "drivers/sensors/adns5050.h"
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
+#elif defined(POINTING_DEVICE_DRIVER_pmw3320)
+# include "drivers/sensors/pmw3320.h"
+# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
#elif defined(POINTING_DEVICE_DRIVER_adns9800)
# include "spi_master.h"
# include "drivers/sensors/adns9800.h"
diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c
index d6f29c062e..9a4315f76f 100644
--- a/quantum/pointing_device/pointing_device_drivers.c
+++ b/quantum/pointing_device/pointing_device_drivers.c
@@ -50,6 +50,28 @@ const pointing_device_driver_t pointing_device_driver = {
};
// clang-format on
+#elif defined(POINTING_DEVICE_DRIVER_pmw3320)
+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;
+}
+
+// clang-format off
+const pointing_device_driver_t pointing_device_driver = {
+ .init = pmw3320_init,
+ .get_report = pmw3320_get_report,
+ .set_cpi = pmw3320_set_cpi,
+ .get_cpi = pmw3320_get_cpi,
+};
+// clang-format on
+
#elif defined(POINTING_DEVICE_DRIVER_adns9800)
report_mouse_t adns9800_get_report_driver(report_mouse_t mouse_report) {