Fix keymap MACRO of pc98 adn hhkb

pull/12/head
tmk 12 years ago
parent 23c32d304b
commit 6778324de2

@ -64,10 +64,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ 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 +91,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,18 +115,70 @@ 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 prog_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_MACRO(LBRACKET), // FN4
ACTION_MACRO(RBRACKET), // FN5
ACTION_MACRO(DUMMY), // FN6
};
/*
* No need to edit.
*/

@ -65,9 +65,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
FN6, A, S, D, F, G, H, J, K, L, FN3, QUOT,FN7, \
FN8, Z, X, C, V, B, N, M, COMM,DOT, FN2, FN12,FN9, \
LGUI,LALT, FN5, FN13,FN4),
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN7, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, FN12,FN9, \
LGUI,LALT, FN5, FN14,FN4),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
@ -173,7 +173,11 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
enum function_id {
LSHIFT_LPAREN,
RSHIFT_RPAREN,
MACRO = 0xff
};
enum macro_id {
SHIFT_D,
HELLO,
};
@ -198,28 +202,30 @@ static const uint16_t PROGMEM fn_actions[] = {
[9] = ACTION_KEYMAP_TAP_TOGGLE(1), // FN9
[11] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // FN11 Function: LShift with tap '('
[12] = ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // FN12 Function: RShift with tap ')'
[13] = ACTION_FUNCTION(MACRO, 1), // FN13 Macro:
[13] = ACTION_MACRO(SHIFT_D),
[14] = ACTION_MACRO(HELLO),
};
/*
* Macro definition
*/
#define MACRO(...) ({ static prog_macro_t _m[] PROGMEM = { __VA_ARGS__ }; _m; })
#define MACRO_NONE 0
static const prog_macro_t *get_macro(uint8_t id, bool pressed)
const prog_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 0:
return (pressed ?
case SHIFT_D:
return (event.pressed ?
MACRO( MD(LSHIFT), D(D), END ) :
MACRO( U(D), MU(LSHIFT), END ) );
case 1:
return (pressed ?
MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
case HELLO:
return (event.pressed ?
MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
MACRO_NONE );
}
return 0;
return MACRO_NONE;
}
@ -300,9 +306,6 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
}
}
break;
case MACRO:
action_macro_play(get_macro(opt, event.pressed));
break;
}
}

Loading…
Cancel
Save