1
0

ps2_usb: Change Makefiles

This commit is contained in:
tmk 2016-09-17 10:20:52 +09:00
parent 1c1f7b14e3
commit 5ee5b6bd7e
11 changed files with 87 additions and 308 deletions

View File

@ -1,31 +1,39 @@
#
# Makefile for Teensy
#
# Target file name (without extension). # Target file name (without extension).
TARGET = ps2_usb_lufa TARGET ?= ps2_usb
# Directory common source filess exist # Directory common source filess exist
TMK_DIR = ../../tmk_core TMK_DIR ?= ../../tmk_core
# Directory keyboard dependent files exist # Directory keyboard dependent files exist
TARGET_DIR = . TARGET_DIR ?= .
# project specific files # project specific files
SRC = matrix.c \ SRC ?= matrix.c \
led.c led.c
ifdef KEYMAP #
SRC := keymap_$(KEYMAP).c $(SRC) # Keymap file
#
ifdef UNIMAP_ENABLE
KEYMAP_FILE = unimap
else else
SRC := keymap_plain.c $(SRC) ifdef ACTIONMAP_ENABLE
KEYMAP_FILE = actionmap
else
KEYMAP_FILE = keymap
endif
endif
ifdef KEYMAP
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
else
SRC := $(KEYMAP_FILE)_plain.c $(SRC)
endif endif
CONFIG_H = config.h CONFIG_H ?= config.h
# MCU name # MCU name
#MCU = at90usb1287 MCU ?= atmega32u2
MCU = atmega32u4
# Processor frequency. # Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the # This will define a symbol, F_CPU, in all source code files equal to the
@ -38,14 +46,14 @@ MCU = atmega32u4
# does not *change* the processor frequency - it should merely be updated to # 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 # reflect the processor speed set externally so that the code can use accurate
# software delays. # software delays.
F_CPU = 16000000 F_CPU ?= 16000000
# #
# LUFA specific # LUFA specific
# #
# Target architecture (see library "Board Types" documentation). # Target architecture (see library "Board Types" documentation).
ARCH = AVR8 ARCH ?= AVR8
# Input clock frequency. # Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the # This will define a symbol, F_USB, in all source code files equal to the
@ -58,7 +66,7 @@ ARCH = AVR8
# #
# If no clock division is performed on the input clock inside the AVR (via the # 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. # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU) F_USB ?= $(F_CPU)
# Interrupt driven control endpoint task(+60) # Interrupt driven control endpoint task(+60)
#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT #OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
@ -70,25 +78,26 @@ F_USB = $(F_CPU)
# Atmel DFU loader 4096 # Atmel DFU loader 4096
# LUFA bootloader 4096 # LUFA bootloader 4096
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=512 BOOTLOADER_SIZE ?= 4096
OPT_DEFS += -DBOOTLOADER_SIZE=$(BOOTLOADER_SIZE)
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE ?= yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE ?= yes # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA NKRO_ENABLE ?= yes # USB Nkey Rollover - not yet supported in LUFA
# PS/2 Options # PS/2 Options
# #
#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) #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_INT ?= yes # uses external interrupt for falling edge of PS/2 clock pin
#PS2_USE_BUSYWAIT = yes # uses primitive reference code #PS2_USE_BUSYWAIT ?= yes # uses primitive reference code
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"

View File

@ -1,74 +0,0 @@
# Target file name (without extension).
TARGET = ps2_usb_pjrc
# Directory common source filess exist
TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
# keyboard dependent files
SRC = 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
# 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.
F_CPU = 16000000
# 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
# Build Options
# *Comment out* to disable the options.
#
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover
# 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
# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)
include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/protocol/pjrc.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk

View File

@ -0,0 +1,17 @@
TARGET ?= ps2_usb_rev1
MCU = atmega32u4
CONFIG_H = config_rev1.h
BOOTLOADER_SIZE = 4096
BOOTMAGIC_ENABLE ?= no
MOUSEKEY_ENABLE ?= yes
EXTRAKEY_ENABLE ?= yes
CONSOLE_ENABLE ?= yes
COMMAND_ENABLE ?= yes
NKRO_ENABLE ?= yes
PS2_USE_USART = yes
PS2_USE_INT = no
PS2_USE_BUSYWAIT = no
include Makefile

View File

@ -0,0 +1,17 @@
TARGET ?= ps2_usb_rev2
MCU = atmega32u2
CONFIG_H = config_rev2.h
BOOTLOADER_SIZE = 4096
BOOTMAGIC_ENABLE ?= no
MOUSEKEY_ENABLE ?= no
EXTRAKEY_ENABLE ?= yes
CONSOLE_ENABLE ?= yes
COMMAND_ENABLE ?= yes
NKRO_ENABLE ?= yes
PS2_USE_USART = no
PS2_USE_INT = yes
PS2_USE_BUSYWAIT = no
include Makefile

View File

@ -1,97 +0,0 @@
#
# Makefile for TMK keyboard converter rev2
# https://github.com/tmk/keyboard_converter#pcb-rev1
#
# Target file name (without extension).
TARGET = ps2_usb_tmk_rev1
# Directory common source filess exist
TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
# project specific files
SRC = matrix.c \
led.c
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
else
SRC := keymap_plain.c $(SRC)
endif
CONFIG_H = config_tmk_rev1.h
# MCU name
MCU = atmega32u4
# Processor frequency.
# 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
#
# 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)
# 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
# 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
# PS/2 Options
#
PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)
include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk

View File

@ -1,97 +0,0 @@
#
# Makefile for TMK keyboard converter rev2
# https://github.com/tmk/keyboard_converter#pcb-rev2
#
# Target file name (without extension).
TARGET = ps2_usb_tmk_rev2
# Directory common source filess exist
TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
# project specific files
SRC = matrix.c \
led.c
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
else
SRC := keymap_plain.c $(SRC)
endif
CONFIG_H = config_tmk_rev2.h
# MCU name
MCU = atmega32u2
# Processor frequency.
# 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
#
# 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)
# 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
# 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
# PS/2 Options
#
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)
include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk

View File

@ -0,0 +1,5 @@
TARGET = ps2_usb_rev1_unimap
UNIMAP_ENABLE = yes
KEYMAP_SECTION_ENABLE = yes
include Makefile.rev1

View File

@ -0,0 +1,5 @@
TARGET = ps2_usb_rev2_unimap
UNIMAP_ENABLE = yes
KEYMAP_SECTION_ENABLE = yes
include Makefile.rev2

View File

@ -5,36 +5,30 @@ This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set
Connect Wires Connect Wires
------------- -------------
In case of Teensy2.0(ATMega32U4):
1. Connect **Vcc** and **GND**. 1. Connect **Vcc** and **GND**.
2. Connect **Clock** and **Data** line. 2. Connect **Clock** and **Data** line.
- **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible) - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible)
- **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`. - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`.
- **USART**: **Clock** is on `PD5` and **Data** on `PD2`. - **USART**: **Clock** is on `PD5` and **Data** on `PD2`.
3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. 3. You need pull-up resistors. 1K-10K Ohm would be fine.
To change pin configuration edit **config.h** and **Makefile**. To change pin configuration edit **config.h** and **Makefile**.
Build Firmware Build Firmware
-------------- --------------
For **PJRC Teensy** just run `make`: For **TMK converter Rev.2**:
$ make clean $ make -f Makefile.rev2 clean
$ make $ make -f Makefile.rev2 KEYMAP=plain
To select keymap: To program firmware push the button on converter and run:
$ make clean $ make -f Makefile.rev2 KEYMAP=plain dfu
$ make KEYMAP=[plain|jis|spacefn|...]
After that you will find HEX file `ps2_usb_lufa.hex` in current directory.
- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`. - For **TMK converter Rev.1** use `make -f Makefile.rev1` instead.
- To select keymap use `jis`, `spacefn` or your own in place of `plain`.
- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`.
Keymap Keymap