From e7808f7ea4015dbed19f38a6dbbd82b0a3146fe6 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 29 Apr 2016 15:30:32 +0900 Subject: [PATCH] x68k_usb: Convert legacy keymap into current one --- converter/x68k_usb/Makefile | 2 +- .../x68k_usb/{config_pjrc.h => config.h} | 3 -- converter/x68k_usb/keymap.c | 42 +++++-------------- 3 files changed, 12 insertions(+), 35 deletions(-) rename converter/x68k_usb/{config_pjrc.h => config.h} (97%) diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile index fd2eb199..9df264b3 100644 --- a/converter/x68k_usb/Makefile +++ b/converter/x68k_usb/Makefile @@ -18,7 +18,7 @@ SRC = keymap.c \ led.c \ protocol/serial_uart.c -CONFIG_H = config_pjrc.h +CONFIG_H = config.h # MCU name, you MUST set this to match the board you are using diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config.h similarity index 97% rename from converter/x68k_usb/config_pjrc.h rename to converter/x68k_usb/config.h index 77989fe3..b552223a 100644 --- a/converter/x68k_usb/config_pjrc.h +++ b/converter/x68k_usb/config.h @@ -39,9 +39,6 @@ along with this program. If not, see . keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \ ) -/* legacy keymap support */ -#define USE_LEGACY_KEYMAP - /* USART configuration * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c index 5e09f55d..671e5dec 100644 --- a/converter/x68k_usb/keymap.c +++ b/converter/x68k_usb/keymap.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include #include "keycode.h" +#include "action.h" #include "util.h" #include "keymap.h" @@ -70,30 +71,12 @@ along with this program. If not, see . } -// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. -static const uint8_t PROGMEM fn_layer[] = { - 0, // Fn0 - 0, // Fn1 - 0, // Fn2 - 0, // Fn3 - 0, // Fn4 - 0, // Fn5 - 0, // Fn6 - 0 // Fn7 +static const uint16_t fn_actions[] PROGMEM = { }; -// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. -// See layer.c for details. -static const uint8_t PROGMEM fn_keycode[] = { - KC_NO, // Fn0 - KC_NO, // Fn1 - KC_NO, // Fn2 - KC_NO, // Fn3 - KC_NO, // Fn4 - KC_NO, // Fn5 - KC_NO, // Fn6 - KC_NO // Fn7 -}; +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +} static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -134,17 +117,14 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { - return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); } -uint8_t keymap_fn_layer(uint8_t index) +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) { - return pgm_read_byte(&fn_layer[index]); -} - -uint8_t keymap_fn_keycode(uint8_t index) -{ - return pgm_read_byte(&fn_keycode[index]); + return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; }