Cleanup of keymap definition

This commit is contained in:
Jeremy Soller 2020-01-12 10:37:56 -07:00
parent a49e3f791b
commit cb1f7df142
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
4 changed files with 39 additions and 33 deletions

View File

@ -1,7 +1,8 @@
EC=it5570e
# Add keymaps to include
INCLUDE+=$(wildcard $(BOARD_DIR)/keymap/*.h)
# Add keymap to src
KEYMAP?=default
SRC+=$(BOARD_DIR)/keymap/$(KEYMAP).c
# Set log level
# 0 - NONE

View File

@ -3,6 +3,36 @@
#include <stdint.h>
#define ___ 0
// Conversion of physical layout to keyboard matrix
#define LAYOUT( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, \
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, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, \
K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, \
K60, K61, K62 \
) { \
{ ___, ___, ___, ___, ___, ___, K52, ___ }, \
{ ___, ___, ___, ___, ___, ___, K50, K56 }, \
{ ___, ___, ___, ___, ___, ___, K53, K55 }, \
{ ___, ___, ___, ___, ___, ___, K40, K4B }, \
{ K42, K41, K30, K31, K20, ___, K54, K21 }, \
{ K44, K43, ___, K33, ___, ___, ___, K23 }, \
{ K51, K45, K34, K35, K24, K25, ___, ___ }, \
{ ___, K46, K36, K26, K12, K11, K10, K00 }, \
{ K28, K47, K27, K15, K14, K13, K02, K01 }, \
{ K22, K37, K38, ___, K17, K16, K04, K03 }, \
{ K32, K48, K39, K29, K19, K18, K06, K05 }, \
{ ___, K58, K49, K3A, K2A, K1A, K08, K07 }, \
{ ___, ___, K4A, K3B, K2B, K1B, K0A, K09 }, \
{ ___, ___, K0D, K2C, K1C, K62, K0E, K0B }, \
{ ___, K2D, K60, K1D, K57, K0F, ___, K0G }, \
{ ___, ___, K3C, ___, K61, K0C, ___, K59 } \
}
// Keymap output pins
#define KM_OUT 16
// Keymap input pins
@ -10,8 +40,13 @@
// Keymap layers (normal, Fn)
#define KM_LAY 2
// Keymap
extern uint16_t __code KEYMAP[KM_LAY][KM_OUT][KM_IN];
// Get a keycode from the keymap
uint16_t keymap(int output, int input, int layer);
// Translate a keycode from PS/2 set 2 to PS/2 set 1
uint16_t keymap_translate(uint16_t key);
// Key types

View File

@ -1,9 +1,6 @@
#include <board/keymap.h>
#include <common/debug.h>
// Set the desired keymap here
#include "keymap/default.h"
uint16_t keymap(int output, int input, int layer) {
if (output < KM_OUT && input < KM_IN && layer < KM_LAY) {
return KEYMAP[layer][output][input];

View File

@ -1,33 +1,6 @@
// Default layout
#define ___ 0
#define LAYOUT( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, \
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, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, \
K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, \
K60, K61, K62 \
) { \
{ ___, ___, ___, ___, ___, ___, K52, ___ }, \
{ ___, ___, ___, ___, ___, ___, K50, K56 }, \
{ ___, ___, ___, ___, ___, ___, K53, K55 }, \
{ ___, ___, ___, ___, ___, ___, K40, K4B }, \
{ K42, K41, K30, K31, K20, ___, K54, K21 }, \
{ K44, K43, ___, K33, ___, ___, ___, K23 }, \
{ K51, K45, K34, K35, K24, K25, ___, ___ }, \
{ ___, K46, K36, K26, K12, K11, K10, K00 }, \
{ K28, K47, K27, K15, K14, K13, K02, K01 }, \
{ K22, K37, K38, ___, K17, K16, K04, K03 }, \
{ K32, K48, K39, K29, K19, K18, K06, K05 }, \
{ ___, K58, K49, K3A, K2A, K1A, K08, K07 }, \
{ ___, ___, K4A, K3B, K2B, K1B, K0A, K09 }, \
{ ___, ___, K0D, K2C, K1C, K62, K0E, K0B }, \
{ ___, K2D, K60, K1D, K57, K0F, ___, K0G }, \
{ ___, ___, K3C, ___, K61, K0C, ___, K59 } \
}
#include <board/keymap.h>
uint16_t __code KEYMAP[KM_LAY][KM_OUT][KM_IN] = {
LAYOUT(