Эх сурвалжийг харах

Merge pull request #34 from jackhumbert/tmk-master

merging from tmk, new_project script and template
Jack Humbert 10 жил өмнө
parent
commit
d311fd8d1a
100 өөрчлөгдсөн 2575 нэмэгдсэн , 963 устгасан
  1. 0 6
      .gitmodules
  2. 29 81
      README.md
  3. 10 6
      converter/adb_usb/Makefile
  4. 10 6
      converter/adb_usb/Makefile.pjrc
  5. 56 49
      converter/adb_usb/README.md
  6. 1 1
      converter/adb_usb/keymap_ansi.c
  7. 2 2
      converter/adb_usb/keymap_hasu.c
  8. 1 1
      converter/adb_usb/keymap_iso.c
  9. 61 0
      converter/adb_usb/matrix.c
  10. 6 6
      converter/ascii_usb/Makefile
  11. 6 6
      converter/ibm4704_usb/Makefile
  12. 14 4
      converter/ibm4704_usb/README.md
  13. 5 18
      converter/ibm4704_usb/config.h
  14. 11 10
      converter/ibm4704_usb/ibm4704.txt
  15. 17 0
      converter/ibm4704_usb/keymap_50key.c
  16. 50 0
      converter/ibm4704_usb/keymap_alps102key.c
  17. 97 24
      converter/ibm4704_usb/keymap_common.h
  18. 5 5
      converter/ibm4704_usb/keymap_hasu.c
  19. 26 14
      converter/ibm4704_usb/keymap_plain.c
  20. 22 30
      converter/ibm4704_usb/matrix.c
  21. 6 6
      converter/m0110_usb/Makefile
  22. 6 6
      converter/m0110_usb/Makefile.teensy
  23. 37 14
      converter/m0110_usb/Makefile.tmk_rev1
  24. 96 0
      converter/m0110_usb/Makefile.tmk_rev2
  25. 4 7
      converter/m0110_usb/README.md
  26. 48 58
      converter/m0110_usb/keymap_common.h
  27. 62 10
      converter/m0110_usb/keymap_default.c
  28. 0 118
      converter/m0110_usb/keymap_for_editor.c
  29. 8 20
      converter/m0110_usb/keymap_intl.c
  30. 0 64
      converter/m0110_usb/keymap_plain.c
  31. 6 6
      converter/news_usb/Makefile.pjrc
  32. 8 8
      converter/next_usb/Makefile
  33. 6 6
      converter/next_usb/Makefile.pjrc
  34. 10 8
      converter/next_usb/config.h
  35. 1 1
      converter/next_usb/keymap.c
  36. 6 1
      converter/next_usb/led.c
  37. 3 1
      converter/next_usb/matrix.c
  38. 6 6
      converter/pc98_usb/Makefile
  39. 8 8
      converter/ps2_usb/Makefile
  40. 2 2
      converter/ps2_usb/Makefile.mbed
  41. 6 6
      converter/ps2_usb/Makefile.pjrc
  42. 6 6
      converter/ps2_usb/Makefile.tmk_rev1
  43. 6 6
      converter/ps2_usb/Makefile.tmk_rev2
  44. 10 10
      converter/ps2_usb/Makefile.vusb
  45. 1 1
      converter/ps2_usb/README.md
  46. 3 3
      converter/ps2_usb/config.h
  47. 6 6
      converter/serialmouse_usb/Makefile
  48. 6 6
      converter/sun_usb/Makefile
  49. 9 2
      converter/sun_usb/README
  50. 8 2
      converter/sun_usb/config.h
  51. 173 0
      converter/sun_usb/keymap_sun3.c
  52. 2 0
      converter/sun_usb/led.c
  53. 34 10
      converter/sun_usb/matrix.c
  54. 7 7
      converter/terminal_bluefruit/Makefile
  55. 6 6
      converter/terminal_usb/Makefile
  56. 60 0
      converter/terminal_usb/keymap.c
  57. 12 8
      converter/usb_usb/Makefile
  58. 4 26
      converter/usb_usb/keymap.c
  59. 49 37
      converter/usb_usb/main.cpp
  60. 6 6
      converter/x68k_usb/Makefile
  61. 5 5
      keyboard/IIgs/Makefile
  62. 134 0
      keyboard/alps64/Makefile
  63. 70 0
      keyboard/alps64/config.h
  64. 30 0
      keyboard/alps64/keymap_common.c
  65. 70 0
      keyboard/alps64/keymap_common.h
  66. 151 0
      keyboard/alps64/keymap_hasu.c
  67. 12 0
      keyboard/alps64/keymap_plain.c
  68. 10 0
      keyboard/alps64/led.c
  69. 200 0
      keyboard/alps64/matrix.c
  70. 1 1
      keyboard/ergodox_ez/Makefile
  71. 6 6
      keyboard/gh60/Makefile
  72. 5 5
      keyboard/gh60/Makefile.pjrc
  73. 40 8
      keyboard/gh60/keymap_common.h
  74. 8 11
      keyboard/gh60/led.c
  75. 47 51
      keyboard/gh60/matrix.c
  76. 5 5
      keyboard/ghost_squid/Makefile.lufa
  77. 5 5
      keyboard/hbkb/Makefile.lufa
  78. 9 5
      keyboard/hhkb/Makefile
  79. 5 5
      keyboard/hhkb/Makefile.pjrc
  80. 6 6
      keyboard/hhkb/Makefile.rn42
  81. 11 10
      keyboard/hhkb/doc/HHKB.txt
  82. 69 0
      keyboard/hhkb/doc/HHKB_keycodes.txt
  83. 2 2
      keyboard/hhkb/keymap_hasu.c
  84. 37 4
      keyboard/hhkb/keymap_hhkb.c
  85. 6 0
      keyboard/hhkb/matrix.c
  86. 6 6
      keyboard/hhkb/not_supported/Makefile.iwrap
  87. 5 5
      keyboard/hhkb/not_supported/Makefile.vusb
  88. 5 5
      keyboard/hid_liber/Makefile.lufa
  89. 5 5
      keyboard/hid_liber/Makefile.pjrc
  90. 2 2
      keyboard/infinity/Makefile
  91. 18 16
      keyboard/infinity/mbed-infinity.mk
  92. 44 0
      keyboard/infinity/mbed-infinity/README
  93. 259 0
      keyboard/infinity/mbed-infinity/startup_MK20D5.s
  94. 80 2
      keyboard/infinity/tool/README
  95. 16 1
      keyboard/infinity/tool/k20dx32_flash.cfg
  96. 5 5
      keyboard/kitten_paw/Makefile.lufa
  97. 5 5
      keyboard/kmac/Makefile.lufa
  98. 5 5
      keyboard/kmac/Makefile.pjrc
  99. 5 5
      keyboard/lightpad/Makefile.lufa
  100. 5 5
      keyboard/lightsaber/Makefile.lufa

+ 0 - 6
.gitmodules

@@ -1,6 +0,0 @@
-[submodule "protocol/lufa/LUFA-git"]
-	path = protocol/lufa/LUFA-git
-	url = https://github.com/abcminiuser/lufa.git
-[submodule "protocol/usb_hid/USB_Host_Shield_2.0"]
-	path = protocol/usb_hid/USB_Host_Shield_2.0
-	url = https://github.com/felis/USB_Host_Shield_2.0.git

+ 29 - 81
README.md

@@ -2,6 +2,17 @@ Quantum MK Firmware
 ================================
 This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controller, and more specifically, the OLKB product line.
 
+Updates
+-------
+#### 2015/04/22
+Core library was separated to other branch `core`. <https://github.com/tmk/tmk_keyboard/tree/core>
+
+In `Makefile` you need to set `TMK_DIR` to indicate core library location now.
+
+    TMK_DIR = ../../tmk_core
+
+
+
 Features
 --------
 These features can be used in your keyboard.
@@ -23,6 +34,7 @@ These features can be used in your keyboard.
 * Backlight           - Control backlight levels
 
 
+
 Projects
 --------
 You can find some keyboard specific projects under `converter` and `keyboard` directory.
@@ -53,8 +65,8 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
 * [ibm4704_usb](converter/ibm4704_usb)      - [IBM 4704 keyboard Converter][GH_ibm4704]
 
 ### keyboard
-* [hhkb](keyboard/hhkb/)                    - [Happy Hacking Keyboard pro][GH_hhkb] **my main board**
-* [gh60](keyboard/gh60/)                    - [GH60] DIY 60% keyboard [prototype][GH60_proto] **my second board**
+* [hhkb](keyboard/hhkb/)                    - [Happy Hacking Keyboard pro][GH_hhkb] hasu's main board
+* [gh60](keyboard/gh60/)                    - [GH60] DIY 60% keyboard [prototype][GH60_proto] hasu's second board
 * [hbkb](keyboard/hbkb/)                    - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
 * [hid_liber](keyboard/hid_liber/)          - [HID liberation][HID_liber] controller (by alaricljs)
 * [phantom](keyboard/phantom/)              - [Phantom] keyboard (by Tranquilite)
@@ -107,7 +119,8 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
 License
 -------
 **GPLv2** or later. Some protocol files are under **Modified BSD License**.
-LUFA, PJRC and V-USB stack have their own license respectively.
+
+Third party libraries like LUFA, PJRC and V-USB have their own license respectively.
 
 
 
@@ -127,7 +140,8 @@ Magic Commands
 --------------
 To see help press `Magic` + `H`.
 
- `Magic` key bind may be `LShift` + `RShift` in many project, but `Power` key on ADB converter. `Magic` keybind can be vary on each project, check `config.h` in project directory.
+`Magic` key combination is `LShift` + `RShift` in many project, but `Power` key on ADB converter. 
+`Magic` keybind can be vary on each project, check `config.h` in project directory.
 
 Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed.
 
@@ -151,13 +165,14 @@ Following commands can be also executed with `Magic` + key. In console mode `Mag
     Caps:   Lock Keyboard(Child Proof)
     Paus:   jump to bootloader
 
-**TBD**
 
-### Boot Magic Configuration - Virtual DIP Switch
+
+Boot Magic Configuration - Virtual DIP Switch
+---------------------------------------------
 Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
 Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles.
 
-To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [common/bootmagic.h](common/bootmagic.h).
+To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [tmk_core/common/bootmagic.h](tmk_core/common/bootmagic.h).
 
 #### General
 - Skip reading EEPROM to start with default configuration(`ESC`)
@@ -192,55 +207,23 @@ To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be
 - Set Default Layer to 6(`6`)
 - Set Default Layer to 7(`7`)
 
-#### Caution
-Unintentional use of this feature will cause user confusion.
-
-TODO: Magic key combination to avoid unintentional press during plug in
-
-**TBD**
 
 
 Mechanical Locking support
 --------------------------
-This feature makes it possible for you to use mechanical switch for `CapsLock`, `NumLock` or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LNUM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Resync option tries to keep lock switch state consistent with keyboard LED state.
+This feature makes it possible for you to use mechanical locking switch for `CapsLock`, `NumLock` 
+or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LN
+UM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Res
+ync option tries to keep switch state consistent with keyboard LED state.
  
     #define LOCKING_SUPPORT_ENABLE
     #define LOCKING_RESYNC_ENABLE
 
 
+
 Start Your Own Project
 -----------------------
 **TBD**
-### Config.h Options
-#### 1. USB vendor/product ID and device description
-    #define VENDOR_ID       0xFEED
-    #define PRODUCT_ID      0xBEEF
-    #define MANUFACTURER    t.m.k.
-    #define PRODUCT         Macway mod
-    #define DESCRIPTION     t.m.k. keyboard firmware for Macway mod
-
-#### 2. Keyboard matrix configuration
-    #define MATRIX_ROWS 8
-    #define MATRIX_COLS 8
-    #define MATRIX_HAS_GHOST
-
-
-
-Architecture
-------------
-    Architecture Diagram
-                               +---------------+---------------+-------------+
-                               |    Host       |   Keyboard    | Matrix, LED |
-       ___________             |-----------+-+ +-------------+ | +-----------|
-      /          /| Keys/Mouse | Protocol  |d| | Action      | | | Protocol  |
-     /__________/ |<-----------|  LUFA     |r| |  Layer, Tap | | |  Matrix   |
-     |.--------.| |   LED      |  V-USB    |i| |-------------| | |  PS/2,IBM |             __________________
-     ||        || |----------->|  PJRC     |v| | Keymap      | | |  ADB,M0110|  Keys      / /_/_/_/_/_/_/_/ /|
-     ||  Host  || |  Console   |  iWRAP(BT)|e| | Mousekey    | | |  SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
-     ||________||/.<-----------|  UART     |r| | Report      | | |  X68K/PC98| Control  / /_/_/_/_/_/_/_/ / /
-     `_========_'/|            |---------------------------------------------|-------->/___ /_______/ ___/ /
-     |_o______o_|/             | Sendchar, Print, Debug, Command, ...        |         |_________________|/
-                               +---------------------------------------------+              Keyboard
 
 
 
@@ -248,52 +231,17 @@ Debugging
 --------
 Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
 
-You can use xprintf() to display debug info on `hid_listen`, see `common/xprintf.h`.
+You can use xprintf() to display debug info on `hid_listen`, see `tmk_core/common/xprintf.h`.
 
 
 
 Files and Directories
 -------------------
 ### Top
-* common/       - common codes
-* protocol/     - keyboard protocol support
+* tmk_core/     - core library
 * keyboard/     - keyboard projects
 * converter/    - protocol converter projects
 * doc/          - documents
-* common.mk     - Makefile for common
-* protocol.mk    - Makefile for protocol
-* rules.mk      - Makefile for build rules
-
-### Common
-* host.h
-* host_driver.h
-* keyboard.h
-* command.h
-* keymap.h
-* action.h
-* keycode.h
-* matrix.h
-* led.h
-* mousekey.h
-* report.h
-* debug.h
-* print.h
-* bootloader.h
-* sendchar.h
-* timer.h
-* util.h
-
-### Keyboard Protocols
-* lufa/     - LUFA USB stack
-* pjrc/     - PJRC USB stack
-* vusb/     - Objective Development V-USB
-* iwrap/    - Bluetooth HID for Bluegiga iWRAP
-* ps2.c     - PS/2 protocol
-* adb.c     - Apple Desktop Bus protocol
-* m0110.c   - Macintosh 128K/512K/Plus keyboard protocol
-* news.c    - Sony NEWS keyboard protocol
-* x68k.c    - Sharp X68000 keyboard protocol
-* serial_soft.c - Asynchronous Serial protocol implemented by software
 
 
 

+ 10 - 6
converter/adb_usb/Makefile

@@ -42,7 +42,7 @@
 TARGET = adb_usb_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -122,6 +122,10 @@ CONSOLE_ENABLE = yes	# Console for debug(+400)
 COMMAND_ENABLE = yes    # Commands for debug and configuration
 #SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
 #NKRO_ENABLE = yes	# USB Nkey Rollover
+ADB_MOUSE_ENABLE = yes
+
+# ADB Mice need acceleration for todays much bigger screens. 
+OPT_DEFS += -DADB_MOUSE_MAXACC=8
 
 
 # Optimize size but this may cause error "relocation truncated to fit"
@@ -129,9 +133,9 @@ COMMAND_ENABLE = yes    # Commands for debug and configuration
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 10 - 6
converter/adb_usb/Makefile.pjrc

@@ -2,7 +2,7 @@
 TARGET = adb_usb_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -57,13 +57,17 @@ CONSOLE_ENABLE = yes    # Console for debug
 COMMAND_ENABLE = yes    # Commands for debug and configuration
 #SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
 #NKRO_ENABLE = yes	# USB Nkey Rollover(+500)
+ADB_MOUSE_ENABLE = yes
+
+# ADB Mice need acceleration for todays much bigger screens. 
+OPT_DEFS += -DADB_MOUSE_MAXACC=8
 
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 56 - 49
converter/adb_usb/README.md

@@ -7,70 +7,69 @@ But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U
 Discuss: http://geekhack.org/showwiki.php?title=Island:14290
 
 
+
+README FIRST
+------------
+https://github.com/tmk/tmk_keyboard
+https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb
+
+Also check these when you are in trouble.
+
+https://github.com/tmk/tmk_keyboard/wiki
+https://github.com/tmk/tmk_keyboard/labels/NOTE
+
+
 Wiring
 ------
-0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
-   This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable.
-   The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.
-1. Define following macros for ADB connection in config.h if you use other than port PD0.
-   ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
-2. make
-3. program Teensy
+Connect ADB pins to controller just by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
+
+ADB female socket from the front:
+
+      ,--_--.
+     / o4 3o \      1: DATA
+    | o2   1o |     2: Power SW
+     -  ===  -      3: VCC
+      `-___-'       4: GND
+
+This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.(It is almost must!)
+https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor
+
+Pull-up resister:
+
+    Keyboard       Conveter
+                   ,------.
+    5V------+------|VCC   |
+            |      |      |
+           [R]     |      |
+            |      |      |
+    Signal--+------|PD0   |
+                   |      |
+    GND------------|GND   |
+                   `------'
+    R: 1K Ohm resistor
+
+
+Define following macros for ADB connection in config.h if you use other than port PD0.
+
+    ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
 
 
 Build
 -----
-Just make
+See doc/build.md. In short,
 
     $ make clean
     $ make
 
-If your keyboard is ISO layout
+You can select keymap(ansi is default) like this:
 
-    $ make KEYMAP=iso
-
-
-LOCKING CAPSLOCK
-----------------
-Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
-
-Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
-http://www.youtube.com/watch?v=9wqnt2mGJ2Y
+    $ make KEYMAP=[ansi|iso|hasu]
 
 
 Keymap
 ------
-You can change a keymap by editing code of keymap.c like following.
-This is a keymap for AEK, however, also used for other keyboards.
-How to define the keymap is probably obvious. You can find key symbols in keycode.h.
-If you want to define some keymaps than just one, see hhkb/keymap.c and
-macway/keymap.c as examples. Keymap(layer) switching may needs a bit of
-effort at this time.
-
-    /* Default Layer: plain keymap
-     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
-     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
-     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
-     * ,-----------------------------------------------------------. ,-----------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
-     * |-----------------------------------------------------------| |-----------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
-     * |-----------------------------------------------------------| `-----------' |---------------|
-     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
-     * |-----------------------------------------------------------|     ,---.     |---------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
-     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
-     * |Ctrl |Alt |Gui |         Space             |Gui |Alt |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
-     * `-----------------------------------------------------------' `-----------' `---------------'
-     */
-    KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    PWR,
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
-    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
-    LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
-    ),
+You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c.
+How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see doc/keymap.md for more detail.
 
 
 Magic command
@@ -78,6 +77,14 @@ Magic command
 To get help press `h` holding Magic key. Magic key is `Power key`.
 
 
+Locking CapsLock
+----------------
+Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
+https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-support
+
+Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
+
+
 Notes
 -----
 Not-extended ADB keyboards have no discrimination between right modifier and left one,

+ 1 - 1
converter/adb_usb/keymap_ansi.c

@@ -3,7 +3,7 @@
 
 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KEYMAP_EXT_ANSI(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
+    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   NO,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
     LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,

+ 2 - 2
converter/adb_usb/keymap_hasu.c

@@ -22,7 +22,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN0,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
+    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
@@ -47,7 +47,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO, 
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN0,      DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
-    CAPS,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
+    LCAP,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL,     HOME,PGDN,END,     BTN1,     BTN2,BTN3
     ),

+ 1 - 1
converter/adb_usb/keymap_iso.c

@@ -3,7 +3,7 @@
 
 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KEYMAP_EXT_ISO(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
+    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   NO,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,ENT,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
     LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,NUHS,                             P4,  P5,  P6,  PPLS,

+ 61 - 0
converter/adb_usb/matrix.c

@@ -27,6 +27,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "debug.h"
 #include "adb.h"
 #include "matrix.h"
+#include "report.h"
+#include "host.h"
 
 
 #if (MATRIX_COLS > 16)
@@ -38,6 +40,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 static bool is_modified = false;
+static report_mouse_t mouse_report = {};
 
 // matrix state buffer(1:on, 0:off)
 #if (MATRIX_COLS <= 8)
@@ -86,6 +89,64 @@ void matrix_init(void)
     return;
 }
 
+#ifdef ADB_MOUSE_ENABLE
+
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
+
+void adb_mouse_task(void)
+{
+    uint16_t codes;
+    int16_t x, y;
+    static int8_t mouseacc; 
+    _delay_ms(12);  // delay for preventing overload of poor ADB keyboard controller
+    codes = adb_host_mouse_recv();
+    // If nothing received reset mouse acceleration, and quit. 
+    if (!codes) {
+        mouseacc = 1;
+        return;
+    };
+    // Bit sixteen is button.
+    if (~codes & (1 << 15))
+        mouse_report.buttons |= MOUSE_BTN1;
+    if (codes & (1 << 15))
+        mouse_report.buttons &= ~MOUSE_BTN1;
+    // lower seven bits are movement, as signed int_7. 
+    // low byte is X-axis, high byte is Y. 
+    y = (codes>>8 & 0x3F);
+    x = (codes>>0 & 0x3F);
+    // bit seven and fifteen is negative
+    // usb does not use int_8, but int_7 (measuring distance) with sign-bit. 
+    if (codes & (1 << 6))
+          x = (x-0x40);
+    if (codes & (1 << 14))
+         y = (y-0x40);
+    // Accelerate mouse. (They weren't meant to be used on screens larger than 320x200).
+    x *= mouseacc;
+    y *= mouseacc;
+    // Cap our two bytes per axis to one byte. 
+    // Easier with a MIN-function, but since -MAX(-a,-b) = MIN(a,b)...
+	 // I.E. MIN(MAX(x,-127),127) = -MAX(-MAX(x, -127), -127) = MIN(-MIN(-x,127),127)
+    mouse_report.x = -MAX(-MAX(x, -127), -127);
+    mouse_report.y = -MAX(-MAX(y, -127), -127);
+    if (debug_mouse) {
+            print("adb_host_mouse_recv: "); print_bin16(codes); print("\n");
+            print("adb_mouse raw: [");
+            phex(mouseacc); print(" ");
+            phex(mouse_report.buttons); print("|");
+            print_decs(mouse_report.x); print(" ");
+            print_decs(mouse_report.y); print("]\n");
+    }
+    // Send result by usb. 
+    host_mouse_send(&mouse_report);
+    // increase acceleration of mouse
+    mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 );
+    return;
+}
+#endif
+
 uint8_t matrix_scan(void)
 {
     /* extra_key is volatile and more convoluted than necessary because gcc refused

+ 6 - 6
converter/ascii_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = ascii_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -73,10 +73,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/ibm4704_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = ibm4704_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -85,9 +85,9 @@ COMMAND_ENABLE = yes    # Commands for debug and configuration
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 14 - 4
converter/ibm4704_usb/README.md

@@ -5,13 +5,21 @@ This firmware converts IBM 4704 keyboard protocol to USB HID.
 Keyboard initialization process takes a few seconds at start up. During that you will hear buzzer from the keyboard. **You need to plug USB cable after hooking up your keyboard to the converter.**
 
 
+Update
+------
+2015/09/07  Added keymap for Alps 102-key. Thanks, tai @ geekhack!
+2015/05/05  Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack!
+2015/05/19  Fixed a protocol handling bug.
+
+
+
 Supported Keyboard
 ------------------
 ### IBM capacitive switch models:
-- 6019273 Model 100 50-key (grid layout)      http://kishy.dyndns.org/?p=977
-- 6019284 Model 200 62-key Alpha(60% layout)  http://kishy.dyndns.org/?p=894
-- 6019303 Model 300 77-key Expanded Alpha     http://kbtalking.cool3c.com/article/23272
-- 6020218 Model 400 107-key Full key          http://kishy.dyndns.org/?p=980
+- 6019273 Model 100 50-key (grid layout)      http://kishy.ca/?p=894
+- 6019284 Model 200 62-key Alpha(60% layout)  http://kishy.ca/?p=894
+- 6019303 Model 300 77-key Expanded Alpha     http://deskthority.net/photos-f62/ibm-6019303-t8502.html
+- 6020218 Model 400 107-key Full key          http://kishy.ca/?p=894
 
 ### Alps switch(vintage Green) models:
 
@@ -60,3 +68,5 @@ To select keymap:
 Keymap
 ------
 Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files.
+
+Use `KEYMAP_ALPS102()` to define your keymap for Alps models.

+ 5 - 18
converter/ibm4704_usb/config.h

@@ -41,9 +41,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 
-/*
- * Busywait
- */
+/* Pin configuration */
 #define IBM4704_CLOCK_PORT  PORTD
 #define IBM4704_CLOCK_PIN   PIND
 #define IBM4704_CLOCK_DDR   DDRD
@@ -53,22 +51,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define IBM4704_DATA_DDR    DDRD
 #define IBM4704_DATA_BIT    0
 
-/*
- * Pin interrupt
- */
-#ifdef IBM4704_USE_INT
-#define IBM4704_INT_INIT()  do {    \
-    EICRA |= ((1<<ISC11) |      \
-              (0<<ISC10));      \
-} while (0)
-#define IBM4704_INT_ON()  do {      \
-    EIMSK |= (1<<INT1);         \
-} while (0)
-#define IBM4704_INT_OFF() do {      \
-    EIMSK &= ~(1<<INT1);        \
-} while (0)
+/* Pin interrupt on rising edge of clock */
+#define IBM4704_INT_INIT()  do { EICRA |= ((1<<ISC11)|(1<<ISC10)); } while (0)
+#define IBM4704_INT_ON()    do { EIFR |= (1<<INTF1); EIMSK |= (1<<INT1); } while (0)
+#define IBM4704_INT_OFF()   do { EIMSK &= ~(1<<INT1); } while (0)
 #define IBM4704_INT_VECT    INT1_vect
-#endif
 
 
 #endif

+ 11 - 10
converter/ibm4704_usb/ibm4704.txt

@@ -1,10 +1,10 @@
 IBM 4704 Keyboard
 =================
 IBM capacitive switch models:
-    6019273 Model 100 50-key (grid layout)      http://kishy.dyndns.org/?p=977
-    6019284 Model 200 62-key Alpha(60% layout)  http://kishy.dyndns.org/?p=894
-    6019303 Model 300 77-key Expanded Alpha     http://kbtalking.cool3c.com/article/23272
-    6020218 Model 400 107-key Full key          http://kishy.dyndns.org/?p=980
+    6019273 Model 100 50-key (grid layout)      http://kishy.ca/?p=894
+    6019284 Model 200 62-key Alpha(60% layout)  http://kishy.ca/?p=894
+    6019303 Model 300 77-key Expanded Alpha     http://deskthority.net/photos-f62/ibm-6019303-t8502.html
+    6020218 Model 400 107-key Full key          http://kishy.ca/?p=894
 
 Alps switch(vintage Green) models:
     5954339 Japanese 102-key    http://deskthority.net/post87127.html#p87127
@@ -33,7 +33,7 @@ so that it doesn't send any scancode until you send 'FF'(End of FC command mode)
     Model 100 50-key            A2h
     Model 200 62-key            A3h
     Model 300 77-key            A4h
-    Model 400 107-key           ??
+    Model 400 107-key           A5h
     Japanese/Chinese 102-key    A6h
 
 
@@ -57,15 +57,15 @@ Keyboard to Host
 ----------------
 Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
 
-            ____      __   __   __   __   __   __   __   __   __   ________
-    Clock       \____/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/
+            ____       __   __   __   __   __   __   __   __   __   _______
+    Clock       \_____/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/
                  ____ ____ ____ ____ ____ ____ ____ ____ ____ ____    
     Data    ____/    X____X____X____X____X____X____X____X____X____X________
                 Start   0    1    2    3    4    5    6    7    P  Stop
 
 Start bit:  can be long as 300-350us.
 Inhibit:    Pull Data line down to inhibit keyboard to send.
-Timing:     Host reads bit while Clock is hi.
+Timing:     Host reads bit while Clock is hi.(rising edge)
 Stop bit:   Keyboard pulls down Data line to lo after 9th clock.
 
 
@@ -166,13 +166,14 @@ Data sent from host:
          |   `-----`--- scan code
          `------------- enable bit(0: enable repeat, 1: enable break)
 
-    00-77   Enable repeat(78-7F: invalid scancode)
-    80-F7   Enable break(F8-FF: invalid scancode)
+    00-79   Enable repeat
+    80-F9   Enable break(FA-FF are used as other commands, see above.)
     FE      Resend(011ah) no need to use
     FF      End(0114h) exits FC command mode.
 
 Response from keyboard:
     FD      Out of bound - Invalid scancode
+    --      OK - No response means that command is accepted.
 
 Examples:
     To enable break code of all keys.

+ 17 - 0
converter/ibm4704_usb/keymap_50key.c

@@ -0,0 +1,17 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    KEYMAP_50(
+    F1,  F2,  F3,   F4,  F5,  F6,   F7,  F8,  F9,  F10,  \
+    1,   2,   3,    4,   5,   6,    7,   8,   9,   0,    \
+    Q,   W,   E,    R,   T,   Y,    U,   I,   O,   P,    \
+    A,   S,   D,    F,   G,   H,    J,   K,   L,   SCLN, \
+    Z,   X,   C,    V,   B,   N,    M,   COMM,DOT, SLSH  \
+    ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
+
+

+ 50 - 0
converter/ibm4704_usb/keymap_alps102key.c

@@ -0,0 +1,50 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Layer 0:
+     * ,---------------------------------------------------------------.  ,-----------. ,---------------.
+     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|BS |BS |F21|  |PSC|SLK|PAU| |F1 |F2 |F3 |F4 |
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|F22|  |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Ret|Ret |F23|  |Del|End|PgD| |F9 |F10|F11|F12|
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shf|Shift |F24|  |   |Up |   | |F13|F14|F15|F16|
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Fn0  |Gui|Alt  |         Space             |Alt* |Gui|Fn0      |  |Lef|Dow|Rig| |F17|F18|F19|F20|
+     * `---------------------------------------------------------------'  `-----------' `---------------'
+     */
+    KEYMAP_ALPS102(
+    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,BSPC,F21,      PSCR,SLCK,PAUS,     F1,  F2,  F3,  F4,  \
+    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     F22,      INS, HOME,PGUP,     F5,  F6,  F7,  F8,  \
+    LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,GRV, ENT,      F23,      DEL, END, PGDN,     F9,  F10, F11, F12, \
+    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,RSFT,          F24,      NO,  UP,  NO,       F13, F14, F15, F16, \
+    FN0, LGUI,LALT,          SPC,                     RALT,RGUI,               FN0,      LEFT,DOWN,RGHT,     F17, F18, F19, F20  \
+    ),
+
+    /* Layer 1:
+     * ,---------------------------------------------------------------.  ,-----------. ,---------------.
+     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|BS |BS |F21|  |VoD|VoU|Mut| |F1 |F2 |F3 |F4 |
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|F22|  |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Ret|Ret |F23|  |Del|End|PgD| |F9 |F10|F11|F12|
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shf|Shift |F24|  |   |PgU|   | |F13|F14|F15|F16|
+     * |---------------------------------------------------------------|  |-----------| |---------------|
+     * |Fn0  |Gui|Alt  |         Space             |Alt* |Gui|Fn0      |  |Hom|PgD|End| |F17|F18|F19|F20|
+     * `---------------------------------------------------------------'  `-----------' `---------------'
+     */
+    KEYMAP_ALPS102(
+    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     VOLD,VOLU,MUTE,     TRNS,TRNS,TRNS,TRNS, \
+    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,TRNS, \
+    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,TRNS, \
+    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,PGUP,TRNS,     TRNS,TRNS,TRNS,TRNS, \
+    TRNS,TRNS,TRNS,          TRNS,                    TRNS,TRNS,               TRNS,     HOME,PGDN,END,      TRNS,TRNS,TRNS,TRNS  \
+    ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+    [0] = ACTION_LAYER_MOMENTARY(1),
+};

+ 97 - 24
converter/ibm4704_usb/keymap_common.h

@@ -34,40 +34,113 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
 extern const uint16_t fn_actions[];
 
 
-/* Original keys */
+/* 107-key */
 #define KEYMAP( \
+    K46,K64,     K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E,   K6A,K6B,K6C,    K47,K48,K49,K4A, \
+    K56,K66,     K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D,       K6D,K6E,K6F,    K4B,K4C,K4D,K4E, \
+    K71,K77,     K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D,       K70,K65,K72,    K50,K51,K52,K53, \
+    K44,K45,     K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,       K74,K75,K76,    K5E,K58,K59,K5A, \
+    K54,K55,     K31,K41,K3F,        K40,                        K42,K2F,       K78,K67,K79,    K5B,K5C,K5D,K57  \
+) { \
+    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO    }, \
+    { KC_##K08, KC_##K09, KC_##K0A, KC_NO,    KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO,    KC_##K1F }, \
+    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO,    KC_##K2F }, \
+    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+    { KC_##K40, KC_##K41, KC_##K42, KC_NO,    KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+    { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO    }, \
+    { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+    { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_NO    }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+    { KC_NO,    KC_NO,    KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
+    { KC_##K70, KC_##K71, KC_##K72, KC_NO,    KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+    { KC_##K78, KC_##K79, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }  \
+}
+
+/* 77-key */
+#define KEYMAP_77( \
+    K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E,   K6A,K6B,K6C, \
+    K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D,       K6D,K6E,K6F, \
+    K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D,       K70,K65,K72, \
+    K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,       K74,K75,K76, \
+    K31,K41,K3F,        K40,                        K42,K2F,       K78,K67,K79  \
+) KEYMAP( \
+    F1,  F2,    K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E,    K6A,K6B,K6C,    NLCK,PSLS,PAST,PMNS, \
+    F3,  F4,    K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D,        K6D,K6E,K6F,    P7,  P8,  P9,  PPLS, \
+    F5,  F6,    K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D,        K70,K65,K72,    P4,  P5,  P6,  PPLS, \
+    F7,  F8,    K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,        K74,K75,K76,    P1,  P2,  P3,  PENT, \
+    F9,  F10,   K31,K41,K3F,        K40,                        K42,K2F,        K78,K67,K79     P0,  P0,  PDOT,PENT  \
+)
+
+/* 62-key */
+#define KEYMAP_62( \
     K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \
     K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \
     K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \
     K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \
-    K31,K41,K3F,        K40,                    K42,K2F \
+    K31,K41,K3F,        K40,                        K42,K2F  \
+) KEYMAP( \
+    F1,  F2,    K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E,   INS, HOME,PGUP,     NLCK,PSLS,PAST,PMNS, \
+    F3,  F4,    K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D,       DEL, END, PGDN,     P7,  P8,  P9,  PPLS, \
+    F5,  F6,    K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D,       PSCR,SLCK,PAUS,     P4,  P5,  P6,  PPLS, \
+    F7,  F8,    K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,       F11, UP,  F12,      P1,  P2,  P3,  PENT, \
+    F9,  F10,   K31,K41,K3F,        K40,                        K42,K2F,       LEFT,DOWN,RGHT,     P0,  P0,  PDOT,PENT  \
+)
+
+/* 50-key */
+#define KEYMAP_50( \
+    K00,K01,K02,    K03,K04,K05,    K20,K21,K22,K23, \
+    K08,K09,K0A,    K0B,K0C,K0D,    K28,K29,K2A,K35, \
+    K10,K11,K12,    K13,K14,K15,    K30,K31,K32,K36, \
+    K18,K19,K1A,    K1B,K1C,K1D,    K38,K39,K3A,K37, \
+    K16,K1E,K0E,    K0F,K1F,K17,    K33,K3B,K2B,K3F  \
 ) { \
-    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \
-    { KC_##K08, KC_##K09, KC_##K0A, KC_NO,    KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_NO,    KC_NO,   }, \
+    { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
     { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
-    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO,    KC_##K1F }, \
+    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO,    KC_##K35, KC_##K36, KC_##K37 }, \
+    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO,    KC_NO,    KC_NO,    KC_##K3F }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }  \
+}
+
+/* Alps 102-key */
+#define KEYMAP_ALPS102( \
+    K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,   K44, K45, K46,   K43, K41, K42, K4A, \
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D,      K1E,   K54, K55, K56,   K50, K51, K52, K5A, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D,      K2E,   K64, K65, K66,   K60, K61, K62, K6B, \
+    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D,           K3E,   K74, K75, K76,   K70, K71, K72, K7B, \
+    K31, K47, K3F,                 K40,               K4F, K48,                K2F,   K77, K67, K57,   K73, K63, K53, K4E  \
+) { \
+    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+    { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO,   }, \
     { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
-    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO,    KC_##K2F }, \
+    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
     { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
     { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
-    { KC_##K40, KC_##K41, KC_##K42, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
-    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO }, \
+    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+    { KC_##K48, KC_NO,    KC_##K4A, KC_NO,    KC_NO,    KC_NO,    KC_##K4E, KC_##K4F }, \
+    { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+    { KC_NO,    KC_NO,    KC_##K5A, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_##K6B, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
+    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_##K7B, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }  \
 }
 
-#endif
 
-/*
-    { K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \
-    { K50, K51, K52, K53, K54, K55, K56, K57 }, \
-    { K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, \
-    { K60, K61, K62, K63, K64, K65, K66, K67 }, \
-    { K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \
-    { K70, K71, K72, K73, K74, K75, K76, K77 }, \
-    { K78, K79, K7A, K7B, K7C, K7D, K7E, K7F }, \
-*/
+#endif

+ 5 - 5
converter/ibm4704_usb/keymap_hasu.c

@@ -15,7 +15,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * |Ctrl |Gui|Alt  |         Space             |Alt  |Gui|Ctrl |
      * `-----------------------------------------------------------'
      */
-    KEYMAP(
+    KEYMAP_62(
     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,   FN1, QUOT,NO,  ENT, \
@@ -23,7 +23,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          FN3,                               RGUI,RCTL \
     ),
 
-    KEYMAP(
+    KEYMAP_62(
     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,PAUS, UP, NO,  BSPC, \
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO,  ENT, \
@@ -31,7 +31,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL \
     ),
 
-    KEYMAP(
+    KEYMAP_62(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL, \
     TAB, NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \
     LCTL,NO,  ACL0,ACL1,ACL2,NO,  MS_L,MS_D,MS_U,MS_R,TRNS,NO,  NO,  ENT, \
@@ -39,7 +39,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          BTN1,                              RGUI,RCTL \
     ),
 
-    KEYMAP(
+    KEYMAP_62(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL, \
     TAB, HOME,PGDN,UP,  PGUP,END, HOME,PGDN,PGUP,END, NO,  NO,  NO,  BSPC, \
     LCTL,NO,  LEFT,DOWN,RGHT,NO,  LEFT,DOWN,UP,  RGHT,NO,  NO,  NO,  ENT, \
@@ -47,7 +47,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL \
     ),
 
-    KEYMAP(
+    KEYMAP_62(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL, \
     TAB, NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \
     LCTL,VOLD,VOLU,MUTE,NO,  NO,  BTN2,MS_L,MS_D,MS_R,BTN1,NO,  NO,  ENT, \

+ 26 - 14
converter/ibm4704_usb/keymap_plain.c

@@ -8,28 +8,40 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * |-----------------------------------------------------------|
      * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|
      * |-----------------------------------------------------------|
-     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  #|Ret |
+     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Ret|Ret |
      * |-----------------------------------------------------------|
-     * |Shif|  \|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|???|Shift |
+     * |Shif|Shf|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|???|Shift |
      * |-----------------------------------------------------------|
-     * |Ctrl |Gui|Alt  |         Space             |Alt* |Gui|Ctrl |
+     * |Ctrl |Gui|Alt  |         Space             |Alt* |Gui|Fn   |
      * `-----------------------------------------------------------'
      */
     KEYMAP(
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSLS,BSPC, \
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
-    LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,NUHS,ENT, \
-    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,NO,  FN0, \
-    LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL \
+    F1,  F2,    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NO,  BSPC,     INS, HOME,PGUP,     NLCK,PSLS,PAST,PMNS, \
+    F3,  F4,    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,          DEL, END, PGDN,     P7,  P8,  P9,  PPLS, \
+    F5,  F6,    LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT, ENT,           PSCR,SLCK,PAUS,     P4,  P5,  P6,  PPLS, \
+    F7,  F8,    LSFT,LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,NO,  RSFT,          F11, UP,  F12,      P1,  P2,  P3,  PENT, \
+    F9,  F10,   LCTL,LGUI,LALT,          SPC,                               RGUI,FN0,           LEFT,DOWN,RGHT,     P0,  P0,  PDOT,PENT  \
     ),
 
-    /* 1: HHKB */
+    /* 1: HHKB
+     * ,-----------------------------------------------------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|???|Del|
+     * |-----------------------------------------------------------|
+     * |Caps |   |   |   |   |   |   |   |Psc|Slk|Pau| Up|   |  Ins|
+     * |-----------------------------------------------------------|
+     * |Ctrl  |VoD|VoU|VoM|   |   |  *|  /|Hom|PgU|Lef|Rig|Ret|Ret |
+     * |-----------------------------------------------------------|
+     * |Shif|Shi|   |   |   |   |   |  +|  -|End|PgD|Dow|???|Shift |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui|Alt  |         Space             |Alt* |Gui|Fn   |
+     * `-----------------------------------------------------------'
+     */
     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,PAUS, UP, NO,  INS, \
-    LCTL,VOLD,VOLU,MUTE,NO,  NO,  PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO,  ENT, \
-    LSFT,NO,  NO,  NO,  NO,  NO,  NO,  PPLS,PMNS,END, PGDN,DOWN,NO,  TRNS, \
-    LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL \
+    F1,  F2,    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, NO,  DEL,      INS, HOME,PGUP,     NLCK,PSLS,PAST,PMNS, \
+    F3,  F4,    CAPS,NO,  NO,  NO,  NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS, UP, NO,  INS,           DEL, END, PGDN,     P7,  P8,  P9,  PPLS, \
+    F5,  F6,    TRNS,VOLD,VOLU,MUTE,NO,  NO,  PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, ENT,           PSCR,SLCK,PAUS,     P4,  P5,  P6,  PPLS, \
+    F7,  F8,    TRNS,TRNS,NO,  NO,  NO,  NO,  NO,  PPLS,PMNS,END, PGDN,DOWN,NO,  TRNS,          F11, UP,  F12,      P1,  P2,  P3,  PENT, \
+    F9,  F10,   TRNS,TRNS,TRNS,          TRNS,                              TRNS,TRNS,          LEFT,DOWN,RGHT,     P0,  P0,  PDOT,PENT  \
     ),
 };
 

+ 22 - 30
converter/ibm4704_usb/matrix.c

@@ -67,43 +67,33 @@ uint8_t matrix_cols(void)
 
 static void enable_break(void)
 {
-    uint8_t ret;
     print("Enable break: ");
-    // valid scancode: 00-77h
-    for (uint8_t code = 0; code < 0x78; code++) {
-        while (ibm4704_send(0x80|code) != 0) {
-            print("z");
-            _delay_us(500);
-        }
-        _delay_us(2000);
-        ret = ibm4704_recv();
-        if (ret != 0xff) {
-            xprintf("c%02X:r%02X ", code, ret);
-        }
-        _delay_us(1000);
+    while (ibm4704_send(0xFC)) { _delay_ms(10); }
+    // valid scancode: 00-79h
+    for (uint8_t code = 0; code < 0x7F; code++) {
+        while (ibm4704_send(0x80|code)) _delay_ms(10);
+        _delay_ms(5);   // wait for response
+        // No response(FF) when ok, FD when out of bound
+        xprintf("s%02X:r%02X ", code, ibm4704_recv());
     }
-    _delay_us(1000);
-    while (ibm4704_send(0xFF) != 0) { _delay_us(500); } // End
+    while (ibm4704_send(0xFF)) { _delay_ms(10); } // End
     print("End\n");
 }
 
-void matrix_init(void)
-{
-    uint8_t ret;
-    debug_enable = true;
 
+void matrix_setup(void)
+{
     ibm4704_init();
-    matrix_clear();
+}
 
-    // read keyboard id
-    while ((ret = ibm4704_recv()) == 0xFF) {
-        ibm4704_send(0xFE);
-        _delay_us(100);
-    }
+void matrix_init(void)
+{
+    debug_enable = true;
 
-    _delay_ms(2000);    // wait for starting up debug console 
     print("IBM 4704 converter\n");
-    xprintf("Keyboard ID: %02X\n", ret);
+    matrix_clear();
+    _delay_ms(2000);    // wait for keyboard starting up
+    xprintf("Keyboard ID: %02X\n", ibm4704_recv());
     enable_break();
 }
 
@@ -116,14 +106,16 @@ uint8_t matrix_scan(void)
     if (code==0xFF) {
         // Not receivd
         return 0;
-    } else if ((code&0x78)==0x78) {
-        // 0xFF-F8 and 0x7F-78 is not scancode
-        xprintf("Error: %0X\n", code);
+    } else if ((code&0x7F) >= 0x7A) {
+        // 0xFF-FA and 0x7F-7A is not scancode
+        xprintf("Error: %02X\n", code);
         matrix_clear();
         return 0;
     } else if (code&0x80) {
+        dprintf("%02X\n", code);
         matrix_make(code);
     } else {
+        dprintf("%02X\n", code);
         matrix_break(code);
     }
     return 1;

+ 6 - 6
converter/m0110_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = m0110_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -87,10 +87,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/m0110_usb/Makefile.teensy

@@ -2,7 +2,7 @@
 TARGET = m0110_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -89,10 +89,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 37 - 14
converter/m0110_usb/Makefile.pjrc → converter/m0110_usb/Makefile.tmk_rev1

@@ -1,8 +1,8 @@
 # Target file name (without extension).
-TARGET = m0110_pjrc
+TARGET = m0110_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -10,13 +10,14 @@ TARGET_DIR = .
 # keyboard dependent files
 SRC =	matrix.c \
 	led.c \
+	keymap_common.c \
 	m0110.c
 
 # To use own keymap file run make like: make keymap=hasu
-ifdef keymap
-    SRC += keymap_$(keymap).c
+ifdef KEYMAP
+    SRC += keymap_$(KEYMAP).c
 else
-    SRC += keymap.c
+    SRC += keymap_default.c
 endif
 
 CONFIG_H = config.h
@@ -24,10 +25,8 @@ CONFIG_H = config.h
 
 # MCU name, you MUST set this to match the board you are using
 # type "make clean" after changing this, so all files will be rebuilt
-#MCU = at90usb162       # Teensy 1.0
-MCU = atmega32u4       # Teensy 2.0
-#MCU = at90usb646       # Teensy++ 1.0
-#MCU = at90usb1286      # Teensy++ 2.0
+#MCU = atmega32u2       # TMK converter rev2
+MCU = atmega32u4       # TMK converter rev1
 
 
 # Processor frequency.
@@ -38,6 +37,29 @@ MCU = atmega32u4       # Teensy 2.0
 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
 #   Atmel DFU loader 4096
@@ -55,6 +77,7 @@ CONSOLE_ENABLE = yes	# Console for debug(+400)
 COMMAND_ENABLE = yes    # Commands for debug and configuration
 #SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
 #NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
+#KEYMAP_SECTION_ENABLE = yes	# fixed address keymap for keymap editor
 
 
 
@@ -64,10 +87,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 96 - 0
converter/m0110_usb/Makefile.tmk_rev2

@@ -0,0 +1,96 @@
+# Target file name (without extension).
+TARGET = m0110_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC =	matrix.c \
+	led.c \
+	keymap_common.c \
+	m0110.c
+
+# To use own keymap file run make like: make keymap=hasu
+ifdef KEYMAP
+    SRC += keymap_$(KEYMAP).c
+else
+    SRC += keymap_default.c
+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 = atmega32u2       # TMK converter rev2
+#MCU = atmega32u4       # TMK converter rev1
+
+
+# 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
+
+
+#
+# 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
+#   Atmel DFU loader 4096
+#   LUFA bootloader  4096
+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
+#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
+#KEYMAP_SECTION_ENABLE = yes	# fixed address keymap for keymap editor
+
+
+
+#---------------- Programming Options --------------------------
+PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 4 - 7
converter/m0110_usb/README.md

@@ -59,19 +59,16 @@ To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to
 
     $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
     $ cd m0110_usb
-    $ make -f Makefile clean
-    $ make -f Makefile [KEYMAP={default|plain|intl|spacefn|hasu}]
+    $ make -f Makefile.rev2 clean
+    $ make -f Makefile.rev2 [KEYMAP={default|intl|spacefn|hasu}]
 
-Use `Makefile.teensy` instead for Teensy.
+Use `Maefile.tmk_rev1` for TMK converter Rev.1, `Makefile.teensy` for Teensy instead.
 
 
 
 Keymap
 ------
-To create your own keymap copy existent keymap file to `keymap_name.c` and edit it. You can build it like this.
-
-    $ make -f Makefile clean
-    $ make -f Makefile KEYMAP=name
+To create your own keymap copy existent keymap file to `keymap_name.c` and edit it.
 
 
 

+ 48 - 58
converter/m0110_usb/keymap_common.h

@@ -1,5 +1,5 @@
 /*
-Copyright 2011,2012,2014 Jun Wako <wakojun@gmail.com>
+Copyright 2011,2012,2014,2015 Jun Wako <wakojun@gmail.com>
 
 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
@@ -24,64 +24,49 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
 extern const uint16_t fn_actions[];
 
 
-/* 
- * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset
- * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist
- * on the M0110A, but since it generates a unique scan code which is not used for some other key in
- * the M0110A, they are totally interchangeable.  In fact, the M0110A is functionally (almost)
- * identical to the combination of the M0110 along with the M0120 keypad. The only difference
- * (which is causing some problems as you will read below) is that the M0110+M0120 don't have
- * dedicated arrow keys, while the M0110A does. However, the M0120 did have arrow keys, which
- * doubled as the [comma], [/], [*] and [+] keys, when used with the [Shift] key. The M0110A has
- * substituted the [comma] key with the [=] key, however its scancode is the same.
+/* Common layout for M0110 and M0110A
+ * This keymap works with both keyboards. As you can see, the M0110A is 
+ * a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110
+ * does not exist on the M0110A.
  *
- * Physical layout:
- * M0110A
  * ,---------------------------------------------------------. ,---------------.
- * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Bcksp| |Clr|  =|  /|  *|
+ * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Clr|  =|  /|  *|
  * |---------------------------------------------------------| |---------------|
  * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|   | |  7|  8|  9|  -|
  * |-----------------------------------------------------'   | |---------------|
  * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  +|
  * |---------------------------------------------------------| |---------------|
  * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shft|Up | |  1|  2|  3|   |
- * |---------------------------------------------------------' |-----------|Ent|
- * |Opt  |Mac    |           Space           |  \|Lft|Rgt|Dn | |      0|  .|   |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Opt  |Mac    |         Space         |Ent|  \|Lft|Rgt|Dn | |      0|  .|   |
  * `---------------------------------------------------------' `---------------'
  *
- * M0110                                                       M0120
+ * M0110A scan codes
  * ,---------------------------------------------------------. ,---------------.
- * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Clr|  -|  +|  *|
+ * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18|   33| | 47| 68| 6D| 62|
  * |---------------------------------------------------------| |---------------|
- * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \| |  7|  8|  9|  /|
- * |---------------------------------------------------------| |---------------|
- * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  ,|
+ * |   30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E|   | | 59| 5B| 5C| 4E|
+ * |-----------------------------------------------------'   | |---------------|
+ * |    39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27|    24| | 56| 57| 58| 66|
  * |---------------------------------------------------------| |---------------|
- * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift   | |  1|  2|  3|   |
- * `---------------------------------------------------------' |-----------|Ent|
- *      |Opt|Mac |         Space               |Ent |Opt|      |      0|  .|   |
- *      `-----------------------------------------------'      `---------------'
- * With Shift keys on M0120 work as curosor.(-:Left *:Right /:Up ,:Down)
+ * |      38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C|  38| 4D| | 53| 54| 55|   |
+ * `---------------------------------------------------------' |-----------| 4C|
+ * |   3A|     37|             31            | 2A| 46| 42| 48| |     52| 41|   |
+ * `---------------------------------------------------------' `---------------'
  *
- * NOTE: \ is located differently.
- * NOTE: Enter on M0110 is different from Enter on keypad(M0120 and M0110A).
- * NOTE: Left Shift and right Shift are logically same key.
- * NOTE: Left Option and right Option are logically same key.
- */
-
-/* Keymap definition Macro
+ * M0110 + M0120 scan codes
  * ,---------------------------------------------------------. ,---------------.
- * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Clr|  =|  /|  *|
+ * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18|   33| | 47| 68| 6D| 62|
  * |---------------------------------------------------------| |---------------|
- * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|   | |  7|  8|  9|  -|
- * |-----------------------------------------------------'   | |---------------|
- * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  +|
+ * |   30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
  * |---------------------------------------------------------| |---------------|
- * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shft|Up | |  1|  2|  3|   |
- * |---------------------------------------------------------| |-----------|Ent|
- * |Opt  |Mac    |         Space         |Ent|  \|Lft|Rgt|Dn | |      0|  .|   |
- * `---------------------------------------------------------' `---------------'
- * NOTE: Ent between Space and \ means Enter on M0110.
+ * |    39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27|    24| | 56| 57| 58| 66|
+ * |---------------------------------------------------------| |---------------|
+ * |      38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C|      38| | 53| 54| 55|   |
+ * `---------------------------------------------------------' |-----------| 4C|
+ *      | 3A|  37|             31              |   34| 3A|     |     52| 41|   |
+ *      `------------------------------------------------'     `---------------'
+ * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
  */
 #define KEYMAP( \
     K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33,  K47,K68,K6D,K62, \
@@ -106,25 +91,30 @@ extern const uint16_t fn_actions[];
     { KC_##K68, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K6D, KC_NO,    KC_NO    }, \
 }
 
-/* International keyboard
- *  ,---------------------------------------------------------.
- *  | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18|   33|
- *  |---------------------------------------------------------|
- *  |   30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A|
- *  |------------------------------------------------------,  |
- *  |    39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24|  |
- *  |---------------------------------------------------------|
- *  |  38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A|      38|
- *  `---------------------------------------------------------'
- *       | 3A|  37|             34              |   31| 3A|
- *       `------------------------------------------------'
+/* International keyboard layout for M0110 + M0120
+ * https://en.wikipedia.org/wiki/File:Apple_Macintosh_Plus_Keyboard.jpg
+ * Probably International keyboard layout of M0110A doesn't exist.
+ *
+ * M0110 + M0120 scan codes
+ * ,---------------------------------------------------------. ,---------------.
+ * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18|   33| | 47| 68| 6D| 62|
+ * |---------------------------------------------------------| |---------------|
+ * |   30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
+ * |------------------------------------------------------,  | |---------------|
+ * |    39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24|  | | 56| 57| 58| 66|
+ * |---------------------------------------------------------| |---------------|
+ * |  38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A|      38| | 53| 54| 55|   |
+ * `---------------------------------------------------------' |-----------| 4C|
+ *      | 3A|  37|             34              |   31| 3A|     |     52| 41|   |
+ *      `------------------------------------------------'     `---------------'
+ * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
  */
 #define KEYMAP_INTL( \
     K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33,  K47,K68,K6D,K62, \
     K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A,  K59,K5B,K5C,K4E, \
     K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24,      K56,K57,K58,K66, \
-    K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A,    K4D,  K53,K54,K55,K4C, \
-    K3A,K37,            K34,            K31,    K46,K42,K48,  K52,    K41      \
+    K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A,          K53,K54,K55,K4C, \
+        K3A,K37,            K34,                K31,          K52,    K41      \
 ) { \
     { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
     { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
@@ -134,8 +124,8 @@ extern const uint16_t fn_actions[];
     { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
     { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO,    KC_NO,    KC_##K37 }, \
     { KC_##K38, KC_##K39, KC_##K3A, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
-    { KC_NO,    KC_##K41, KC_##K42, KC_NO,    KC_NO,    KC_NO,    KC_##K46, KC_##K47 }, \
-    { KC_##K48, KC_NO,    KC_NO,    KC_NO,    KC_##K4C, KC_##K4D, KC_##K4E, KC_NO    }, \
+    { KC_NO,    KC_##K41, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K47 }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K4C, KC_NO,    KC_##K4E, KC_NO    }, \
     { KC_NO,    KC_NO,    KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
     { KC_##K58, KC_##K59, KC_NO,    KC_##K5B, KC_##K5C, KC_NO,    KC_NO,    KC_NO    }, \
     { KC_NO,    KC_NO,    KC_##K62, KC_NO,    KC_NO,    KC_NO,    KC_##K66, KC_NO    }, \

+ 62 - 10
converter/m0110_usb/keymap_default.c

@@ -20,15 +20,19 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 
+#ifdef KEYMAP_SECTION_ENABLE
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
 const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+#endif
     /* Default:
      * M0110                                                       M0120
      * ,---------------------------------------------------------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Nlk|  -|  +|  *|
+     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Nlk|  =|  /|  *|
      * |---------------------------------------------------------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \| |  7|  8|  9|  /|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \| |  7|  8|  9|  -|
      * |---------------------------------------------------------| |---------------|
-     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  ,|
+     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  +|
      * |---------------------------------------------------------| |---------------|
      * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift   | |  1|  2|  3|   |
      * `---------------------------------------------------------' |-----------|Ent|
@@ -52,27 +56,40 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,         P7,  P8,  P9,  PMNS,
     LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,     P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          UP,      P1,  P2,  P3,  PENT,
-    LALT,LGUI,               SPC,                FN0, BSLS,LEFT,RGHT,DOWN,    P0,       PDOT
+    LALT,LGUI,               SPC,                FN0, FN13,LEFT,RGHT,DOWN,    P0,       PDOT
     ),
-    /* Cursor Layer
+    /* Cursor Layer:
+     * M0110                                                       M0120
      * ,---------------------------------------------------------. ,---------------.
-     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|  -|  +|  *|
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|  =|  /|  *|
      * |---------------------------------------------------------| |---------------|
-     * |Caps |Hom| Up|PgU|   |   |   |   |Psc|Slk|Pau|Up |   |INS| |  7|  8|  9|  /|
+     * |Caps |Hom| Up|PgU|   |   |   |   |Psc|Slk|Pau|Up |INS|   | |  7|  8|  9|  -|
      * |---------------------------------------------------------| |---------------|
-     * |Ctrl  |Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Return| |  4|  5|  6|  ,|
+     * |Ctrl  |Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Return| |  4|  5|  6|  +|
      * |---------------------------------------------------------| |---------------|
      * |Shift   |End|   |PgD|   |   |   |   |End|PgD|Dow|Shift   | |  1|  2|  3|   |
      * `---------------------------------------------------------' |-----------|Ent|
      *      |Opt|Mac |         Space               |Fn  |Opt|      |      0|  .|   |
      *      `-----------------------------------------------'      `---------------'
+     * M0110A
+     * ,---------------------------------------------------------. ,---------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|  =|  /|  *|
+     * |---------------------------------------------------------| |---------------|
+     * |Caps |Hom| Up|PgU|   |   |   |   |Psc|Slk|Pau|Up |INS|   | |  7|  8|  9|  -|
+     * |-----------------------------------------------------'   | |---------------|
+     * |Ctrl  |Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Return| |  4|  5|  6|  +|
+     * |---------------------------------------------------------| |---------------|
+     * |Shift   |End|   |PgD|   |   |   |   |End|PgD|Dow|Shft|PgU| |  1|  2|  3|   |
+     * |---------------------------------------------------------| |-----------|Ent|
+     * |Opt  |Mac    |         Space             |  \|Hom|End|PgD| |      0|  .|   |
+     * `---------------------------------------------------------' `---------------'
      */
     [1] = KEYMAP(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
-    CAPS,HOME,UP,  PGUP,NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,           P7,  P8,  P9,  PMNS,
+    CAPS,HOME,UP,  PGUP,NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  INS,          P7,  P8,  P9,  PMNS,
     LCTL,LEFT,DOWN,RGHT,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,     ENT,     P4,  P5,  P6,  PPLS,
     LSFT,END, NO,  PGDN,NO,  NO,  NO,  NO,  END, PGDN,DOWN,          PGUP,    P1,  P2,  P3,  PENT,
-    LALT,LGUI,               SPC,                FN0, INS, HOME,END, PGDN,    P0,       PDOT
+    LALT,LGUI,               SPC,                FN0, FN13,HOME,END, PGDN,    P0,       PDOT
     ),
 };
 
@@ -80,6 +97,41 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
 /*
  * Fn action definition
  */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
 const uint16_t fn_actions[] PROGMEM = {
+#endif
     [0]  = ACTION_LAYER_MOMENTARY(1),
+    [1]  = ACTION_LAYER_MOMENTARY(2),
+    [2]  = ACTION_LAYER_MOMENTARY(3),
+    [3]  = ACTION_LAYER_MOMENTARY(4),
+    [4]  = ACTION_LAYER_MOMENTARY(5),
+    [5]  = ACTION_LAYER_MOMENTARY(6),
+    [6]  = ACTION_LAYER_MOMENTARY(7),
+    [7]  = ACTION_LAYER_TOGGLE(1),
+    [8]  = ACTION_LAYER_TOGGLE(2),
+    [9]  = ACTION_LAYER_TOGGLE(3),
+    [10] = ACTION_LAYER_TAP_TOGGLE(1),
+    [11] = ACTION_LAYER_TAP_TOGGLE(2),
+    [12] = ACTION_LAYER_TAP_TOGGLE(3),
+    [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH),
+    [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB),
+    [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER),
+    [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
+    [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
+    [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
+    [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
+    [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
+    [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
+    [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
+    [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
+    [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
+    [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
+    [26] = ACTION_MODS_ONESHOT(MOD_LCTL),
+    [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
+    [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
+    [29] = ACTION_MODS_ONESHOT(MOD_LSFT),
+    [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE),
+    [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH),
 };

+ 0 - 118
converter/m0110_usb/keymap_for_editor.c

@@ -1,118 +0,0 @@
-/*
-Copyright 2014 Jun Wako <wakojun@gmail.com>
-
-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 <http://www.gnu.org/licenses/>.
-*/
-#include <stdint.h>
-#include "keycode.h"
-#include "keymap_common.h"
-
-
-#ifdef KEYMAP_SECTION_ENABLE
-const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
-#else
-const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
-#endif
-    /* Default:
-     * ,---------------------------------------------------------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Clr|  =|  /|  *|
-     * |---------------------------------------------------------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|   | |  7|  8|  9|  -|
-     * |-----------------------------------------------------'   | |---------------|
-     * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Enter | |  4|  5|  6|  +|
-     * |---------------------------------------------------------| |---------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shft|Up | |  1|  2|  3|   |
-     * |---------------------------------------------------------| |-----------|Ent|
-     * |Ctl  |Gui    |         Space         |Alt|  \|Lft|Rgt|Dn | |      0|  .|   |
-     * `---------------------------------------------------------' `---------------'
-     */
-    [0] = KEYMAP(
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    CLR, EQL, PSLS,PAST,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,         P7,  P8,  P9,  PMNS,
-    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     FN15,    P4,  P5,  P6,  PPLS,
-    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          UP,      P1,  P2,  P3,  PENT,
-    LCTL,LGUI,               FN16,               LALT,FN31,LEFT,RGHT,DOWN,    P0,       PDOT
-    ),
-    /* Cursor Layer(WASD, IJKL)
-     * ,---------------------------------------------------------. ,---------------.
-     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|  =|  /|  *|
-     * |---------------------------------------------------------| |---------------|
-     * |Caps |Hom| Up|PgU|   |   |   |   |Psc|Slk|Pau|Up |Ins|   | |  7|  8|  9|  -|
-     * |-----------------------------------------------------'   | |---------------|
-     * |Caps  |Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Enter | |  4|  5|  6|  +|
-     * |---------------------------------------------------------| |---------------|
-     * |Shift   |End|   |PgD|   |   |   |   |End|PgD|Dow|Shif|PgU| |  1|  2|  3|   |
-     * |---------------------------------------------------------| |-----------|Ent|
-     * |Ctl  |Gui    |         Space        |Alt |  \|Hom|End|PgD| |      0|  .|   |
-     * `---------------------------------------------------------' `---------------'
-     */
-    [3] = KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
-    CAPS,HOME,UP,  PGUP,NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  INS,          P7,  P8,  P9,  PMNS,
-    LCAP,LEFT,DOWN,RGHT,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,     FN15,    P4,  P5,  P6,  PPLS,
-    LSFT,END, NO,  PGDN,NO,  NO,  NO,  NO,  END, PGDN,DOWN,          PGUP,    P1,  P2,  P3,  PENT,
-    LCTL,LGUI,               FN16,               LALT,FN31,HOME,END, PGDN,    P0,       PDOT
-    ),
-    [4] = KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
-    CAPS,HOME,UP,  PGUP,NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  INS,          P7,  P8,  P9,  PMNS,
-    LCAP,LEFT,DOWN,RGHT,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,     FN15,    P4,  P5,  P6,  PPLS,
-    LSFT,END, NO,  PGDN,NO,  NO,  NO,  NO,  END, PGDN,DOWN,          PGUP,    P1,  P2,  P3,  PENT,
-    LCTL,LGUI,               FN16,               LALT,FN31,HOME,END, PGDN,    P0,       PDOT
-    ),
-    [7] = {},
-};
-
-
-/*
- * Fn action definition
- */
-#ifdef KEYMAP_SECTION_ENABLE
-const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
-#else
-const uint16_t fn_actions[] PROGMEM = {
-#endif
-    [0]  = ACTION_LAYER_MOMENTARY(1),
-    [1]  = ACTION_LAYER_MOMENTARY(2),
-    [2]  = ACTION_LAYER_MOMENTARY(3),
-    [3]  = ACTION_LAYER_MOMENTARY(4),
-    [4]  = ACTION_LAYER_MOMENTARY(5),
-    [5]  = ACTION_LAYER_MOMENTARY(6),
-    [6]  = ACTION_LAYER_MOMENTARY(7),
-    [7]  = ACTION_LAYER_TOGGLE(1),
-    [8]  = ACTION_LAYER_TOGGLE(2),
-    [9]  = ACTION_LAYER_TOGGLE(3),
-    [10] = ACTION_LAYER_TAP_TOGGLE(1),
-    [11] = ACTION_LAYER_TAP_TOGGLE(2),
-    [12] = ACTION_LAYER_TAP_TOGGLE(3),
-    [13] = ACTION_LAYER_TAP_KEY(1, KC_F),
-    [14] = ACTION_LAYER_TAP_KEY(2, KC_J),
-    [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER),
-    [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
-    [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
-    [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
-    [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
-    [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
-    [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
-    [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
-    [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
-    [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
-    [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
-    [26] = ACTION_MODS_ONESHOT(MOD_LCTL),
-    [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
-    [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
-    [29] = ACTION_MODS_ONESHOT(MOD_LSFT),
-    [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE),
-    [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH),
-};

+ 8 - 20
converter/m0110_usb/keymap_intl.c

@@ -30,29 +30,17 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
      * |------------------------------------------------------,  | |---------------|
      * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  \|  | |  4|  5|  6|  ,|
      * |---------------------------------------------------------| |---------------|
-     * |Shif|  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift   | |  1|  2|  3|   |
+     * |Shif|  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|        | |  1|  2|  3|   |
      * `---------------------------------------------------------' |-----------|Ent|
-     *      |Opt|Mac |         Space               |Fn  |Opt|      |      0|  .|   |
+     *      |Opt|Mac |         Space               |Fn  |   |      |      0|  .|   |
      *      `-----------------------------------------------'      `---------------'
-     * M0110A(not existent?)
-     * ,---------------------------------------------------------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Nlk|  =|  /|  *|
-     * |---------------------------------------------------------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|Ret| |  7|  8|  9|  -|
-     * |------------------------------------------------------,  | |---------------|
-     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  \|  | |  4|  5|  6|  +|
-     * |---------------------------------------------------------| |---------------|
-     * |Shif|  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shft|Up | |  1|  2|  3|   |
-     * |---------------------------------------------------------| |-----------|Ent|
-     * |Opt  |Mac    |         Space             |  \|Lft|Rgt|Dn | |      0|  .|   |
-     * `---------------------------------------------------------' `---------------'
      */
     [0] = KEYMAP_INTL(
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,ENT,     P7,  P8,  P9,  PMNS,
     LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,BSLS,         P4,  P5,  P6,  PPLS,
-    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     UP,      P1,  P2,  P3,  PENT,
-    LALT,LGUI,               SPC,                FN0,      LEFT,RGHT,DOWN,    P0,       PDOT
+    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,              P1,  P2,  P3,  PENT,
+         LALT,LGUI,               SPC,                     FN0,               P0,       PDOT
     ),
     /* Cursor Layer
      * ,---------------------------------------------------------. ,---------------.
@@ -62,17 +50,17 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
      * |------------------------------------------------------,  | |---------------|
      * |Ctrl  |Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Ins|  | |  4|  5|  6|  ,|
      * |---------------------------------------------------------| |---------------|
-     * |Shif|  <|End|   |PgD|   |   |   |   |End|PgD|Dow|Shift   | |  1|  2|  3|   |
+     * |Shif|  <|End|   |PgD|   |   |   |   |End|PgD|Dow|        | |  1|  2|  3|   |
      * `---------------------------------------------------------' |-----------|Ent|
-     *      |Opt|Mac |         Space               |Fn  |Opt|      |      0|  .|   |
+     *      |Opt|Mac |         Space               |Fn  |   |      |      0|  .|   |
      *      `-----------------------------------------------'      `---------------'
      */
     [1] = KEYMAP_INTL(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,     NLCK,EQL, PSLS,PAST,
     CAPS,HOME,UP,  PGUP,NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,  ENT,     P7,  P8,  P9,  PMNS,
     LCTL,LEFT,DOWN,RGHT,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,INS,          P4,  P5,  P6,  PPLS,
-    LSFT,NO,  END, NO,  PGDN,NO,  NO,  NO,  NO,  END, PGDN,DOWN,     PGUP,    P1,  P2,  P3,  PENT,
-    LALT,LGUI,               SPC,                FN0,      HOME,END, PGDN,    P0,       PDOT
+    LSFT,NO,  END, NO,  PGDN,NO,  NO,  NO,  NO,  END, PGDN,DOWN,              P1,  P2,  P3,  PENT,
+         LALT,LGUI,               SPC,                     FN0,               P0,       PDOT
     ),
 };
 

+ 0 - 64
converter/m0110_usb/keymap_plain.c

@@ -1,64 +0,0 @@
-/*
-Copyright 2014 Jun Wako <wakojun@gmail.com>
-
-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 <http://www.gnu.org/licenses/>.
-*/
-#include <stdint.h>
-#include "keycode.h"
-#include "keymap_common.h"
-
-
-const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-    /* Default:
-     * M0110                                                       M0120
-     * ,---------------------------------------------------------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backs| |Nlk|  -|  +|  *|
-     * |---------------------------------------------------------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \| |  7|  8|  9|  /|
-     * |---------------------------------------------------------| |---------------|
-     * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  ,|
-     * |---------------------------------------------------------| |---------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift   | |  1|  2|  3|   |
-     * `---------------------------------------------------------' |-----------|Ent|
-     *      |Opt|Mac |         Space               |Mac |Opt|      |      0|  .|   |
-     *      `-----------------------------------------------'      `---------------'
-     *  M0110A
-     * ,---------------------------------------------------------. ,---------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Bcksp| |Nlk|  =|  /|  *|
-     * |---------------------------------------------------------| |---------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|   | |  7|  8|  9|  -|
-     * |-----------------------------------------------------'   | |---------------|
-     * |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return| |  4|  5|  6|  +|
-     * |---------------------------------------------------------| |---------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shft|Up | |  1|  2|  3|   |
-     * |---------------------------------------------------------' |-----------|Ent|
-     * |Opt  |Mac    |           Space           |  \|Lft|Rgt|Dn | |      0|  .|   |
-     * `---------------------------------------------------------' `---------------'
-     */
-    [0] = KEYMAP(
-    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    NLCK,PEQL,PSLS,PAST,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,         P7,  P8,  P9,  PMNS,
-    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,     P4,  P5,  P6,  PPLS,
-    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          UP,      P1,  P2,  P3,  PENT,
-    LALT,LGUI,               SPC,                RGUI,BSLS,LEFT,RGHT,DOWN,    P0,       PDOT
-    ),
-};
-
-/*
- * Fn action definition
- */
-const uint16_t fn_actions[] PROGMEM = {
-};
-
-

+ 6 - 6
converter/news_usb/Makefile.pjrc

@@ -7,7 +7,7 @@
 TARGET = news_usb_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -65,10 +65,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 8 - 8
converter/next_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = next_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -17,10 +17,10 @@ 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 = atmega32u4       # Teensy 2.0
 #MCU = at90usb646       # Teensy++ 1.0
 #MCU = at90usb1286      # Teensy++ 2.0
-#MCU = atmega32u2       # TMK converter
+MCU = atmega32u2       # TMK converter
 
 
 # Processor frequency.
@@ -78,10 +78,10 @@ SRC += next_kbd.c
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/next_usb/Makefile.pjrc

@@ -2,7 +2,7 @@
 TARGET = next_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -54,10 +54,10 @@ SRC += next_kbd.c
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 10 - 8
converter/next_usb/config.h

@@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-#define VENDOR_ID       0xBCBC
+#define VENDOR_ID       0xFEED
 #define PRODUCT_ID      0xBCBC
 #define DEVICE_VER      0x0500
 #define MANUFACTURER    t.m.k.
@@ -56,14 +56,15 @@ POSSIBILITY OF SUCH DAMAGE.
 #define MATRIX_ROWS 12  // keycode bit: 3-0
 #define MATRIX_COLS  8  // keycode bit: 6-4
 
-//#define DEBUG_ON_INIT 1
+#define DEBUG_ON_INIT 1
 
 //#define TEENSY_CONFIG 1
-#define PRO_MICRO_CONFIG 1
-//#define TMK_CONFIG 1
+//#define PRO_MICRO_CONFIG 1
+#define TMK_CONFIG 1
 
-// comment out if you don't want the keyboard's LEDs to flash upon initialization
-#define NEXT_KBD_INIT_FLASH_LEDS
+// comment out if you don't want the keyboard's LEDs to flash upon initialization or pressing shift
+//#define NEXT_KBD_INIT_FLASH_LEDS
+//#define NEXT_KBD_SHIFT_FLASH_LEDS
 
 //============= Start of Arduino Pro Micro Configuration ==============
 #ifdef PRO_MICRO_CONFIG
@@ -183,6 +184,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* key combination for command */
 #define IS_COMMAND() ( \
-    (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))|| \
-    (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL)))  \
+    (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
+    (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RALT))) || \
+    (keyboard_report->mods == (MOD_BIT(KC_RGUI) | MOD_BIT(KC_RGUI)))  \
 )

+ 1 - 1
converter/next_usb/keymap.c

@@ -159,7 +159,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS,  VOLD,     PGDN,  BTN1,MS_U,BTN2,WH_U,
     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,                   MS_L,MS_D,MS_R,WH_D,
     TRNS,     FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,       TRNS,       TRNS,TRNS,TRNS,  
-    TRNS,RALT,                    TRNS,                         RGUI,TRNS,  TRNS,TRNS,TRNS,  TRNS,     TRNS,TRNS
+    TRNS,TRNS,                    TRNS,                         TRNS,TRNS,  TRNS,TRNS,TRNS,  TRNS,     TRNS,TRNS
     
     )
 };

+ 6 - 1
converter/next_usb/led.c

@@ -47,9 +47,14 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "stdint.h"
 #include "led.h"
+#include "next_kbd.h"
 
 
 void led_set(uint8_t usb_led)
 {
-
+    if (usb_led &  (1<<USB_LED_CAPS_LOCK)) {
+        next_kbd_set_leds(true, true);
+    } else {
+        next_kbd_set_leds(false, false);
+    }
 }

+ 3 - 1
converter/next_usb/matrix.c

@@ -160,7 +160,7 @@ void matrix_init(void)
 /* scan all key states on matrix */
 uint8_t matrix_scan(void)
 {
-    _delay_ms(20);
+    _delay_ms(5);
     
     //next_kbd_set_leds(false, false);
     NEXT_KBD_LED1_OFF;
@@ -194,10 +194,12 @@ uint8_t matrix_scan(void)
     
     NEXT_KBD_LED1_ON;
     
+#ifdef NEXT_KBD_SHIFT_FLASH_LEDS
     next_kbd_set_leds(
         NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false, 
         NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
     );
+#endif
     
     dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
         resp, \

+ 6 - 6
converter/pc98_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = pc98_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -74,10 +74,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 8 - 8
converter/ps2_usb/Makefile

@@ -5,7 +5,7 @@
 TARGET = ps2_usb_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -87,8 +87,8 @@ 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_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
 
 
@@ -97,9 +97,9 @@ PS2_USE_USART = yes	# uses hardware USART engine for PS/2 signal receive(recomen
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 2 - 2
converter/ps2_usb/Makefile.mbed

@@ -1,7 +1,7 @@
 PROJECT = ps2_usb
 
-TMK_DIR = ../..
-MBED_DIR = $(TMK_DIR)/mbed-sdk
+TMK_DIR = ../../tmk_core
+MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk
 
 #VPATH += $(MBED_DIR):$(TMK_DIR)
 vpath %.s .:$(MBED_DIR):$(TMK_DIR)

+ 6 - 6
converter/ps2_usb/Makefile.pjrc

@@ -2,7 +2,7 @@
 TARGET = ps2_usb_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -66,10 +66,10 @@ PS2_USE_BUSYWAIT = yes	# uses primitive reference code
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/ps2_usb/Makefile.tmk_rev1

@@ -6,7 +6,7 @@
 TARGET = ps2_usb_tmk_rev1
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -90,9 +90,9 @@ PS2_USE_USART = yes	# uses hardware USART engine for PS/2 signal receive(recomen
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/ps2_usb/Makefile.tmk_rev2

@@ -6,7 +6,7 @@
 TARGET = ps2_usb_tmk_rev2
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -90,9 +90,9 @@ PS2_USE_INT = yes	# uses external interrupt for falling edge of PS/2 clock pin
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 10 - 10
converter/ps2_usb/Makefile.vusb

@@ -2,7 +2,7 @@
 TARGET = ps2_usb_vusb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -18,13 +18,13 @@ else
     SRC := keymap_plain.c $(SRC)
 endif
 
-# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
-SRC += protocol/ps2_usart.c
-OPT_DEFS += -DPS2_USE_USART
-
 CONFIG_H = config.h
 
 
+# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
+PS2_USE_USART = yes
+
+
 # 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
@@ -98,10 +98,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=2048
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/protocol/vusb.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/rules.mk

+ 1 - 1
converter/ps2_usb/README.md

@@ -14,7 +14,7 @@ In case of Teensy2.0(ATMega32U4):
     - **USART**:       **Clock** is on `PD5` and **Data** on `PD2`.
 3. Optionally you need pull-up resistor. 1K-10K Ohm is OK.
 
-To change pin configuration edit config.h.
+To change pin configuration edit **config.h** and **Makefile**.
 
 
 Build Firmware

+ 3 - 3
converter/ps2_usb/config.h

@@ -50,11 +50,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define PS2_CLOCK_PORT  PORTD
 #define PS2_CLOCK_PIN   PIND
 #define PS2_CLOCK_DDR   DDRD
-#define PS2_CLOCK_BIT   5
+#define PS2_CLOCK_BIT   1
 #define PS2_DATA_PORT   PORTD
 #define PS2_DATA_PIN    PIND
 #define PS2_DATA_DDR    DDRD
-#define PS2_DATA_BIT    2
+#define PS2_DATA_BIT    0
 #endif
 
 /*
@@ -69,7 +69,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define PS2_DATA_PORT   PORTD
 #define PS2_DATA_PIN    PIND
 #define PS2_DATA_DDR    DDRD
-#define PS2_DATA_BIT    2
+#define PS2_DATA_BIT    0
 #define PS2_INT_INIT()  do {    \
     EICRA |= ((1<<ISC11) |      \
               (0<<ISC10));      \

+ 6 - 6
converter/serialmouse_usb/Makefile

@@ -5,7 +5,7 @@
 TARGET = serialmouse_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -98,9 +98,9 @@ SERIAL_MOUSE_USE_SOFT = yes		# use software serial implementation
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/sun_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = sun_usb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -76,10 +76,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 9 - 2
converter/sun_usb/README

@@ -1,11 +1,18 @@
 Sun to USB keyboard protocol converter
 ======================================
 Target MCU is ATMega32u4 but other USB capable AVR will also work.
-Supported keyboards: Sun Type 5 Keyboard, CTCSP SHORT TYPE KEYBOARD(CKUB)
 
-CTCSP SHORT TYPE KEYBOARD: http://imgur.com/a/QIv6p
+This converter will work with Sun Type 2-5 Keyboards.
 
 
+Tested on:
+Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
+CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p
+
+
+Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository.
+https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb
+
 
 
 Connector

+ 8 - 2
converter/sun_usb/config.h

@@ -56,12 +56,18 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define SERIAL_SOFT_RXD_BIT         2
 #define SERIAL_SOFT_RXD_VECT        INT2_vect
 /* RXD Interupt */
+#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
+/* enable interrupt: INT2(rising edge) */
+#define INTR_TRIG_EDGE   ((1<<ISC21)|(1<<ISC20))
+#else
+/* enable interrupt: INT2(falling edge) */
+#define INTR_TRIG_EDGE   ((1<<ISC21)|(0<<ISC20))
+#endif
 #define SERIAL_SOFT_RXD_INIT()      do { \
     /* pin configuration: input with pull-up */ \
     SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
     SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
-    /* enable interrupt: INT2(rising edge) */ \
-    EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+    EICRA |= INTR_TRIG_EDGE; \
     EIMSK |= (1<<INT2); \
     sei(); \
 } while (0)

+ 173 - 0
converter/sun_usb/keymap_sun3.c

@@ -0,0 +1,173 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "util.h"
+#include "keymap.h"
+
+
+/* Sun type 3 keyboard 
+,-------.  ,-----------------------------------------------------------.  ,-----------.
+| 01| 03|  | 05| 06|     08|     0A|     0C|     0E|     10| 11| 12| 2B|  | 15| 16| 17|
+|-------|  |-----------------------------------------------------------|  |-----------|
+| 19| 1A|  | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A|  | 2D| 2E| 2F|
+|-------|  |-----------------------------------------------------------|  |-----------|
+| 31| 33|  |  35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42  |  | 44| 45| 46|
+|-------|  |-----------------------------------------------------------|  |-----------|
+| 48| 49|  |  4C  | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57|   59   |  | 5B| 5C| 5D|
+|-------|  |-----------------------------------------------------------|  |-----------|
+| 5F| 61|  |   63   | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D|    6E| 6F|  | 70| 71| 72|
+`-------'  |-----------------------------------------------------------|  `-----------'
+           | 77 | 78  |               79                  | 7A  |   13 |  
+           `-----------------------------------------------------------'  
+*/
+
+
+#define KEYMAP( \
+    K01,K03,  K05,K06,    K08,    K0A,    K0C,    K0E,    K10,K11,K12,K2B,  K15,K16,K17, \
+    K19,K1A,  K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A,  K2D,K2E,K2F, \
+    K31,K33,  K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,   K42,  K44,K45,K46, \
+    K48,K49,  K4C,  K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57,      K59,  K5B,K5C,K5D, \
+    K5F,K61,  K63,   K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D,     K6E,K6F,  K70,K71,K72, \
+              K77,K78,                    K79,                    K7A,K13                \
+) { \
+    { KC_NO,    KC_##K01, KC_NO,    KC_##K03, KC_NO,    KC_##K05, KC_##K06, KC_NO    }, \
+    { KC_##K08, KC_NO,    KC_##K0A, KC_NO,    KC_##K0C, KC_NO,    KC_##K0E, KC_NO    }, \
+    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_NO,    KC_##K15, KC_##K16, KC_##K17 }, \
+    { KC_NO,    KC_##K19, KC_##K1A, KC_NO,    KC_NO,    KC_##K1D, KC_##K1E, KC_##K1F }, \
+    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO,    KC_##K2D, KC_##K2E, KC_##K2F }, \
+    { KC_NO,    KC_##K31, KC_NO,    KC_##K33, KC_NO,    KC_##K35, KC_##K36, KC_##K37 }, \
+    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+    { KC_##K40, KC_##K41, KC_##K42, KC_NO,    KC_##K44, KC_##K45, KC_##K46, KC_NO    }, \
+    { KC_##K48, KC_##K49, KC_NO,    KC_NO,    KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+    { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+    { KC_##K58, KC_##K59, KC_NO,    KC_##K5B, KC_##K5C, KC_##K5D, KC_NO,    KC_##K5F }, \
+    { KC_NO,    KC_##K61, KC_NO,    KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+    { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
+    { KC_##K70, KC_##K71, KC_##K72, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K77 }, \
+    { KC_##K78, KC_##K79, KC_##K7A, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }  \
+}
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+    2,              // Fn0
+    3,              // Fn1
+    4,              // Fn2
+    0,              // Fn3
+    0,              // Fn4
+    0,              // Fn5
+    0,              // Fn6
+    0               // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+    KC_NO,          // Fn0
+    KC_SCLN,        // Fn1
+    KC_SLSH,        // Fn2
+    KC_NO,          // Fn3
+    KC_NO,          // Fn4
+    KC_NO,          // Fn5
+    KC_NO,          // Fn6
+    KC_NO           // Fn7
+};
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+    KEYMAP(
+    F10, F11,   F1, F2,     F3,     F4,     F5,     F6,      F7,  F8, F9,  BSPC,   VOLD, MUTE,   VOLU,
+    F12, F13,   ESC, 1,  2,  3,  4,  5,  6,  7,  8,  9,  0,MINS, EQL, BSLS, GRV,   MPRV, MPLY,   MNXT,
+    F14, F15,   TAB, Q,  W,  E,  R,  T,  Y,  U,  I,  O,  P,   LBRC,RBRC,    DEL,   HOME, UP,     PGUP,
+    F16, F17,   LCTL, A,  S,  D,  F,  G,  H,  J,  K,  L,  SCLN,QUOT,        ENT,   LEFT, INSERT, RIGHT, 
+    F18, F19,   LSFT,  Z,  X,  C,  V,  B,  N,  M,  COMM,DOT,SLSH,     RSFT,RCTL,   END,  DOWN,   PGDOWN,
+                LGUI, LALT,                 SPC,                      RALT,RGUI
+    ),
+    /*
+    // 0: default
+    SHORT_TYPE(
+        STOP, F1,F2,F3,F4, F5, F6,   CUT,PASTE,COPY,PWR,    INS, HOME,PGUP,
+              F7,F8,F9,F10,F11,F12,                         DEL, END, PGDN,
+        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,   SCLN,QUOT,        ENT,
+        LSFT,   Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,  RALT,UP,  RSFT,
+        CAPS,LALT,LGUI,            SPC,              RGUI,APP, NLCK,LEFT,DOWN,RGHT
+    ),
+    // 1: with layer keys
+    SHORT_TYPE(
+        ESC,  F1,F2,F3,F4, F5, F6,   CUT,PASTE,COPY,PWR,    INS, HOME,PGUP,
+              F7,F8,F9,F10,F11,F12,                         DEL, END, PGDN,
+        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,   FN1, QUOT,        ENT,
+        LSFT,   Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, FN2,   RSFT,UP,  FN0,
+        CAPS,LALT,LGUI,            SPC,              RGUI,RALT,FN0, LEFT,DOWN,RGHT
+    ),
+    // 2: HHKB
+    SHORT_TYPE(
+        ESC,  F1,F2,F3,F4, F5, F6,   CUT,PASTE,COPY,PWR,    INS, HOME,PGUP,
+              F7,F8,F9,F10,F11,F12,                         DEL, END, PGDN,
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,
+        CAPS, NO,  NO,  NO,  NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,      BSPC,
+        LCTL,  VOLD,VOLU,MUTE,NO,  NO,  NO,  NO,  HOME,PGUP,LEFT,RGHT,        ENT,
+        LSFT,   Z,   X,   C,   V,   B,   NO,  NO,  END, PGDN,DOWN,  RSFT,PGUP,FN0,
+        CAPS,LALT,LGUI,            SPC,              RGUI,RALT,FN0, HOME,PGDN,END
+    ),
+    // 3: Mousekey
+    SHORT_TYPE(
+        ESC,  F1,F2,F3,F4, F5, F6,   CUT,PASTE,COPY,PWR,    INS, HOME,PGUP,
+              F7,F8,F9,F10,F11,F12,                         DEL, END, PGDN,
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,
+        CAPS, NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,WH_U,WH_R,NO,  NO,  NO,      BSPC,
+        LCTL,  NO,  ACL0,ACL1,ACL2,NO,  MS_L,MS_D,MS_U,MS_R,FN1, NO,          ENT,
+        LSFT,   NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,NO,  NO,  NO,    RSFT,UP,  NO,
+        CAPS,LALT,LGUI,            BTN1,             RGUI,RALT,NO,  LEFT,DOWN,RGHT
+    ),
+    // 4: Cursor
+    SHORT_TYPE(
+        ESC,  F1,F2,F3,F4, F5, F6,   CUT,PASTE,COPY,PWR,    INS, HOME,PGUP,
+              F7,F8,F9,F10,F11,F12,                         DEL, END, PGDN,
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,
+        CAPS, NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, NO,  NO,  NO,      BSPC,
+        LCTL,  NO,  NO,  NO,  NO,  NO,  LEFT,DOWN,UP,  RGHT,NO,  NO,          ENT,
+        LSFT,   NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, FN2,   RSFT,UP,  NO,
+        CAPS,LALT,LGUI,            BTN1,             RGUI,RALT,NO,  LEFT,DOWN,RGHT
+    ),
+    */
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+    return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+    return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+    return pgm_read_byte(&fn_keycode[index]);
+}

+ 2 - 0
converter/sun_usb/led.c

@@ -18,6 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "stdint.h"
 #include "serial.h"
 #include "led.h"
+#include "debug.h"
 
 
 void led_set(uint8_t usb_led)
@@ -27,6 +28,7 @@ void led_set(uint8_t usb_led)
     if (usb_led & (1<<USB_LED_COMPOSE))     sun_led |= (1<<1);
     if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
     if (usb_led & (1<<USB_LED_CAPS_LOCK))   sun_led |= (1<<3);
+    xprintf("LED: %02X\n", usb_led);
 
     serial_send(0x0E);
     serial_send(sun_led);

+ 34 - 10
converter/sun_usb/matrix.c

@@ -72,6 +72,21 @@ void matrix_init(void)
     // initialize matrix state: all keys off
     for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
 
+    // wait for keyboard coming up
+    // otherwise LED status update fails
+    print("Reseting ");
+    while (1) {
+        print(".");
+        while (serial_recv());
+        serial_send(0x01);
+        _delay_ms(500);
+        if (serial_recv() == 0xFF) {
+            _delay_ms(500);
+            if (serial_recv() == 0x04)
+                break;
+        }
+    }
+    print(" Done\n");
     return;
 }
 
@@ -86,17 +101,26 @@ uint8_t matrix_scan(void)
     debug_hex(code); debug(" ");
 
     switch (code) {
-        case 0xFF:  // reset success
-        case 0xFE:  // layout
-        case 0x7E:  // reset fail
-            if (code == 0xFF) print("reset: 0xFF ");
-            if (code == 0x7E) print("reset fail: 0x7E ");
-            if (code == 0xFE) print("layout: 0xFE ");
-            // response byte
+        case 0xFF:  // reset success: FF 04
+            print("reset: ");
+            _delay_ms(500);
+            code = serial_recv();
+            xprintf("%02X\n", code);
+            if (code == 0x04) {
+                // LED status
+                led_set(host_keyboard_leds());
+            }
+            return 0;
+        case 0xFE:  // layout: FE <layout>
+            print("layout: ");
+            _delay_ms(500);
+            xprintf("%02X\n", serial_recv());
+            return 0;
+        case 0x7E:  // reset fail: 7E 01
+            print("reset fail: ");
             _delay_ms(500);
-            if (code = serial_recv()) print_hex8(code);
-            print("\n");
-            // FALL THROUGH
+            xprintf("%02X\n", serial_recv());
+            return 0;
         case 0x7F:
             // all keys up
             for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;

+ 7 - 7
converter/terminal_bluefruit/Makefile

@@ -2,7 +2,7 @@
 TARGET = terminal_bluefruit
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -89,11 +89,11 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/bluefruit.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/bluefruit.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
converter/terminal_usb/Makefile

@@ -2,7 +2,7 @@
 TARGET = terminal_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -89,10 +89,10 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 60 - 0
converter/terminal_usb/keymap.c

@@ -70,6 +70,36 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
     { KC_NO,    KC_NO,    KC_NO,    KC_##K83, KC_##K84, KC_NO,    KC_NO,    KC_NO,   }, \
 }
 
+/*
+ * IBM Terminal keyboard 1399625, 101-key
+ */
+#define KEYMAP_101( \
+    K08,    K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E,  K57,K5F,K62,                   \
+                                                                                             \
+    K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66,  K67,K6E,K6F,  K76,K77,K7E,K84, \
+    K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5C,  K64,K65,K6D,  K6C,K75,K7D,     \
+    K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,    K5A,                K6B,K73,K74,K7C, \
+    K12,    K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,    K59,      K63,      K69,K72,K7A,     \
+    K11,    K19,            K29,                K39,    K58,  K61,K60,K6A,  K70,    K71,K79  \
+) { \
+    { KC_NO,    KC_NO   , KC_NO,    KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_##K07 }, \
+    { KC_##K08, KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_##K0D, KC_##K0E, KC_##K0F }, \
+    { KC_NO   , KC_##K11, KC_##K12, KC_NO   , KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+    { KC_NO   , KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+    { KC_NO   , KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+    { KC_NO   , KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+    { KC_NO   , KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+    { KC_NO   , KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+    { KC_NO   , KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+    { KC_NO   , KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+    { KC_NO   , KC_NO   , KC_##K52, KC_NO   , KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+    { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_NO   , KC_##K5E, KC_##K5F }, \
+    { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+    { KC_NO   , KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
+    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+    { KC_NO   , KC_##K79, KC_##K7A, KC_NO   , KC_##K7C, KC_##K7D, KC_##K7E, KC_NO    }, \
+    { KC_NO,    KC_NO,    KC_NO,    KC_NO   , KC_##K84, KC_NO,    KC_NO,    KC_NO,   }, \
+}
 
 // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
 static const uint8_t PROGMEM fn_layer[] = {
@@ -137,6 +167,36 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     APP, INT6,  LSFT,LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     NO,  RSFT,  LEFT,INT2,RGHT,  P1,  P2,  P3,  PENT,
     RGUI,LGUI,  LCTL,     LALT,               SPC,                          LGUI,     GRV,        DOWN,       NO,  P0,  PDOT,NO
     ),
+
+/* 101-key keymaps
+ */
+    /* 0: default
+     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
+     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+     * `---'   `---------------' `---------------' `---------------' `-----------'
+     * ,-----------------------------------------------------------. ,-----------. ,---------------.
+     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  /|  *|  -|
+     * |-----------------------------------------------------------| |-----------| |---------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|   |
+     * |-----------------------------------------------------------| `-----------' |-----------|  +|
+     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|   |
+     * |-----------------------------------------------------------|     ,---.     |---------------|
+     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
+     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+     * |Ctrl|    |Alt |          Space              |Alt |    |Ctrl| |Lef|Dow|Rig| |      0|  .|   |
+     * `----'    `---------------------------------------'    `----' `-----------' `---------------'
+     */
+/*
+    KEYMAP_101(
+     ESC,       F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9, F10, F11, F12,     PSCR,SLCK, BRK,
+
+     GRV,   1,   2,   3,   4,   5,   6,   7,   8,   9,   0,MINS, EQL,BSPC,      INS,HOME,PGUP,     NLCK,PSLS,PAST,PMNS,
+     TAB,   Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,LBRC,RBRC,BSLS,      DEL, END,PGDN,       P7,  P8,  P9,
+    CAPS,   A,   S,   D,   F,   G,   H,   J,   K,   L,SCLN,QUOT,      ENT,                           P4,  P5,  P6,PPLS,
+    LSFT,        Z,   X,   C,   V,   B,   N,   M,COMM, DOT,SLSH,     RSFT,            UP,            P1,  P2,  P3,
+    LCTL,     LALT,                SPC,                    RALT,     RCTL,     LEFT,DOWN,RGHT,       P0,     PDOT,PENT
+    ),
+*/
 };
 
 

+ 12 - 8
converter/usb_usb/Makefile

@@ -27,7 +27,7 @@
 # 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, 
+# 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.
@@ -41,7 +41,7 @@
 # Target file name (without extension).
 TARGET = usb_usb
 
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -93,6 +93,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
 MOUSEKEY_ENABLE = yes	# Mouse keys
 EXTRAKEY_ENABLE = yes	# Media control and System control
 CONSOLE_ENABLE = yes	# Console for debug
+#COMMAND_ENABLE = yes    # Commands for debug and configuration
 #NKRO_ENABLE = yes	# USB Nkey Rollover
 
 # Boot Section Size in bytes
@@ -101,12 +102,15 @@ CONSOLE_ENABLE = yes	# Console for debug
 #   LUFA bootloader  4096
 OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
+#LDFLAGS += -Wl,--relax
 
+#OPT_DEFS += -DNO_ACTION_TAPPING
+#OPT_DEFS += -DNO_ACTION_LAYER
+#OPT_DEFS += -DNO_ACTION_MACRO
 
 SRC =  \
        keymap_common.c \
        matrix.c \
-       led.c \
        main.cpp
 
 ifdef KEYMAP
@@ -121,7 +125,7 @@ CONFIG_H = config.h
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
 
@@ -130,7 +134,7 @@ PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV)
 
 
 
-include $(TOP_DIR)/protocol/usb_hid.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/usb_hid.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 4 - 26
converter/usb_usb/keymap.c

@@ -19,7 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-    /* 0: default
+    /* 0: plain Qwerty without layer switching
      * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.     ,-----------.
      * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|     |Pwr|Slp|Wak|
      * `---'   `---------------' `---------------' `---------------' `-----------'     `-----------'
@@ -37,28 +37,6 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      */
     KEYMAP(
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,
-    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
-    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
-    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
-    LCTL,LGUI,LALT,          SPC,                     RALT,RGUI,APP, GRV,      LEFT,DOWN,RGHT,    P0,       PDOT,PENT
-    ),
-
-    /* 1: plain Qwerty without layer switching
-     * ,-----------------------------------------------------------.
-     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa|
-     * |-----------------------------------------------------------|
-     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|
-     * |-----------------------------------------------------------|
-     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |
-     * |-----------------------------------------------------------|
-     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |
-     * |-----------------------------------------------------------|
-     * |Ctrl |Gui |Alt |         Space         |Alt |Gui |Menu|Ctrl|
-     * `-----------------------------------------------------------'
-     */
-    KEYMAP(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,
     CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
@@ -66,7 +44,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          SPC,                     RALT,RGUI,APP, RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
 
-    /* 2: Colemak http://colemak.com
+    /* 1: Colemak http://colemak.com
      * ,-----------------------------------------------------------.
      * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa|
      * |-----------------------------------------------------------|
@@ -88,7 +66,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          SPC,                     RALT,RGUI,APP, RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
 
-    /* 3: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
+    /* 2: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
      * ,-----------------------------------------------------------.
      * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  [|  ]|Backspa|
      * |-----------------------------------------------------------|
@@ -110,7 +88,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     LCTL,LGUI,LALT,          SPC,                     RALT,RGUI,APP, RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
 
-    /* 4: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
+    /* 3: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
      * ,-----------------------------------------------------------.
      * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa|
      * |-----------------------------------------------------------|

+ 49 - 37
converter/usb_usb/main.cpp

@@ -5,10 +5,10 @@
 
 // USB HID host
 #include "Usb.h"
+#include "usbhub.h"
 #include "hid.h"
 #include "hidboot.h"
 #include "parser.h"
-#include "usbhub.h"
 
 // LUFA
 #include "lufa.h"
@@ -17,22 +17,31 @@
 #include "sendchar.h"
 #include "debug.h"
 #include "keyboard.h"
+#include "led.h"
+
+
+/* LED ping configuration */
+#define TMK_LED
+//#define LEONARDO_LED
+#if defined(TMK_LED)
+// For TMK converter and Teensy
+#define LED_TX_INIT    (DDRD  |=  (1<<6))
+#define LED_TX_ON      (PORTD |=  (1<<6))
+#define LED_TX_OFF     (PORTD &= ~(1<<6))
+#define LED_TX_TOGGLE  (PORTD ^=  (1<<6))
+#elif defined(LEONARDO_LED)
+// For Leonardo(TX LED)
+#define LED_TX_INIT    (DDRD  |=  (1<<5))
+#define LED_TX_ON      (PORTD &= ~(1<<5))
+#define LED_TX_OFF     (PORTD |=  (1<<5))
+#define LED_TX_TOGGLE  (PORTD ^=  (1<<5))
+#else
+#define LED_TX_INIT
+#define LED_TX_ON
+#define LED_TX_OFF
+#define LED_TX_TOGGLE
+#endif
 
-#include "leonardo_led.h"
-
-
-static USB     usb_host;
-static HIDBoot<HID_PROTOCOL_KEYBOARD>    kbd(&usb_host);
-static KBDReportParser kbd_parser;
-static USBHub hub1(&usb_host);  // one hub is enough for HHKB pro2
-/* may be needed  for other device with more hub
-static USBHub hub2(&usb_host);
-static USBHub hub3(&usb_host);
-static USBHub hub4(&usb_host);
-static USBHub hub5(&usb_host);
-static USBHub hub6(&usb_host);
-static USBHub hub7(&usb_host);
-*/
 
 static void LUFA_setup(void)
 {
@@ -53,18 +62,24 @@ static void LUFA_setup(void)
     print_set_sendchar(sendchar);
 }
 
-static void HID_setup()
+
+
+/*
+ * USB Host Shield HID keyboard
+ */
+USB usb_host;
+USBHub hub1(&usb_host);
+HIDBoot<HID_PROTOCOL_KEYBOARD>    kbd(&usb_host);
+KBDReportParser kbd_parser;
+
+
+void led_set(uint8_t usb_led)
 {
-    if (usb_host.Init() == -1) {
-        debug("HID init: failed\n");
-        LED_TX_OFF;
-    }
-  
-    _delay_ms(200);
-      
-    kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser);
+    kbd.SetReport(0, 0, 2, 0, 1, &usb_led);
 }
 
+
+
 int main(void)
 {
     // LED for debug
@@ -72,35 +87,32 @@ int main(void)
     LED_TX_ON;
 
     debug_enable = true;
-/*
-    debug_matrix = true;
     debug_keyboard = true;
-    debug_mouse = true;
-*/
 
     host_set_driver(&lufa_driver);
     keyboard_init();
 
     LUFA_setup();
+
+    // USB Host Shield setup
+    usb_host.Init();
+    kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser);
+
+    /* NOTE: Don't insert time consuming job here.
+     * It'll cause unclear initialization failure when DFU reset(worm start).
+     */
     sei();
 
-uint8_t ret;
     // wait for startup of sendchar routine
     while (USB_DeviceState != DEVICE_STATE_Configured) ;
     if (debug_enable) {
         _delay_ms(1000);
     }
 
-    debug("init: start\n");
-    HID_setup();
-    
     debug("init: done\n");
 
 uint16_t timer;
-// to see loop pulse with oscillo scope
-DDRF = (1<<7);
     for (;;) {
-PORTF ^= (1<<7);
         keyboard_task();
 
 timer = timer_read();
@@ -115,6 +127,6 @@ if (timer > 100) {
         USB_USBTask();
 #endif
     }
-        
+
     return 0;
 }

+ 6 - 6
converter/x68k_usb/Makefile

@@ -7,7 +7,7 @@
 TARGET = x68k_usb_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -92,10 +92,10 @@ PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/IIgs/Makefile

@@ -42,7 +42,7 @@
 TARGET = IIgs_Standard
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -88,8 +88,8 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 134 - 0
keyboard/alps64/Makefile

@@ -0,0 +1,134 @@
+#----------------------------------------------------------------------------
+# 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 = alps64
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC =	keymap_common.c \
+	matrix.c \
+	led.c
+
+ifdef KEYMAP
+    SRC := keymap_$(KEYMAP).c $(SRC)
+else
+    SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# MCU name
+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)
+
+# 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
+#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 70 - 0
keyboard/alps64/config.h

@@ -0,0 +1,70 @@
+/*
+Copyright 2015 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID       0xFEED
+#define PRODUCT_ID      0x6464
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    TMK
+#define PRODUCT         Alps64
+#define DESCRIPTION     TMK keyboard firmware for Alps64
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE    5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+
+/*
+ * Feature disable options
+ *  These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+
+#endif

+ 30 - 0
keyboard/alps64/keymap_common.c

@@ -0,0 +1,30 @@
+/*
+Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+    return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+    return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}

+ 70 - 0
keyboard/alps64/keymap_common.h

@@ -0,0 +1,70 @@
+/*
+Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+#ifndef KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* Alps64 keymap definition macro */
+#define KEYMAP( \
+    K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \
+    K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+    K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+    K31, K41, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, K22, \
+    K30, K40, K50,           K60,                     K70, K00, K10, K20  \
+) { \
+    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+    { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+    { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 } \
+}
+
+/* AEK US */
+#define KEYMAP_AEK( \
+    K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K27, \
+    K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+    K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+    K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \
+    K30, K40, K50,           K60,                          K00, K10, K20  \
+) KEYMAP( \
+    K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NUHS,K27, \
+    K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+    K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+    K31, NUBS,K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, ESC, \
+    K30, K40, K50,           K60,                     APP, K00, K10, K20  \
+)
+
+#endif

+ 151 - 0
keyboard/alps64/keymap_hasu.c

@@ -0,0 +1,151 @@
+#include "keymap_common.h"
+
+/*
+ * Hasu
+ */
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Default Layer
+     * ,-----------------------------------------------------------.
+     * |Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|   \   |
+     * |-----------------------------------------------------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|Bspc |
+     * |-----------------------------------------------------------|
+     * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|Fn3|  '|FN1     |
+     * |-----------------------------------------------------------|
+     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|Fn2|Shift     |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui |Alt  |       Space            |Alt   |Fn5 |Ctrl |
+     * `-----------------------------------------------------------'
+     */
+    [0] = KEYMAP_AEK( \
+        ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSLS, \
+        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,FN1, \
+        LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, FN2, RSFT, \
+        LCTL,LGUI,LALT,          FN4,                          RALT,FN5, FN0),
+
+    /* HHKB mode[HHKB Fn]
+     * ,-----------------------------------------------------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|   `   |
+     * |-----------------------------------------------------------|
+     * |Caps |   |   |   |   |   |   |   |Psc|Slk|Pus|Up |   |Del  |
+     * |-----------------------------------------------------------|
+     * |Contro|VoD|VoU|Mut|   |   |  *|  /|Hom|PgU|Lef|Rig|Enter   |
+     * |-----------------------------------------------------------|
+     * |Shift   |   |   |   |   |   |  +|  -|End|PgD|Dow|Shift     |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui |Alt  |       Space            |Alt   |Fn5 |Ctrl |
+     * `-----------------------------------------------------------'
+     */ 
+    [1] = KEYMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        CAPS,NO,  NO,  NO,  NO,  NO,  NO,  NO,  PSCR,SLCK,PAUS,UP,  NO,  DEL, \
+        LCTL,VOLD,VOLU,MUTE,NO,  NO,  PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
+        LSFT,NO,  NO,  NO,  NO,  NO,  PPLS,PMNS,END, PGDN,DOWN,RSFT, \
+        LCTL,LGUI,LALT,          TRNS,                         RALT,RGUI,TRNS),
+
+    /* Vi mode[Slash]
+     * ,-----------------------------------------------------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del    |
+     * |-----------------------------------------------------------|
+     * |Tab  |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd|   |   |   |Backs|
+     * |-----------------------------------------------------------|
+     * |Contro|   |Lef|Dow|Rig|   |Lef|Dow|Up |Rig|   |   |Return  |
+     * |-----------------------------------------------------------|
+     * |Shift   |   |   |   |   |   |Hom|PgD|PgUlEnd|Fn0|Shift     |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui |Alt  |       Space            |Alt   |Fn5 |Ctrl |
+     * `-----------------------------------------------------------'
+     */
+    [2] = KEYMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        TAB, HOME,PGDN,UP,  PGUP,END, HOME,PGDN,PGUP,END, NO,  NO,  NO,  DEL, \
+        LCTL,NO,  LEFT,DOWN,RGHT,NO,  LEFT,DOWN,UP,  RGHT,NO,  NO,  ENT, \
+        LSFT,NO,  NO,  NO,  NO,  NO,  HOME,PGDN,PGUP,END, FN2, RSFT, \
+        LCTL,LGUI,LALT,          SPC,                          RALT,RGUI,RCTL),
+
+    /* Mouse mode(IJKL)[Semicolon]
+     * ,-----------------------------------------------------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+     * |-----------------------------------------------------------|
+     * |Tab  |   |   |   |   |   |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+     * |-----------------------------------------------------------|
+     * |Contro|   |   |   |   |   |Mb2|McL|McD|McR|Fn |   |Return  |
+     * |-----------------------------------------------------------|
+     * |Shift   |   |   |   |   |Mb3|Mb2|Mb1|Mb4|Mb5|   |Shift |   |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui |Alt  |       Space            |Alt   |Fn5 |Ctrl |
+     * `-----------------------------------------------------------'
+     * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+     */
+    [3] = KEYMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        FN8, NO,  NO,  NO,  NO,  NO,  NO,  WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+        LCTL,ACL0,ACL1,ACL2,ACL2,NO,  NO,  MS_L,MS_D,MS_R,TRNS,NO,  ENT, \
+        LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,FN9, FN10,NO,  RSFT, \
+        LCTL,LGUI,LALT,          BTN1,                         TRNS,TRNS,TRNS),
+
+    /* Layer 4: Mouse mode(IJKL)[Space]
+     * ,-----------------------------------------------------------.
+     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+     * |-----------------------------------------------------------|
+     * |Tab  |   |   |   |   |   |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+     * |-----------------------------------------------------------|
+     * |Contro|   |   |   |   |   |Mb2|McL|McD|McR|Mb1|   |Return  |
+     * |-----------------------------------------------------------|
+     * |Shift   |   |   |   |   |Mb3|Mb2|Mb1|Mb4|Mb5|   |Shift |   |
+     * |-----------------------------------------------------------|
+     * |Ctrl |Gui |Alt  |       Space            |Alt   |Fn5 |Ctrl |
+     * `-----------------------------------------------------------'
+     * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+     */
+    [4] = KEYMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        FN8, NO,  NO,  NO,  NO,  NO,  NO,  WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+        LCTL,VOLD,VOLU,MUTE,NO,  NO,  NO,  MS_L,MS_D,MS_R,BTN1,NO,  ENT, \
+        LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,FN9, FN10,NO,  RSFT, \
+        LCTL,LGUI,LALT,          TRNS,                         TRNS,TRNS,TRNS),
+};
+
+
+/* id for user defined function/macro */
+enum function_id {
+    NONE,
+};
+
+enum macro_id {
+    ALT_TAB,
+};
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+    [0] = ACTION_LAYER_MOMENTARY(1),                  // HHKB layer
+    [1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER),          // HHKB layer
+    [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH),          // Cursor layer with Slash*
+    [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN),           // Mousekey layer with Semicolon*
+    [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC),            // Mousekey layer with Space
+    [5] = ACTION_LAYER_MOMENTARY(3),                  // Mousekey layer(IJKL)
+    [6] = ACTION_LAYER_TAP_KEY(MOD_RCTL, KC_ENT),      // RControl with tap Enter
+    [7] = ACTION_MODS_ONESHOT(MOD_LSFT),              // Oneshot Shift
+    [8] = ACTION_MACRO(ALT_TAB),                      // Application switching
+    [9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT),
+   [10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT),
+};
+
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+    switch (id) {
+        case ALT_TAB:
+            return (record->event.pressed ?
+                    MACRO( D(LALT), D(TAB), END ) :
+                    MACRO( U(TAB), END ));
+    }
+    return MACRO_NONE;
+}

+ 12 - 0
keyboard/alps64/keymap_plain.c

@@ -0,0 +1,12 @@
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* 0: qwerty */
+    KEYMAP( \
+        GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NUHS, BSPC, \
+        TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
+        CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,  \
+        LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,ESC, \
+        LCTL,LGUI,LALT,          SPC,                     APP, RALT,RGUI,RCTL),
+};
+const uint16_t PROGMEM fn_actions[] = {};

+ 10 - 0
converter/usb_usb/led.c → keyboard/alps64/led.c

@@ -15,10 +15,20 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <avr/io.h>
 #include "stdint.h"
 #include "led.h"
 
 
 void led_set(uint8_t usb_led)
 {
+    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+        // output high
+        DDRC |= (1<<5);
+        PORTC |= (1<<5);
+    } else {
+        // Hi-Z
+        DDRC &= ~(1<<5);
+        PORTC &= ~(1<<5);
+    }
 }

+ 200 - 0
keyboard/alps64/matrix.c

@@ -0,0 +1,200 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+#   define DEBOUNCE	5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+    return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+    return MATRIX_COLS;
+}
+
+#define LED_ON()    do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0)
+#define LED_OFF()   do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0)
+#define LED_TGL()   do { DDRC |= (1<<5); PINC |= (1<<5); } while (0)
+
+void matrix_init(void)
+{
+    // initialize row and col
+    unselect_rows();
+    init_cols();
+
+    // initialize matrix state: all keys off
+    for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+        matrix[i] = 0;
+        matrix_debouncing[i] = 0;
+    }
+
+    //debug
+    debug_matrix = true;
+    LED_ON();
+    _delay_ms(500);
+    LED_OFF();
+}
+
+uint8_t matrix_scan(void)
+{
+    for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+        select_row(i);
+        _delay_us(30);  // without this wait read unstable value.
+        matrix_row_t cols = read_cols();
+        if (matrix_debouncing[i] != cols) {
+            matrix_debouncing[i] = cols;
+            if (debouncing) {
+                debug("bounce!: "); debug_hex(debouncing); debug("\n");
+            }
+            debouncing = DEBOUNCE;
+        }
+        unselect_rows();
+    }
+
+    if (debouncing) {
+        if (--debouncing) {
+            _delay_ms(1);
+        } else {
+            for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+                matrix[i] = matrix_debouncing[i];
+            }
+        }
+    }
+
+    return 1;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+    return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+    return matrix[row];
+}
+
+void matrix_print(void)
+{
+    print("\nr/c 0123456789ABCDEF\n");
+    for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+        phex(row); print(": ");
+        pbin_reverse16(matrix_get_row(row));
+        print("\n");
+    }
+}
+
+/* Column pin configuration
+ * col: 0   1   2   3   4   5   6   7
+ * pin: B0  B1  B2  B3  B4  B5  B6  B7
+ */
+static void  init_cols(void)
+{
+    // Input with pull-up(DDR:0, PORT:1)
+    DDRB  &= ~0b11111111;
+    PORTB |=  0b11111111;
+}
+
+/* Returns status of switches(1:on, 0:off) */
+static matrix_row_t read_cols(void)
+{
+    // Invert because PIN indicates 'switch on' with low(0) and 'off' with high(1)
+    return ~PINB;
+}
+
+/* Row pin configuration
+ * row: 0   1   2   3   4   5   6   7
+ * pin: D0  D1  D2  D3  D4  D5  D6  C2
+ */
+static void unselect_rows(void)
+{
+    // Hi-Z(DDR:0, PORT:0) to unselect
+    DDRD  &= ~0b01111111;
+    PORTD &= ~0b01111111;
+    DDRC  &= ~0b00000100;
+    PORTC &= ~0b00000100;
+}
+
+static void select_row(uint8_t row)
+{
+    // Output low(DDR:1, PORT:0) to select
+    switch (row) {
+        case 0:
+            DDRD  |= (1<<0);
+            PORTD &= ~(1<<0);
+            break;
+        case 1:
+            DDRD  |= (1<<1);
+            PORTD &= ~(1<<1);
+            break;
+        case 2:
+            DDRD  |= (1<<2);
+            PORTD &= ~(1<<2);
+            break;
+        case 3:
+            DDRD  |= (1<<3);
+            PORTD &= ~(1<<3);
+            break;
+        case 4:
+            DDRD  |= (1<<4);
+            PORTD &= ~(1<<4);
+            break;
+        case 5:
+            DDRD  |= (1<<5);
+            PORTD &= ~(1<<5);
+            break;
+        case 6:
+            DDRD  |= (1<<6);
+            PORTD &= ~(1<<6);
+            break;
+        case 7:
+            DDRC  |= (1<<2);
+            PORTC &= ~(1<<2);
+            break;
+    }
+}

+ 1 - 1
keyboard/ergodox_ez/Makefile

@@ -110,5 +110,5 @@ COMMAND_ENABLE = yes    # Commands for debug and configuration
 VPATH += $(TARGET_DIR)
 VPATH += $(TOP_DIR)
 
-include $(TOP_DIR)/quantum.mk
+include $(TOP_DIR)/quantum/quantum.mk
 

+ 6 - 6
keyboard/gh60/Makefile

@@ -42,7 +42,7 @@
 TARGET = gh60_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -55,7 +55,7 @@ SRC =	keymap_common.c \
 ifdef KEYMAP
     SRC := keymap_$(KEYMAP).c $(SRC)
 else
-    SRC := keymap_planck.c $(SRC)
+    SRC := keymap_poker.c $(SRC)
 endif
 
 CONFIG_H = config.h
@@ -128,8 +128,8 @@ NKRO_ENABLE = yes	# USB Nkey Rollover - not yet supported in LUFA
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/gh60/Makefile.pjrc

@@ -42,7 +42,7 @@
 TARGET = gh60_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -97,11 +97,11 @@ NKRO_ENABLE = yes	# USB Nkey Rollover(+500)
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 plain: OPT_DEFS += -DKEYMAP_PLAIN
 plain: all

+ 40 - 8
keyboard/gh60/keymap_common.h

@@ -38,15 +38,47 @@ extern const uint16_t fn_actions[];
  * K2C, K31 and  K3C are extra keys for ISO
  */
 #define KEYMAP( \
-    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
-    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
-    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
-    K30, K31, K32, K33, K34,      K36, K37, K38, K39, K3A, K3B  \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
+    K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+    K40, K41, K42,           K45,                K49, K4A, K4B, K4C, K4D  \
 ) { \
-    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
-    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
-    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
-    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO,    KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }  \
+    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
+    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
+    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
+    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
+    { KC_##K40, KC_##K41, KC_##K42, KC_NO,    KC_NO,    KC_##K45, KC_NO,    KC_NO,    KC_NO,    KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D }  \
 }
 
+/* ANSI valiant. No extra keys for ISO */
+#define KEYMAP_ANSI( \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
+    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,           K3D, \
+    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
+) KEYMAP( \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
+    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO,  K3D, \
+    K40, K41, K42,           K45,                NO,  K4A, K4B, K4C, K4D  \
+)
+
+
+#define KEYMAP_HHKB( \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
+    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,      K3D, K3C, \
+    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
+) KEYMAP( \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
+    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+    K40, K41, K42,           K45,                K49, K4A, K4B, K4C, K4D  \
+)
+
 #endif

+ 8 - 11
keyboard/gh60/led.c

@@ -1,16 +1,13 @@
 /*
 Copyright 2012 Jun Wako <wakojun@gmail.com>
-
 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 <http://www.gnu.org/licenses/>.
 */
@@ -22,13 +19,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 void led_set(uint8_t usb_led)
 {
-    if (usb_led & (1<<USB_LED_FUNCTION)) {
-        // Output high.
-        DDRF |= (1<<0);
-        PORTF |= (1<<0);
+    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+        // output low
+        DDRB |= (1<<2);
+        PORTB &= ~(1<<2);
     } else {
-        // Output low.
-        DDRF &= ~(1<<0);
-        PORTF &= ~(1<<0);
+        // Hi-Z
+        DDRB &= ~(1<<2);
+        PORTB &= ~(1<<2);
     }
-}
+}

+ 47 - 51
keyboard/gh60/matrix.c

@@ -22,7 +22,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdbool.h>
 #include <avr/io.h>
 #include <util/delay.h>
-#include "action_layer.h"
 #include "print.h"
 #include "debug.h"
 #include "util.h"
@@ -30,7 +29,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 #ifndef DEBOUNCE
-#   define DEBOUNCE	10
+#   define DEBOUNCE 5
 #endif
 static uint8_t debouncing = DEBOUNCE;
 
@@ -95,19 +94,6 @@ uint8_t matrix_scan(void)
         }
     }
 
-    uint8_t layer = biton32(layer_state);
-    switch (layer) {
-        case 1:
-        case 2:
-            DDRC |= (1<<7);
-            PORTC |= (1<<7);
-            break;
-        case 0:
-            DDRC &= ~(1<<7);
-            PORTC &= ~(1<<7);
-            break;
-    }
-
     return 1;
 }
 
@@ -149,67 +135,77 @@ uint8_t matrix_key_count(void)
 }
 
 /* Column pin configuration
- * col: 0  1  2  3  4  5  6  7  8  9  10 11
- * pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 D5 D4
+ * col: 0   1   2   3   4   5   6   7   8   9   10  11  12  13
+ * pin: F0  F1  E6  C7  C6  B6  D4  B1  B0  B5  B4  D7  D6  B3  (Rev.A)
+ * pin:                                 B7                      (Rev.B)
  */
-
-static void init_cols(void)
+static void  init_cols(void)
 {
-    DDRF  &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
-    PORTF |=  (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
-    DDRD  &= ~(1<<0);
-    PORTD |=  (1<<0);
-    DDRB  &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
-    PORTB |=  (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
+    // Input with pull-up(DDR:0, PORT:1)
+    DDRF  &= ~(1<<0 | 1<<1);
+    PORTF |=  (1<<0 | 1<<1);
+    DDRE  &= ~(1<<6);
+    PORTE |=  (1<<6);
+    DDRD  &= ~(1<<7 | 1<<6 | 1<<4);
+    PORTD |=  (1<<7 | 1<<6 | 1<<4);
+    DDRC  &= ~(1<<7 | 1<<6);
+    PORTC |=  (1<<7 | 1<<6);
+    DDRB  &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
+    PORTB |=  (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
 }
 
 static matrix_row_t read_cols(void)
 {
-    return (PINB&(1<<0) ? 0 : (1<< 0)) |
-           (PINB&(1<<1) ? 0 : (1<< 1)) |
-           (PINB&(1<<2) ? 0 : (1<< 2)) |
-           (PINB&(1<<3) ? 0 : (1<< 3)) |
-           (PINB&(1<<7) ? 0 : (1<< 4)) |
-           (PIND&(1<<0) ? 0 : (1<< 5)) |
-           (PINF&(1<<7) ? 0 : (1<< 6)) |
-           (PINF&(1<<6) ? 0 : (1<< 7)) |
-           (PINF&(1<<5) ? 0 : (1<< 8)) |
-           (PINF&(1<<4) ? 0 : (1<< 9)) |
-           (PINF&(1<<1) ? 0 : (1<<10)) |
-           (PINF&(1<<0) ? 0 : (1<<11));
+    return (PINF&(1<<0) ? 0 : (1<<0)) |
+           (PINF&(1<<1) ? 0 : (1<<1)) |
+           (PINE&(1<<6) ? 0 : (1<<2)) |
+           (PINC&(1<<7) ? 0 : (1<<3)) |
+           (PINC&(1<<6) ? 0 : (1<<4)) |
+           (PINB&(1<<6) ? 0 : (1<<5)) |
+           (PIND&(1<<4) ? 0 : (1<<6)) |
+           (PINB&(1<<1) ? 0 : (1<<7)) |
+           ((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<8)) |     // Rev.A and B
+           (PINB&(1<<5) ? 0 : (1<<9)) |
+           (PINB&(1<<4) ? 0 : (1<<10)) |
+           (PIND&(1<<7) ? 0 : (1<<11)) |
+           (PIND&(1<<6) ? 0 : (1<<12)) |
+           (PINB&(1<<3) ? 0 : (1<<13));
 }
 
 /* Row pin configuration
- * row: 0  1  2  3
- * pin: B0 B1 B2 B3
+ * row: 0   1   2   3   4
+ * pin: D0  D1  D2  D3  D5
  */
 static void unselect_rows(void)
 {
     // Hi-Z(DDR:0, PORT:0) to unselect
-    DDRB  &= ~0b01110000;
-    PORTB &= ~0b01110000;
-    DDRD  &= ~0b10000000;
-    PORTD &= ~0b10000000;
+    DDRD  &= ~0b00101111;
+    PORTD &= ~0b00101111;
 }
 
 static void select_row(uint8_t row)
 {
+    // Output low(DDR:1, PORT:0) to select
     switch (row) {
         case 0:
-            DDRB  |= (1<<6);
-            PORTB &= ~(1<<6);
+            DDRD  |= (1<<0);
+            PORTD &= ~(1<<0);
             break;
         case 1:
-            DDRB  |= (1<<5);
-            PORTB &= ~(1<<5);
+            DDRD  |= (1<<1);
+            PORTD &= ~(1<<1);
             break;
         case 2:
-            DDRB  |= (1<<4);
-            PORTB &= ~(1<<4);
+            DDRD  |= (1<<2);
+            PORTD &= ~(1<<2);
             break;
         case 3:
-            DDRD  |= (1<<7);
-            PORTD &= ~(1<<7);
+            DDRD  |= (1<<3);
+            PORTD &= ~(1<<3);
+            break;
+        case 4:
+            DDRD  |= (1<<5);
+            PORTD &= ~(1<<5);
             break;
     }
 }

+ 5 - 5
keyboard/ghost_squid/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = ghostsquid_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -110,8 +110,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/hbkb/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = hbkb_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -113,8 +113,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 9 - 5
keyboard/hhkb/Makefile

@@ -42,7 +42,7 @@
 TARGET = hhkb_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -120,6 +120,10 @@ NKRO_ENABLE = yes		# USB Nkey Rollover
 #KEYMAP_SECTION_ENABLE = yes	# fixed address keymap for keymap editor
 #HHKB_JP = yes			# HHKB JP support
 
+#OPT_DEFS += -DNO_ACTION_TAPPING
+#OPT_DEFS += -DNO_ACTION_LAYER
+#OPT_DEFS += -DNO_ACTION_MACRO
+
 
 #
 # Keymap file
@@ -142,11 +146,11 @@ endif
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
 debug-on: all

+ 5 - 5
keyboard/hhkb/Makefile.pjrc

@@ -7,7 +7,7 @@
 TARGET = hhkb_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -61,8 +61,8 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 6 - 6
keyboard/hhkb/Makefile.rn42

@@ -42,7 +42,7 @@
 TARGET = hhkb_rn42
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -139,13 +139,13 @@ endif
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
 include rn42.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
 debug-on: all

+ 11 - 10
keyboard/hhkb/doc/HHKB.txt

@@ -31,27 +31,28 @@ Two PCBs are connected by 15 lines(13 in case of Pro2).
 Vcc and GND use 3(2) lines each, other lines are for keyboard signaling.
 
     HHKB connector lines:
-    JP   Pro2   Pro     Function    Description                               Teensy++ pins
+    JP   Pro2   Pro     Function    Description                               TMK pin usage
     --------------------------------------------------------------------------------------------
                  1      Vcc(5V)                                               5V
      1    1      2      Vcc(5V)                                               5V
      2    2      3      Vcc(5V)                                               5V
-     3    3      4      TP1684      KEY: Low(0) when key pressed              PE6 input(with pullup)
-     4    4      5      TP1684      KEY_PREV: make threshold                  PE7 output
+     3    3      4      TP1684      ~KEY: Low(0) when key is pressed          PD7 input(with pullup)
+     4    4      5      TP1684      HYS: High(1) when key is pressed          PB7 output
      5    5      6      HC4051      A(bit0)\                                  PB0 output
      6    6      7      HC4051      B(bit1) > select row 0-7                  PB1 output
      7    7      8      HC4051      C(bit2)/                                  PB2 output
      8    8      9      LS145       A(bit0)\                                  PB3 output
      9    9     10      LS145       B(bit1) > select column 0-7               PB4 output
     10   10     11      LS145       C(bit2)/                                  PB5 output
-    11   11     12      LS145       D(enable) Low(0) enables selected column  PB6 output
+    11   11     12      LS145       ~D(enable) Low(0) enables selected column PB6 output
     12   12     13      GND                                                   GND
     13   13     14      GND                                                   GND
                 15      GND
-    14                  HC4051(Z2)  ~Enable of Z2   row0-7
-    15                  HC4051(Z3)  ~Enable of Z3   row8-15
+    14                  HC4051(Z2)  ~Enable of Z2   row0-7                    PC6
+    15                  HC4051(Z3)  ~Enable of Z3   row8-15                   PC7
 
-    NOTE: guessing pin5(KEY_PREV) may work for hysteresis of capacitive sensing.
+    NOTE: Probably HYS changes threshold for upstroke and makes hysteresis in the result.
+    NOTE: HYS should be given High(1) when previous KEY state is Low(0).
     NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK.
     NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them.
 
@@ -112,7 +113,7 @@ Matrix diagram:
     |         <-+    |        <6-------|-|-|-|-|-|-|-|--|R|-+
     |   1   4 | |    |        <7-------|-|-|-|-|-|-|-|--|R|-+
     +---V---^-+ |    +-^-^-^--+        0 1 2 3 4 5 6 7  33K*8
-       KEY PREV |      A B C         +-----------------+
+       KEY HYS  |      A B C         +-----------------+
         |   | +-^----+ | | |         |      LS145      |
     Vcc |   | |BU9831| | | |         +-^--^--^--^------+
     --- |   | +------+ | | |           A  B  C  D   +-------+
@@ -138,7 +139,7 @@ Matrix diagram:
     |         | +---->        <6-----------|-|-|-|-|----|R|-+
     |         | | |  | A B C  <7-----------|-|-|-|-|----|R|-+
     +---V---^-+ | |  +-^-^-^--+            | | | | |        |
-       KEY PREV | |    | | |               | | | | |        |
+       KEY HYS  | |    | | |               | | | | |        |
         |   |   | |  +--------+            | | | | |        |
         |   |   | |  | HC4051 <8-----------|-|-|-|-|----|R|-+
         |   |   | |  |    Z3  <9-----------|-|-|-|-|----|R|-+
@@ -192,7 +193,7 @@ Signals charts
             0123456701234567    selected column
 
     3) Wait 5us after column select, then set prev, strobe colD to spit out key status and read it.
-    prev    _~~~~_____          20us if previous key state is low
+    hys     _~~~~_____          20us if previous key state is low
     colD    ~~~__~~~~~          10us strobe
     key     ~~~____~~~          22us indicates current state of the key
 

+ 69 - 0
keyboard/hhkb/doc/HHKB_keycodes.txt

@@ -0,0 +1,69 @@
+HHKB keycodes
+=============
+2015/10/03
+Looked into unclear keycodes(usages) of Fn-chording-key on HHKB.
+Followings are usages of Keyboard/Keypad Page(0x07) that HHKB spits out when Fn key is down.
+
+## HHK mode(Off-Off)
+    Key         Usage
+    ------------------------
+    ⌘ / ◇       0x78    Stop
+
+## Lite Ext. mode(On-Off)
+
+
+## Mac mode(Off-On)
+    Key         Usage
+    ------------------------
+    Esc         0x66    Power
+    A           0x81    Volume Down
+    S           0x80    Volume Up
+    D           0x7F    Mute
+    F           0x6F    F20
+    Delete      0x53    Num Lock and Clear
+
+
+## Secret mode(On-On)
+    Key         Usage
+    ------------------------
+    Esc         0x66    Power
+    Q           0x78    Stop
+    W           0x7E    Find
+    E           0x74    Execute
+    R           0x77    Select
+    T           0x76    Menu
+    Y           0x75    Help
+    Z           0x7A    Undo
+    X           0x7B    Cut
+    C           0x7C    Copy
+    V           0x7D    Paste
+    B           0x79    Again
+
+
+## Matrix Key-Mode
+
+
+                Mode
+                -------------------------------
+    Key         HHK     Lite    Mac     Secret  Desc
+    ---------------------------------------------------------------------------------------
+    ⌘ / ◇       0x78    -       -       -       Stop
+    Esc         -       -       0x66    0x66    Power
+    A           -       -       0x81    -       Volume Down
+    S           -       -       0x80    -       Volume Up
+    D           -       -       0x7F    -       Mute
+    F           -       -       0x6F    -       F20
+    Delete      0x2A    0x2A    0x53    0x2A    Num Lock and Clear(0x53)/Backspace(0x2A)
+    Q           -       -       -       0x78    Stop
+    W           -       -       -       0x7E    Find
+    E           -       -       -       0x74    Execute
+    R           -       -       -       0x77    Select
+    T           -       -       -       0x76    Menu
+    Y           -       -       -       0x75    Help
+    Z           -       -       -       0x7A    Undo
+    X           -       -       -       0x7B    Cut
+    C           -       -       -       0x7C    Copy
+    V           -       -       -       0x7D    Paste
+    B           -       -       -       0x79    Again
+
+EOF

+ 2 - 2
keyboard/hhkb/keymap_hasu.c

@@ -85,7 +85,7 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
      */
     [3] = \
     KEYMAP(GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL, \
-           FN8, NO,  NO,  NO,  NO,  NO,  NO,  WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+           FN8, NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,MS_U,WH_U,WH_R,FN9, FN10,FN8, \
            LCTL,ACL0,ACL1,ACL2,ACL2,NO,  NO,  MS_L,MS_D,MS_R,FN3, NO,  ENT, \
            LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,FN9, FN10,NO,  RSFT,TRNS, \
                 LGUI,LALT,          BTN1,               TRNS,TRNS),
@@ -106,7 +106,7 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
      */
     [4] = \
     KEYMAP(GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL, \
-           FN8, NO,  NO,  NO,  NO,  NO,  NO,  WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+           FN8, NO,  NO,  NO,  NO,  NO,  WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN8, \
            LCTL,VOLD,VOLU,MUTE,NO,  NO,  NO,  MS_L,MS_D,MS_R,BTN1,NO,  ENT, \
            LSFT,NO,  NO,  NO,  NO,  BTN3,BTN2,BTN1,FN9, FN10,NO,  RSFT,TRNS, \
                 LGUI,LALT,          TRNS,               TRNS,TRNS),

+ 37 - 4
keyboard/hhkb/keymap_hhkb.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * HHKB Layout
  */
 #include "keymap_common.h"
@@ -40,7 +40,7 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
      * `-----------------------------------------------------------'
      *       |   |     |                       |     |   |
      *       `-------------------------------------------'
-     */ 
+     */
     KEYMAP(PWR, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,   \
            CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC,      \
            TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT,            \
@@ -55,8 +55,41 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
  */
 #ifdef KEYMAP_SECTION_ENABLE
 const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+    [0]  = ACTION_LAYER_MOMENTARY(1),
+    [1]  = ACTION_LAYER_MOMENTARY(2),
+    [2]  = ACTION_LAYER_MOMENTARY(3),
+    [3]  = ACTION_LAYER_MOMENTARY(4),
+    [4]  = ACTION_LAYER_MOMENTARY(5),
+    [5]  = ACTION_LAYER_MOMENTARY(6),
+    [6]  = ACTION_LAYER_MOMENTARY(7),
+    [7]  = ACTION_LAYER_TOGGLE(1),
+    [8]  = ACTION_LAYER_TOGGLE(2),
+    [9]  = ACTION_LAYER_TOGGLE(3),
+    [10] = ACTION_LAYER_TAP_TOGGLE(1),
+    [11] = ACTION_LAYER_TAP_TOGGLE(2),
+    [12] = ACTION_LAYER_TAP_TOGGLE(3),
+    [13] = ACTION_LAYER_TAP_KEY(1, KC_A),
+    [14] = ACTION_LAYER_TAP_KEY(2, KC_F),
+    [15] = ACTION_LAYER_TAP_KEY(3, KC_J),
+    [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
+    [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
+    [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
+    [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
+    [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
+    [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
+    [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
+    [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
+    [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
+    [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
+    [26] = ACTION_MODS_ONESHOT(MOD_LCTL),
+    [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
+    [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
+    [29] = ACTION_MODS_ONESHOT(MOD_LSFT),
+    [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ESC),
+    [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSPACE),
+};
 #else
 const uint16_t fn_actions[] PROGMEM = {
-#endif
-    [0] = ACTION_LAYER_MOMENTARY(1),
+    [0]  = ACTION_LAYER_MOMENTARY(1),
 };
+#endif

+ 6 - 0
keyboard/hhkb/matrix.c

@@ -132,7 +132,13 @@ uint8_t matrix_scan(void)
 
             // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE.
             // This takes 25us or more to make sure KEY_STATE returns to idle state.
+#ifdef HHKB_JP
+            // Looks like JP needs faster scan due to its twice larger matrix
+            // or it can drop keys in fast key typing
+            _delay_us(30);
+#else
             _delay_us(75);
+#endif
         }
         if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
     }

+ 6 - 6
keyboard/hhkb/not_supported/Makefile.iwrap

@@ -7,7 +7,7 @@
 TARGET = hhkb_iwrap
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -94,10 +94,10 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/iwrap.mk
+include $(TMK_DIR)/protocol/iwrap.mk
 # TODO: to be selectable: V-USB, LUFA or PJRC
-#include $(TOP_DIR)/protocol/vusb.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+#include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/hhkb/not_supported/Makefile.vusb

@@ -7,7 +7,7 @@
 TARGET = hhkb_vusb
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -87,11 +87,11 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/vusb.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 debug-on: EXTRAFLAGS += -DDEBUG
 debug-on: all

+ 5 - 5
keyboard/hid_liber/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = hid_liber_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -119,11 +119,11 @@ COMMAND_ENABLE = yes        # Commands for debug and configuration
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 ansi: OPT_DEFS += -DLAYOUT_ANSI
 ansi: all

+ 5 - 5
keyboard/hid_liber/Makefile.pjrc

@@ -42,7 +42,7 @@
 TARGET = hid_liber_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -92,11 +92,11 @@ NKRO_ENABLE = yes           # USB Nkey Rollover - not yet supported in LUFA
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 ansi: OPT_DEFS += -DLAYOUT_ANSI
 ansi: all

+ 2 - 2
keyboard/infinity/Makefile

@@ -1,7 +1,7 @@
 PROJECT = infinity
 
-TMK_DIR = ../..
-MBED_DIR = $(TMK_DIR)/mbed-sdk
+TMK_DIR = ../../tmk_core
+MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk
 
 #VPATH += $(MBED_DIR):$(TMK_DIR)
 vpath %.s .:$(MBED_DIR):$(TMK_DIR)

+ 18 - 16
keyboard/infinity/mbed-infinity.mk

@@ -19,29 +19,31 @@ OBJECTS += \
 	$(OBJDIR)/mbed-infinity/cmsis_nvic.o \
 	$(OBJDIR)/mbed-infinity/system_MK20D5.o \
 	$(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \
-	$(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \
-	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o
+	$(OBJDIR)/mbed-infinity/startup_MK20D5.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/analogin_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/gpio_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/gpio_irq_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/i2c_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/pinmap.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/port_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/pwmout_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/rtc_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/serial_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/sleep.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/spi_api.o \
+	$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/us_ticker.o
 
 INCLUDE_PATHS += \
 	-Imbed \
 	-I$(MBED_DIR)/libraries/mbed/targets \
 	-I$(MBED_DIR)/libraries/mbed/targets/cmsis \
 	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \
-	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \
-	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \
+	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX \
+	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M \
+	-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \
 	-I$(MBED_DIR)/libraries/mbed/targets/hal \
 	-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \
-	-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M
+	-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX \
+	-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M
 
 LINKER_SCRIPT = mbed-infinity/infinity.ld

+ 44 - 0
keyboard/infinity/mbed-infinity/README

@@ -37,3 +37,47 @@ Clock enable:
     SIM_SCGC4[USBOTG] = 1
 
 
+
+Infinity bootloader change
+==========================
+After @2c7542e(2015/01) Infinity bootloader doesn't disable watchdog timer and keyboard firmware has to do it itself.  mbed disables watchdog in startup sequence but unfortunately timer is timed out bofore that.
+
+We have to do that in earlier phase of mbed startup sequence.
+
+
+mbed starup sequence files:
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_M20D5.s
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
+
+Infinity booloader change commit:
+https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483
+
+discussion:
+https://geekhack.org/index.php?topic=41989.msg1686616#msg1686616
+
+
+WORKAROUND
+----------
+Call SystemInit early in Reset_Handler.
+
+$ diff -u ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s mbed-infinity
+--- ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s      2015-03-22 10:33:22.779866000 +0900
++++ mbed-infinity/startup_MK20D5.s      2015-03-22 10:32:56.483866000 +0900
+@@ -147,6 +147,8 @@
+  *      __etext: End of code section, i.e., begin of data sections to copy from.
+  *      __data_start__/__data_end__: RAM address range that data should be
+  *      copied to. Both must be aligned to 4 bytes boundary.  */
++    ldr    r0, =SystemInit
++    blx    r0
+
+     ldr    r1, =__etext
+     ldr    r2, =__data_start__
+@@ -161,8 +163,6 @@
+
+ .Lflash_to_ram_loop_end:
+
+-    ldr    r0, =SystemInit
+-    blx    r0
+     ldr    r0, =_start
+     bx    r0
+     .pool

+ 259 - 0
keyboard/infinity/mbed-infinity/startup_MK20D5.s

@@ -0,0 +1,259 @@
+/* File: startup_MK20D5.s
+ * Purpose: startup file for Cortex-M4 devices. Should use with
+ *   GCC for ARM Embedded Processors
+ * Version: V1.3
+ * Date: 08 Feb 2012
+ *
+ * Copyright (c) 2012, ARM Limited
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of the ARM Limited nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+    .syntax unified
+    .arch armv7-m
+
+    .section .stack
+    .align 3
+#ifdef __STACK_SIZE
+    .equ    Stack_Size, __STACK_SIZE
+#else
+    .equ    Stack_Size, 0x400
+#endif
+    .globl    __StackTop
+    .globl    __StackLimit
+__StackLimit:
+    .space    Stack_Size
+    .size __StackLimit, . - __StackLimit
+__StackTop:
+    .size __StackTop, . - __StackTop
+
+    .section .heap
+    .align 3
+#ifdef __HEAP_SIZE
+    .equ    Heap_Size, __HEAP_SIZE
+#else
+    .equ    Heap_Size, 0xC00
+#endif
+    .globl    __HeapBase
+    .globl    __HeapLimit
+__HeapBase:
+    .if    Heap_Size
+    .space    Heap_Size
+    .endif
+    .size __HeapBase, . - __HeapBase
+__HeapLimit:
+    .size __HeapLimit, . - __HeapLimit
+
+    .section .isr_vector
+    .align 2
+    .globl __isr_vector
+__isr_vector:
+    .long    __StackTop            /* Top of Stack */
+    .long    Reset_Handler         /* Reset Handler */
+    .long    NMI_Handler           /* NMI Handler */
+    .long    HardFault_Handler     /* Hard Fault Handler */
+    .long    MemManage_Handler     /* MPU Fault Handler */
+    .long    BusFault_Handler      /* Bus Fault Handler */
+    .long    UsageFault_Handler    /* Usage Fault Handler */
+    .long    0                     /* Reserved */
+    .long    0                     /* Reserved */
+    .long    0                     /* Reserved */
+    .long    0                     /* Reserved */
+    .long    SVC_Handler           /* SVCall Handler */
+    .long    DebugMon_Handler      /* Debug Monitor Handler */
+    .long    0                     /* Reserved */
+    .long    PendSV_Handler        /* PendSV Handler */
+    .long    SysTick_Handler       /* SysTick Handler */
+
+    /* External interrupts */
+    .long    DMA0_IRQHandler        /*  0:  Watchdog Timer            */
+    .long    DMA1_IRQHandler        /*  1:  Real Time Clock           */
+    .long    DMA2_IRQHandler       /*  2:  Timer0 / Timer1           */
+    .long    DMA3_IRQHandler       /*  3:  Timer2 / Timer3           */
+    .long    DMA_Error_IRQHandler       /*  4:  MCIa                      */
+    .long    0       /*  5:  MCIb                      */
+    .long    FTFL_IRQHandler      /*  6:  UART0 - DUT FPGA          */
+    .long    Read_Collision_IRQHandler      /*  7:  UART1 - DUT FPGA          */
+    .long    LVD_LVW_IRQHandler      /*  8:  UART2 - DUT FPGA          */
+    .long    LLW_IRQHandler      /*  9:  UART4 - not connected     */
+    .long    Watchdog_IRQHandler       /* 10: AACI / AC97                */
+    .long    I2C0_IRQHandler       /* 11: CLCD Combined Interrupt    */
+    .long    SPI0_IRQHandler       /* 12: Ethernet                   */
+    .long    I2S0_Tx_IRQHandler      /* 13: USB Device                 */
+    .long    I2S0_Rx_IRQHandler      /* 14: USB Host Controller        */
+    .long    UART0_LON_IRQHandler      /* 15: Character LCD              */
+    .long    UART0_RX_TX_IRQHandler    /* 16: Flexray                    */
+    .long    UART0_ERR_IRQHandler        /* 17: CAN                        */
+    .long    UART1_RX_TX_IRQHandler        /* 18: LIN                        */
+    .long    UART1_ERR_IRQHandler        /* 19: I2C ADC/DAC                */
+    .long    UART2_RX_TX_IRQHandler                     /* 20: Reserved                   */
+    .long    UART2_ERR_IRQHandler                     /* 21: Reserved                   */
+    .long    ADC0_IRQHandler                     /* 22: Reserved                   */
+    .long    CMP0_IRQHandler                     /* 23: Reserved                   */
+    .long    CMP1_IRQHandler                     /* 24: Reserved                   */
+    .long    FTM0_IRQHandler                     /* 25: Reserved                   */
+    .long    FTM1_IRQHandler                     /* 26: Reserved                   */
+    .long    CMT_IRQHandler                     /* 27: Reserved                   */
+    .long    RTC_IRQHandler   /* 28: Reserved - CPU FPGA CLCD   */
+    .long    RTC_Seconds_IRQHandler                     /* 29: Reserved - CPU FPGA        */
+    .long    PIT0_IRQHandler      /* 30: UART3    - CPU FPGA        */
+    .long    PIT1_IRQHandler        /* 31: SPI Touchscreen - CPU FPGA */
+    .long    PIT2_IRQHandler
+    .long    PIT3_IRQHandler
+    .long    PDB0_IRQHandler
+    .long    USB0_IRQHandler
+    .long    USBDCD_IRQHandler
+    .long    TSI0_IRQHandler
+    .long    MCG_IRQHandler
+    .long    LPTimer_IRQHandler
+    .long    PORTA_IRQHandler
+    .long    PORTB_IRQHandler
+    .long    PORTC_IRQHandler
+    .long    PORTD_IRQHandler
+    .long    PORTE_IRQHandler
+    .long    SWI_IRQHandler
+    .size    __isr_vector, . - __isr_vector
+
+    .section .text.Reset_Handler
+    .thumb
+    .thumb_func
+    .align 2
+    .globl    Reset_Handler
+    .type    Reset_Handler, %function
+Reset_Handler:
+/*     Loop to copy data from read only memory to RAM. The ranges
+ *      of copy from/to are specified by following symbols evaluated in
+ *      linker script.
+ *      __etext: End of code section, i.e., begin of data sections to copy from.
+ *      __data_start__/__data_end__: RAM address range that data should be
+ *      copied to. Both must be aligned to 4 bytes boundary.  */
+    ldr    r0, =SystemInit
+    blx    r0
+
+    ldr    r1, =__etext
+    ldr    r2, =__data_start__
+    ldr    r3, =__data_end__
+
+.Lflash_to_ram_loop:
+    cmp     r2, r3
+    ittt    lt
+    ldrlt   r0, [r1], #4
+    strlt   r0, [r2], #4
+    blt    .Lflash_to_ram_loop
+
+.Lflash_to_ram_loop_end:
+
+    ldr    r0, =_start
+    bx    r0
+    .pool
+    .size Reset_Handler, . - Reset_Handler
+
+    .text
+/*    Macro to define default handlers. Default handler
+ *    will be weak symbol and just dead loops. They can be
+ *    overwritten by other handlers */
+    .macro    def_default_handler    handler_name
+    .align 1
+    .thumb_func
+    .weak    \handler_name
+    .type    \handler_name, %function
+\handler_name :
+    b    .
+    .size    \handler_name, . - \handler_name
+    .endm
+
+    def_default_handler    NMI_Handler
+    def_default_handler    HardFault_Handler
+    def_default_handler    MemManage_Handler
+    def_default_handler    BusFault_Handler
+    def_default_handler    UsageFault_Handler
+    def_default_handler    SVC_Handler
+    def_default_handler    DebugMon_Handler
+    def_default_handler    PendSV_Handler
+    def_default_handler    SysTick_Handler
+    def_default_handler    Default_Handler
+
+    .macro    def_irq_default_handler    handler_name
+    .weak     \handler_name
+    .set      \handler_name, Default_Handler
+    .endm
+
+    def_irq_default_handler    DMA0_IRQHandler
+    def_irq_default_handler    DMA1_IRQHandler
+    def_irq_default_handler    DMA2_IRQHandler
+    def_irq_default_handler    DMA3_IRQHandler
+    def_irq_default_handler    DMA_Error_IRQHandler
+    def_irq_default_handler    FTFL_IRQHandler
+    def_irq_default_handler    Read_Collision_IRQHandler
+    def_irq_default_handler    LVD_LVW_IRQHandler
+    def_irq_default_handler    LLW_IRQHandler
+    def_irq_default_handler    Watchdog_IRQHandler
+    def_irq_default_handler    I2C0_IRQHandler
+    def_irq_default_handler    SPI0_IRQHandler
+    def_irq_default_handler    I2S0_Tx_IRQHandler
+    def_irq_default_handler    I2S0_Rx_IRQHandler
+    def_irq_default_handler    UART0_LON_IRQHandler
+    def_irq_default_handler    UART0_RX_TX_IRQHandler
+    def_irq_default_handler    UART0_ERR_IRQHandler
+    def_irq_default_handler    UART1_RX_TX_IRQHandler
+    def_irq_default_handler    UART1_ERR_IRQHandler
+    def_irq_default_handler    UART2_RX_TX_IRQHandler
+    def_irq_default_handler    UART2_ERR_IRQHandler
+    def_irq_default_handler    ADC0_IRQHandler
+    def_irq_default_handler    CMP0_IRQHandler
+    def_irq_default_handler    CMP1_IRQHandler
+    def_irq_default_handler    FTM0_IRQHandler
+    def_irq_default_handler    FTM1_IRQHandler
+    def_irq_default_handler    CMT_IRQHandler
+    def_irq_default_handler    RTC_IRQHandler
+    def_irq_default_handler    RTC_Seconds_IRQHandler
+    def_irq_default_handler    PIT0_IRQHandler
+    def_irq_default_handler    PIT1_IRQHandler
+    def_irq_default_handler    PIT2_IRQHandler
+    def_irq_default_handler    PIT3_IRQHandler
+    def_irq_default_handler    PDB0_IRQHandler
+    def_irq_default_handler    USB0_IRQHandler
+    def_irq_default_handler    USBDCD_IRQHandler
+    def_irq_default_handler    TSI0_IRQHandler
+    def_irq_default_handler    MCG_IRQHandler
+    def_irq_default_handler    LPTimer_IRQHandler
+    def_irq_default_handler    PORTA_IRQHandler
+    def_irq_default_handler    PORTB_IRQHandler
+    def_irq_default_handler    PORTC_IRQHandler
+    def_irq_default_handler    PORTD_IRQHandler
+    def_irq_default_handler    PORTE_IRQHandler
+    def_irq_default_handler    SWI_IRQHandler
+    def_irq_default_handler    DEF_IRQHandler
+
+/* Flash protection region, placed at 0x400 */
+    .text
+    .thumb
+    .align 2
+    .section .kinetis_flash_config_field,"a",%progbits
+kinetis_flash_config:
+    .long 0xffffffff
+    .long 0xffffffff
+    .long 0xffffffff
+    .long 0xfffffffe
+
+    .end

+ 80 - 2
keyboard/infinity/tool/README

@@ -2,7 +2,7 @@ OpenOCD config files for Kinetis
 ================================
 http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD
 
-These are needed for SWD debug and programing bootloader. To flash keyboard firmware use 'dfu-util'.
+These are needed for debug and programing bootloader with SWD. To flash keyboard firmware use 'dfu-util'.
 
 Flash security of Freescale kinetis
 -----------------------------------
@@ -21,5 +21,83 @@ Flash bootloader:
 
 Infinity SWD pinout
 -------------------
-SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, VCC from top.
+SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, 5V from top.
 Note that RESET is also needed to get full control with OpenOCD.
+
+             --------
+            | ___  o |CLK
+            ||RST| o |DIO
+            ||BTN| o |GND
+            | ---  o |5V
+             --------
+
+
+Kinetis sercure state
+----------------------
+openocd 0.9.0
+
+Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
+Warn : ****                                                          ****
+Warn : **** Your Kinetis MCU is in secured state, which means that,  ****
+Warn : **** with exception for very basic communication, JTAG/SWD    ****
+Warn : **** interface will NOT work. In order to restore its         ****
+Warn : **** functionality please issue 'kinetis mdm mass_erase'      ****
+Warn : **** command, power cycle the MCU and restart OpenOCD.        ****
+Warn : ****                                                          ****
+Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
+
+
+Info : MDM: Chip is unsecured. Continuing.
+target state: halted
+target halted due to debug-request, current mode: Thread
+xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
+auto erase enabled
+Info : Probing flash info for bank 0
+Warn : flash configuration field erased, please reset the device
+wrote 4096 bytes from file kiibohd_bootloader.bin in 2.442562s (1.638 KiB/s)
+Info : MDM: Chip is unsecured. Continuing.
+
+
+
+
+Open On-Chip Debugger 0.9.0-dev-00346-g3e1dfdc-dirty (2015-03-21-20:41)
+Licensed under GNU GPL v2
+For bug reports, read
+        http://openocd.sourceforge.net/doc/doxygen/bugs.html
+Info : only one transport option; autoselect 'cmsis-dap'
+Kinetis MUST need Hardware SRST Control to Recover Secure-State!
+adapter_nsrst_delay: 200
+srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
+Info : add flash_bank kinetis k20.pflash
+cortex_m reset_config sysresetreq
+adapter speed: 1000 kHz
+srst_only separate srst_nogate srst_open_drain connect_assert_srst
+Info : CMSIS-DAP: SWD  Supported
+Info : CMSIS-DAP: Interface Initialised (SWD)
+Info : CMSIS-DAP: FW Version = 1.0
+Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
+Info : Connecting under reset
+Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
+Info : CMSIS-DAP: Interface ready
+Info : clock speed 1000 kHz
+Info : IDCODE 0x2ba01477
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Info : k20.cpu: hardware has 6 breakpoints, 4 watchpoints
+Info : MDM: Chip is unsecured. Continuing.
+Info : MDM: Chip is unsecured. Continuing.
+target state: halted
+target halted due to debug-request, current mode: Thread
+xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
+auto erase enabled
+Info : Probing flash info for bank 0
+Warn : flash configuration field erased, please reset the device
+wrote 4096 bytes from file kiibohd_bootloader.bin in 2.446902s (1.635 KiB/s)
+Info : MDM: Chip is unsecured. Continuing.
+Info : Halt timed out, wake up GDB.
+Error: timed out while waiting for target halted
+Runtime Error: tool/k20dx32_flash.cfg:81:
+in procedure 'mt_flash'
+in procedure 'halt' called at file "tool/k20dx32_flash.cfg", line 81

+ 16 - 1
keyboard/infinity/tool/k20dx32_flash.cfg

@@ -2,6 +2,22 @@
 # Nemuisan's Special for MK20DN32VFT5,MK20DX32VFT5,MK10DN32VFT5,MK10DX32VFT5
 
 
+# 0.8.0 has no these procs
+proc using_jtag {} {
+        set _TRANSPORT [ transport select ]
+        expr { [ string first "jtag" $_TRANSPORT ] != -1 }
+}
+
+proc using_swd {} {
+        set _TRANSPORT [ transport select ]
+        expr { [ string first "swd" $_TRANSPORT ] != -1 }
+}
+
+proc using_hla {} {
+        set _TRANSPORT [ transport select ]
+        expr { [ string first "hla" $_TRANSPORT ] != -1 }
+}
+
 source [find target/swj-dp.tcl]
 
 if { [info exists CHIPNAME] } {
@@ -109,7 +125,6 @@ proc eraser {} {
 	shutdown
 }
 
-
 #debug_level 3
 # HLA doesn't have cortex_m commands 
 if {![using_hla]} {

+ 5 - 5
keyboard/kitten_paw/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = kittenpaw_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -110,8 +110,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/kmac/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = kmac_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -117,11 +117,11 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 winkey: OPT_DEFS += -DLAYOUT_WINKEY
 winkey: all

+ 5 - 5
keyboard/kmac/Makefile.pjrc

@@ -42,7 +42,7 @@
 TARGET = kmac_pjrc
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -88,11 +88,11 @@ BACKLIGHT_ENABLE = yes  # Enable keyboard backlight functionality
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 winkey: OPT_DEFS += -DLAYOUT_WINKEY
 winkey: all

+ 5 - 5
keyboard/lightpad/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = lightpad_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -110,8 +110,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk

+ 5 - 5
keyboard/lightsaber/Makefile.lufa

@@ -42,7 +42,7 @@
 TARGET = lightsaber_lufa
 
 # Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
 
 # Directory keyboard dependent files exist
 TARGET_DIR = .
@@ -116,11 +116,11 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
 
 # Search Path
 VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
 
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
 
 winkey: OPT_DEFS += -DLAYOUT_WINKEY
 winkey: all

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно