diff options
-rw-r--r-- | converter/ps2_usb/Makefile | 111 | ||||
-rw-r--r-- | converter/ps2_usb/config.h | 23 |
2 files changed, 79 insertions, 55 deletions
diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile index 0c6442374c..04bf28a00c 100644 --- a/converter/ps2_usb/Makefile +++ b/converter/ps2_usb/Makefile @@ -1,5 +1,5 @@ # Target file name (without extension). -TARGET = ps2_usb +TARGET = ps2_usb_lufa # Directory common source filess exist TOP_DIR = ../.. @@ -7,69 +7,96 @@ TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . +# project specific files +SRC = keymap_common.c \ + matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h -# MCU name, you MUST set this to match the board you are using -# type "make clean" after changing this, so all files will be rebuilt -#MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 -#MCU = at90usb646 # Teensy++ 1.0 -#MCU = at90usb1286 # Teensy++ 2.0 +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 # Processor frequency. -# Normally the first thing your program should do is set the clock prescaler, -# so your program will run at the correct speed. You should also set this -# variable to same clock speed. The _delay_ms() macro uses this, and many -# examples use this variable to calculate timings. Do not add a "UL" here. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. F_CPU = 16000000 -# Build Options -# *Comment out* to disable the options. # -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -NKRO_ENABLE = yes # USB Nkey Rollover +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) -PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) -#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin -#PS2_USE_BUSYWAIT = yes # uses primitive reference code +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT -# keyboard dependent files -SRC = keymap.c \ - matrix.c \ - led.c - +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 -ifdef PS2_USE_USART - SRC += protocol/ps2_usart.c - OPT_DEFS += -DPS2_USE_USART -endif -ifdef PS2_USE_INT - SRC += protocol/ps2.c - OPT_DEFS += -DPS2_USE_INT -endif -ifdef PS2_USE_BUSYWAIT - SRC += protocol/ps2.c - OPT_DEFS += -DPS2_USE_BUSYWAIT -endif +# Build Options +# comment out to disable the options. +# +#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -#CONFIG_H = config_pjrc_usart.h -CONFIG_H = config.h +# PS/2 Options +# +#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) +#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin +PS2_USE_BUSYWAIT = yes # uses primitive reference code -#---------------- Programming Options -------------------------- -PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax # Search Path VPATH += $(TARGET_DIR) VPATH += $(TOP_DIR) - -include $(TOP_DIR)/protocol/pjrc.mk include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/protocol/lufa.mk include $(TOP_DIR)/common.mk include $(TOP_DIR)/rules.mk diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h index 51cd271d78..1ad2bd1b49 100644 --- a/converter/ps2_usb/config.h +++ b/converter/ps2_usb/config.h @@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6512 +#define DEVICE_VER 0x0001 #define MANUFACTURER t.m.k. #define PRODUCT PS/2 keyboard converter #define DESCRIPTION convert PS/2 keyboard to USB @@ -39,10 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ) -/* legacy keymap support */ -#define USE_LEGACY_KEYMAP - - #ifdef PS2_USE_USART #if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) /* XCK for clock line and RXD for data line */ @@ -136,7 +133,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PS2_CLOCK_PORT PORTD #define PS2_CLOCK_PIN PIND #define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 1 +#define PS2_CLOCK_BIT 5 #define PS2_DATA_PORT PORTD #define PS2_DATA_PIN PIND #define PS2_DATA_DDR DDRD @@ -157,14 +154,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef PS2_USE_BUSYWAIT -#define PS2_CLOCK_PORT PORTF -#define PS2_CLOCK_PIN PINF -#define PS2_CLOCK_DDR DDRF -#define PS2_CLOCK_BIT 0 -#define PS2_DATA_PORT PORTF -#define PS2_DATA_PIN PINF -#define PS2_DATA_DDR DDRF -#define PS2_DATA_BIT 1 +#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 #endif #endif |