99bffc2a21ebed07fd767ad2a9a7e1aadd491ef3

Author
Joel Challis <git@zvecr.com>
Committer
GitHub <noreply@github.com>
Date

Message

Migrate some tmk_core files to quantum (#11791)

* Migrate some tmk_core files to quantum

* Fix build errors

Diff

  1diff --git a/common_features.mk b/common_features.mk
  2index b9cd084d293ec06c4667d8c01a7bb958d4c6fb41..f98a788ca2aabd16ce99d798bfa573c2bad82c14 100644
  3--- a/common_features.mk
  4+++ b/common_features.mk
  5@@ -17,6 +17,7 @@ SERIAL_PATH := $(QUANTUM_PATH)/serial_link
  6 
  7 QUANTUM_SRC += \
  8     $(QUANTUM_DIR)/quantum.c \
  9+    $(QUANTUM_DIR)/bitwise.c \
 10     $(QUANTUM_DIR)/led.c \
 11     $(QUANTUM_DIR)/keymap_common.c \
 12     $(QUANTUM_DIR)/keycode_config.c
 13@@ -36,6 +37,11 @@ ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
 14     SRC += $(QUANTUM_DIR)/api.c
 15 endif
 16 
 17+ifeq ($(strip $(COMMAND_ENABLE)), yes)
 18+    SRC += $(QUANTUM_DIR)/command.c
 19+    OPT_DEFS += -DCOMMAND_ENABLE
 20+endif
 21+
 22 ifeq ($(strip $(AUDIO_ENABLE)), yes)
 23     OPT_DEFS += -DAUDIO_ENABLE
 24     MUSIC_ENABLE = yes
 25diff --git a/keyboards/ai03/orbit/matrix.h b/keyboards/ai03/orbit/matrix.h
 26deleted file mode 100644
 27index 664372b769954e47576654adecfa25101c9f8ae3..0000000000000000000000000000000000000000
 28--- a/keyboards/ai03/orbit/matrix.h
 29+++ /dev/null
 30@@ -1,3 +0,0 @@
 31-#pragma once
 32-
 33-#include "common/matrix.h"
 34diff --git a/keyboards/ai03/orbit/transport.h b/keyboards/ai03/orbit/transport.h
 35index 67597652fdb8639dd9d04cdaf42bbcdd621d67a3..757eae6f5c48ab6609c9ee8f7ce84f4b08f1b20f 100644
 36--- a/keyboards/ai03/orbit/transport.h
 37+++ b/keyboards/ai03/orbit/transport.h
 38@@ -1,6 +1,6 @@
 39 #pragma once
 40 
 41-#include "common/matrix.h"
 42+#include "matrix.h"
 43 
 44 #define ROWS_PER_HAND (MATRIX_ROWS/2)
 45 
 46diff --git a/tmk_core/common/util.c b/quantum/bitwise.c
 47rename from tmk_core/common/util.c
 48rename to quantum/bitwise.c
 49diff --git a/tmk_core/common/util.h b/quantum/bitwise.h
 50rename from tmk_core/common/util.h
 51rename to quantum/bitwise.h
 52index db57f268c30527f1ec20a4adadd422da6b133aef..276bc7437b3fae37036060a8ed4de3d108c4d5db 100644
 53--- a/tmk_core/common/util.h
 54+++ b/quantum/bitwise.h
 55@@ -19,13 +19,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 56 
 57 #include <stdint.h>
 58 
 59-// convert to L string
 60-#define LSTR(s) XLSTR(s)
 61-#define XLSTR(s) L## #s
 62-// convert to string
 63-#define STR(s) XSTR(s)
 64-#define XSTR(s) #s
 65-
 66 #ifdef __cplusplus
 67 extern "C" {
 68 #endif
 69diff --git a/tmk_core/common/command.c b/quantum/command.c
 70rename from tmk_core/common/command.c
 71rename to quantum/command.c
 72diff --git a/tmk_core/common/command.h b/quantum/command.h
 73rename from tmk_core/common/command.h
 74rename to quantum/command.h
 75diff --git a/tmk_core/common/led.h b/quantum/led.h
 76rename from tmk_core/common/led.h
 77rename to quantum/led.h
 78diff --git a/tmk_core/common/matrix.h b/quantum/matrix.h
 79rename from tmk_core/common/matrix.h
 80rename to quantum/matrix.h
 81diff --git a/tmk_core/ring_buffer.h b/quantum/ring_buffer.h
 82rename from tmk_core/ring_buffer.h
 83rename to quantum/ring_buffer.h
 84index 8f887c8f74ab6d7dc2a33d4cf5467c076db0545e..284745ca8e03d3e2cd1032a82e7dde2045b9b56d 100644
 85--- a/tmk_core/ring_buffer.h
 86+++ b/quantum/ring_buffer.h
 87@@ -1,14 +1,13 @@
 88 #pragma once
 89 
 90-/*--------------------------------------------------------------------
 91- * Ring buffer to store scan codes from keyboard
 92- *------------------------------------------------------------------*/
 93-#ifndef RBUF_SIZE
 94-#    define RBUF_SIZE 32
 95-#endif
 96 #include <util/atomic.h>
 97 #include <stdint.h>
 98 #include <stdbool.h>
 99+
100+#ifndef RBUF_SIZE
101+#    define RBUF_SIZE 32
102+#endif
103+
104 static uint8_t     rbuf[RBUF_SIZE];
105 static uint8_t     rbuf_head = 0;
106 static uint8_t     rbuf_tail = 0;
107diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h
108index f3e752bf9bffd029aedad10bee6b2d8c887b8b4b..c667bfab8537ce14aa5c93b048954f46ef90ad45 100644
109--- a/quantum/split_common/transport.h
110+++ b/quantum/split_common/transport.h
111@@ -1,6 +1,6 @@
112 #pragma once
113 
114-#include "common/matrix.h"
115+#include "matrix.h"
116 
117 void transport_master_init(void);
118 void transport_slave_init(void);
119diff --git a/keyboards/converter/adb_usb/led.h b/quantum/util.h
120rename from keyboards/converter/adb_usb/led.h
121rename to quantum/util.h
122index b33b6894e516edf7dc61fab8eda5b830f1b65f6c..bef3b9abe360830870f289713697e9b6c831b4d3 100644
123--- a/keyboards/converter/adb_usb/led.h
124+++ b/quantum/util.h
125@@ -13,31 +13,14 @@ GNU General Public License for more details.
126 
127 You should have received a copy of the GNU General Public License
128 along with this program.  If not, see <http://www.gnu.org/licenses/>.
129-
130-Ported to QMK by Peter Roe <pete@13bit.me>
131 */
132+#pragma once
133 
134-#ifndef LED_H
135-#define LED_H
136-#include <stdint.h>
137-
138-
139-/* keyboard LEDs */
140-#define USB_LED_NUM_LOCK                0
141-#define USB_LED_CAPS_LOCK               1
142-#define USB_LED_SCROLL_LOCK             2
143-#define USB_LED_COMPOSE                 3
144-#define USB_LED_KANA                    4
145-
146-
147-#ifdef __cplusplus
148-extern "C" {
149-#endif
150-
151-void led_set(uint8_t usb_led);
152-
153-#ifdef __cplusplus
154-}
155-#endif
156+#include "bitwise.h"
157 
158-#endif
159+// convert to L string
160+#define LSTR(s) XLSTR(s)
161+#define XLSTR(s) L## #s
162+// convert to string
163+#define STR(s) XSTR(s)
164+#define XSTR(s) #s
165diff --git a/tmk_core/common.mk b/tmk_core/common.mk
166index fdf2aa09727ff8133fb2a9d7cfd8d22203661151..55af71ed6fa240df608632006c35b232f73f2f81 100644
167--- a/tmk_core/common.mk
168+++ b/tmk_core/common.mk
169@@ -13,7 +13,6 @@ TMK_COMMON_SRC +=	$(COMMON_DIR)/host.c \
170 	$(COMMON_DIR)/print.c \
171 	$(COMMON_DIR)/debug.c \
172 	$(COMMON_DIR)/sendchar_null.c \
173-	$(COMMON_DIR)/util.c \
174 	$(COMMON_DIR)/eeconfig.c \
175 	$(COMMON_DIR)/report.c \
176 	$(PLATFORM_COMMON_DIR)/suspend.c \
177@@ -93,11 +92,6 @@ else
178     TMK_COMMON_DEFS += -DNO_DEBUG
179 endif
180 
181-ifeq ($(strip $(COMMAND_ENABLE)), yes)
182-    TMK_COMMON_SRC += $(COMMON_DIR)/command.c
183-    TMK_COMMON_DEFS += -DCOMMAND_ENABLE
184-endif
185-
186 ifeq ($(strip $(NKRO_ENABLE)), yes)
187     ifeq ($(PROTOCOL), VUSB)
188         $(info NKRO is not currently supported on V-USB, and has been disabled.)
189diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
190index 439aaf8b380906384b5c6b08317c651dce8b4e31..0ea7e3839557c9296f614dc4fd162b73309ab35b 100644
191--- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
192+++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c
193@@ -16,7 +16,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
194 */
195 
196 #include "arm_atsam_protocol.h"
197-#include "tmk_core/common/led.h"
198+#include "led.h"
199 #include "rgb_matrix.h"
200 #include <string.h>
201 #include <math.h>