summaryrefslogtreecommitdiff
path: root/converter
diff options
context:
space:
mode:
Diffstat (limited to 'converter')
-rw-r--r--converter/adb_usb/README.md2
-rw-r--r--converter/adb_usb/keymap_common.c2
-rw-r--r--converter/ascii_usb/keymap.c2
-rw-r--r--converter/ibm4704_usb/keymap_common.c2
-rw-r--r--converter/m0110_usb/keymap.c2
-rw-r--r--converter/m0110_usb/keymap_common.c2
-rw-r--r--converter/next_usb/keymap.c2
-rw-r--r--converter/pc98_usb/keymap.c2
-rw-r--r--converter/ps2_usb/Makefile.mbed46
-rw-r--r--converter/ps2_usb/config_mbed.h60
-rw-r--r--converter/ps2_usb/keymap_common.c3
-rw-r--r--converter/ps2_usb/keymap_common.h1
-rw-r--r--converter/ps2_usb/main.cpp46
-rw-r--r--converter/ps2_usb/matrix.c3
-rw-r--r--converter/serialmouse_usb/keymap.c2
-rw-r--r--converter/serialmouse_usb/keymap_common.c2
-rw-r--r--converter/terminal_bluefruit/Makefile16
-rw-r--r--converter/terminal_bluefruit/keymap.c2
-rw-r--r--converter/terminal_usb/Makefile15
-rw-r--r--converter/usb_usb/Makefile12
-rw-r--r--converter/usb_usb/README51
-rw-r--r--converter/usb_usb/config.h4
-rw-r--r--converter/usb_usb/keymap.c128
-rw-r--r--converter/usb_usb/keymap_common.c31
-rw-r--r--converter/usb_usb/keymap_common.h77
-rw-r--r--converter/usb_usb/keymap_hasu.c158
-rw-r--r--converter/usb_usb/keymap_spacefn.c61
-rw-r--r--converter/usb_usb/main.cpp14
-rw-r--r--converter/usb_usb/matrix.c6
29 files changed, 575 insertions, 179 deletions
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
index defc477e2c..21ad318c1d 100644
--- a/converter/adb_usb/README.md
+++ b/converter/adb_usb/README.md
@@ -88,7 +88,7 @@ modifiers except for GUI key(Windows/Command).
And most ADB keyboard has no diodes in its matrix so they are not NKRO,
though ADB protocol itself supports it. See protocol/adb.c for more info.
-If keyobard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
+If keyboard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
keymap you will suffer from swapped keys problem.
https://github.com/tmk/tmk_keyboard/issues/35
diff --git a/converter/adb_usb/keymap_common.c b/converter/adb_usb/keymap_common.c
index 241d2e33b1..55a13793cb 100644
--- a/converter/adb_usb/keymap_common.c
+++ b/converter/adb_usb/keymap_common.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/ascii_usb/keymap.c b/converter/ascii_usb/keymap.c
index 5c13beaffa..a0c61ce8de 100644
--- a/converter/ascii_usb/keymap.c
+++ b/converter/ascii_usb/keymap.c
@@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Keymap is not used. See matrix.c.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return KC_NO;
}
diff --git a/converter/ibm4704_usb/keymap_common.c b/converter/ibm4704_usb/keymap_common.c
index 241d2e33b1..55a13793cb 100644
--- a/converter/ibm4704_usb/keymap_common.c
+++ b/converter/ibm4704_usb/keymap_common.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/m0110_usb/keymap.c b/converter/m0110_usb/keymap.c
index 031c881b72..4570dd2832 100644
--- a/converter/m0110_usb/keymap.c
+++ b/converter/m0110_usb/keymap.c
@@ -209,7 +209,7 @@ static const uint16_t fn_actions[] PROGMEM = {
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/m0110_usb/keymap_common.c b/converter/m0110_usb/keymap_common.c
index bad18c91a8..4ac2d71783 100644
--- a/converter/m0110_usb/keymap_common.c
+++ b/converter/m0110_usb/keymap_common.c
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/next_usb/keymap.c b/converter/next_usb/keymap.c
index d844f8a4e2..3a51075483 100644
--- a/converter/next_usb/keymap.c
+++ b/converter/next_usb/keymap.c
@@ -165,7 +165,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c
index 7420e24ac8..8922ea7bab 100644
--- a/converter/pc98_usb/keymap.c
+++ b/converter/pc98_usb/keymap.c
@@ -185,7 +185,7 @@ static const uint16_t PROGMEM fn_actions[] = {
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
if (layer < KEYMAPS_SIZE) {
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
diff --git a/converter/ps2_usb/Makefile.mbed b/converter/ps2_usb/Makefile.mbed
new file mode 100644
index 0000000000..ff8a0de7a4
--- /dev/null
+++ b/converter/ps2_usb/Makefile.mbed
@@ -0,0 +1,46 @@
+PROJECT = ps2_usb
+
+TMK_DIR = ../..
+MBED_DIR = $(TMK_DIR)/mbed-sdk
+
+#VPATH += $(MBED_DIR):$(TMK_DIR)
+vpath %.s .:$(MBED_DIR):$(TMK_DIR)
+vpath %.c .:$(MBED_DIR):$(TMK_DIR)
+vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
+
+OBJDIR = ./build
+
+OBJECTS = \
+ $(OBJDIR)/protocol/ps2_busywait.o \
+ $(OBJDIR)/protocol/ps2_io_mbed.o \
+ $(OBJDIR)/./keymap_common.o \
+ $(OBJDIR)/./matrix.o \
+ $(OBJDIR)/./led.o \
+ $(OBJDIR)/./main.o
+
+ifdef KEYMAP
+ OBJECTS := $(OBJDIR)/keymap_$(KEYMAP).o $(OBJECTS)
+else
+ OBJECTS := $(OBJDIR)/keymap_plain.o $(OBJECTS)
+endif
+
+CONFIG_H = config_mbed.h
+
+SYS_OBJECTS =
+
+INCLUDE_PATHS = -I.
+
+LIBRARY_PATHS =
+LIBRARIES =
+
+# Build Options
+# Comment out to disable
+#BOOTMAGIC_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+
+
+#include $(TMK_DIR)/tool/mbed/mk20d50m.mk
+include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk
+include $(TMK_DIR)/tool/mbed/mbed.mk
+include $(TMK_DIR)/tool/mbed/common.mk
+include $(TMK_DIR)/tool/mbed/gcc.mk
diff --git a/converter/ps2_usb/config_mbed.h b/converter/ps2_usb/config_mbed.h
new file mode 100644
index 0000000000..5819763e65
--- /dev/null
+++ b/converter/ps2_usb/config_mbed.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_MBED_H
+#define CONFIG_MBED_H
+
+
+#if 0
+// duplicated name against mbed USBDeivce
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6512
+#endif
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2 keyboard converter
+#define DESCRIPTION convert PS/2 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 32 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+/*
+ * PS/2 Busywait
+ */
+#ifdef PS2_USE_BUSYWAIT
+# define PS2_CLOCK_PORT PORTD
+# define PS2_CLOCK_PIN PIND
+# define PS2_CLOCK_DDR DDRD
+# define PS2_CLOCK_BIT 5
+# define PS2_DATA_PORT PORTD
+# define PS2_DATA_PIN PIND
+# define PS2_DATA_DDR DDRD
+# define PS2_DATA_BIT 2
+#endif
+
+
+#endif
diff --git a/converter/ps2_usb/keymap_common.c b/converter/ps2_usb/keymap_common.c
index 241d2e33b1..e344fb4167 100644
--- a/converter/ps2_usb/keymap_common.c
+++ b/converter/ps2_usb/keymap_common.c
@@ -15,10 +15,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keymap_common.h"
+#include "progmem.h"
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/ps2_usb/keymap_common.h b/converter/ps2_usb/keymap_common.h
index 216a8dc020..d783e01ded 100644
--- a/converter/ps2_usb/keymap_common.h
+++ b/converter/ps2_usb/keymap_common.h
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
-#include <avr/pgmspace.h>
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
diff --git a/converter/ps2_usb/main.cpp b/converter/ps2_usb/main.cpp
new file mode 100644
index 0000000000..860af149a0
--- /dev/null
+++ b/converter/ps2_usb/main.cpp
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "debug.h"
+#include "timer.h"
+#include "action.h"
+#include "keycode.h"
+#include "host.h"
+#include "host_driver.h"
+#include "mbed_driver.h"
+
+
+// Button and LEDs of LPC11U35 board
+DigitalIn isp(P0_1); // ISP button
+DigitalOut led_red(P0_20);
+DigitalOut led_green(P0_21);
+
+
+int main(void) {
+ isp.mode(PullUp);
+ led_red = 1;
+ led_green = 0;
+
+ timer_init();
+ host_set_driver(&mbed_driver);
+ keyboard_init();
+
+ //debug_enable = true;
+ xprintf("mbed_onekey ver.eee:\r\n");
+
+
+ bool last_isp = isp;
+ while (1) {
+ keyboard_task();
+
+ //led_green = !led_green;
+ if (last_isp == isp) continue;
+ last_isp = isp;
+ if (last_isp == 0) {
+ led_red = 0; // on
+ dprintf("timer: %i\r\n", timer_read());
+ //register_code(KC_A);
+ } else {
+ led_red = 1; // off
+ //unregister_code(KC_A);
+ }
+ }
+}
diff --git a/converter/ps2_usb/matrix.c b/converter/ps2_usb/matrix.c
index 45344c0f75..45cf2a4a90 100644
--- a/converter/ps2_usb/matrix.c
+++ b/converter/ps2_usb/matrix.c
@@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
-#include <avr/io.h>
-#include <util/delay.h>
#include "action.h"
#include "print.h"
#include "util.h"
@@ -189,6 +187,7 @@ uint8_t matrix_scan(void)
}
uint8_t code = ps2_host_recv();
+ if (code) xprintf("%i\r\n", code);
if (!ps2_error) {
switch (state) {
case INIT:
diff --git a/converter/serialmouse_usb/keymap.c b/converter/serialmouse_usb/keymap.c
index de8f75c2af..cb78b4d195 100644
--- a/converter/serialmouse_usb/keymap.c
+++ b/converter/serialmouse_usb/keymap.c
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return KC_NO;
}
diff --git a/converter/serialmouse_usb/keymap_common.c b/converter/serialmouse_usb/keymap_common.c
index 241d2e33b1..55a13793cb 100644
--- a/converter/serialmouse_usb/keymap_common.c
+++ b/converter/serialmouse_usb/keymap_common.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/terminal_bluefruit/Makefile b/converter/terminal_bluefruit/Makefile
index 83d68fc252..28b7397bae 100644
--- a/converter/terminal_bluefruit/Makefile
+++ b/converter/terminal_bluefruit/Makefile
@@ -83,21 +83,6 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
-ifdef PS2_USE_USART
- SRC += protocol/ps2_usart.c
- OPT_DEFS += -DPS2_USE_USART
-endif
-
-ifdef PS2_USE_INT
- SRC += protocol/ps2.c
- OPT_DEFS += -DPS2_USE_INT
-endif
-
-ifdef PS2_USE_BUSYWAIT
- SRC += protocol/ps2.c
- OPT_DEFS += -DPS2_USE_BUSYWAIT
-endif
-
#---------------- Programming Options --------------------------
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
@@ -107,6 +92,7 @@ VPATH += $(TARGET_DIR)
VPATH += $(TOP_DIR)
+include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/protocol/bluefruit.mk
include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/common.mk
diff --git a/converter/terminal_bluefruit/keymap.c b/converter/terminal_bluefruit/keymap.c
index 716590a456..8acd8cfb33 100644
--- a/converter/terminal_bluefruit/keymap.c
+++ b/converter/terminal_bluefruit/keymap.c
@@ -214,7 +214,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
*/
-uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}
diff --git a/converter/terminal_usb/Makefile b/converter/terminal_usb/Makefile
index 6154d86826..16df638b94 100644
--- a/converter/terminal_usb/Makefile
+++ b/converter/terminal_usb/Makefile
@@ -82,21 +82,6 @@ PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomen
#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
-ifdef PS2_USE_USART
- SRC += protocol/ps2_usart.c
- OPT_DEFS += -DPS2_USE_USART
-endif
-
-ifdef PS2_USE_INT
- SRC += protocol/ps2.c
- OPT_DEFS += -DPS2_USE_INT
-endif
-
-ifdef PS2_USE_BUSYWAIT
- SRC += protocol/ps2.c
- OPT_DEFS += -DPS2_USE_BUSYWAIT
-endif
-
#---------------- Programming Options --------------------------
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile
index 13f77ca9b7..d6867bb002 100644
--- a/converter/usb_usb/Makefile
+++ b/converter/usb_usb/Makefile
@@ -99,16 +99,22 @@ CONSOLE_ENABLE = yes # Console for debug
# Teensy halfKay 512
# Atmel DFU loader 4096
# LUFA bootloader 4096
-#OPT_DEFS += -DBOOTLOADER_SIZE=4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
SRC = \
- keymap.c \
+ keymap_common.c \
matrix.c \
led.c \
main.cpp
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap.c $(SRC)
+endif
+
CONFIG_H = config.h
@@ -120,7 +126,7 @@ VPATH += $(TOP_DIR)
# program Leonardo
-PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -P$(DEV) -b57600 -Uflash:w:$(TARGET).hex
+PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV)
diff --git a/converter/usb_usb/README b/converter/usb_usb/README
index a489371107..30d5deb1e5 100644
--- a/converter/usb_usb/README
+++ b/converter/usb_usb/README
@@ -7,7 +7,19 @@ Arduino Leonardo
http://arduino.cc/en/Main/ArduinoBoardLeonardo
Circuit@Home USB Host Shield 2.0
- http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/
+
+Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be the easiest way, you won't need even soldering iron.
+Arduino's Shield will also work well but I think Sparkfun's needs to be modified.
+
+ http://arduino.cc/en/Main/ArduinoUSBHostShield
+ https://www.sparkfun.com/products/9947
+
+Also Pro Micro 3.3V(not Mini) or Teensy with mini host shield will work with some fixes on signal/power routing.
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
+ https://www.sparkfun.com/products/12587
+ https://www.pjrc.com/teensy/td_libs_USBHostShield.html
+
Build firmware
@@ -19,13 +31,44 @@ Build firmware
$ cd converter/usb_usb
$ make
-You will get usb_usb.hex if you are lucky.
-Program your Leonardo with avrdude(or easy-going Arduino IDE):
+Program converter. Push reset button on Leonardo before run this command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.
+
+ $ DEV=COM17 make program
+ or
+ $ avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:usb_usb.hex -PCOM17
- $ avrdude -patmega32u4 -cavr109 -PCOM17 -b57600 -Uflash:w:usb_usb.hex
Limitation
----------
Only supports 'HID Boot protocol'.
Not support keyboard LED yet.
+
+Note that the converter can host only USB "boot protocol" keyboard(6KRO) and not NKRO, it is possible to support NKRO keyboard but you will need to write HID report parser for that. Every NKRO keyboard can have different HID report and it is difficult to support all kind of NKRO keyboards in the market.
+
+
+
+Update
+------
+2014/12/11 Added Hub support(confirmed with HHKB pro2)
+
+
+
+Resource
+--------
+USB Host Sheild 2.0
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
+USB Host Sheild 2.0 source
+ https://github.com/felis/USB_Host_Shield_2.0
+Arduino USB Host Shield(with bootst converter)
+ http://arduino.cc/en/Main/ArduinoUSBHostShield
+Arduino source
+ https://github.com/arduino/Arduino/hardware/arduino/{cores,variants}
+Initial release of TMK USB-USB converter
+ https://geekhack.org/index.php?topic=33057.msg653549#msg653549
+ http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html#p74854
+Arduino-based hardware keyboard remapper - Colemak forum
+ http://forum.colemak.com/viewtopic.php?id=1561
+Teensy + Host Shield
+ http://www.pjrc.com/teensy/td_libs_USBHostShield.html
diff --git a/converter/usb_usb/config.h b/converter/usb_usb/config.h
index d614973f7e..c992456763 100644
--- a/converter/usb_usb/config.h
+++ b/converter/usb_usb/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0xCAFE
+#define PRODUCT_ID 0x005B
#define DEVICE_VER 0x0814
#define MANUFACTURER t.m.k.
#define PRODUCT USB to USB keyboard converter
@@ -33,8 +33,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 32
#define MATRIX_COLS 8
-#define USE_LEGACY_KEYMAP
-
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c
index ff166fcf1f..c14a8aa553 100644
--- a/converter/usb_usb/keymap.c
+++ b/converter/usb_usb/keymap.c
@@ -15,62 +15,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <avr/pgmspace.h>
-#include "keycode.h"
-#include "util.h"
-#include "keymap.h"
+#include "keymap_common.h"
-#define KEYMAP( \
- K29,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \
- K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \
- K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K31, K4C,K4D,K4E, K5F,K60,K61, \
- K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K28, K5C,K5D,K5E,K57, \
- KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B, \
- KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58 \
-) { \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, /* 00-07 */ \
- { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, /* 08-0F */ \
- { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, /* 10-17 */ \
- { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, /* 18-1F */ \
- { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, /* 20-27 */ \
- { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \
- { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, /* 30-37 */ \
- { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, /* 38-3F */ \
- { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, /* 40-47 */ \
- { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, /* 48-4F */ \
- { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, /* 50-57 */ \
- { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, /* 58-5F */ \
- { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_NO, KC_##K65, KC_NO, KC_NO }, /* 60-67 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 68-6F */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 70-77 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 78-7F */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 80-87 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 90-97 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A0-A7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B0-B7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C0-C7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D0-D7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \
- { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, /* E0-E7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F0-F7 */ \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \
-}
-
-
-// Layers to switch by holding Fn key(0-7)
-static const uint8_t PROGMEM fn_layer[] = { 5, 6, 5, 0, 0, 0, 0, 0 };
-
-// Codes to register by clicking Fn key(0-7)
-static const uint8_t PROGMEM fn_keycode[] = { KC_SCLN, KC_SLSH, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO };
-
-static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: default
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
@@ -86,16 +34,14 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
* `-----------------------------------------------------------' `-----------' `---------------'
- * ; = Fn0(to Layer 5)
- * / = Fn1(to Layer 6)
*/
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
- FN2, A, S, D, F, G, H, J, K, L, FN0, QUOT, ENT, P4, P5, P6, PPLS,
- LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, RSFT, UP, P1, P2, P3,
- LCTL,LGUI,LALT, SPC, RALT,FN2, FN2, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ CAPS,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, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT
),
/* 1: plain Qwerty without layer switching
@@ -185,67 +131,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
),
-
- /* 5: Mouse keys
- * ,-----------------------------------------------------------.
- * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa|
- * |-----------------------------------------------------------|
- * |Tab |MwL|MwU|McU|WwU|WwR|MwL|MwD|MwU|MwR| | | | \|
- * |-----------------------------------------------------------|
- * |CapsLo| |McL|McD|McR| |McL|McD|McU|McR|Fn0| |Return |
- * |-----------------------------------------------------------|
- * |Shift |VoD|VoU|Mut|Mb2|Mb3|Mb2|Mb1|VoD|VoU|Mut|Shift |
- * |-----------------------------------------------------------|
- * |Ctrl |Gui |Alt | Mb1 |Alt |Gui |Menu|Ctrl|
- * `-----------------------------------------------------------'
- * Mc = mouse cursor, Mw = mouse wheel, Mb = mouse button
- * Vo = Volume, Mut = Mute
- */
- KEYMAP(
- ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
- GRV, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
- CAPS,NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
- FN2, VOLD,VOLU,MUTE,NO, NO, MS_L,MS_D,MS_U,MS_R,FN0, NO, ENT, P4, P5, P6, PPLS,
- LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT, UP, P1, P2, P3,
- LCTL,LGUI,LALT, BTN1, RALT,FN2, FN2, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
- ),
-
- /* 6: Cursor keys
- * ,-----------------------------------------------------------.
- * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa|
- * |-----------------------------------------------------------|
- * |Tab |Hom|PgU| Up|PgU|End|Hom|PgD|PgU|End| | | | \|
- * |-----------------------------------------------------------|
- * |CapsLo| |Lef|Dow|Rig| |Lef|Dow| Up|Rig| | |Return |
- * |-----------------------------------------------------------|
- * |Shift | | | | | |Hom|PgD|PgU|End|Fn1|Shift |
- * |-----------------------------------------------------------|
- * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
- * `-----------------------------------------------------------'
- */
- KEYMAP(
- ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
- GRV, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
- CAPS,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, INS, DEL, END, PGDN, P7, P8, P9,
- LCTL,NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
- LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN1, RSFT, UP, P1, P2, P3,
- LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
- ),
};
-
-
-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 index)
-{
- return pgm_read_byte(&fn_layer[index]);
-}
-
-uint8_t keymap_fn_keycode(uint8_t index)
-{
- return pgm_read_byte(&fn_keycode[index]);
-}
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/usb_usb/keymap_common.c b/converter/usb_usb/keymap_common.c
new file mode 100644
index 0000000000..8ab5ba923e
--- /dev/null
+++ b/converter/usb_usb/keymap_common.c
@@ -0,0 +1,31 @@
+/*
+Copyright 2014 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "keymap_common.h"
+#include "progmem.h"
+
+
+/* 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)]) };
+}
diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h
new file mode 100644
index 0000000000..435d83fdc7
--- /dev/null
+++ b/converter/usb_usb/keymap_common.h
@@ -0,0 +1,77 @@
+/*
+Copyright 2014 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+#define KEYMAP( \
+ K29,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \
+ K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \
+ K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K31, K4C,K4D,K4E, K5F,K60,K61, \
+ K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K28, K5C,K5D,K5E,K57, \
+ KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B, \
+ KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58 \
+) { \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, /* 00-07 */ \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, /* 08-0F */ \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, /* 10-17 */ \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, /* 18-1F */ \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, /* 20-27 */ \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \
+ { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, /* 30-37 */ \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, /* 38-3F */ \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, /* 40-47 */ \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, /* 48-4F */ \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, /* 50-57 */ \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, /* 58-5F */ \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_NO, KC_##K65, KC_NO, KC_NO }, /* 60-67 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 68-6F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 70-77 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 78-7F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 80-87 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 90-97 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A0-A7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B0-B7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C0-C7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D0-D7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \
+ { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, /* E0-E7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F0-F7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \
+}
+
+#endif
diff --git a/converter/usb_usb/keymap_hasu.c b/converter/usb_usb/keymap_hasu.c
new file mode 100644
index 0000000000..de19e23076
--- /dev/null
+++ b/converter/usb_usb/keymap_hasu.c
@@ -0,0 +1,158 @@
+#include "keymap_common.h"
+
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Fn6 |
+ * |-----------------------------------------------------------|
+ * |Fn7 | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1|
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Fn4 |Fn5 |Gui|
+ * `-------------------------------------------'
+ */
+ [0] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, FN6, P4, P5, P6, PPLS,
+ FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, FN4, RALT,FN5, FN5, FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 1: HHKB mode[HHKB Fn]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [1] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 2: Vi mode[Slash]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [2] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 3: Mouse mode(IJKL)[Semicolon]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
+ */
+ [3] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, BTN1, RALT,TRNS,TRNS,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 5: Mouse mode(IJKL)[Space]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
+ */
+ [4] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, TRNS, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+
+/*
+ * Macro definition
+ */
+enum macro_id {
+ ALT_TAB,
+};
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch (id) {
+ case ALT_TAB:
+ return (record->event.pressed ?
+ MACRO( D(LALT), D(TAB), END ) :
+ MACRO( U(TAB), END ));
+ }
+ return MACRO_NONE;
+}
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
+ [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
+ [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
+ [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
+ [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
+ [5] = ACTION_LAYER_MOMENTARY(3), // Mousekey layer
+ [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
+ [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
+ [8] = ACTION_MACRO(ALT_TAB), // Application switching
+};
diff --git a/converter/usb_usb/keymap_spacefn.c b/converter/usb_usb/keymap_spacefn.c
new file mode 100644
index 0000000000..bffd2bc606
--- /dev/null
+++ b/converter/usb_usb/keymap_spacefn.c
@@ -0,0 +1,61 @@
+/*
+ * SpaceFN layout
+ * http://geekhack.org/index.php?topic=51069.0
+ */
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,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, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 1: SpaceFN
+ * ,-----------------------------------------------------------.
+ * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ * |-----------------------------------------------------------|
+ * | | | | | | |PgU|Lef|Dow|Rig| | | |
+ * |-----------------------------------------------------------|
+ * | | | | | |Spc|PgD|` |~ | |Men| |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+};
+
diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp
index 20b7af66a2..30fd3348a3 100644
--- a/converter/usb_usb/main.cpp
+++ b/converter/usb_usb/main.cpp
@@ -8,11 +8,13 @@
#include "hid.h"
#include "hidboot.h"
#include "parser.h"
+#include "usbhub.h"
// LUFA
#include "lufa.h"
#include "timer.h"
+#include "sendchar.h"
#include "debug.h"
#include "keyboard.h"
@@ -22,6 +24,15 @@
static USB usb_host;
static HIDBoot<HID_PROTOCOL_KEYBOARD> kbd(&usb_host);
static KBDReportParser kbd_parser;
+static USBHub hub1(&usb_host); // one hub is enough for HHKB pro2
+/* may be needed for other device with more hub
+static USBHub hub2(&usb_host);
+static USBHub hub3(&usb_host);
+static USBHub hub4(&usb_host);
+static USBHub hub5(&usb_host);
+static USBHub hub6(&usb_host);
+static USBHub hub7(&usb_host);
+*/
static void LUFA_setup(void)
{
@@ -39,6 +50,7 @@ static void LUFA_setup(void)
// for Console_Task
USB_Device_EnableSOFEvents();
+ print_set_sendchar(sendchar);
}
static void HID_setup()
@@ -60,9 +72,11 @@ int main(void)
LED_TX_ON;
debug_enable = true;
+/*
debug_matrix = true;
debug_keyboard = true;
debug_mouse = true;
+*/
host_set_driver(&lufa_driver);
keyboard_init();
diff --git a/converter/usb_usb/matrix.c b/converter/usb_usb/matrix.c
index 3cdb0860d5..83d5ab6c83 100644
--- a/converter/usb_usb/matrix.c
+++ b/converter/usb_usb/matrix.c
@@ -81,7 +81,7 @@ bool matrix_is_on(uint8_t row, uint8_t col) {
return true;
}
}
- for (uint8_t i = 0; i < REPORT_KEYS; i++) {
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (usb_hid_keyboard_report.keys[i] == code) {
return true;
}
@@ -96,7 +96,7 @@ uint8_t matrix_get_row(uint8_t row) {
row_bits |= usb_hid_keyboard_report.mods;
}
- for (uint8_t i = 0; i < REPORT_KEYS; i++) {
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
if (row == ROW(usb_hid_keyboard_report.keys[i])) {
row_bits |= ROW_BITS(usb_hid_keyboard_report.keys[i]);
@@ -110,7 +110,7 @@ uint8_t matrix_key_count(void) {
uint8_t count = 0;
count += bitpop(usb_hid_keyboard_report.mods);
- for (uint8_t i = 0; i < REPORT_KEYS; i++) {
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
count++;
}