From: tmk Date: Sun, 28 Jul 2013 15:53:18 +0000 (+0900) Subject: Change README Makefile and config.h in hhkb X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e7c2af78b704bfddb581559d42cc7cc31ffab0bf;p=qmk_firmware.git Change README Makefile and config.h in hhkb --- diff --git a/keyboard/hhkb/Makefile b/keyboard/hhkb/Makefile new file mode 100644 index 000000000..1ef0a0187 --- /dev/null +++ b/keyboard/hhkb/Makefile @@ -0,0 +1,131 @@ +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device. +# Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +# (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# Target file name (without extension). +TARGET = hhkb_lufa + +# Directory common source filess exist +TOP_DIR = ../.. + +# Directory keyboard dependent files exist +TARGET_DIR = . + + +# List C source files here. (C dependencies are automatically generated.) +SRC += keymap.c \ + matrix.c \ + led.c + +CONFIG_H = config.h + + +# MCU name +# PJRC Teensy++ 2.0 +#MCU = at90usb1286 +# TMK Alt Controller or PJRC Teensy 2.0 +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 +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 (TMK Alt Controller) +# 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 +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) + +include $(TOP_DIR)/protocol/lufa.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk + +debug-on: EXTRAFLAGS += -DDEBUG +debug-on: all diff --git a/keyboard/hhkb/Makefile.lufa b/keyboard/hhkb/Makefile.lufa deleted file mode 100644 index 262282a01..000000000 --- a/keyboard/hhkb/Makefile.lufa +++ /dev/null @@ -1,129 +0,0 @@ -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device. -# Please customize your programmer settings(PROGRAM_CMD) -# -# make teensy = Download the hex file to the device, using teensy_loader_cli. -# (must have teensy_loader_cli installed). -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - -# Target file name (without extension). -TARGET = hhkb_lufa - -# Directory common source filess exist -TOP_DIR = ../.. - -# Directory keyboard dependent files exist -TARGET_DIR = . - - -# List C source files here. (C dependencies are automatically generated.) -SRC += keymap.c \ - matrix.c \ - led.c - -CONFIG_H = config.h - - -# MCU name -#MCU = at90usb1286 -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 -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 -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover - - -# Search Path -VPATH += $(TARGET_DIR) -VPATH += $(TOP_DIR) - -include $(TOP_DIR)/protocol/lufa.mk -include $(TOP_DIR)/common.mk -include $(TOP_DIR)/rules.mk - -debug-on: EXTRAFLAGS += -DDEBUG -debug-on: all diff --git a/keyboard/hhkb/README.md b/keyboard/hhkb/README.md index b9e0b534a..3959ae85a 100644 --- a/keyboard/hhkb/README.md +++ b/keyboard/hhkb/README.md @@ -8,7 +8,6 @@ See [this thread][AltController] in geekhack.org. [HHKB]: http://www.pfu.fujitsu.com/hhkeyboard/ [AltController]: http://geekhack.org/index.php?topic=12047.0 -[Teensy]: http://www.pjrc.com/teensy/ ##Features @@ -22,8 +21,8 @@ See README of [tmk_keyboard] for more. [tmk_keyboard]: http://github.com/tmk/tmk_keyboard ###Pros -* No risk: Everything is all reversible -* Without PCB trace cutting, case mod or any destructives +* No risks: Everything is all reversible +* No need for PCB trace patching, case cutting or any other destructive mod * Can keep original controller intact * Can change all HHKB behaviour as you like @@ -41,61 +40,35 @@ See [doc/HHKB.txt](doc/HHKB.txt) and files under [doc/](doc/) for internal of HH ##Build Firmware & Program -You can choose some combination of hardware and USB protocol stack([LUFA], [PJRC]). +See [this document](../../doc/build.md) first. -### Install Tools -See [this document](../../doc/build.md). +### Configuration +Set `MCU`, `BOOTLOADER_SIZE` and other build options in `Makefile` and `config.h`. -### TMK Alt Controller Board - $ make -f Makefile.tmk +### Build +Just run make after intall tools. -This programs the controller with [dfu-programmer] if the tool is intalled and configured properly. + $ make - $ make -f Makefile.tmk dfu - -Push reset button and program with [FLIP]. The tool should be intalled and configured properly. - - $ make -f Makefile.tmk flip - -Or you can also program with FLIP GUI. - -[dfu-programmer]: http://dfu-programmer.sourceforge.net/ -[FLIP]: http://www.atmel.com/tools/FLIP.aspx - - -### PJRC Teensy++ -Build with [LUFA] USB stack: - - $ make -f Makefile.lufa - -or with [PJRC] USB stack: +Use `Makefile.pjrc` if you want to use PJRC stack instead of LUFA.(LUFA is recommended.) $ make -f Makefile.pjrc -Push reset button and program with [Teensy Loader(command line)]. The tool should be intalled and configured properly. - - $ make -f Makefile.lufa teensy - $ make -f Makefile.pjrc teensy - -Or you can also program with [Teensy Loader(GUI)]. +Use `Makefile.vusb` for [V-USB] controller.(not supported actively any more.) + $ make -f Makefile.vusb -[LUFA]: http://www.fourwalledcubicle.com/LUFA.php -[PJRC]: http://www.pjrc.com/teensy/usb_keyboard.html -[Teensy Loader(command line)]: http://www.pjrc.com/teensy/loader_cli.html -[Teensy Loader(GUI)]: http://www.pjrc.com/teensy/loader.html +### Program +First, push reset button on board to start bootloader. +This command programs the controller with [dfu-programmer] if the tool is intalled and configured properly. -###AVR Mega with [V-USB] -Build: - $ make -f Makefile.vusb + $ make dfu -Program [USBaspLoader] on MCU with AVR programmer like [AVRISPmkII] and tool like [avrdude]. +Or you can also use [FLIP] command to program. Also the tool should be intalled and configured properly. FLIP GUI app is also available. -You can programs with [avrdude] once you have programmed [USBaspLoader] on MCU. - $ make -f Makefile.vusb program + $ make flip -[AVRISPmkII]: http://www.atmel.com/tools/AVRISPMKII.aspx -[avrdude]: http://www.nongnu.org/avrdude/ +Use [Teensy Loader] if your controller is Teensy/Teensy++. ##How to Customize @@ -103,7 +76,7 @@ See [tmk_keyboard] documents. ##Hardware -You have some options for hardware. Development boards with USB AVR family(ATMega32U4, AT90USB1286) like Teensy will work while MegaAVR with V-USB library is also cheapear option for DIY. +You have some options for hardware. Development boards with USB AVR family(ATMega32U4, AT90USB1286) like Teensy will work while MegaAVR with [V-USB] library is also cheapear option for DIY. ###1. TMK Alt Controller Board TMK designed [Keyboard Controller Board for HHKB Pro2(KiCad project)](https://github.com/tmk/HHKB_controller). @@ -127,7 +100,6 @@ See [this post](http://geekhack.org/index.php?topic=12047.msg948923#msg948923). +---------------+ - NOTE: PJRC [Teensy](http://www.pjrc.com/teensy/) -[Teensy Loader]: http://www.pjrc.com/teensy/loader.html ###3. V-USB connection +---+ +---------------+ @@ -156,5 +128,11 @@ See [this post](http://geekhack.org/index.php?topic=12047.msg948923#msg948923). - NOTE: See [V-USB] documentation for more detail of hardware and the USB stack. - NOTE: [USBaspLoader] is very useful for firmware update. + +[LUFA]: http://www.fourwalledcubicle.com/LUFA.php +[PJRC]: http://www.pjrc.com/teensy/usb_keyboard.html +[dfu-programmer]: http://dfu-programmer.sourceforge.net/ +[FLIP]: http://www.atmel.com/tools/FLIP.aspx +[Teensy Loader]: http://www.pjrc.com/teensy/loader.html [V-USB]: http://www.obdev.at/products/vusb/index.html [USBaspLoader]: http://www.obdev.at/products/vusb/usbasploader.html diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h index ebee0c036..83a911bea 100644 --- a/keyboard/hhkb/config.h +++ b/keyboard/hhkb/config.h @@ -31,27 +31,10 @@ along with this program. If not, see . #define MATRIX_ROWS 8 #define MATRIX_COLS 8 -/* - * Boot magic keys - * call some function by pressing key when pluging cable or powering on. - */ -/* key position on matrix(ROW:COL) */ -#define KEY_FN 0x54 -#define KEY_D 0x14 -#define KEY_IS_ON(key) matrix_is_on((key)>>4, (key)&0xF) -/* kick up bootloader */ -#define IS_BOOTMAGIC_BOOTLOADER() KEY_IS_ON(KEY_FN) -/* debug on */ -#define IS_BOOTMAGIC_DEBUG() KEY_IS_ON(KEY_D) - /* key combination for command */ #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) -/* mouse keys */ -#ifdef MOUSEKEY_ENABLE -# define MOUSEKEY_DELAY_TIME 100 -#endif /* period of tapping(ms) */ #define TAPPING_TERM 300 @@ -62,11 +45,11 @@ along with this program. If not, see . /* Boot Magic salt key: Space */ #define BOOTMAGIC_KEY_SALT KC_FN6 + /* * Feature disable options * These options are also useful to firmware size reduction. */ - /* disable debug print */ //#define NO_DEBUG