From e67c988824f5ec0c965beb412f8ee5953dfd3c8c Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 17 Sep 2011 22:39:50 +0900 Subject: Added Bulegiga iWRAP support into HHKB.(Bluetooth) --- Makefile.common | 35 -- Makefile.pjrc | 21 -- Makefile.rules | 547 -------------------------------- Makefile.vusb | 11 - POWER.txt | 62 ++++ README | 4 +- adb_usb/Makefile | 20 +- adb_usb/README | 8 + adb_usb/config.h | 4 +- command.c | 56 +++- command.h | 2 + common.mk | 38 +++ hhkb/FUSE.txt | 40 +++ hhkb/Makefile | 55 ---- hhkb/Makefile.iwrap | 91 ++++++ hhkb/Makefile.pjrc | 58 ++++ hhkb/Makefile.vusb | 29 +- hhkb/README | 113 +++++-- hhkb/config_iwrap.h | 55 ++++ hhkb/config_pjrc.h | 6 +- hhkb/config_vusb.h | 12 +- hhkb/doc/Bluetooth.txt | 4 + hhkb/doc/Bluetooth_img/.picasa.ini | 2 + hhkb/doc/Bluetooth_img/BT_circuit.jpg | Bin 0 -> 502118 bytes hhkb/doc/HHKB_TP1684.jpg | Bin 149082 -> 0 bytes hhkb/doc/HHKB_chart1.jpg | Bin 155342 -> 0 bytes hhkb/doc/HHKB_chart2.jpg | Bin 148225 -> 0 bytes hhkb/doc/HHKB_connector.jpg | Bin 193900 -> 0 bytes hhkb/doc/HHKB_controller.jpg | Bin 135100 -> 0 bytes hhkb/doc/HHKB_img/HHKB_TP1684.jpg | Bin 0 -> 149082 bytes hhkb/doc/HHKB_img/HHKB_chart1.jpg | Bin 0 -> 155342 bytes hhkb/doc/HHKB_img/HHKB_chart2.jpg | Bin 0 -> 148225 bytes hhkb/doc/HHKB_img/HHKB_connector.jpg | Bin 0 -> 193900 bytes hhkb/doc/HHKB_img/HHKB_controller.jpg | Bin 0 -> 135100 bytes hhkb/doc/HHKB_img/HHKB_keyswitch.jpg | Bin 0 -> 171469 bytes hhkb/doc/HHKB_img/connector_contact.jpg | Bin 0 -> 192830 bytes hhkb/doc/HHKB_img/logic_analyzer.jpg | Bin 0 -> 169564 bytes hhkb/doc/HHKB_img/probe_contact.jpg | Bin 0 -> 208477 bytes hhkb/doc/HHKB_img/teensy_install.jpg | Bin 0 -> 135851 bytes hhkb/doc/HHKB_img/teensy_wiring.jpg | Bin 0 -> 154695 bytes hhkb/doc/HHKB_keyswitch.jpg | Bin 171469 -> 0 bytes hhkb/doc/connector_contact.jpg | Bin 192830 -> 0 bytes hhkb/doc/logic_analyzer.jpg | Bin 169564 -> 0 bytes hhkb/doc/probe_contact.jpg | Bin 208477 -> 0 bytes hhkb/doc/teensy_install.jpg | Bin 135851 -> 0 bytes hhkb/doc/teensy_wiring.jpg | Bin 154695 -> 0 bytes hhkb/keymap.c | 115 ++++--- hhkb/matrix.c | 66 +++- hhkb/usbconfig.h | 16 +- host.c | 190 +++++++++++ host.h | 89 +----- host_driver.h | 33 ++ iwrap.mk | 10 + iwrap/iWRAP.txt | 376 ++++++++++++++++++++++ iwrap/iwrap.c | 467 +++++++++++++++++++++++++++ iwrap/iwrap.h | 49 +++ iwrap/main.c | 378 ++++++++++++++++++++++ iwrap/suart.S | 156 +++++++++ iwrap/suart.h | 8 + iwrap/wd.h | 159 ++++++++++ keyboard.c | 9 +- layer.c | 4 +- macway/Makefile | 16 +- macway/config.h | 4 +- macway/doc/back.jpg | Bin macway/doc/case.jpg | Bin macway/doc/keys.jpg | Bin macway/doc/side.jpg | Bin macway/doc/switch.jpg | Bin macway/doc/teensy.jpg | Bin macway/doc/wiring.jpg | Bin macway/doc/withHHKB.jpg | Bin macway/doc/withThinkPad.jpg | Bin main_pjrc.c | 94 ------ main_vusb.c | 58 ---- mousekey.c | 10 +- pjrc.mk | 21 ++ pjrc/host.c | 10 +- pjrc/main.c | 97 ++++++ pjrc/pjrc.c | 76 +++++ pjrc/pjrc.h | 26 ++ pjrc/usb.c | 34 +- pjrc/usb.h | 2 +- pjrc/usb_keyboard.c | 4 +- print.c | 13 + print.h | 2 + ps2_usb/Makefile | 18 +- ps2_usb/Makefile.vusb | 19 +- ps2_usb/config_pjrc.h | 4 +- ps2_usb/config_vusb.h | 4 +- ps2_usb/keymap.c | 6 +- ps2_usb/matrix.c | 1 + report.h | 96 ++++++ rules.mk | 547 ++++++++++++++++++++++++++++++++ sendchar.h | 4 +- sendchar_null.c | 23 ++ sendchar_uart.c | 25 ++ timer.c | 35 +- timer.h | 21 +- uart.c | 129 ++++++++ uart.h | 11 + usb_keycodes.h | 8 +- vusb.mk | 17 + vusb/host.c | 521 ------------------------------ vusb/host_vusb.h | 23 -- vusb/main.c | 99 ++++++ vusb/vusb.c | 462 +++++++++++++++++++++++++++ vusb/vusb.h | 27 ++ 108 files changed, 4289 insertions(+), 1676 deletions(-) delete mode 100644 Makefile.common delete mode 100644 Makefile.pjrc delete mode 100644 Makefile.rules delete mode 100644 Makefile.vusb create mode 100644 POWER.txt create mode 100644 common.mk create mode 100644 hhkb/FUSE.txt delete mode 100644 hhkb/Makefile create mode 100644 hhkb/Makefile.iwrap create mode 100644 hhkb/Makefile.pjrc create mode 100644 hhkb/config_iwrap.h create mode 100644 hhkb/doc/Bluetooth.txt create mode 100755 hhkb/doc/Bluetooth_img/.picasa.ini create mode 100755 hhkb/doc/Bluetooth_img/BT_circuit.jpg delete mode 100644 hhkb/doc/HHKB_TP1684.jpg delete mode 100644 hhkb/doc/HHKB_chart1.jpg delete mode 100644 hhkb/doc/HHKB_chart2.jpg delete mode 100644 hhkb/doc/HHKB_connector.jpg delete mode 100644 hhkb/doc/HHKB_controller.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_TP1684.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_chart1.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_chart2.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_connector.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_controller.jpg create mode 100644 hhkb/doc/HHKB_img/HHKB_keyswitch.jpg create mode 100644 hhkb/doc/HHKB_img/connector_contact.jpg create mode 100644 hhkb/doc/HHKB_img/logic_analyzer.jpg create mode 100644 hhkb/doc/HHKB_img/probe_contact.jpg create mode 100644 hhkb/doc/HHKB_img/teensy_install.jpg create mode 100644 hhkb/doc/HHKB_img/teensy_wiring.jpg delete mode 100644 hhkb/doc/HHKB_keyswitch.jpg delete mode 100644 hhkb/doc/connector_contact.jpg delete mode 100644 hhkb/doc/logic_analyzer.jpg delete mode 100644 hhkb/doc/probe_contact.jpg delete mode 100644 hhkb/doc/teensy_install.jpg delete mode 100644 hhkb/doc/teensy_wiring.jpg create mode 100644 host.c create mode 100644 host_driver.h create mode 100644 iwrap.mk create mode 100644 iwrap/iWRAP.txt create mode 100644 iwrap/iwrap.c create mode 100644 iwrap/iwrap.h create mode 100644 iwrap/main.c create mode 100644 iwrap/suart.S create mode 100644 iwrap/suart.h create mode 100644 iwrap/wd.h mode change 100755 => 100644 macway/doc/back.jpg mode change 100755 => 100644 macway/doc/case.jpg mode change 100755 => 100644 macway/doc/keys.jpg mode change 100755 => 100644 macway/doc/side.jpg mode change 100755 => 100644 macway/doc/switch.jpg mode change 100755 => 100644 macway/doc/teensy.jpg mode change 100755 => 100644 macway/doc/wiring.jpg mode change 100755 => 100644 macway/doc/withHHKB.jpg mode change 100755 => 100644 macway/doc/withThinkPad.jpg delete mode 100644 main_pjrc.c delete mode 100644 main_vusb.c mode change 100644 => 100755 mousekey.c create mode 100644 pjrc.mk create mode 100644 pjrc/main.c create mode 100644 pjrc/pjrc.c create mode 100644 pjrc/pjrc.h create mode 100644 report.h create mode 100644 rules.mk create mode 100644 sendchar_null.c create mode 100644 sendchar_uart.c create mode 100644 uart.c create mode 100644 uart.h create mode 100644 vusb.mk delete mode 100644 vusb/host.c delete mode 100644 vusb/host_vusb.h create mode 100644 vusb/main.c create mode 100644 vusb/vusb.c create mode 100644 vusb/vusb.h diff --git a/Makefile.common b/Makefile.common deleted file mode 100644 index 1922def001..0000000000 --- a/Makefile.common +++ /dev/null @@ -1,35 +0,0 @@ -SRC += host.c \ - keyboard.c \ - command.c \ - layer.c \ - timer.c \ - print.c \ - util.c - - -# Option modules -ifdef MOUSEKEY_ENABLE - SRC += mousekey.c - OPT_DEFS += -DMOUSEKEY_ENABLE -endif - -ifdef PS2_MOUSE_ENABLE - SRC += ps2.c \ - ps2_mouse.c - OPT_DEFS += -DPS2_MOUSE_ENABLE -endif - -ifdef USB_EXTRA_ENABLE - OPT_DEFS += -DUSB_EXTRA_ENABLE -endif - -ifdef USB_NKRO_ENABLE - OPT_DEFS += -DUSB_NKRO_ENABLE -endif - -ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) - OPT_DEFS += -DUSB_MOUSE_ENABLE -endif - - -include $(COMMON_DIR)/Makefile.rules diff --git a/Makefile.pjrc b/Makefile.pjrc deleted file mode 100644 index 894d4dcee3..0000000000 --- a/Makefile.pjrc +++ /dev/null @@ -1,21 +0,0 @@ -OPT_DEFS += -DHOST_PJRC - -SRC = usb_keyboard.c \ - usb_debug.c \ - usb.c \ - jump_bootloader.c -SRC += $(TARGET_SRC) - - -# C source file search path -VPATH = $(TARGET_DIR):$(COMMON_DIR):$(COMMON_DIR)/pjrc - - -# Option modules -ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) - SRC += usb_mouse.c -endif - -ifdef USB_EXTRA_ENABLE - SRC += usb_extra.c -endif diff --git a/Makefile.rules b/Makefile.rules deleted file mode 100644 index f1d0a301ca..0000000000 --- a/Makefile.rules +++ /dev/null @@ -1,547 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -#---------------------------------------------------------------------------- -# WinAVR Makefile Template written by Eric B. Weddington, Jg Wunsch, et al. -# -# Released to the Public Domain -# -# Additional material for this makefile was written by: -# Peter Fleury -# Tim Henigan -# Colin O'Flynn -# Reiner Patommel -# Markus Pfaff -# Sander Pool -# Frederik Rouleau -# Carlos Lamas -# -#---------------------------------------------------------------------------- -# 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, using avrdude. -# Please customize the avrdude settings below first! -# -# 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". -#---------------------------------------------------------------------------- - - -# Output format. (can be srec, ihex, binary) -FORMAT = ihex - - -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -OBJDIR = obj_$(TARGET) - - -# Optimization level, can be [0, 1, 2, 3, s]. -# 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) -OPT = s - - -# Debugging format. -# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. -# AVR Studio 4.10 requires dwarf-2. -# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. -DEBUG = dwarf-2 - - -# List any extra directories to look for include files here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = $(subst :, ,$(VPATH)) - - -# Compiler flag to set the C Standard level. -# c89 = "ANSI" C -# gnu89 = c89 plus GCC extensions -# c99 = ISO C99 standard (not yet fully implemented) -# gnu99 = c99 plus GCC extensions -CSTANDARD = -std=gnu99 - - -# Place -D or -U options here for C sources -CDEFS = -DF_CPU=$(F_CPU)UL -CDEFS += $(OPT_DEFS) - - -# Place -D or -U options here for ASM sources -ADEFS = -DF_CPU=$(F_CPU) -ADEFS += $(OPT_DEFS) - - -# Place -D or -U options here for C++ sources -CPPDEFS = -DF_CPU=$(F_CPU)UL -#CPPDEFS += -D__STDC_LIMIT_MACROS -#CPPDEFS += -D__STDC_CONSTANT_MACROS -CPPDEFS += $(OPT_DEFS) - - - -#---------------- Compiler Options C ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CFLAGS = -g$(DEBUG) -CFLAGS += $(CDEFS) -CFLAGS += -O$(OPT) -CFLAGS += -funsigned-char -CFLAGS += -funsigned-bitfields -CFLAGS += -ffunction-sections -CFLAGS += -fpack-struct -CFLAGS += -fshort-enums -CFLAGS += -Wall -CFLAGS += -Wstrict-prototypes -#CFLAGS += -mshort-calls -#CFLAGS += -fno-unit-at-a-time -#CFLAGS += -Wundef -#CFLAGS += -Wunreachable-code -#CFLAGS += -Wsign-compare -CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) -CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -CFLAGS += $(CSTANDARD) -CFLAGS += -include $(CONFIG_H) - - -#---------------- Compiler Options C++ ---------------- -# -g*: generate debugging information -# -O*: optimization level -# -f...: tuning, see GCC manual and avr-libc documentation -# -Wall...: warning level -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns...: create assembler listing -CPPFLAGS = -g$(DEBUG) -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) -CPPFLAGS += -funsigned-char -CPPFLAGS += -funsigned-bitfields -CPPFLAGS += -fpack-struct -CPPFLAGS += -fshort-enums -CPPFLAGS += -fno-exceptions -CPPFLAGS += -Wall -CPPFLAGS += -Wundef -#CPPFLAGS += -mshort-calls -#CPPFLAGS += -fno-unit-at-a-time -#CPPFLAGS += -Wstrict-prototypes -#CPPFLAGS += -Wunreachable-code -#CPPFLAGS += -Wsign-compare -CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) -CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -#CPPFLAGS += $(CSTANDARD) -CPPFLAGS += -include $(CONFIG_H) - - -#---------------- Assembler Options ---------------- -# -Wa,...: tell GCC to pass this to the assembler. -# -adhlns: create listing -# -gstabs: have the assembler create line number information; note that -# for use in COFF files, additional information about filenames -# and function names needs to be present in the assembler source -# files -- see avr-libc docs [FIXME: not yet described there] -# -listing-cont-lines: Sets the maximum number of continuation lines of hex -# dump that will be displayed for a given single line of source input. -ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 -ASFLAGS += -include $(CONFIG_H) - - -#---------------- Library Options ---------------- -# Minimalistic printf version -PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min - -# Floating point printf version (requires MATH_LIB = -lm below) -PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt - -# If this is left blank, then it will use the Standard printf version. -PRINTF_LIB = -#PRINTF_LIB = $(PRINTF_LIB_MIN) -#PRINTF_LIB = $(PRINTF_LIB_FLOAT) - - -# Minimalistic scanf version -SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min - -# Floating point + %[ scanf version (requires MATH_LIB = -lm below) -SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt - -# If this is left blank, then it will use the Standard scanf version. -SCANF_LIB = -#SCANF_LIB = $(SCANF_LIB_MIN) -#SCANF_LIB = $(SCANF_LIB_FLOAT) - - -MATH_LIB = -lm - - -# List any extra directories to look for libraries here. -# Each directory must be seperated by a space. -# Use forward slashes for directory separators. -# For a directory that has spaces, enclose it in quotes. -EXTRALIBDIRS = - - - -#---------------- External Memory Options ---------------- - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# used for variables (.data/.bss) and heap (malloc()). -#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff - -# 64 KB of external RAM, starting after internal RAM (ATmega128!), -# only used for heap (malloc()). -#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff - -EXTMEMOPTS = - - - -#---------------- Linker Options ---------------- -# -Wl,...: tell GCC to pass this to linker. -# -Map: create map file -# --cref: add cross reference to map file -# -# Comennt out "--relax" option to avoid a error such: -# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12' -# -LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax -LDFLAGS += -Wl,--gc-sections -LDFLAGS += $(EXTMEMOPTS) -LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) -LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - - - -#---------------- Debugging Options ---------------- - -# For simulavr only - target MCU frequency. -DEBUG_MFREQ = $(F_CPU) - -# Set the DEBUG_UI to either gdb or insight. -# DEBUG_UI = gdb -DEBUG_UI = insight - -# Set the debugging back-end to either avarice, simulavr. -DEBUG_BACKEND = avarice -#DEBUG_BACKEND = simulavr - -# GDB Init Filename. -GDBINIT_FILE = __avr_gdbinit - -# When using avarice settings for the JTAG -JTAG_DEV = /dev/com1 - -# Debugging port used to communicate between GDB / avarice / simulavr. -DEBUG_PORT = 4242 - -# Debugging host used to communicate between GDB / avarice / simulavr, normally -# just set to localhost unless doing some sort of crazy debugging when -# avarice is running on a different computer. -DEBUG_HOST = localhost - - - -#============================================================================ - - -# Define programs and commands. -SHELL = sh -CC = avr-gcc -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump -SIZE = avr-size -AR = avr-ar rcs -NM = avr-nm -REMOVE = rm -f -REMOVEDIR = rmdir -COPY = cp -WINSHELL = cmd - - -# Define Messages -# English -MSG_ERRORS_NONE = Errors: none -MSG_BEGIN = -------- begin -------- -MSG_END = -------- end -------- -MSG_SIZE_BEFORE = Size before: -MSG_SIZE_AFTER = Size after: -MSG_COFF = Converting to AVR COFF: -MSG_EXTENDED_COFF = Converting to AVR Extended COFF: -MSG_FLASH = Creating load file for Flash: -MSG_EEPROM = Creating load file for EEPROM: -MSG_EXTENDED_LISTING = Creating Extended Listing: -MSG_SYMBOL_TABLE = Creating Symbol Table: -MSG_LINKING = Linking: -MSG_COMPILING = Compiling C: -MSG_COMPILING_CPP = Compiling C++: -MSG_ASSEMBLING = Assembling: -MSG_CLEANING = Cleaning project: -MSG_CREATING_LIBRARY = Creating library: - - - - -# Define all object files. -OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC)))) - -# Define all listing files. -LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC)))) - - -# Compiler flags to generate dependency files. -GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d - - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - - - - -# Default target. -all: begin gccversion sizebefore build sizeafter end - -# Change the build target to build a HEX file or a library. -build: elf hex eep lss sym -#build: lib - - -elf: $(TARGET).elf -hex: $(TARGET).hex -eep: $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym -LIBNAME=lib$(TARGET).a -lib: $(LIBNAME) - - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @echo - @echo $(MSG_BEGIN) - -end: - @echo $(MSG_END) - @echo - - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex -#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf -ELFSIZE = $(SIZE) $(TARGET).elf - -sizebefore: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ - 2>/dev/null; echo; fi - -sizeafter: - @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ - 2>/dev/null; echo; fi - - - -# Display compiler version information. -gccversion : - @$(CC) --version - - - -# Program the device. -program: $(TARGET).hex $(TARGET).eep - $(PROGRAM_CMD) - - -# Generate avr-gdb config/init file which does the following: -# define the reset signal, load the target file, connect to target, and set -# a breakpoint at main(). -gdb-config: - @$(REMOVE) $(GDBINIT_FILE) - @echo define reset >> $(GDBINIT_FILE) - @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) - @echo end >> $(GDBINIT_FILE) - @echo file $(TARGET).elf >> $(GDBINIT_FILE) - @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) -ifeq ($(DEBUG_BACKEND),simulavr) - @echo load >> $(GDBINIT_FILE) -endif - @echo break main >> $(GDBINIT_FILE) - -debug: gdb-config $(TARGET).elf -ifeq ($(DEBUG_BACKEND), avarice) - @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. - @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ - $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) - @$(WINSHELL) /c pause - -else - @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ - $(DEBUG_MFREQ) --port $(DEBUG_PORT) -endif - @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) - - - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT = $(OBJCOPY) --debugging -COFFCONVERT += --change-section-address .data-0x800000 -COFFCONVERT += --change-section-address .bss-0x800000 -COFFCONVERT += --change-section-address .noinit-0x800000 -COFFCONVERT += --change-section-address .eeprom-0x810000 - - - -coff: $(TARGET).elf - @echo - @echo $(MSG_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-avr $< $(TARGET).cof - - -extcoff: $(TARGET).elf - @echo - @echo $(MSG_EXTENDED_COFF) $(TARGET).cof - $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof - - - -# Create final output files (.hex, .eep) from ELF output file. -%.hex: %.elf - @echo - @echo $(MSG_FLASH) $@ - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo - @echo $(MSG_EEPROM) $@ - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 - -# Create extended listing file from ELF output file. -%.lss: %.elf - @echo - @echo $(MSG_EXTENDED_LISTING) $@ - $(OBJDUMP) -h -S -z $< > $@ - -# Create a symbol table from ELF output file. -%.sym: %.elf - @echo - @echo $(MSG_SYMBOL_TABLE) $@ - $(NM) -n $< > $@ - - - -# Create library from object files. -.SECONDARY : $(TARGET).a -.PRECIOUS : $(OBJ) -%.a: $(OBJ) - @echo - @echo $(MSG_CREATING_LIBRARY) $@ - $(AR) $@ $(OBJ) - - -# Link: create ELF output file from object files. -.SECONDARY : $(TARGET).elf -.PRECIOUS : $(OBJ) -%.elf: $(OBJ) - @echo - @echo $(MSG_LINKING) $@ - $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) - - -# Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c - @echo - @echo $(MSG_COMPILING) $< - $(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp - @echo - @echo $(MSG_COMPILING_CPP) $< - $(CC) -c $(ALL_CPPFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -%.s : %.c - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C++ source files. -%.s : %.cpp - $(CC) -S $(ALL_CPPFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S - @echo - @echo $(MSG_ASSEMBLING) $< - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - -# Create preprocessed source for use in sending a bug report. -%.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ - - -# Target: clean project. -clean: begin clean_list end - -clean_list : - @echo - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss - $(REMOVE) $(OBJ) - $(REMOVE) $(LST) - $(REMOVE) $(OBJ:.o=.s) - $(REMOVE) $(OBJ:.o=.i) - $(REMOVE) -r .dep - $(REMOVEDIR) $(OBJDIR) - - -# Create object files directory -$(shell mkdir $(OBJDIR) 2>/dev/null) - - -# Include the dependency files. --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - - -# Listing of phony targets. -.PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff \ -clean clean_list program debug gdb-config - diff --git a/Makefile.vusb b/Makefile.vusb deleted file mode 100644 index b8e71a8e36..0000000000 --- a/Makefile.vusb +++ /dev/null @@ -1,11 +0,0 @@ -OPT_DEFS += -DHOST_VUSB - -SRC = usbdrv.c \ - usbdrvasm.S \ - oddebug.c \ - sendchar_usart.c -SRC += $(TARGET_SRC) - - -# C source file search path -VPATH = $(TARGET_DIR):$(COMMON_DIR):$(COMMON_DIR)/vusb:$(COMMON_DIR)/vusb/usbdrv diff --git a/POWER.txt b/POWER.txt new file mode 100644 index 0000000000..0abbbe48e8 --- /dev/null +++ b/POWER.txt @@ -0,0 +1,62 @@ +Time to Sleep +============= +USB suspend no activity on USB line for 3ms +No Interaction no user interaction + matrix has no change + matrix has no switch on + + +AVR Power Management +==================== + +V-USB suspend + USB suspend + http://vusb.wikidot.com/examples + +MCUSR MCU Status Register + WDRF Watchdog Reset Flag + BORF + EXTRF + PORF Power-on Reset Flag + +SMCR Sleep Mode Control Register + SE Sleep Enable + SM2:0 + #define set_sleep_mode(mode) \ + #define SLEEP_MODE_IDLE (0) + #define SLEEP_MODE_ADC _BV(SM0) + #define SLEEP_MODE_PWR_DOWN _BV(SM1) + #define SLEEP_MODE_PWR_SAVE (_BV(SM0) | _BV(SM1)) + #define SLEEP_MODE_STANDBY (_BV(SM1) | _BV(SM2)) + #define SLEEP_MODE_EXT_STANDBY (_BV(SM0) | _BV(SM1) | _BV(SM2)) + + +ACSR Analog Comparator Control and Status Register + To disable Analog Comparator + ACSR = 0x80; + or + ACSR &= ~_BV(ACIE); + ACSR |= _BV(ACD); + + ACD: Analog Comparator Disable + When this bit is written logic one, the power to the Analog Comparator is + switched off. This bit can be set at any time to turn off the Analog + Comparator. This will reduce power consumption in Active and Idle mode. + When changing the ACD bit, the Analog Comparator Interrupt must be disabled + by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when + the bit is changed. + +DIDR1 Digital Input Disable Register 1 + AIN1D + AIN0D + When this bit is written logic one, the digital input buffer on the AIN1/0 pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer. + + +PRR Power Reduction Register + PRTWI + PRTIM2 + PRTIM0 + PRTIM1 + PRSPI + PRUSART0 + PRADC diff --git a/README b/README index 2aa0106b06..d85f512c71 100644 --- a/README +++ b/README @@ -96,8 +96,8 @@ Build Options 3. Choose optional modules as needed. Comment out to disable optional modules. MOUSEKEY_ENABLE = yes # Mouse keys PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support - USB_EXTRA_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) - USB_NKRO_ENABLE = yes # USB Nkey Rollover + EXTRAKEY_ENABLE = yes # Enhanced feature for Windows(Audio control and System control) + NKRO_ENABLE = yes # USB Nkey Rollover /config.h: 1. USB vendor/product ID and device description diff --git a/adb_usb/Makefile b/adb_usb/Makefile index 802b4248cb..56b342df94 100644 --- a/adb_usb/Makefile +++ b/adb_usb/Makefile @@ -8,11 +8,11 @@ COMMON_DIR = .. TARGET_DIR = . # keyboard dependent files -TARGET_SRC = main_pjrc.c \ - keymap.c \ - matrix.c \ - led.c \ - adb.c +SRC = main.c \ + keymap.c \ + matrix.c \ + led.c \ + adb.c CONFIG_H = config.h @@ -36,10 +36,10 @@ F_CPU = 16000000 # Build Options # comment out to disable the options. # -MOUSEKEY_ENABLE = yes # Mouse keys +#MOUSEKEY_ENABLE = yes # Mouse keys #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support -USB_EXTRA_ENABLE = yes # Audio control and System control -#USB_NKRO_ENABLE = yes # USB Nkey Rollover +#EXTRAKEY_ENABLE = yes # Audio control and System control +#NKRO_ENABLE = yes # USB Nkey Rollover @@ -48,5 +48,5 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -include $(COMMON_DIR)/Makefile.pjrc -include $(COMMON_DIR)/Makefile.common +include $(COMMON_DIR)/pjrc.mk +include $(COMMON_DIR)/common.mk diff --git a/adb_usb/README b/adb_usb/README index b4bd35bb33..5d0e1bc86b 100644 --- a/adb_usb/README +++ b/adb_usb/README @@ -59,4 +59,12 @@ effort at this time. ), +Notes +----- +Many ADB keyboards has no discrimination between right modifier and left one, +you will always see left control even if you press right control key. +Apple Extended Keyboard and Apple Extended Keyboard II are the examples. +Though ADB protocol itsef has the ability of distinction between right and left. +And most ADB keyboard has no NKRO functionality, though ADB protocol itsef has that. + EOF diff --git a/adb_usb/config.h b/adb_usb/config.h index 27f31ca9e9..6431ede4cf 100644 --- a/adb_usb/config.h +++ b/adb_usb/config.h @@ -37,8 +37,8 @@ along with this program. If not, see . /* key combination for command */ #define IS_COMMAND() ( \ - keyboard_report->mods == (BIT_LSHIFT | BIT_LCTRL | BIT_LALT | BIT_LGUI) || \ - keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) \ + keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_LCTRL) | MOD_BIT(KB_LALT) | MOD_BIT(KB_LGUI)) || \ + keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)) \ ) diff --git a/command.c b/command.c index 0a07aebfc1..22f25e99c0 100644 --- a/command.c +++ b/command.c @@ -30,24 +30,49 @@ along with this program. If not, see . #ifdef HOST_PJRC # include "jump_bootloader.h" # include "usb_keyboard.h" -# ifdef USB_EXTRA_ENABLE +# ifdef EXTRAKEY_ENABLE # include "usb_extra.h" # endif #endif +#ifdef HOST_VUSB +# include "usbdrv.h" +#endif + +static uint8_t command_common(void); static void help(void); static void switch_layer(uint8_t layer); +static bool last_print_enable; uint8_t command_proc(void) { + uint8_t processed = 0; + last_print_enable = print_enable; + if (!IS_COMMAND()) return 0; - uint8_t processed = 1; - bool last_print_enable = print_enable; print_enable = true; + if (command_extra() || command_common()) { + processed = 1; + _delay_ms(500); + } + print_enable = last_print_enable; + return processed; +} + +/* This allows to define extra commands. return 0 when not processed. */ +uint8_t command_extra(void) __attribute__ ((weak)); +uint8_t command_extra(void) +{ + return 0; +} + + +static uint8_t command_common(void) +{ switch (host_get_first_key()) { case KB_H: help(); @@ -122,21 +147,27 @@ uint8_t command_proc(void) print("usb_keyboard_protocol: "); phex(usb_keyboard_protocol); print("\n"); print("usb_keyboard_idle_config:"); phex(usb_keyboard_idle_config); print("\n"); print("usb_keyboard_idle_count:"); phex(usb_keyboard_idle_count); print("\n"); +#endif + +#ifdef HOST_VUSB +# if USB_COUNT_SOF + print("usbSofCount: "); phex(usbSofCount); print("\n"); +# endif #endif break; -#ifdef USB_NKRO_ENABLE +#ifdef NKRO_ENABLE case KB_N: // send empty report before change host_clear_keyboard_report(); host_send_keyboard_report(); keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) - print("USB_NKRO: enabled\n"); + print("NKRO: enabled\n"); else - print("USB_NKRO: disabled\n"); + print("NKRO: disabled\n"); break; #endif -#ifdef USB_EXTRA_ENABLE +#ifdef EXTRAKEY_ENABLE case KB_ESC: host_clear_keyboard_report(); host_send_keyboard_report(); @@ -175,12 +206,9 @@ uint8_t command_proc(void) switch_layer(4); break; default: - processed = 0; + return 0; } - if (processed) - _delay_ms(500); - print_enable = last_print_enable; - return processed; + return 1; } static void help(void) @@ -194,8 +222,8 @@ static void help(void) print("v: print version\n"); print("t: print timer count\n"); print("s: print status\n"); -#ifdef USB_NKRO_ENABLE - print("n: toggle USB_NKRO\n"); +#ifdef NKRO_ENABLE + print("n: toggle NKRO\n"); #endif print("Backspace: clear matrix\n"); print("ESC: power down/wake up\n"); diff --git a/command.h b/command.h index dca6da456b..4888f5ee0b 100644 --- a/command.h +++ b/command.h @@ -19,5 +19,7 @@ along with this program. If not, see . #define COMMAND uint8_t command_proc(void); +/* This allows to extend commands. Return 0 when command is not processed. */ +uint8_t command_extra(void); #endif diff --git a/common.mk b/common.mk new file mode 100644 index 0000000000..17c6816f6c --- /dev/null +++ b/common.mk @@ -0,0 +1,38 @@ +SRC += host.c \ + keyboard.c \ + command.c \ + layer.c \ + timer.c \ + print.c \ + util.c + + +# Option modules +ifdef MOUSEKEY_ENABLE + SRC += mousekey.c + OPT_DEFS += -DMOUSEKEY_ENABLE +endif + +ifdef PS2_MOUSE_ENABLE + SRC += ps2.c \ + ps2_mouse.c + OPT_DEFS += -DPS2_MOUSE_ENABLE +endif + +ifdef EXTRAKEY_ENABLE + OPT_DEFS += -DEXTRAKEY_ENABLE +endif + +ifdef NKRO_ENABLE + OPT_DEFS += -DNKRO_ENABLE +endif + +ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) + OPT_DEFS += -DMOUSE_ENABLE +endif + +# Search Path +VPATH += $(COMMON_DIR) + + +include $(COMMON_DIR)/rules.mk diff --git a/hhkb/FUSE.txt b/hhkb/FUSE.txt new file mode 100644 index 0000000000..40055e5ab1 --- /dev/null +++ b/hhkb/FUSE.txt @@ -0,0 +1,40 @@ +ATMega168P Fuse/Lock Bits +========================= +This configuration is from usbasploader's Makefile. + + HFUSE 0xD6 + LFUSE 0xDF + EFUSE 0x00 + LOCK 0x3F(intact) + +#--------------------------------------------------------------------- +# ATMega168P +#--------------------------------------------------------------------- +# Fuse extended byte: +# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800) +# \+/ +# +------- BOOTSZ (00 = 2k bytes) +# Fuse high byte: +# 0xd6 = 1 1 0 1 0 1 1 0 +# ^ ^ ^ ^ ^ \-+-/ +# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) +# | | | | + --------- EESAVE (preserve EEPROM over chip erase) +# | | | +-------------- WDTON (if 0: watchdog always on) +# | | +---------------- SPIEN (allow serial programming) +# | +------------------ DWEN (debug wire enable) +# +-------------------- RSTDISBL (reset pin is enabled) +# Fuse low byte: +# 0xdf = 1 1 0 1 1 1 1 1 +# ^ ^ \ / \--+--/ +# | | | +------- CKSEL 3..0 (external >8M crystal) +# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) +# | +------------------ CKOUT (if 0: Clock output enabled) +# +-------------------- CKDIV8 (if 0: divide by 8) + + +# Lock Bits +# 0x3f = - - 1 1 1 1 1 1 +# \ / \-/ \-/ +# | | +----- LB 2..1 (No memory lock features enabled) +# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section) +# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section) diff --git a/hhkb/Makefile b/hhkb/Makefile deleted file mode 100644 index e1cc2f2106..0000000000 --- a/hhkb/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# -# Makefile for PJRC Teensy -# - - -# Target file name (without extension). -TARGET = hhkb_pjrc - -# Directory common source filess exist -COMMON_DIR = .. - -# Directory keyboard dependent files exist -TARGET_DIR = . - -# keyboard dependent files -TARGET_SRC = main_pjrc.c \ - keymap.c \ - matrix.c \ - led.c - -CONFIG_H = config_pjrc.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 - - -# Build Options -# comment out to disable the options. -MOUSEKEY_ENABLE = yes # Mouse keys -#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support -USB_EXTRA_ENABLE = yes # Audio control and System control -USB_NKRO_ENABLE = yes # USB Nkey Rollover - - - -#---------------- Programming Options -------------------------- -PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex - - - -include $(COMMON_DIR)/Makefile.pjrc -include $(COMMON_DIR)/Makefile.common diff --git a/hhkb/Makefile.iwrap b/hhkb/Makefile.iwrap new file mode 100644 index 0000000000..cf020b94aa --- /dev/null +++ b/hhkb/Makefile.iwrap @@ -0,0 +1,91 @@ +# +# Makefile for iWRAP +# + + +# Target file name (without extension). +TARGET = hhkb_iwrap + +# Directory common source filess exist +COMMON_DIR = .. + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = main.c \ + keymap.c \ + matrix.c \ + led.c + +CONFIG_H = config_iwrap.h + + +# V-USB debug level: To use ps2_usart.c level must be 0 +# ps2_usart.c requires USART to receive PS/2 signal. +OPT_DEFS = -DDEBUG_LEVEL=0 + + +# 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 = atmega168p +# avrdude doesn't know atmega168p +AVRDUDE_MCU = atmega168 + + +# 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 = 12000000 + + +# 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 + + + +#---------------- Programming Options -------------------------- +AVRDUDE = avrdude +# Type: avrdude -c ? to get a full listing. +AVRDUDE_PROGRAMMER = usbasp +AVRDUDE_PORT = +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +#AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + +PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + +# Search Path +VPATH = $(TARGET_DIR) + +include $(COMMON_DIR)/iwrap.mk +# To be swatchable btween Bluetooth and USB. Comment out if you don't need USB. +include $(COMMON_DIR)/vusb.mk +include $(COMMON_DIR)/common.mk diff --git a/hhkb/Makefile.pjrc b/hhkb/Makefile.pjrc new file mode 100644 index 0000000000..17aa865ddc --- /dev/null +++ b/hhkb/Makefile.pjrc @@ -0,0 +1,58 @@ +# +# Makefile for PJRC Teensy +# + + +# Target file name (without extension). +TARGET = hhkb_pjrc + +# Directory common source filess exist +COMMON_DIR = .. + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = main.c \ + keymap.c \ + matrix.c \ + led.c + +CONFIG_H = config_pjrc.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 + + +# Build Options +# comment out to disable the options. +MOUSEKEY_ENABLE = yes # Mouse keys +#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support +EXTRAKEY_ENABLE = yes # Audio control and System control +NKRO_ENABLE = yes # USB Nkey Rollover + + + +#---------------- Programming Options -------------------------- +PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + + + +# Search Path +VPATH = $(TARGET_DIR) + +include $(COMMON_DIR)/pjrc.mk +include $(COMMON_DIR)/common.mk diff --git a/hhkb/Makefile.vusb b/hhkb/Makefile.vusb index 77841b824c..5bfc233df8 100644 --- a/hhkb/Makefile.vusb +++ b/hhkb/Makefile.vusb @@ -13,10 +13,10 @@ COMMON_DIR = .. TARGET_DIR = . # keyboard dependent files -TARGET_SRC = main_vusb.c \ - keymap.c \ - matrix.c \ - led.c +SRC = main.c \ + keymap.c \ + matrix.c \ + led.c CONFIG_H = config_vusb.h @@ -28,7 +28,9 @@ OPT_DEFS = -DDEBUG_LEVEL=0 # 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 = atmega168 +MCU = atmega168p +# avrdude doesn't know atmega168p +AVRDUDE_MCU = atmega168 # Processor frequency. @@ -36,15 +38,15 @@ MCU = atmega168 # 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 = 20000000 +F_CPU = 12000000 # Build Options # comment out to disable the options. # MOUSEKEY_ENABLE = yes # Mouse keys -USB_EXTRA_ENABLE = yes # Audio control and System control -#USB_NKRO_ENABLE = yes # USB Nkey Rollover +EXTRAKEY_ENABLE = yes # Audio control and System control +#NKRO_ENABLE = yes # USB Nkey Rollover @@ -70,8 +72,8 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex # to submit bug reports. #AVRDUDE_VERBOSE = -v -v -#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) +#AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER) AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) @@ -80,5 +82,8 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE -include $(COMMON_DIR)/Makefile.vusb -include $(COMMON_DIR)/Makefile.common +# Search Path +VPATH = $(TARGET_DIR) + +include $(COMMON_DIR)/vusb.mk +include $(COMMON_DIR)/common.mk diff --git a/hhkb/README b/hhkb/README index 2a44181016..65f7dcab5a 100644 --- a/hhkb/README +++ b/hhkb/README @@ -4,7 +4,7 @@ Alternative Controller for HHKB Feature ------- - Mouse Keys -- NKRO on USB +- NKRO on USB(PJRC Tennsy only) - Keymap Layers @@ -13,8 +13,11 @@ Customize Keymap see keymap.c. -Build for Teensy ----------------- + +Build +===== +PJRC Teensy +----------- 0. Edit matrix.c. adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts) 1. Define macros in config_pjrc.h.(Optional) @@ -22,15 +25,15 @@ Build for Teensy IS_COMMAND 2. Edit Makefile for MCU setting and build options. MCU, F_CPU - MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE + MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, NKRO_ENABLE 3. Build hex file. - $ make + $ make -f Makefile.pjrc 4. Program MCU. - $ make program + $ make -f Makefile.pjrc program -Build for V-USB ---------------- +V-USB +----- 0. Edit matrix.c and usbconfig.h. adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts) define macros for V-USB in usbconfig.h. @@ -38,7 +41,7 @@ Build for V-USB IS_COMMAND 2. Edit Makefile.vusb for MCU setting and build options. MCU, F_CPU - MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE + MOUSEKEY_ENABLE, EXTRAKEY_ENABLE 3. Build hex file. $ make -f Makefile.vusb 4. Program MCU. @@ -52,21 +55,59 @@ Build for V-USB http://www.obdev.at/products/vusb/usbasploader.html -V-USB Circuit -------------- +iWRAP +----- +0. Edit matrix.c and usbconfig.h. + adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts) + define macros for V-USB in usbconfig.h. +1. Define macros in config_iwrap.h.(Optional) + IS_COMMAND +2. Edit Makefile.iwrap for MCU setting and build options. + MCU, F_CPU + MOUSEKEY_ENABLE, EXTRAKEY_ENABLE +3. Build hex file. + $ make -f Makefile.iwrap +4. Program MCU. + $ make -f Makefile.iwrap program + + + +Hardware +======== +PJRC Teensy +----------- + +---------------+ + | Teensy++ | + | | + | | HHKB + | | ~~~~ + | PB0-2|------->ROW(6-8) + | PB3-5|------->COL(9-11) + | PB6|------->ENABLE(12) + | PE6|<-------KEY(4) + | PE7|------->PREV(5) + | | + | | + | | + +---------------+ + + +V-USB +----- +---+ +---------------+ USB GND | | ATmega168 | -=== C3 | | +~~~ C3 | | 5V <-------+--------+---|Vcc,AVCC | HHKB - R1 | | ==== -D- <----+--+-----R2-----|INT1 PB0-2|------->ROW -D+ <----|---+----R3-----|INT0 PB3-5|------->COL - Z1 Z2 | PB6|------->ENABLE -GND<----+---+--+--+-----|GND PE6|------->KEY - | | | PE7|------->PREV - | C2-+--|XTAL1 | (see doc/HHKB.txt for pinouts) - | X1 | | - +--C3-+--|XTAL2 RST|---SW--+GND + R1 | | ~~~~ +D- <----+--+-----R2-----|INT1 PB2-4|------->ROW(6-8) +D+ <----|---+----R3-----|INT0 PC0-2|------->COL(9-11) + Z1 Z2 | PC3|------->ENABLE(12) +GND<----+---+-----------|GND PB0|<-------KEY(4) + | PB1|------->PREV(5) + | | + GND+-C2--+--|XTAL1 RXD|------->Debug Console + X1 | TXD|<-------Debug Console + GND+-C3--+--|XTAL2 RST|---SW--+GND +---------------+ R1: 1.5K Ohm R2,R3: 68 Ohm @@ -77,4 +118,34 @@ X1: Crystal 20MHz(16MHz/12MHz) SW: Push Switch(Optional for bootloader) +iWRAP +----- + +---------------+ WT12 + 5V | ATmega168 | 5V/3.3V~~~~ + +-----+---|Vcc,AVCC PC4|---/--->iWRAP(RxD) +USB | C3 | PC5|<--/----iWRAP(TxD) +~~~ | + | | +5V <--BATT + GND | | HHKB + R1 | | ~~~~ +D- <----+-----+--R2-----|INT1 PB2-4|------->ROW(6-8) +D+ <----|---+----R3-----|INT0 PC0-2|------->COL(9-11) + Z1 Z2 | PC3|------->ENABLE(12) +GND<----+---+-----------|GND PB0|<-------KEY(4) + | PB1|------->PREV(5) + | | + GND+-C2--+--|XTAL1 RXD|------->Debug Console + X1 | TXD|<-------Debug Console + GND+-C3--+--|XTAL2 RST|---SW--+GND + +---------------+ + +R1: 1.5K Ohm +R2,R3: 68 Ohm +Z1,Z2: Zener 3.6V +C1,C2: 22pF +C3: 0.1uF +X1: Crystal 12MHz +SW: Push Switch(Optional) +BATT: Li-Po Battery, Battery Charger and Voltage Regulator(5V and 3.3V). + + EOF diff --git a/hhkb/config_iwrap.h b/hhkb/config_iwrap.h new file mode 100644 index 0000000000..80ab64398b --- /dev/null +++ b/hhkb/config_iwrap.h @@ -0,0 +1,55 @@ +/* +Copyright 2011 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xBEEA +// TODO: share these strings with usbconfig.h +// Edit usbconfig.h to change these. +#define MANUFACTURER t.m.k. +#define PRODUCT HHKB mod +#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod + + +/* matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 8 + + +/* key combination for command */ +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) + +/* mouse keys */ +#ifdef MOUSEKEY_ENABLE +# define MOUSEKEY_DELAY_TIME 255 +#endif + +/* pins for Software UART */ +#define SUART_IN_PIN PINC +#define SUART_IN_BIT 5 +#define SUART_OUT_PORT PORTC +#define SUART_OUT_BIT 4 + + +#define DEBUG_LED 1 +#define DEBUG_LED_CONFIG (DDRD |= (1<<4)) +#define DEBUG_LED_OFF (PORTD |= (1<<4)) +#define DEBUG_LED_ON (PORTD &= ~(1<<4)) + +#endif diff --git a/hhkb/config_pjrc.h b/hhkb/config_pjrc.h index ef2efe2d93..8379202ca8 100644 --- a/hhkb/config_pjrc.h +++ b/hhkb/config_pjrc.h @@ -36,11 +36,7 @@ along with this program. If not, see . /* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \ - keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \ -) - +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) /* mouse keys */ #ifdef MOUSEKEY_ENABLE diff --git a/hhkb/config_vusb.h b/hhkb/config_vusb.h index 115b73de30..268644849e 100644 --- a/hhkb/config_vusb.h +++ b/hhkb/config_vusb.h @@ -18,7 +18,6 @@ along with this program. If not, see . #ifndef CONFIG_H #define CONFIG_H - #define VENDOR_ID 0xFEED #define PRODUCT_ID 0xC0FE // TODO: share these strings with usbconfig.h @@ -34,11 +33,7 @@ along with this program. If not, see . /* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \ - keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \ -) - +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) /* mouse keys */ #ifdef MOUSEKEY_ENABLE @@ -46,4 +41,9 @@ along with this program. If not, see . #endif +#define DEBUG_LED 1 +#define DEBUG_LED_CONFIG (DDRD |= (1<<4)) +#define DEBUG_LED_OFF (PORTD |= (1<<4)) +#define DEBUG_LED_ON (PORTD &= ~(1<<4)) + #endif diff --git a/hhkb/doc/Bluetooth.txt b/hhkb/doc/Bluetooth.txt new file mode 100644 index 0000000000..b27f197006 --- /dev/null +++ b/hhkb/doc/Bluetooth.txt @@ -0,0 +1,4 @@ +HHKB Bluetooth mod +================== +See this article: +http://geekhack.org/showwiki.php?title=Island:20851 diff --git a/hhkb/doc/Bluetooth_img/.picasa.ini b/hhkb/doc/Bluetooth_img/.picasa.ini new file mode 100755 index 0000000000..f6a4f60674 --- /dev/null +++ b/hhkb/doc/Bluetooth_img/.picasa.ini @@ -0,0 +1,2 @@ +[Picasa] +name=Bluetooth_img diff --git a/hhkb/doc/Bluetooth_img/BT_circuit.jpg b/hhkb/doc/Bluetooth_img/BT_circuit.jpg new file mode 100755 index 0000000000..2e5a25e81e Binary files /dev/null and b/hhkb/doc/Bluetooth_img/BT_circuit.jpg differ diff --git a/hhkb/doc/HHKB_TP1684.jpg b/hhkb/doc/HHKB_TP1684.jpg deleted file mode 100644 index 0a03164094..0000000000 Binary files a/hhkb/doc/HHKB_TP1684.jpg and /dev/null differ diff --git a/hhkb/doc/HHKB_chart1.jpg b/hhkb/doc/HHKB_chart1.jpg deleted file mode 100644 index 1f09bd185c..0000000000 Binary files a/hhkb/doc/HHKB_chart1.jpg and /dev/null differ diff --git a/hhkb/doc/HHKB_chart2.jpg b/hhkb/doc/HHKB_chart2.jpg deleted file mode 100644 index 45f5ada905..0000000000 Binary files a/hhkb/doc/HHKB_chart2.jpg and /dev/null differ diff --git a/hhkb/doc/HHKB_connector.jpg b/hhkb/doc/HHKB_connector.jpg deleted file mode 100644 index e8a09e9b28..0000000000 Binary files a/hhkb/doc/HHKB_connector.jpg and /dev/null differ diff --git a/hhkb/doc/HHKB_controller.jpg b/hhkb/doc/HHKB_controller.jpg deleted file mode 100644 index e3dae8e86c..0000000000 Binary files a/hhkb/doc/HHKB_controller.jpg and /dev/null differ diff --git a/hhkb/doc/HHKB_img/HHKB_TP1684.jpg b/hhkb/doc/HHKB_img/HHKB_TP1684.jpg new file mode 100644 index 0000000000..0a03164094 Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_TP1684.jpg differ diff --git a/hhkb/doc/HHKB_img/HHKB_chart1.jpg b/hhkb/doc/HHKB_img/HHKB_chart1.jpg new file mode 100644 index 0000000000..1f09bd185c Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_chart1.jpg differ diff --git a/hhkb/doc/HHKB_img/HHKB_chart2.jpg b/hhkb/doc/HHKB_img/HHKB_chart2.jpg new file mode 100644 index 0000000000..45f5ada905 Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_chart2.jpg differ diff --git a/hhkb/doc/HHKB_img/HHKB_connector.jpg b/hhkb/doc/HHKB_img/HHKB_connector.jpg new file mode 100644 index 0000000000..e8a09e9b28 Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_connector.jpg differ diff --git a/hhkb/doc/HHKB_img/HHKB_controller.jpg b/hhkb/doc/HHKB_img/HHKB_controller.jpg new file mode 100644 index 0000000000..e3dae8e86c Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_controller.jpg differ diff --git a/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg b/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg new file mode 100644 index 0000000000..3afc269e7b Binary files /dev/null and b/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg differ diff --git a/hhkb/doc/HHKB_img/connector_contact.jpg b/hhkb/doc/HHKB_img/connector_contact.jpg new file mode 100644 index 0000000000..5304bc8d7e Binary files /dev/null and b/hhkb/doc/HHKB_img/connector_contact.jpg differ diff --git a/hhkb/doc/HHKB_img/logic_analyzer.jpg b/hhkb/doc/HHKB_img/logic_analyzer.jpg new file mode 100644 index 0000000000..f1b438ae77 Binary files /dev/null and b/hhkb/doc/HHKB_img/logic_analyzer.jpg differ diff --git a/hhkb/doc/HHKB_img/probe_contact.jpg b/hhkb/doc/HHKB_img/probe_contact.jpg new file mode 100644 index 0000000000..dc79afa0cc Binary files /dev/null and b/hhkb/doc/HHKB_img/probe_contact.jpg differ diff --git a/hhkb/doc/HHKB_img/teensy_install.jpg b/hhkb/doc/HHKB_img/teensy_install.jpg new file mode 100644 index 0000000000..873d988edb Binary files /dev/null and b/hhkb/doc/HHKB_img/teensy_install.jpg differ diff --git a/hhkb/doc/HHKB_img/teensy_wiring.jpg b/hhkb/doc/HHKB_img/teensy_wiring.jpg new file mode 100644 index 0000000000..1c4eb67434 Binary files /dev/null and b/hhkb/doc/HHKB_img/teensy_wiring.jpg differ diff --git a/hhkb/doc/HHKB_keyswitch.jpg b/hhkb/doc/HHKB_keyswitch.jpg deleted file mode 100644 index 3afc269e7b..0000000000 Binary files a/hhkb/doc/HHKB_keyswitch.jpg and /dev/null differ diff --git a/hhkb/doc/connector_contact.jpg b/hhkb/doc/connector_contact.jpg deleted file mode 100644 index 5304bc8d7e..0000000000 Binary files a/hhkb/doc/connector_contact.jpg and /dev/null differ diff --git a/hhkb/doc/logic_analyzer.jpg b/hhkb/doc/logic_analyzer.jpg deleted file mode 100644 index f1b438ae77..0000000000 Binary files a/hhkb/doc/logic_analyzer.jpg and /dev/null differ diff --git a/hhkb/doc/probe_contact.jpg b/hhkb/doc/probe_contact.jpg deleted file mode 100644 index dc79afa0cc..0000000000 Binary files a/hhkb/doc/probe_contact.jpg and /dev/null differ diff --git a/hhkb/doc/teensy_install.jpg b/hhkb/doc/teensy_install.jpg deleted file mode 100644 index 873d988edb..0000000000 Binary files a/hhkb/doc/teensy_install.jpg and /dev/null differ diff --git a/hhkb/doc/teensy_wiring.jpg b/hhkb/doc/teensy_wiring.jpg deleted file mode 100644 index 1c4eb67434..0000000000 Binary files a/hhkb/doc/teensy_wiring.jpg and /dev/null differ diff --git a/hhkb/keymap.c b/hhkb/keymap.c index f539a06ccb..85a7c31b7e 100644 --- a/hhkb/keymap.c +++ b/hhkb/keymap.c @@ -32,21 +32,21 @@ along with this program. If not, see . // Convert physical keyboard layout to matrix array. // This is a macro to define keymap easily in keyboard layout form. #define KEYMAP( \ - R3C1, R3C0, R0C0, R1C0, R1C1, R2C0, R2C1, R4C0, R4C1, R6C0, R6C1, R7C0, R7C1, R5C0, R5C1, \ - R3C2, R0C1, R0C2, R1C3, R1C2, R2C3, R2C2, R4C2, R4C3, R6C2, R6C3, R7C3, R7C2, R5C2, \ - R3C3, R0C4, R0C3, R1C4, R1C5, R2C4, R2C5, R4C5, R4C4, R6C5, R6C4, R7C4, R5C3, \ - R3C4, R0C5, R0C6, R0C7, R1C6, R1C7, R2C6, R4C6, R6C6, R7C6, R7C5, R5C5, R5C4, \ - R3C5, R3C6, R3C7, R5C7, R5C6 \ + K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ + K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ + K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \ + K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \ + K35, K36, K37, K57, K56 \ ) \ { \ - { R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7 }, \ - { R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7 }, \ - { R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, KB_NO }, \ - { R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7 }, \ - { R4C0, R4C1, R4C2, R4C3, R4C4, R4C5, R4C6, KB_NO }, \ - { R5C0, R5C1, R5C2, R5C3, R5C4, R5C5, R5C6, R5C7 }, \ - { R6C0, R6C1, R6C2, R6C3, R6C4, R6C5, R6C6, KB_NO }, \ - { R7C0, R7C1, R7C2, R7C3, R7C4, R7C5, R7C6, KB_NO } \ + { KB_##K00, KB_##K01, KB_##K02, KB_##K03, KB_##K04, KB_##K05, KB_##K06, KB_##K07 }, \ + { KB_##K10, KB_##K11, KB_##K12, KB_##K13, KB_##K14, KB_##K15, KB_##K16, KB_##K17 }, \ + { KB_##K20, KB_##K21, KB_##K22, KB_##K23, KB_##K24, KB_##K25, KB_##K26, KB_NO }, \ + { KB_##K30, KB_##K31, KB_##K32, KB_##K33, KB_##K34, KB_##K35, KB_##K36, KB_##K37 }, \ + { KB_##K40, KB_##K41, KB_##K42, KB_##K43, KB_##K44, KB_##K45, KB_##K46, KB_NO }, \ + { KB_##K50, KB_##K51, KB_##K52, KB_##K53, KB_##K54, KB_##K55, KB_##K56, KB_##K57 }, \ + { KB_##K60, KB_##K61, KB_##K62, KB_##K63, KB_##K64, KB_##K65, KB_##K66, KB_NO }, \ + { KB_##K70, KB_##K71, KB_##K72, KB_##K73, KB_##K74, KB_##K75, KB_##K76, KB_NO } \ } #define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) @@ -58,8 +58,8 @@ static const uint8_t PROGMEM fn_layer[] = { 1, // Fn1 2, // Fn2 3, // Fn3 - 4, // Fn4 - 0, // Fn5 + 3, // Fn4 + 4, // Fn5 0, // Fn6 0 // Fn7 }; @@ -71,8 +71,8 @@ static const uint8_t PROGMEM fn_keycode[] = { KB_NO, // Fn1 KB_SLSH, // Fn2 KB_SCLN, // Fn3 - KB_SPC, // Fn4 - KB_NO, // Fn5 + KB_NO, // Fn4 + KB_SPC, // Fn5 KB_NO, // Fn6 KB_NO // Fn7 }; @@ -91,11 +91,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Gui|Alt |Fn5 |Alt |Fn4| * `-------------------------------------------' */ - KEYMAP(KB_ESC, KB_1, KB_2, KB_3, KB_4, KB_5, KB_6, KB_7, KB_8, KB_9, KB_0, KB_MINS,KB_EQL, KB_BSLS,KB_GRV, \ - KB_TAB, KB_Q, KB_W, KB_E, KB_R, KB_T, KB_Y, KB_U, KB_I, KB_O, KB_P, KB_LBRC,KB_RBRC,KB_BSPC, \ - KB_LCTL,KB_A, KB_S, KB_D, KB_F, KB_G, KB_H, KB_J, KB_K, KB_L, KB_FN3, KB_QUOT,KB_ENT, \ - KB_LSFT,KB_Z, KB_X, KB_C, KB_V, KB_B, KB_N, KB_M, KB_COMM,KB_DOT, KB_FN2, KB_RSFT,KB_FN1, \ - KB_LGUI,KB_LALT,KB_FN4, KB_RALT,KB_RGUI), + KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ + LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \ + LGUI,LALT, FN5, RALT,FN4), /* Layer 1: HHKB mode (HHKB Fn) * ,-----------------------------------------------------------. @@ -110,11 +110,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Gui |Alt |Space |Alt |xxx| * `--------------------------------------------' */ - KEYMAP(KB_ESC, KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, KB_INS, KB_DEL, \ - KB_CAPS,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_PSCR,KB_SLCK,KB_BRK, KB_UP, KB_NO, KB_BSPC, \ - KB_LCTL,KB_VOLD,KB_VOLU,KB_MUTE,KB_NO, KB_NO, KB_PAST,KB_PSLS,KB_HOME,KB_PGUP,KB_LEFT,KB_RGHT,KB_ENT, \ - KB_LSFT,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_PPLS,KB_PMNS,KB_END, KB_PGDN,KB_DOWN,KB_RSFT,KB_FN1, \ - KB_LGUI,KB_LALT,KB_SPC, KB_RALT,KB_FN7), + KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,BRK, UP, NO, BSPC, \ + LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \ + LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,FN1, \ + LGUI,LALT, SPC, RALT,FN7), /* Layer 2: Vi mode (Slash) * ,-----------------------------------------------------------. @@ -129,11 +129,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COL