aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-10-20 21:18:49 +0100
committerGitHub <noreply@github.com>2021-10-20 21:18:49 +0100
commitd4be4b67a251ecc046d857c5cd00cfb37c394ab7 (patch)
tree15f6dd05ec293081782a9b42a30e1a81b33b6aa0
parent5500c428dd41348243e8a1695986b0da070e2ffa (diff)
downloadqmk_firmware-d4be4b67a251ecc046d857c5cd00cfb37c394ab7.tar.gz
qmk_firmware-d4be4b67a251ecc046d857c5cd00cfb37c394ab7.zip
Relocate PS2 code (#14895)
* Relocate ps2 protocol code * clang * Move makefile logic
-rw-r--r--common_features.mk34
-rw-r--r--drivers/ps2/ps2.h (renamed from tmk_core/protocol/ps2.h)0
-rw-r--r--drivers/ps2/ps2_busywait.c (renamed from tmk_core/protocol/ps2_busywait.c)0
-rw-r--r--drivers/ps2/ps2_interrupt.c (renamed from tmk_core/protocol/ps2_interrupt.c)0
-rw-r--r--drivers/ps2/ps2_io.h (renamed from tmk_core/protocol/ps2_io.h)0
-rw-r--r--drivers/ps2/ps2_mouse.c (renamed from tmk_core/protocol/ps2_mouse.c)10
-rw-r--r--drivers/ps2/ps2_mouse.h (renamed from tmk_core/protocol/ps2_mouse.h)0
-rw-r--r--platforms/avr/drivers/ps2/ps2_io.c (renamed from tmk_core/protocol/ps2_io_avr.c)0
-rw-r--r--platforms/avr/drivers/ps2/ps2_usart.c (renamed from tmk_core/protocol/ps2_usart.c)1
-rw-r--r--platforms/chibios/drivers/ps2/ps2_io.c (renamed from tmk_core/protocol/ps2_io_chibios.c)0
-rw-r--r--tmk_core/protocol.mk25
11 files changed, 38 insertions, 32 deletions
diff --git a/common_features.mk b/common_features.mk
index 9b9425dc3..083aa4aaa 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -576,6 +576,40 @@ ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
576 endif 576 endif
577endif 577endif
578 578
579ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
580 PS2_ENABLE := yes
581 SRC += ps2_mouse.c
582 OPT_DEFS += -DPS2_MOUSE_ENABLE
583 OPT_DEFS += -DMOUSE_ENABLE
584endif
585
586ifeq ($(strip $(PS2_USE_BUSYWAIT)), yes)
587 PS2_ENABLE := yes
588 SRC += ps2_busywait.c
589 SRC += ps2_io_avr.c
590 OPT_DEFS += -DPS2_USE_BUSYWAIT
591endif
592
593ifeq ($(strip $(PS2_USE_INT)), yes)
594 PS2_ENABLE := yes
595 SRC += ps2_interrupt.c
596 SRC += ps2_io.c
597 OPT_DEFS += -DPS2_USE_INT
598endif
599
600ifeq ($(strip $(PS2_USE_USART)), yes)
601 PS2_ENABLE := yes
602 SRC += ps2_usart.c
603 SRC += ps2_io.c
604 OPT_DEFS += -DPS2_USE_USART
605endif
606
607ifeq ($(strip $(PS2_ENABLE)), yes)
608 COMMON_VPATH += $(DRIVER_PATH)/ps2
609 COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/ps2
610 OPT_DEFS += -DPS2_ENABLE
611endif
612
579JOYSTICK_ENABLE ?= no 613JOYSTICK_ENABLE ?= no
580VALID_JOYSTICK_TYPES := analog digital 614VALID_JOYSTICK_TYPES := analog digital
581JOYSTICK_DRIVER ?= analog 615JOYSTICK_DRIVER ?= analog
diff --git a/tmk_core/protocol/ps2.h b/drivers/ps2/ps2.h
index f12319285..f12319285 100644
--- a/tmk_core/protocol/ps2.h
+++ b/drivers/ps2/ps2.h
diff --git a/tmk_core/protocol/ps2_busywait.c b/drivers/ps2/ps2_busywait.c
index 983194eea..983194eea 100644
--- a/tmk_core/protocol/ps2_busywait.c
+++ b/drivers/ps2/ps2_busywait.c
diff --git a/tmk_core/protocol/ps2_interrupt.c b/drivers/ps2/ps2_interrupt.c
index 70debd02f..70debd02f 100644
--- a/tmk_core/protocol/ps2_interrupt.c
+++ b/drivers/ps2/ps2_interrupt.c
diff --git a/tmk_core/protocol/ps2_io.h b/drivers/ps2/ps2_io.h
index de93cb7a3..de93cb7a3 100644
--- a/tmk_core/protocol/ps2_io.h
+++ b/drivers/ps2/ps2_io.h
diff --git a/tmk_core/protocol/ps2_mouse.c b/drivers/ps2/ps2_mouse.c
index 39251a643..8a6668b41 100644
--- a/tmk_core/protocol/ps2_mouse.c
+++ b/drivers/ps2/ps2_mouse.c
@@ -16,13 +16,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdbool.h> 18#include <stdbool.h>
19
20#if defined(__AVR__)
21# include <avr/io.h>
22#endif
23
24#include "ps2_mouse.h" 19#include "ps2_mouse.h"
25#include "wait.h" 20#include "wait.h"
21#include "gpio.h"
26#include "host.h" 22#include "host.h"
27#include "timer.h" 23#include "timer.h"
28#include "print.h" 24#include "print.h"
@@ -158,8 +154,8 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report)
158 154
159#ifdef PS2_MOUSE_INVERT_BUTTONS 155#ifdef PS2_MOUSE_INVERT_BUTTONS
160 // swap left & right buttons 156 // swap left & right buttons
161 uint8_t needs_left = mouse_report->buttons & PS2_MOUSE_BTN_RIGHT; 157 uint8_t needs_left = mouse_report->buttons & PS2_MOUSE_BTN_RIGHT;
162 uint8_t needs_right = mouse_report->buttons & PS2_MOUSE_BTN_LEFT; 158 uint8_t needs_right = mouse_report->buttons & PS2_MOUSE_BTN_LEFT;
163 mouse_report->buttons = (mouse_report->buttons & ~(PS2_MOUSE_BTN_MASK)) | (needs_left ? PS2_MOUSE_BTN_LEFT : 0) | (needs_right ? PS2_MOUSE_BTN_RIGHT : 0); 159 mouse_report->buttons = (mouse_report->buttons & ~(PS2_MOUSE_BTN_MASK)) | (needs_left ? PS2_MOUSE_BTN_LEFT : 0) | (needs_right ? PS2_MOUSE_BTN_RIGHT : 0);
164#else 160#else
165 // remove sign and overflow flags 161 // remove sign and overflow flags
diff --git a/tmk_core/protocol/ps2_mouse.h b/drivers/ps2/ps2_mouse.h
index c97c6c893..c97c6c893 100644
--- a/tmk_core/protocol/ps2_mouse.h
+++ b/drivers/ps2/ps2_mouse.h
diff --git a/tmk_core/protocol/ps2_io_avr.c b/platforms/avr/drivers/ps2/ps2_io.c
index 7c826fbf1..7c826fbf1 100644
--- a/tmk_core/protocol/ps2_io_avr.c
+++ b/platforms/avr/drivers/ps2/ps2_io.c
diff --git a/tmk_core/protocol/ps2_usart.c b/platforms/avr/drivers/ps2/ps2_usart.c
index 5f7008369..151cfcd68 100644
--- a/tmk_core/protocol/ps2_usart.c
+++ b/platforms/avr/drivers/ps2/ps2_usart.c
@@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
42#include <stdbool.h> 42#include <stdbool.h>
43#include <avr/interrupt.h> 43#include <avr/interrupt.h>
44#include <util/delay.h> 44#include <util/delay.h>
45#include "gpio.h"
45#include "ps2.h" 46#include "ps2.h"
46#include "ps2_io.h" 47#include "ps2_io.h"
47#include "print.h" 48#include "print.h"
diff --git a/tmk_core/protocol/ps2_io_chibios.c b/platforms/chibios/drivers/ps2/ps2_io.c
index 906d85d84..906d85d84 100644
--- a/tmk_core/protocol/ps2_io_chibios.c
+++ b/platforms/chibios/drivers/ps2/ps2_io.c
diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk
index 30c87a0f1..8aa063c91 100644
--- a/tmk_core/protocol.mk
+++ b/tmk_core/protocol.mk
@@ -1,30 +1,5 @@
1PROTOCOL_DIR = protocol 1PROTOCOL_DIR = protocol
2 2
3ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
4 SRC += $(PROTOCOL_DIR)/ps2_mouse.c
5 OPT_DEFS += -DPS2_MOUSE_ENABLE
6 OPT_DEFS += -DMOUSE_ENABLE
7endif
8
9ifeq ($(strip $(PS2_USE_BUSYWAIT)), yes)
10 SRC += protocol/ps2_busywait.c
11 SRC += protocol/ps2_io_avr.c
12 OPT_DEFS += -DPS2_USE_BUSYWAIT
13endif
14
15ifeq ($(strip $(PS2_USE_INT)), yes)
16 SRC += protocol/ps2_interrupt.c
17 SRC += protocol/ps2_io_$(PLATFORM_KEY).c
18 OPT_DEFS += -DPS2_USE_INT
19endif
20
21ifeq ($(strip $(PS2_USE_USART)), yes)
22 SRC += protocol/ps2_usart.c
23 SRC += protocol/ps2_io_$(PLATFORM_KEY).c
24 OPT_DEFS += -DPS2_USE_USART
25endif
26
27
28ifeq ($(strip $(SERIAL_MOUSE_MICROSOFT_ENABLE)), yes) 3ifeq ($(strip $(SERIAL_MOUSE_MICROSOFT_ENABLE)), yes)
29 SRC += $(PROTOCOL_DIR)/serial_mouse_microsoft.c 4 SRC += $(PROTOCOL_DIR)/serial_mouse_microsoft.c
30 OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MICROSOFT \ 5 OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MICROSOFT \