Add poker2-like keymap for gh60
This commit is contained in:
parent
066f3e4c9b
commit
2afa7e162b
@ -48,9 +48,10 @@ TOP_DIR = ../..
|
|||||||
TARGET_DIR = .
|
TARGET_DIR = .
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC = keymap.c \
|
SRC += keymap.c \
|
||||||
matrix.c \
|
matrix.c \
|
||||||
led.c
|
led.c \
|
||||||
|
backlight.c
|
||||||
|
|
||||||
CONFIG_H = config.h
|
CONFIG_H = config.h
|
||||||
|
|
||||||
@ -113,8 +114,12 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
|||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
|
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||||
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
|
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
||||||
|
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
|
|
||||||
|
|
||||||
# Optimize size but this may cause error "relocation truncated to fit"
|
# Optimize size but this may cause error "relocation truncated to fit"
|
||||||
@ -139,3 +144,6 @@ poker_set: all
|
|||||||
|
|
||||||
poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT
|
poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT
|
||||||
poker_bit: all
|
poker_bit: all
|
||||||
|
|
||||||
|
poker2: OPT_DEFS += -DKEYMAP_POKER2 -DBACKLIGHT_CUSTOM -DGH60_REV_C
|
||||||
|
poker2: all
|
||||||
|
@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
|
#include "keymap_ex.h"
|
||||||
|
|
||||||
|
|
||||||
/* GH60 keymap definition macro
|
/* GH60 keymap definition macro
|
||||||
@ -35,13 +36,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
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, \
|
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, \
|
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
|
||||||
K40, K41, K42, K45, K4A, K4B, K4C, K4D \
|
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_##K0C, KC_##K0D }, \
|
{ 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_##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_##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_##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_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
|
{ 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 */
|
/* ANSI valiant. No extra keys for ISO */
|
||||||
@ -56,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
|
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, \
|
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, \
|
K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \
|
||||||
K40, K41, K42, K45, K4A, K4B, K4C, K4D \
|
K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +69,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "keymap_poker_set.h"
|
#include "keymap_poker_set.h"
|
||||||
#elif defined(KEYMAP_POKER_BIT)
|
#elif defined(KEYMAP_POKER_BIT)
|
||||||
#include "keymap_poker_bit.h"
|
#include "keymap_poker_bit.h"
|
||||||
|
#elif defined(KEYMAP_POKER2)
|
||||||
|
#include "keymap_poker2.h"
|
||||||
#else
|
#else
|
||||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/*
|
/*
|
||||||
@ -214,21 +217,45 @@ static const uint16_t PROGMEM fn_actions[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
|
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
|
||||||
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
|
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
|
||||||
|
|
||||||
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
|
const uint8_t* keymaps_pointer(void) {
|
||||||
|
return (const uint8_t*)keymaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint16_t* fn_actions_pointer(void) {
|
||||||
|
return fn_actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t keymaps_size(void) {
|
||||||
|
return KEYMAPS_SIZE * MATRIX_ROWS * MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t fn_actions_size(void) {
|
||||||
|
return FN_ACTIONS_SIZE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* translates key to keycode */
|
/* translates key to keycode */
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
|
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
|
||||||
{
|
{
|
||||||
if (layer < KEYMAPS_SIZE) {
|
if (layer < KEYMAPS_SIZE) {
|
||||||
|
#ifndef KEYMAP_EX_ENABLE
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
||||||
|
#else
|
||||||
|
return eeconfig_read_keymap_key(layer, key.row, key.col);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// XXX: this may cuaes bootlaoder_jump inconsistent fail.
|
// XXX: this may cuaes bootlaoder_jump inconsistent fail.
|
||||||
//debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n");
|
//debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n");
|
||||||
// fall back to layer 0
|
// fall back to layer 0
|
||||||
|
#ifndef KEYMAP_EX_ENABLE
|
||||||
return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
|
return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
|
||||||
|
#else
|
||||||
|
return eeconfig_read_keymap_key(0, key.row, key.col);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +264,11 @@ action_t keymap_fn_to_action(uint8_t keycode)
|
|||||||
{
|
{
|
||||||
action_t action;
|
action_t action;
|
||||||
if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
|
if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
|
||||||
|
#ifndef KEYMAP_EX_ENABLE
|
||||||
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
|
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
|
||||||
|
#else
|
||||||
|
action.code = eeconfig_read_keymap_fn_action(FN_INDEX(keycode));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
action.code = ACTION_NO;
|
action.code = ACTION_NO;
|
||||||
}
|
}
|
||||||
|
60
keyboard/gh60/keymap_poker2.h
Normal file
60
keyboard/gh60/keymap_poker2.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// Poker2
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
||||||
|
#else
|
||||||
|
static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
/* Keymap 0: Default Layer
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Caps | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl|Gui |Alt | Space |Alt |Fn0 |Gui |Ctrl|
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP_ANSI(
|
||||||
|
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, \
|
||||||
|
CAPS,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,FN0, RGUI,RCTL),
|
||||||
|
/* Keymap 1: Fn Layer
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | |Up | | | |Cal| |Ins| |Psc|Slk|Pau| |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | |Lef|Dow|Rig| | | | | | |Hom|PgU| |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | |App|Fn1|Fn2|Fn3|VoD|VoU|Mut|End|PgD| |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | | |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP_ANSI(
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
|
||||||
|
TRNS,TRNS,UP, TRNS,TRNS,TRNS,CALC,TRNS,INS, TRNS,PSCR,SLCK,PAUS,TRNS, \
|
||||||
|
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGUP, TRNS, \
|
||||||
|
TRNS,TRNS,APP, FN1, FN2, FN3, VOLD,VOLU,MUTE,END, PGDN, TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fn action definition
|
||||||
|
*/
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
|
||||||
|
#else
|
||||||
|
static const uint16_t fn_actions[] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
/* Poker2 Layout */
|
||||||
|
[0] = ACTION_LAYER_MOMENTARY(1),
|
||||||
|
[1] = ACTION_BACKLIGHT_DECREASE(),
|
||||||
|
[2] = ACTION_BACKLIGHT_TOGGLE(),
|
||||||
|
[3] = ACTION_BACKLIGHT_INCREASE()
|
||||||
|
};
|
Reference in New Issue
Block a user