From 921b9dad6c37575215231b34a3492ffb38eaeec2 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 13 Mar 2022 17:01:47 -0700 Subject: [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 --- tmk_core/protocol/report.c | 13 +++++++++++++ tmk_core/protocol/report.h | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'tmk_core') 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 -- cgit v1.2.3