X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;ds=sidebyside;f=converter%2Fpc98_usb%2Fkeymap.c;h=e56a72f19ffe13260b3bcce178309cf773a66f58;hb=6bc7bab6a53a7fb78e0ab1d5989de3a6c9efce4f;hp=6bc549b05cbeb67d9f1f0419065d3f24c7ff2a3c;hpb=000f3c4c543e0c4490787ccc3a8920d4ee0692ec;p=max%2Ftmk_keyboard.git
diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c
index 6bc549b0..e56a72f1 100644
--- a/converter/pc98_usb/keymap.c
+++ b/converter/pc98_usb/keymap.c
@@ -17,11 +17,9 @@ along with this program. If not, see .
#include
#include
-#include
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
-#include "layer_switch.h"
#include "util.h"
#include "keymap.h"
@@ -64,16 +62,16 @@ 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 } \
}
-static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
,---------------------------------------------------------------.
| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
@@ -91,11 +89,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(
@@ -116,55 +114,59 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
-static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
-
-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
-};
-
-
-
/*
- * No need to edit.
+ * Macro definition
*/
-#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]))
+enum macro_id {
+ LBRACKET,
+ RBRACKET,
+ DUMMY,
+};
-/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
- /* 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)]);
- }
+ 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;
}
-/* translates Fn keycode to action */
-action_t keymap_fn_to_action(uint8_t keycode)
+/*
+ * Action function
+ */
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
- action_t action;
- if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
- action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
- } else {
- action.code = ACTION_NO;
+/*
+ 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;
}
- return action;
+*/
}
+
+
+/*
+ * Fn actions
+ */
+const action_t PROGMEM fn_actions[] = {
+ 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
+};