X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=converter%2Fpc98_usb%2Fkeymap.c;h=8922ea7baba87fc0ad385351603204bb7e96b918;hb=e1f1a65d6b878aafbe98fe5685a04b6277fdf192;hp=6bc549b05cbeb67d9f1f0419065d3f24c7ff2a3c;hpb=fea6792f1636a716e799539b072930461bfcba67;p=max%2Ftmk_keyboard.git
diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c
index 6bc549b0..8922ea7b 100644
--- a/converter/pc98_usb/keymap.c
+++ b/converter/pc98_usb/keymap.c
@@ -21,7 +21,6 @@ along with this program. If not, see .
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
-#include "layer_switch.h"
#include "util.h"
#include "keymap.h"
@@ -64,10 +63,10 @@ along with this program. If not, see .
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_##K5A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
{ KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_##K70, KC_NO, KC_NO, KC_##K73, KC_##K74, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_NO, KC_##K73, KC_##K74, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
}
@@ -91,11 +90,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
`-----------------------------------------------'
*/
KEYMAP(
- CANCEL,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
- ESC, 1, 2, 3, 4, 5, NO, NO, 6, 7, 8, 9, 0, BSPC,
+ CANCEL,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, FN6,
+ ESC, 1, 2, 3, 4, 5, FN4, FN5, 6, 7, 8, 9, 0, BSPC,
TAB, Q, W, E, R, T, UP, Y, U, I, O, P, ENT,
LCTL, A, S, D, F, G, MINS, EQL, H, J, K, L, FN2,
- LSFT, Z, X, C, V, B, INS, DOWN, DEL, N, M,COMM, DOT, FN1,
+ LSFT, Z, X, C, V, B, GRV, BSLS, QUOT, N, M,COMM, DOT, FN1,
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
),
KEYMAP(
@@ -115,45 +114,84 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
),
};
-
static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
+/*
+ * Macro definition
+ */
+enum macro_id {
+ LBRACKET,
+ RBRACKET,
+ DUMMY,
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ keyevent_t event = record->event;
+ //uint8_t tap_count = record->tap_count;
+
+ switch (id) {
+ case LBRACKET:
+ return (event.pressed ?
+ MACRO( T(LBRC), END ) :
+ MACRO( T(LBRC), END ) );
+ case RBRACKET:
+ return (event.pressed ?
+ MACRO( T(RBRC), END ) :
+ MACRO( T(RBRC), END ) );
+ }
+ return MACRO_NONE;
+}
+
+/*
+ * Action function
+ */
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+/*
+ keyevent_t event = record->event;
+ uint8_t tap_count = record->tap_count;
+ switch (id) {
+ case 0xFF:
+ action_macro_play(get_macro(opt, event.pressed));
+ break;
+ }
+*/
+}
+
+
+/*
+ * Fn actions
+ */
static const uint16_t PROGMEM fn_actions[] = {
- ACTION_KEYMAP_TAP_TOGGLE(0), // FN0
- ACTION_KEYMAP_TAP_KEY(1, KC_SLASH), // FN1
- ACTION_KEYMAP_TAP_KEY(2, KC_SCLN), // FN2
- ACTION_KEYMAP(2), // FN3
+ ACTION_LAYER_TAP_TOGGLE(0), // FN0
+ ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1
+ ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2
+ ACTION_LAYER_MOMENTARY(2), // FN3
+ ACTION_MACRO(LBRACKET), // FN4
+ ACTION_MACRO(RBRACKET), // FN5
+ ACTION_MACRO(DUMMY), // FN6
};
+
+
+
/*
* No need to edit.
*/
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
-#define OVERLAYS_SIZE (sizeof(overlays) / sizeof(overlays[0]))
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
/* 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, keypos_t key)
{
- /* Overlay: 16-31(OVERLAY_BIT(0x10) | overlay_layer) */
- if (layer & OVERLAY_BIT) {
- layer &= OVERLAY_MASK;
- if (layer < OVERLAYS_SIZE) {
- return pgm_read_byte(&overlays[(layer)][(key.row)][(key.col)]);
- } else {
- return KC_TRANSPARENT;
- }
- }
- /* Keymap: 0-15 */
- else {
- if (layer < KEYMAPS_SIZE) {
- return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
- } else {
- // fall back to layer 0
- return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
- }
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
}
}