summaryrefslogtreecommitdiff
path: root/keyboard/hhkb
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-10-27 14:52:18 -0400
committerJack Humbert <jack.humb@gmail.com>2015-10-27 14:52:18 -0400
commitd311fd8d1a0af3b767d26b520d399bf0db22f058 (patch)
treeb9de5704143ac205b4e26222f9d7551e9b161924 /keyboard/hhkb
parenta766918d5c48204375f4c207b30bbbf1389df14f (diff)
parent6f3141965e88c4ee0ebf7c18a243e4c2d9c5021b (diff)
Merge pull request #34 from jackhumbert/tmk-master
merging from tmk, new_project script and template
Diffstat (limited to 'keyboard/hhkb')
-rw-r--r--keyboard/hhkb/Makefile14
-rw-r--r--keyboard/hhkb/Makefile.pjrc10
-rw-r--r--keyboard/hhkb/Makefile.rn4212
-rw-r--r--keyboard/hhkb/doc/HHKB.txt21
-rw-r--r--keyboard/hhkb/doc/HHKB_keycodes.txt69
-rw-r--r--keyboard/hhkb/keymap_hasu.c4
-rw-r--r--keyboard/hhkb/keymap_hhkb.c41
-rw-r--r--keyboard/hhkb/matrix.c6
-rw-r--r--keyboard/hhkb/not_supported/Makefile.iwrap12
-rw-r--r--keyboard/hhkb/not_supported/Makefile.vusb10
10 files changed, 156 insertions, 43 deletions
diff --git a/keyboard/hhkb/Makefile b/keyboard/hhkb/Makefile
index dc5c06a948..5a179bd24d 100644
--- a/keyboard/hhkb/Makefile
+++ b/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
diff --git a/keyboard/hhkb/Makefile.pjrc b/keyboard/hhkb/Makefile.pjrc
index b6ce9c7504..7d0f8c3a9c 100644
--- a/keyboard/hhkb/Makefile.pjrc
+++ b/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
diff --git a/keyboard/hhkb/Makefile.rn42 b/keyboard/hhkb/Makefile.rn42
index b1eacd070f..cbb2b744c9 100644
--- a/keyboard/hhkb/Makefile.rn42
+++ b/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
diff --git a/keyboard/hhkb/doc/HHKB.txt b/keyboard/hhkb/doc/HHKB.txt
index 98397b8477..3d08ceb0af 100644
--- a/keyboard/hhkb/doc/HHKB.txt
+++ b/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
diff --git a/keyboard/hhkb/doc/HHKB_keycodes.txt b/keyboard/hhkb/doc/HHKB_keycodes.txt
new file mode 100644
index 0000000000..9ec85901e0
--- /dev/null
+++ b/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
diff --git a/keyboard/hhkb/keymap_hasu.c b/keyboard/hhkb/keymap_hasu.c
index 433f9cb270..a5602ded31 100644
--- a/keyboard/hhkb/keymap_hasu.c
+++ b/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),
diff --git a/keyboard/hhkb/keymap_hhkb.c b/keyboard/hhkb/keymap_hhkb.c
index 1fc016f8e2..86ad0f5eee 100644
--- a/keyboard/hhkb/keymap_hhkb.c
+++ b/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
diff --git a/keyboard/hhkb/matrix.c b/keyboard/hhkb/matrix.c
index fb96997944..14fae0b82c 100644
--- a/keyboard/hhkb/matrix.c
+++ b/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();
}
diff --git a/keyboard/hhkb/not_supported/Makefile.iwrap b/keyboard/hhkb/not_supported/Makefile.iwrap
index 2d9d82c481..1614c21d75 100644
--- a/keyboard/hhkb/not_supported/Makefile.iwrap
+++ b/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
diff --git a/keyboard/hhkb/not_supported/Makefile.vusb b/keyboard/hhkb/not_supported/Makefile.vusb
index 4343b210d9..1f8d84684b 100644
--- a/keyboard/hhkb/not_supported/Makefile.vusb
+++ b/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