alps64: Add actionmaps
authortmk <hasu@tmk-kbd.com>
Thu, 3 Mar 2016 08:05:22 +0000 (17:05 +0900)
committertmk <hasu@tmk-kbd.com>
Thu, 3 Mar 2016 08:05:22 +0000 (17:05 +0900)
keyboard/alps64/Makefile
keyboard/alps64/actionmap_common.h [new file with mode: 0644]
keyboard/alps64/actionmap_hasu.c [new file with mode: 0644]
keyboard/alps64/actionmap_plain.c [new file with mode: 0644]

index e90dcedb673022f1aca9933402ed75ed63869071..6eadd4f10ba1708ef67b95fe546027cfbbd8842a 100644 (file)
@@ -48,16 +48,9 @@ TMK_DIR = ../../tmk_core
 TARGET_DIR = .
 
 # project specific files
 TARGET_DIR = .
 
 # project specific files
-SRC =  keymap_common.c \
-       matrix.c \
+SRC =  matrix.c \
        led.c
 
        led.c
 
-ifdef KEYMAP
-    SRC := keymap_$(KEYMAP).c $(SRC)
-else
-    SRC := keymap_plain.c $(SRC)
-endif
-
 CONFIG_H = config.h
 
 
 CONFIG_H = config.h
 
 
@@ -120,6 +113,20 @@ 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
 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
+ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes
+
+
+ifdef ACTIONMAP_ENABLE
+    KEYMAP_FILE = actionmap
+else
+    KEYMAP_FILE = keymap
+    SRC := keymap_common.c $(SRC)
+endif
+ifdef KEYMAP
+    SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
+else
+    SRC := $(KEYMAP_FILE)_plain.c $(SRC)
+endif
 
 
 # Optimize size but this may cause error "relocation truncated to fit"
 
 
 # Optimize size but this may cause error "relocation truncated to fit"
diff --git a/keyboard/alps64/actionmap_common.h b/keyboard/alps64/actionmap_common.h
new file mode 100644 (file)
index 0000000..cc45edb
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+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 ACTIONMAP_COMMON_H
+#define ACTIONMAP_COMMON_H
+
+
+/* Alps64 keymap definition macro */
+#define ACTIONMAP( \
+    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  \
+) { \
+    { AC_##K00, AC_##K01, AC_##K02, AC_##K03, AC_##K04, AC_##K05, AC_##K06, AC_##K07 }, \
+    { AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17 }, \
+    { AC_##K20, AC_##K21, AC_##K22, AC_##K23, AC_##K24, AC_##K25, AC_##K26, AC_##K27 }, \
+    { AC_##K30, AC_##K31, AC_##K32, AC_##K33, AC_##K34, AC_##K35, AC_##K36, AC_##K37 }, \
+    { AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_##K47 }, \
+    { AC_##K50, AC_##K51, AC_##K52, AC_##K53, AC_##K54, AC_##K55, AC_##K56, AC_##K57 }, \
+    { AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_##K64, AC_##K65, AC_##K66, AC_##K67 }, \
+    { AC_##K70, AC_##K71, AC_##K72, AC_##K73, AC_##K74, AC_##K75, AC_##K76, AC_##K77 } \
+}
+
+/* AEK US */
+#define ACTIONMAP_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  \
+) ACTIONMAP( \
+    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
diff --git a/keyboard/alps64/actionmap_hasu.c b/keyboard/alps64/actionmap_hasu.c
new file mode 100644 (file)
index 0000000..e5aee15
--- /dev/null
@@ -0,0 +1,149 @@
+#include <avr/pgmspace.h>
+#include "actionmap.h"
+#include "action_code.h"
+#include "actionmap_common.h"
+
+
+/*
+ * Actions
+ */
+#define AC_LM1      ACTION_LAYER_MOMENTARY(1)                   // HHKB layer
+#define AC_LT1      ACTION_LAYER_TAP_KEY(1, KC_ENTER)           // HHKB layer
+#define AC_LT2      ACTION_LAYER_TAP_KEY(2, KC_SLASH)           // Cursor layer with Slash*
+#define AC_LT3      ACTION_LAYER_TAP_KEY(3, KC_SCLN)            // Mousekey layer with Semicolon*
+#define AC_LT4      ACTION_LAYER_TAP_KEY(4, KC_SPC)             // Space Fn
+#define AC_LM3      ACTION_LAYER_MOMENTARY(3)                   // Mousekey layer(IJKL)
+#define AC_APSW     ACTION_MACRO(ALT_TAB)                       // Application switching
+#define AC_BACK     ACTION_MODS_KEY(MOD_LALT, KC_LEFT)
+#define AC_FRWD     ACTION_MODS_KEY(MOD_LALT, KC_RIGHT)
+#define AC_LM5      ACTION_LAYER_MOMENTARY(5)
+
+
+/*
+ * Macro definition
+ */
+enum macro_id {
+    ALT_TAB,
+};
+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;
+}
+
+
+const uint16_t PROGMEM actionmaps[][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] = ACTIONMAP_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,   LT3, QUOT,LT1, \
+        LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, LT2, RSFT, \
+        LCTL,LGUI,LALT,          LT4,                          LM5, LM3, LM1),
+    /* 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] = ACTIONMAP_AEK( \
+        PWR, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP,  TRNS,DEL, \
+        TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \
+        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,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] = ACTIONMAP_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, TRNS,TRNS,TRNS,DEL, \
+        TRNS,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP,  RGHT,TRNS,TRNS,ENT, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS,TRNS, \
+        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,TRNS),
+
+    /* 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] = ACTIONMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \
+        TRNS,ACL0,ACL1,ACL2,ACL2,NO,  NO,  MS_L,MS_D,MS_R,TRNS,TRNS,TRNS,\
+        TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,FRWD,TRNS,TRNS, \
+        TRNS,TRNS,TRNS,          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] = ACTIONMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        APSW,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \
+        TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,MS_L,MS_D,MS_R,BTN1,TRNS,ENT, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,TRNS,TRNS,TRNS, \
+        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,TRNS),
+
+    /* 40% */
+    [5] = ACTIONMAP_AEK( \
+        TRNS,1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   TRNS,TRNS,TRNS, \
+        TRNS,s(1),s(2),s(3),s(4),s(5),s(6),s(7),s(8),s(9),s(0),TRNS,TRNS,TRNS, \
+        TRNS,1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   TRNS,TRNS, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,TRNS),
+};
diff --git a/keyboard/alps64/actionmap_plain.c b/keyboard/alps64/actionmap_plain.c
new file mode 100644 (file)
index 0000000..4a78b7a
--- /dev/null
@@ -0,0 +1,52 @@
+#include <avr/pgmspace.h>
+#include "actionmap.h"
+#include "action_code.h"
+#include "actionmap_common.h"
+
+
+/*
+ * Actions
+ */
+#define AC_LM1      ACTION_LAYER_MOMENTARY(1)                   // HHKB layer
+
+
+const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Default Layer
+     * ,-----------------------------------------------------------.
+     * |Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|BSpc   |
+     * |-----------------------------------------------------------|
+     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  |
+     * |-----------------------------------------------------------|
+     * |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] = ACTIONMAP_AEK( \
+        ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, 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,ENT, \
+        LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT, \
+        LCTL,LGUI,LALT,          SPC,                          RALT,RGUI,LM1),
+    /* 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] = ACTIONMAP_AEK( \
+        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, GRV, \
+        CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP,  TRNS,DEL, \
+        TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
+        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \
+        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,TRNS),
+};
Imprint / Impressum