X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=converter%2Fx68k_usb%2Fkeymap.c;h=4d6a1261070544e3059eb8b56720a89fae9e9708;hb=0575b3db2e825fdf9d77f6cf83f6ecd9626cf59a;hp=5cd14cb6d1dc74d0a10da172a3a69dd719c25efc;hpb=3c822b511e7af60332a7e5a938c08bafb2516ba3;p=max%2Ftmk_keyboard.git diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c index 5cd14cb6..4d6a1261 100644 --- a/converter/x68k_usb/keymap.c +++ b/converter/x68k_usb/keymap.c @@ -17,9 +17,10 @@ along with this program. If not, see . #include #include -#include #include "keycode.h" +#include "action.h" #include "util.h" +#include "serial.h" #include "keymap.h" @@ -70,33 +71,27 @@ 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 +const action_t fn_actions[] PROGMEM = { + [0] = ACTION_FUNCTION(0), // toggle all LEDs }; -// 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 bool led = false; + switch (id) { + case 0: + if (record->event.pressed) { + if ((led = !led)) + serial_send(0x80); // all on + else + serial_send(0xff); // all off + } + break; + } +} -static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* X68000 Keyboard Scan codes ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------. | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54| @@ -113,28 +108,22 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| | `---------------------------------------------' `-----------' `---------------' */ + /* ANSI */ KEYMAP( - NO, NO, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,NO, NO, NO, - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, DEL, END, PGDN, P7, P8, P9, PPLS, - LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, UP, P4, P5, P6, PEQL, + FN0, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,F18, UP, P4, P5, P6, PEQL, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,GRV, LEFT,DOWN,RGHT, P1, P2, P3, PENT, - LGUI,LALT,NO, SPC, RALT,RGUI,RCTL,APP, NO, NO, P0, PCMM,PDOT + F19, LGUI,LALT, SPC, RALT,RGUI,RCTL,APP, F14, F15, P0, PCMM,PDOT + ), + /* JIS */ + KEYMAP( + F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, UP, P4, P5, P6, PEQL, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, LEFT,DOWN,RGHT, P1, P2, P3, PENT, + LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT ), }; - - -uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) -{ - return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); -} - -uint8_t keymap_fn_layer(uint8_t fn_bits) -{ - return pgm_read_byte(&fn_layer[biton(fn_bits)]); -} - -uint8_t keymap_fn_keycode(uint8_t fn_bits) -{ - return pgm_read_byte(&fn_keycode[(biton(fn_bits))]); -}