From 5808317b694004c43a6e0f76e9715415cce19a25 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 5 Mar 2013 15:41:21 +0900 Subject: [PATCH] Fix keymap for new framework --- README.md | 2 +- common/keymap.c | 18 ++-- converter/m0110_usb/Makefile.lufa | 91 ++++++++++++++++++ converter/m0110_usb/README.md | 7 +- converter/m0110_usb/config.h | 1 + converter/m0110_usb/keymap.c | 9 +- converter/pc98_usb/keymap.c | 2 +- keyboard/{IIgs_Standard => IIgs}/Makefile | 0 keyboard/{IIgs_Standard => IIgs}/README | 0 keyboard/{IIgs_Standard => IIgs}/config.h | 0 .../doc/PIN_BYPASS.jpg | Bin .../doc/Teensy++_Mod.jpg | Bin .../{IIgs_Standard => IIgs}/hid_listen.mac | Bin keyboard/{IIgs_Standard => IIgs}/keymap.c | 0 keyboard/{IIgs_Standard => IIgs}/led.c | 0 keyboard/{IIgs_Standard => IIgs}/matrix.c | 0 keyboard/hhkb/keymap.c | 6 +- protocol/vusb/vusb.c | 4 + 18 files changed, 117 insertions(+), 23 deletions(-) create mode 100644 converter/m0110_usb/Makefile.lufa rename keyboard/{IIgs_Standard => IIgs}/Makefile (100%) rename keyboard/{IIgs_Standard => IIgs}/README (100%) rename keyboard/{IIgs_Standard => IIgs}/config.h (100%) rename keyboard/{IIgs_Standard => IIgs}/doc/PIN_BYPASS.jpg (100%) rename keyboard/{IIgs_Standard => IIgs}/doc/Teensy++_Mod.jpg (100%) rename keyboard/{IIgs_Standard => IIgs}/hid_listen.mac (100%) rename keyboard/{IIgs_Standard => IIgs}/keymap.c (100%) rename keyboard/{IIgs_Standard => IIgs}/led.c (100%) rename keyboard/{IIgs_Standard => IIgs}/matrix.c (100%) diff --git a/README.md b/README.md index b85e03ddb..e9dad457d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard professional][GH_hhkb] * [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] * [hbkb](keyboard/hbkb/) - [Happy Buckling sprint keyboard(IBM Model M mod)][GH_hbkb] -* [IIgs_Standard](keyboard/IIgs_Standard/) - Apple [IIGS] keyboard mod(by JeffreySung) +* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung) * [hid_liber](keyboard/hid_liber/) - [HID liberation controller][HID_liber](by alaricljs) * [phantom](keyboard/phantom/) - [Phantom keyboard][PHANTOM] (by Tranquilite) * [gh60](keyboard/gh60/) - [GH60 keyboard][GH60] diff --git a/common/keymap.c b/common/keymap.c index f72be5779..aa8d944a7 100644 --- a/common/keymap.c +++ b/common/keymap.c @@ -38,12 +38,6 @@ action_t action_for_key(uint8_t layer, key_t key) return keycode_to_action(keycode); } } - -__attribute__ ((weak)) -const prog_macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO_NONE; } - -__attribute__ ((weak)) -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {} #else /* * legacy keymap support @@ -71,13 +65,17 @@ action_t action_for_key(uint8_t layer, key_t key) return keycode_to_action(keycode); } } -/* not used for legacy keymap */ -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) -{ -} #endif +__attribute__ ((weak)) +const prog_macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO_NONE; } + +__attribute__ ((weak)) +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {} + + + /* translates keycode to action */ static action_t keycode_to_action(uint8_t keycode) diff --git a/converter/m0110_usb/Makefile.lufa b/converter/m0110_usb/Makefile.lufa new file mode 100644 index 000000000..028bdf933 --- /dev/null +++ b/converter/m0110_usb/Makefile.lufa @@ -0,0 +1,91 @@ +# Target file name (without extension). +TARGET = m0110_lufa + +# Directory common source filess exist +TOP_DIR = ../.. + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = keymap.c \ + matrix.c \ + led.c \ + m0110.c + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +#MCU = at90usb162 # Teensy 1.0 +MCU = atmega32u4 # Teensy 2.0 +#MCU = at90usb646 # Teensy++ 1.0 +#MCU = at90usb1286 # Teensy++ 2.0 + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Build Options +# *Comment out* to disable the options. +# +MOUSEKEY_ENABLE = yes # Mouse keys +#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +#NKRO_ENABLE = yes # USB Nkey Rollover + + +# Boot Section Size in bytes +# Teensy halfKay 512 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +OPT_DEFS += -DBOOT_SIZE=4096 + + + +#---------------- Programming Options -------------------------- +PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) + + +include $(TOP_DIR)/protocol/lufa.mk +include $(TOP_DIR)/protocol.mk +include $(TOP_DIR)/common.mk +include $(TOP_DIR)/rules.mk + +hasu: EXTRAFLAGS += -DHASU +hasu: all diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md index 206f43425..80503e875 100644 --- a/converter/m0110_usb/README.md +++ b/converter/m0110_usb/README.md @@ -53,7 +53,8 @@ You can edit *Makefile* and *config.h* to change compile options and pin configu $ git clone git://github.com/tmk/tmk_keyboard.git (or download source) $ cd m0110_usb - $ make + $ make -f Makefile.lufa clean + $ make -f Makefile.lufa and program your Teensy with [PJRC Teensy loader](http://www.pjrc.com/teensy/loader.html). @@ -74,7 +75,7 @@ You can change keymaps by editing *keymap.c*. |---------------------------------------------------------| |---------------| |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | `---------------------------------------------------------' |-----------|Ent| - |Alt|Gui | Space |Ctl |Alt| | 0| .| | + |Ctl|Alt | Space |Gui |Ctl| | 0| .| | `-----------------------------------------------' `---------------' #### *HHKB/WASD Layer(WASD/IJKL)* ,---------------------------------------------------------. ,---------------. @@ -86,7 +87,7 @@ You can change keymaps by editing *keymap.c*. |---------------------------------------------------------| |---------------| |Shift |End| |PgD| | | |PgD| |End| |Shift | | 1| 2| 3| | `---------------------------------------------------------' |-----------|Ent| - |Alt|Gui | Space |Ctl |Alt| | 0| .| | + |Ctl|Alt | Space |Gui |Ctl| | 0| .| | `-----------------------------------------------' `---------------' ### M0110A diff --git a/converter/m0110_usb/config.h b/converter/m0110_usb/config.h index be00259e6..d43f28383 100644 --- a/converter/m0110_usb/config.h +++ b/converter/m0110_usb/config.h @@ -24,6 +24,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x0110 +#define DEVICE_VER 0x0100 #define MANUFACTURER t.m.k. #define PRODUCT M0110 keyboard converter #define DESCRIPTION convert M0110 keyboard to USB diff --git a/converter/m0110_usb/keymap.c b/converter/m0110_usb/keymap.c index 191bf3a15..7a3bc3585 100644 --- a/converter/m0110_usb/keymap.c +++ b/converter/m0110_usb/keymap.c @@ -19,7 +19,6 @@ along with this program. If not, see . #include #include #include -#include "usb_keyboard.h" #include "keycode.h" #include "print.h" #include "debug.h" @@ -148,7 +147,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |---------------------------------------------------------| |---------------| * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | * |---------------------------------------------------------| |-----------|Ent| - * |Alt |Gui | Space |Ctl| \|Lft|Rgt|Dn | | 0| .| | + * |Ctl |Alt | Space |Gui| \|Lft|Rgt|Dn | | 0| .| | * `---------------------------------------------------------' `---------------' */ KEYMAP( @@ -156,7 +155,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, - LALT,LGUI, SPC, LCTL,BSLS,LEFT,RGHT,DOWN, P0, PDOT + LCTL,LALT, SPC, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT ), /* Cursor Layer(WASD, IJKL) * ,---------------------------------------------------------. ,---------------. @@ -168,7 +167,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |---------------------------------------------------------| |---------------| * |Shift |End| |PgD| | | |PgD| |End| |Shif|PgU| | 1| 2| 3| | * |---------------------------------------------------------| |-----------|Ent| - * |Alt |Gui | Space |Gui |Ins|Hom|End|PgD| | 0| .| | + * |Ctl |Alt | Space |Gui |Ins|Hom|End|PgD| | 0| .| | * `---------------------------------------------------------' `---------------' */ KEYMAP( @@ -176,7 +175,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { CAPS,HOME,UP, PGUP,NO, NO, NO, PGUP,UP, HOME,PSCR,SLCK,PAUS, P7, P8, P9, PMNS, FN0, LEFT,DOWN,RGHT,NO, NO, NO, LEFT,DOWN,RGHT,NO, NO, ENT, P4, P5, P6, PPLS, LSFT,END, NO, PGDN,NO, NO, NO, PGDN,NO, END, NO, PGUP, P1, P2, P3, PENT, - LALT,LGUI, SPC, LCTL,INS, HOME,END, PGDN, P0, PDOT + LCTL,LALT, SPC, LGUI,INS, HOME,END, PGDN, P0, PDOT ), }; diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c index f793539df..279b2b60c 100644 --- a/converter/pc98_usb/keymap.c +++ b/converter/pc98_usb/keymap.c @@ -168,7 +168,7 @@ 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_KEYMAP_MOMENTARY(2), // FN3 ACTION_MACRO(LBRACKET), // FN4 ACTION_MACRO(RBRACKET), // FN5 ACTION_MACRO(DUMMY), // FN6 diff --git a/keyboard/IIgs_Standard/Makefile b/keyboard/IIgs/Makefile similarity index 100% rename from keyboard/IIgs_Standard/Makefile rename to keyboard/IIgs/Makefile diff --git a/keyboard/IIgs_Standard/README b/keyboard/IIgs/README similarity index 100% rename from keyboard/IIgs_Standard/README rename to keyboard/IIgs/README diff --git a/keyboard/IIgs_Standard/config.h b/keyboard/IIgs/config.h similarity index 100% rename from keyboard/IIgs_Standard/config.h rename to keyboard/IIgs/config.h diff --git a/keyboard/IIgs_Standard/doc/PIN_BYPASS.jpg b/keyboard/IIgs/doc/PIN_BYPASS.jpg similarity index 100% rename from keyboard/IIgs_Standard/doc/PIN_BYPASS.jpg rename to keyboard/IIgs/doc/PIN_BYPASS.jpg diff --git a/keyboard/IIgs_Standard/doc/Teensy++_Mod.jpg b/keyboard/IIgs/doc/Teensy++_Mod.jpg similarity index 100% rename from keyboard/IIgs_Standard/doc/Teensy++_Mod.jpg rename to keyboard/IIgs/doc/Teensy++_Mod.jpg diff --git a/keyboard/IIgs_Standard/hid_listen.mac b/keyboard/IIgs/hid_listen.mac similarity index 100% rename from keyboard/IIgs_Standard/hid_listen.mac rename to keyboard/IIgs/hid_listen.mac diff --git a/keyboard/IIgs_Standard/keymap.c b/keyboard/IIgs/keymap.c similarity index 100% rename from keyboard/IIgs_Standard/keymap.c rename to keyboard/IIgs/keymap.c diff --git a/keyboard/IIgs_Standard/led.c b/keyboard/IIgs/led.c similarity index 100% rename from keyboard/IIgs_Standard/led.c rename to keyboard/IIgs/led.c diff --git a/keyboard/IIgs_Standard/matrix.c b/keyboard/IIgs/matrix.c similarity index 100% rename from keyboard/IIgs_Standard/matrix.c rename to keyboard/IIgs/matrix.c diff --git a/keyboard/hhkb/keymap.c b/keyboard/hhkb/keymap.c index 0d07c79cf..094d33af1 100644 --- a/keyboard/hhkb/keymap.c +++ b/keyboard/hhkb/keymap.c @@ -82,7 +82,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Gui|Alt | Space |Alt |Gui| * `-------------------------------------------' */ - KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, 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,ENT, \ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \ @@ -101,7 +101,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Gui|Alt | Space |Alt |Gui| * `-------------------------------------------' */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, 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, ENT, \ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,RSFT,NO, \ @@ -121,7 +121,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------' * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + KEYMAP(GRV, 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,NO, NO, NO, BSPC, \ LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,NO, \ diff --git a/protocol/vusb/vusb.c b/protocol/vusb/vusb.c index 1d5f4a852..328885a9b 100644 --- a/protocol/vusb/vusb.c +++ b/protocol/vusb/vusb.c @@ -88,6 +88,10 @@ static void send_keyboard(report_keyboard_t *report) } else { debug("kbuf: full\n"); } + + // NOTE: send key strokes of Macro + usbPoll(); + vusb_transfer_keyboard(); }