summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol')
-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