summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-03-13 17:01:47 -0700
committerGitHub <noreply@github.com>2022-03-14 00:01:47 +0000
commit921b9dad6c37575215231b34a3492ffb38eaeec2 (patch)
treecc08338fad283e7d442e73870c24eacc3e956977 /tmk_core
parentcc9a2aef0f533adb239a2e2b8a37f81fe6b5b951 (diff)
[Core] Move `has_mouse_report_changed` function to `report.c` (#16543)
* Move 'has_mouse_report_changed' checkto report.c * change mousekeys to use memcpy * fix linting issues
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/report.c13
-rw-r--r--tmk_core/protocol/report.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/tmk_core/protocol/report.c b/tmk_core/protocol/report.c
index 854b59ae48..5755098c60 100644
--- a/tmk_core/protocol/report.c
+++ b/tmk_core/protocol/report.c
@@ -278,3 +278,16 @@ void clear_keys_from_report(report_keyboard_t* keyboard_report) {
#endif
memset(keyboard_report->keys, 0, sizeof(keyboard_report->keys));
}
+
+#ifdef MOUSE_ENABLE
+/**
+ * @brief Compares 2 mouse reports for difference and returns result
+ *
+ * @param[in] new_report report_mouse_t
+ * @param[in] old_report report_mouse_t
+ * @return bool result
+ */
+__attribute__((weak)) bool has_mouse_report_changed(report_mouse_t* new_report, report_mouse_t* old_report) {
+ return memcmp(new_report, old_report, sizeof(report_mouse_t));
+}
+#endif
diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h
index 1adc892f3b..7bbeb78af7 100644
--- a/tmk_core/protocol/report.h
+++ b/tmk_core/protocol/report.h
@@ -320,6 +320,10 @@ void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key);
void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key);
void clear_keys_from_report(report_keyboard_t* keyboard_report);
+#ifdef MOUSE_ENABLE
+bool has_mouse_report_changed(report_mouse_t* new_report, report_mouse_t* old_report);
+#endif
+
#ifdef __cplusplus
}
#endif