X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=converter%2Fx68k_usb%2Fkeymap.c;h=4d6a1261070544e3059eb8b56720a89fae9e9708;hb=7587fe33822af56e257d68064323f737c6d414f5;hp=671e5decc66ba7fec2dfd631babfa9d51f6bc684;hpb=e7808f7ea4015dbed19f38a6dbbd82b0a3146fe6;p=max%2Ftmk_keyboard.git diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c index 671e5dec..4d6a1261 100644 --- a/converter/x68k_usb/keymap.c +++ b/converter/x68k_usb/keymap.c @@ -17,10 +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" @@ -71,15 +71,27 @@ along with this program. If not, see . } -static const uint16_t fn_actions[] PROGMEM = { +const action_t fn_actions[] PROGMEM = { + [0] = ACTION_FUNCTION(0), // toggle all LEDs }; 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| @@ -98,7 +110,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ /* ANSI */ KEYMAP( - F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13, + 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, @@ -115,16 +127,3 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT ), }; - - -/* translates key to keycode */ -uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); -} - -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint8_t keycode) -{ - return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; -}