From dcfffa7b67a072f7d9e37bd8c0029c53b61aeb0f Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 28 Oct 2021 22:31:59 +0100 Subject: [PATCH] Relocate protocol files within tmk_core/common/ (#14972) * Relocate non platform files within tmk_core/common/ * clang --- common_features.mk | 2 +- quantum/keyboard.c | 3 +++ {tmk_core/common => quantum}/raw_hid.h | 0 {tmk_core/common => quantum}/sync_timer.c | 0 {tmk_core/common => quantum}/sync_timer.h | 0 {tmk_core/common => quantum}/virtser.h | 2 ++ tmk_core/common.mk | 4 ---- tmk_core/protocol.mk | 6 ++++++ tmk_core/{common => protocol}/host.c | 0 tmk_core/{common => protocol}/host.h | 0 tmk_core/{common => protocol}/host_driver.h | 0 tmk_core/{common => protocol}/report.c | 4 ++-- tmk_core/{common => protocol}/report.h | 0 {quantum => tmk_core/protocol}/usb_device_state.c | 0 {quantum => tmk_core/protocol}/usb_device_state.h | 0 tmk_core/{common => protocol}/usb_util.c | 0 tmk_core/{common => protocol}/usb_util.h | 0 17 files changed, 14 insertions(+), 7 deletions(-) rename {tmk_core/common => quantum}/raw_hid.h (100%) rename {tmk_core/common => quantum}/sync_timer.c (100%) rename {tmk_core/common => quantum}/sync_timer.h (100%) rename {tmk_core/common => quantum}/virtser.h (89%) rename tmk_core/{common => protocol}/host.c (100%) rename tmk_core/{common => protocol}/host.h (100%) rename tmk_core/{common => protocol}/host_driver.h (100%) rename tmk_core/{common => protocol}/report.c (99%) rename tmk_core/{common => protocol}/report.h (100%) rename {quantum => tmk_core/protocol}/usb_device_state.c (100%) rename {quantum => tmk_core/protocol}/usb_device_state.h (100%) rename tmk_core/{common => protocol}/usb_util.c (100%) rename tmk_core/{common => protocol}/usb_util.h (100%) diff --git a/common_features.mk b/common_features.mk index af538b696f7..1d7e955cdfe 100644 --- a/common_features.mk +++ b/common_features.mk @@ -27,7 +27,7 @@ QUANTUM_SRC += \ $(QUANTUM_DIR)/keyboard.c \ $(QUANTUM_DIR)/keymap_common.c \ $(QUANTUM_DIR)/keycode_config.c \ - $(QUANTUM_DIR)/usb_device_state.c \ + $(QUANTUM_DIR)/sync_timer.c \ $(QUANTUM_DIR)/logging/debug.c \ $(QUANTUM_DIR)/logging/sendchar.c \ diff --git a/quantum/keyboard.c b/quantum/keyboard.c index 030fec2d3e9..806e4ef7e80 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c @@ -94,6 +94,9 @@ along with this program. If not, see . #ifdef DIGITIZER_ENABLE # include "digitizer.h" #endif +#ifdef VIRTSER_ENABLE +# include "virtser.h" +#endif static uint32_t last_input_modification_time = 0; uint32_t last_input_activity_time(void) { return last_input_modification_time; } diff --git a/tmk_core/common/raw_hid.h b/quantum/raw_hid.h similarity index 100% rename from tmk_core/common/raw_hid.h rename to quantum/raw_hid.h diff --git a/tmk_core/common/sync_timer.c b/quantum/sync_timer.c similarity index 100% rename from tmk_core/common/sync_timer.c rename to quantum/sync_timer.c diff --git a/tmk_core/common/sync_timer.h b/quantum/sync_timer.h similarity index 100% rename from tmk_core/common/sync_timer.h rename to quantum/sync_timer.h diff --git a/tmk_core/common/virtser.h b/quantum/virtser.h similarity index 89% rename from tmk_core/common/virtser.h rename to quantum/virtser.h index a0645f9e03e..df7e87984c8 100644 --- a/tmk_core/common/virtser.h +++ b/quantum/virtser.h @@ -1,5 +1,7 @@ #pragma once +void virtser_init(void); + /* Define this function in your code to process incoming bytes */ void virtser_recv(const uint8_t ch); diff --git a/tmk_core/common.mk b/tmk_core/common.mk index ce335f0d3c2..8fa1a31e803 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -2,10 +2,6 @@ COMMON_DIR = common PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY) TMK_COMMON_SRC += \ - $(COMMON_DIR)/host.c \ - $(COMMON_DIR)/report.c \ - $(COMMON_DIR)/sync_timer.c \ - $(COMMON_DIR)/usb_util.c \ $(PLATFORM_COMMON_DIR)/platform.c \ $(PLATFORM_COMMON_DIR)/suspend.c \ $(PLATFORM_COMMON_DIR)/timer.c \ diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index d4ad50db6a7..359ddbfef1b 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk @@ -1,5 +1,11 @@ PROTOCOL_DIR = protocol +TMK_COMMON_SRC += \ + $(PROTOCOL_DIR)/host.c \ + $(PROTOCOL_DIR)/report.c \ + $(PROTOCOL_DIR)/usb_device_state.c \ + $(PROTOCOL_DIR)/usb_util.c \ + ifeq ($(strip $(USB_HID_ENABLE)), yes) include $(TMK_DIR)/protocol/usb_hid.mk endif diff --git a/tmk_core/common/host.c b/tmk_core/protocol/host.c similarity index 100% rename from tmk_core/common/host.c rename to tmk_core/protocol/host.c diff --git a/tmk_core/common/host.h b/tmk_core/protocol/host.h similarity index 100% rename from tmk_core/common/host.h rename to tmk_core/protocol/host.h diff --git a/tmk_core/common/host_driver.h b/tmk_core/protocol/host_driver.h similarity index 100% rename from tmk_core/common/host_driver.h rename to tmk_core/protocol/host_driver.h diff --git a/tmk_core/common/report.c b/tmk_core/protocol/report.c similarity index 99% rename from tmk_core/common/report.c rename to tmk_core/protocol/report.c index 2a7fc006c43..854b59ae481 100644 --- a/tmk_core/common/report.c +++ b/tmk_core/protocol/report.c @@ -24,8 +24,8 @@ #ifdef RING_BUFFERED_6KRO_REPORT_ENABLE # define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) # define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS) -# define RO_INC(a) RO_ADD(a, 1) -# define RO_DEC(a) RO_SUB(a, 1) +# define RO_INC(a) RO_ADD(a, 1) +# define RO_DEC(a) RO_SUB(a, 1) static int8_t cb_head = 0; static int8_t cb_tail = 0; static int8_t cb_count = 0; diff --git a/tmk_core/common/report.h b/tmk_core/protocol/report.h similarity index 100% rename from tmk_core/common/report.h rename to tmk_core/protocol/report.h diff --git a/quantum/usb_device_state.c b/tmk_core/protocol/usb_device_state.c similarity index 100% rename from quantum/usb_device_state.c rename to tmk_core/protocol/usb_device_state.c diff --git a/quantum/usb_device_state.h b/tmk_core/protocol/usb_device_state.h similarity index 100% rename from quantum/usb_device_state.h rename to tmk_core/protocol/usb_device_state.h diff --git a/tmk_core/common/usb_util.c b/tmk_core/protocol/usb_util.c similarity index 100% rename from tmk_core/common/usb_util.c rename to tmk_core/protocol/usb_util.c diff --git a/tmk_core/common/usb_util.h b/tmk_core/protocol/usb_util.h similarity index 100% rename from tmk_core/common/usb_util.h rename to tmk_core/protocol/usb_util.h