Fix Makfile and config.h for LUFA in ps2_usb

master
tmk 2013-11-25 11:25:44 +09:00
parent 4e36159be2
commit 04c9501574
2 changed files with 87 additions and 63 deletions

View File

@ -1,5 +1,5 @@
# Target file name (without extension). # Target file name (without extension).
TARGET = ps2_usb TARGET = ps2_usb_lufa
# Directory common source filess exist # Directory common source filess exist
TOP_DIR = ../.. TOP_DIR = ../..
@ -7,69 +7,96 @@ TOP_DIR = ../..
# Directory keyboard dependent files exist # Directory keyboard dependent files exist
TARGET_DIR = . TARGET_DIR = .
# project specific files
# MCU name, you MUST set this to match the board you are using SRC = keymap_common.c \
# 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
# 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
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
# keyboard dependent files
SRC = keymap.c \
matrix.c \ matrix.c \
led.c led.c
ifdef KEYMAP
ifdef PS2_USE_USART SRC := keymap_$(KEYMAP).c $(SRC)
SRC += protocol/ps2_usart.c else
OPT_DEFS += -DPS2_USE_USART SRC := keymap_plain.c $(SRC)
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 endif
#CONFIG_H = config_pjrc_usart.h
CONFIG_H = config.h CONFIG_H = config.h
#---------------- Programming Options -------------------------- # MCU name
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex #MCU = at90usb1287
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)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# 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_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
PS2_USE_BUSYWAIT = yes # uses primitive reference code
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax
# Search Path # Search Path
VPATH += $(TARGET_DIR) VPATH += $(TARGET_DIR)
VPATH += $(TOP_DIR) VPATH += $(TOP_DIR)
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/protocol/lufa.mk
include $(TOP_DIR)/common.mk include $(TOP_DIR)/common.mk
include $(TOP_DIR)/rules.mk include $(TOP_DIR)/rules.mk

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VENDOR_ID 0xFEED #define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6512 #define PRODUCT_ID 0x6512
#define DEVICE_VER 0x0001
#define MANUFACTURER t.m.k. #define MANUFACTURER t.m.k.
#define PRODUCT PS/2 keyboard converter #define PRODUCT PS/2 keyboard converter
#define DESCRIPTION convert PS/2 keyboard to USB #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 #ifdef PS2_USE_USART
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) #if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
/* XCK for clock line and RXD for data line */ /* 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_PORT PORTD
#define PS2_CLOCK_PIN PIND #define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD #define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 1 #define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD #define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND #define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD #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 #ifdef PS2_USE_BUSYWAIT
#define PS2_CLOCK_PORT PORTF #define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PINF #define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRF #define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 0 #define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTF #define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PINF #define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRF #define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 1 #define PS2_DATA_BIT 2
#endif #endif
#endif #endif