From f20a6f8fed823e5406f783b51db96c07ee14f079 Mon Sep 17 00:00:00 2001 From: Alon Swartz Date: Sat, 15 Apr 2017 22:37:00 +0300 Subject: [PATCH] blackhawk: enabled trackpoint (usart: D2 data, D5 clk) --- keyboard/blackhawk/Makefile | 4 ++++ keyboard/blackhawk/config.h | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/keyboard/blackhawk/Makefile b/keyboard/blackhawk/Makefile index 18cc800f8c..9543774f3d 100644 --- a/keyboard/blackhawk/Makefile +++ b/keyboard/blackhawk/Makefile @@ -122,6 +122,9 @@ COMMAND_ENABLE = yes # Commands for debug and configuration #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support +PS2_USE_USART = yes # hardware USART engine for PS/2 signal receive +#PS2_MOUSE_DEBUG = yes # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax @@ -131,5 +134,6 @@ VPATH += $(TARGET_DIR) VPATH += $(TMK_DIR) include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/protocol.mk # Enables PS/2 Trackpoint include $(TMK_DIR)/common.mk include $(TMK_DIR)/rules.mk diff --git a/keyboard/blackhawk/config.h b/keyboard/blackhawk/config.h index 40deee91bf..785b8394a5 100644 --- a/keyboard/blackhawk/config.h +++ b/keyboard/blackhawk/config.h @@ -48,6 +48,52 @@ along with this program. If not, see . ) +/* PS/2 mouse USART version */ +#ifdef PS2_USE_USART +#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) +/* XCK for clock line and RXD for data line */ +#define PS2_CLOCK_PORT PORTD +#define PS2_CLOCK_PIN PIND +#define PS2_CLOCK_DDR DDRD +#define PS2_CLOCK_BIT 5 +#define PS2_DATA_PORT PORTD +#define PS2_DATA_PIN PIND +#define PS2_DATA_DDR DDRD +#define PS2_DATA_BIT 2 + +/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ +/* set DDR of CLOCK as input to be slave */ +#define PS2_USART_INIT() do { \ + PS2_CLOCK_DDR &= ~(1<