]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
hhkb: Add unimap_jp
authortmk <hasu@tmk-kbd.com>
Thu, 30 Jun 2016 04:31:05 +0000 (13:31 +0900)
committertmk <hasu@tmk-kbd.com>
Mon, 29 Aug 2016 04:54:44 +0000 (13:54 +0900)
keyboard/hhkb/Makefile
keyboard/hhkb/Makefile.unimap.jp [new file with mode: 0644]
keyboard/hhkb/unimap_common.h [new file with mode: 0644]
keyboard/hhkb/unimap_jp.c [new file with mode: 0644]

index 8e15df1992128287c5e79b8e4ce8cb2d19ab3ead..1146d5ec86ff2e581a4ebbd3bf9ed76640ee0a96 100644 (file)
@@ -118,6 +118,9 @@ COMMAND_ENABLE = yes        # Commands for debug and configuration
 NKRO_ENABLE = yes              # USB Nkey Rollover
 #KEYMAP_SECTION_ENABLE = yes   # fixed address keymap for keymap editor
 #HHKB_JP = yes                 # HHKB JP support
+#UNIMAP_ENABLE = yes
+#ACTIONMAP_ENABLE = yes         # Use 16bit actionmap instead of 8bit keymap
+#KEYMAP_SECTION_ENABLE = yes   # fixed address keymap for keymap editor
 
 #OPT_DEFS += -DNO_ACTION_TAPPING
 #OPT_DEFS += -DNO_ACTION_LAYER
@@ -127,13 +130,22 @@ NKRO_ENABLE = yes         # USB Nkey Rollover
 #
 # Keymap file
 #
+ifdef UNIMAP_ENABLE
+    KEYMAP_FILE = unimap
+else
+    ifdef ACTIONMAP_ENABLE
+        KEYMAP_FILE = actionmap
+    else
+        KEYMAP_FILE = keymap
+    endif
+endif
 ifdef KEYMAP
-    SRC := keymap_$(KEYMAP).c $(SRC)
+    SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
 else
     ifdef HHKB_JP
-       SRC := keymap_jp.c $(SRC)
+        SRC := $(KEYMAP_FILE)_jp.c $(SRC)
     else 
-       SRC := keymap_hhkb.c $(SRC)
+        SRC := $(KEYMAP_FILE)_hhkb.c $(SRC)
     endif
 endif
 
diff --git a/keyboard/hhkb/Makefile.unimap.jp b/keyboard/hhkb/Makefile.unimap.jp
new file mode 100644 (file)
index 0000000..3c41b25
--- /dev/null
@@ -0,0 +1,4 @@
+HHKB_JP = yes
+UNIMAP_ENABLE = yes
+KEYMAP_SECTION_ENABLE = yes
+include Makefile
diff --git a/keyboard/hhkb/unimap_common.h b/keyboard/hhkb/unimap_common.h
new file mode 100644 (file)
index 0000000..905c116
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+Copyright 2016 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 UNIMAP_COMMON_H
+#define UNIMAP_COMMON_H
+
+#include <stdint.h>
+#include <avr/pgmspace.h>
+#include "unimap.h"
+
+
+/* HHKB JP
+ * ,-----------------------------------------------------------.
+ * |`  |1  |2  |3  |4  |5  |6  |7  |8  |9  |0  |-  |=  |JPY|BS |
+ * |-----------------------------------------------------------|
+ * |Tab  |Q  |W  |E  |R  |T  |Y  |U  |I  |O  |P  |[  |]  |Enter|
+ * |------------------------------------------------------`    |
+ * |Caps  |A  |S  |D  |F  |G  |H  |J  |K  |L  |;  |'  |#  |    |
+ * |-----------------------------------------------------------|
+ * |Shift  |Z  |X  |C  |V  |B  |N  |M  |,  |.  |/  |Ro |Up |Shi|
+ * |-----------------------------------------------------------|
+ * |Ctl||Esc|Gui|Alt|Mhn|         |Hen|Kan|Alt|Ctl||Lef|Dow|Rig|
+ * `-----------------------------------------------------------'
+ * Esc          = Grave(`)
+ * Control      = Caps Lock
+ * Left Fn      = Left Control
+ * Right Fn     = Right Control
+ */
+// row:16 x col:8
+const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
+    // 0
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_GRAVE,
+        UNIMAP_TAB,
+        UNIMAP_LCTRL,
+        UNIMAP_LSHIFT,
+        UNIMAP_CAPSLOCK,
+        UNIMAP_NO,
+    },
+    // 1
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_4,
+        UNIMAP_E,
+        UNIMAP_MHEN,
+        UNIMAP_C,
+        UNIMAP_D,
+        UNIMAP_NO,
+    },
+    // 2
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_3,
+        UNIMAP_W,
+        UNIMAP_LALT,
+        UNIMAP_X,
+        UNIMAP_S,
+        UNIMAP_NO,
+    },
+    // 3
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_1,
+        UNIMAP_NO,
+        UNIMAP_ESCAPE,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+    },
+    // 4
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_NO,
+    },
+    // 5
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_5,
+        UNIMAP_R,
+        UNIMAP_NO,
+        UNIMAP_V,
+        UNIMAP_F,
+        UNIMAP_NO,
+    },
+    // 6
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_2,
+        UNIMAP_Q,
+        UNIMAP_LGUI,
+        UNIMAP_Z,
+        UNIMAP_A,
+        UNIMAP_NO,
+    },
+    // 7
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_6,
+        UNIMAP_T,
+        UNIMAP_SPACE,
+        UNIMAP_B,
+        UNIMAP_G,
+        UNIMAP_NO,
+    },
+    // 8
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_9,
+        UNIMAP_I,
+        UNIMAP_KANA,
+        UNIMAP_COMMA,
+        UNIMAP_K,
+        UNIMAP_NO,
+    },
+    // 9
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_8,
+        UNIMAP_U,
+        UNIMAP_HENK,
+        UNIMAP_M,
+        UNIMAP_J,
+        UNIMAP_NO,
+    },
+    // A
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_7,
+        UNIMAP_Y,
+        UNIMAP_NO,
+        UNIMAP_N,
+        UNIMAP_H,
+        UNIMAP_NO,
+    },
+    // B
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_0,
+        UNIMAP_O,
+        UNIMAP_RALT,
+        UNIMAP_DOT,
+        UNIMAP_L,
+        UNIMAP_NO,
+    },
+    // C
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_BSPACE,
+        UNIMAP_NO,
+        UNIMAP_RIGHT,
+        UNIMAP_RSHIFT,
+        UNIMAP_ENTER,
+        UNIMAP_NO,
+    },
+    // D
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_JYEN,
+        UNIMAP_RBRACKET,
+        UNIMAP_DOWN,
+        UNIMAP_UP,
+        UNIMAP_NONUS_HASH,
+        UNIMAP_NO,
+    },
+    // E
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_MINUS,
+        UNIMAP_P,
+        UNIMAP_RCTRL,
+        UNIMAP_SLASH,
+        UNIMAP_SCOLON,
+        UNIMAP_NO,
+    },
+    // F
+    {
+        UNIMAP_NO,
+        UNIMAP_NO,
+        UNIMAP_EQUAL,
+        UNIMAP_LBRACKET,
+        UNIMAP_LEFT,
+        UNIMAP_RO,
+        UNIMAP_QUOTE,
+        UNIMAP_NO,
+    },
+};
+
+#endif
diff --git a/keyboard/hhkb/unimap_jp.c b/keyboard/hhkb/unimap_jp.c
new file mode 100644 (file)
index 0000000..70e6b0c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+Copyright 2016 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 "unimap_common.h"
+
+
+#define AC_FN0     ACTION_LAYER_MOMENTARY(1)
+
+#ifdef KEYMAP_SECTION_ENABLE
+const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
+const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
+#endif
+    UNIMAP(
+              NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO, 
+    ZKHK,     NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,  NO,            NO,  NO,  NO,           NO,  NO,  NO,
+    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,     NO,  NO,  NO,      NO,  NO,  NO,  NO,
+    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,     NO,  NO,  NO,      NO,  NO,  NO,  NO,
+    LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,                         NO,  NO,  NO,  NO,
+    LSFT,NO,  Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  RSFT,          UP,           NO,  NO,  NO,  NO,
+    FN0, LGUI,LALT,MHEN,          SPC,           HENK,KANA,RALT,NO,  NO,  FN0,      LEFT,DOWN,RGHT,    NO,       NO,  NO
+    ),
+    UNIMAP(
+              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,
+    PWR, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,      TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
+    CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP,  TRNS,     TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
+    TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,     TRNS,PENT,                        TRNS,TRNS,TRNS,TRNS,
+    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,     TRNS,TRNS,          PGUP,         TRNS,TRNS,TRNS,TRNS,
+    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     HOME,PGDN,END,     TRNS,     TRNS,TRNS
+    ),
+};