From fb95d86b39074b581455fb35a17477cce79a3738 Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sat, 17 Jun 2017 17:55:44 +0300
Subject: [PATCH] Move functions for adding keys from to reports to report.h

---
 tmk_core/common/action_util.c | 32 --------------------------------
 tmk_core/common/action_util.h | 14 +++++++++++---
 tmk_core/common/report.c      | 30 ++++++++++++++++++++++++++++++
 tmk_core/common/report.h      |  4 ++++
 4 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c
index 511649676..f76398fb9 100644
--- a/tmk_core/common/action_util.c
+++ b/tmk_core/common/action_util.c
@@ -136,38 +136,6 @@ void send_keyboard_report(void) {
     host_keyboard_send(keyboard_report);
 }
 
-/* key */
-void add_key(uint8_t key)
-{
-#ifdef NKRO_ENABLE
-    if (keyboard_protocol && keymap_config.nkro) {
-        add_key_bit(keyboard_report, key);
-        return;
-    }
-#endif
-    add_key_byte(keyboard_report, key);
-}
-
-void del_key(uint8_t key)
-{
-#ifdef NKRO_ENABLE
-    if (keyboard_protocol && keymap_config.nkro) {
-        del_key_bit(keyboard_report, key);
-        return;
-    }
-#endif
-    del_key_byte(keyboard_report, key);
-}
-
-void clear_keys(void)
-{
-    // not clear mods
-    for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
-        keyboard_report->raw[i] = 0;
-    }
-}
-
-
 /* modifier */
 uint8_t get_mods(void) { return real_mods; }
 void add_mods(uint8_t mods) { real_mods |= mods; }
diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h
index 8fb88c0f6..345893151 100644
--- a/tmk_core/common/action_util.h
+++ b/tmk_core/common/action_util.h
@@ -29,9 +29,17 @@ extern report_keyboard_t *keyboard_report;
 void send_keyboard_report(void);
 
 /* key */
-void add_key(uint8_t key);
-void del_key(uint8_t key);
-void clear_keys(void);
+inline void add_key(uint8_t key) {
+  add_key_to_report(keyboard_report, key);
+}
+
+inline void del_key(uint8_t key) {
+  del_key_from_report(keyboard_report, key);
+}
+
+inline void clear_keys(void) {
+  clear_keys_from_report(keyboard_report);
+}
 
 /* modifier */
 uint8_t get_mods(void);
diff --git a/tmk_core/common/report.c b/tmk_core/common/report.c
index 0a67b2534..74c6d3fdd 100644
--- a/tmk_core/common/report.c
+++ b/tmk_core/common/report.c
@@ -175,3 +175,33 @@ void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code)
     }
 }
 #endif
+
+void add_key_to_report(report_keyboard_t* keyboard_report, int8_t key)
+{
+#ifdef NKRO_ENABLE
+    if (keyboard_protocol && keymap_config.nkro) {
+        add_key_bit(keyboard_report, key);
+        return;
+    }
+#endif
+    add_key_byte(keyboard_report, key);
+}
+
+void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key)
+{
+#ifdef NKRO_ENABLE
+    if (keyboard_protocol && keymap_config.nkro) {
+        del_key_bit(keyboard_report, key);
+        return;
+    }
+#endif
+    del_key_byte(keyboard_report, key);
+}
+
+void clear_keys_from_report(report_keyboard_t* keyboard_report)
+{
+    // not clear mods
+    for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
+        keyboard_report->raw[i] = 0;
+    }
+}
\ No newline at end of file
diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h
index 30ce80542..899fc524c 100644
--- a/tmk_core/common/report.h
+++ b/tmk_core/common/report.h
@@ -184,6 +184,10 @@ void add_key_bit(report_keyboard_t* keyboard_report, uint8_t code);
 void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code);
 #endif
 
+void add_key_to_report(report_keyboard_t* keyboard_report, int8_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 __cplusplus
 }
 #endif