From 0f827cf94ccd6bef490ba889bc86c61483b1eb80 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 10 Feb 2014 10:01:42 +0900 Subject: [PATCH] Add keymap_hasu.c --- converter/ibm4704_usb/Makefile | 4 +- converter/ibm4704_usb/README.md | 2 +- converter/ibm4704_usb/keymap_common.h | 4 +- converter/ibm4704_usb/keymap_hasu.c | 85 +++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 converter/ibm4704_usb/keymap_hasu.c diff --git a/converter/ibm4704_usb/Makefile b/converter/ibm4704_usb/Makefile index bc0f9fde7..112b00129 100644 --- a/converter/ibm4704_usb/Makefile +++ b/converter/ibm4704_usb/Makefile @@ -76,8 +76,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # comment out to disable the options. # #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -#MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -##EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md index f38cdd164..852a4448a 100644 --- a/converter/ibm4704_usb/README.md +++ b/converter/ibm4704_usb/README.md @@ -1,5 +1,5 @@ IBM 4704 to USB keyboard converter -=======----======================= +================================== This firmware converts IBM 4704 keyboard protocol to USB HID. diff --git a/converter/ibm4704_usb/keymap_common.h b/converter/ibm4704_usb/keymap_common.h index 8955baeb5..c55a81720 100644 --- a/converter/ibm4704_usb/keymap_common.h +++ b/converter/ibm4704_usb/keymap_common.h @@ -39,7 +39,7 @@ extern const uint16_t fn_actions[]; K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \ K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \ K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \ - K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3D, \ + K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \ K31,K41,K3F, K40, K42,K2F \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \ @@ -49,7 +49,7 @@ extern const uint16_t fn_actions[]; { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO, KC_##K2F }, \ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ - { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_##K3D, KC_##K3E, KC_##K3F }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ { KC_##K40, KC_##K41, KC_##K42, 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_NO, KC_NO, KC_NO, KC_NO }, \ diff --git a/converter/ibm4704_usb/keymap_hasu.c b/converter/ibm4704_usb/keymap_hasu.c new file mode 100644 index 000000000..7545b0923 --- /dev/null +++ b/converter/ibm4704_usb/keymap_hasu.c @@ -0,0 +1,85 @@ +#include "keymap_common.h" + + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: default + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|xxx|Ret | + * |-----------------------------------------------------------| + * |Shif|xxx| Z| X| C| V| B| N| M| ,| ,| /|xxx|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl | + * `-----------------------------------------------------------' + */ + 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, \ + LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \ + LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, FN2, NO, FN0, \ + LCTL,LGUI,LALT, FN3, RGUI,RCTL \ + ), + + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \ + LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \ + LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \ + LCTL,LGUI,LALT, SPC, RGUI,RCTL \ + ), + + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \ + LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \ + LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, RSFT,\ + LCTL,LGUI,LALT, BTN1, RGUI,RCTL \ + ), + + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ + LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \ + LSFT,NO, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,NO, RSFT, \ + LCTL,LGUI,LALT, SPC, RGUI,RCTL \ + ), + + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \ + LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \ + LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, NO, \ + LCTL,LGUI,LALT, TRNS, RGUI,RCTL \ + ), +}; + +enum macro_id { + ALT_TAB, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN), + [2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH), + [3] = ACTION_LAYER_TAP_KEY(4, KC_SPC), + [4] = ACTION_MACRO(ALT_TAB), +}; + +/* + * Macro definition + */ +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + keyevent_t event = record->event; + + switch (id) { + case ALT_TAB: + return (event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; +}