From d7d20e2511f454fb9610cd49d35dd46ceef85536 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Tue, 20 Jun 2017 02:19:15 +0200 Subject: start working on usb-usb converter port --- keyboards/converter/usb_usb/Makefile | 3 + keyboards/converter/usb_usb/Makefile.8mhz | 5 + keyboards/converter/usb_usb/Makefile.debug | 6 + keyboards/converter/usb_usb/Makefile.unimap | 5 + keyboards/converter/usb_usb/README | 100 +++++++ keyboards/converter/usb_usb/config.h | 37 +++ keyboards/converter/usb_usb/keymap.c | 288 ++++++++++++++++++++ .../converter/usb_usb/keymaps/default/Makefile | 3 + .../converter/usb_usb/keymaps/default/config.h | 6 + .../converter/usb_usb/keymaps/default/keymap.c | 297 +++++++++++++++++++++ keyboards/converter/usb_usb/main.c | 102 +++++++ keyboards/converter/usb_usb/matrix.cpp | 234 ++++++++++++++++ keyboards/converter/usb_usb/rules.mk | 149 +++++++++++ keyboards/converter/usb_usb/unimap.c | 45 ++++ keyboards/converter/usb_usb/usb_usb.c | 1 + keyboards/converter/usb_usb/usb_usb.h | 200 ++++++++++++++ 16 files changed, 1481 insertions(+) create mode 100644 keyboards/converter/usb_usb/Makefile create mode 100644 keyboards/converter/usb_usb/Makefile.8mhz create mode 100644 keyboards/converter/usb_usb/Makefile.debug create mode 100644 keyboards/converter/usb_usb/Makefile.unimap create mode 100644 keyboards/converter/usb_usb/README create mode 100644 keyboards/converter/usb_usb/config.h create mode 100644 keyboards/converter/usb_usb/keymap.c create mode 100644 keyboards/converter/usb_usb/keymaps/default/Makefile create mode 100644 keyboards/converter/usb_usb/keymaps/default/config.h create mode 100644 keyboards/converter/usb_usb/keymaps/default/keymap.c create mode 100644 keyboards/converter/usb_usb/main.c create mode 100644 keyboards/converter/usb_usb/matrix.cpp create mode 100644 keyboards/converter/usb_usb/rules.mk create mode 100644 keyboards/converter/usb_usb/unimap.c create mode 100644 keyboards/converter/usb_usb/usb_usb.c create mode 100644 keyboards/converter/usb_usb/usb_usb.h (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/Makefile b/keyboards/converter/usb_usb/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/converter/usb_usb/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/converter/usb_usb/Makefile.8mhz b/keyboards/converter/usb_usb/Makefile.8mhz new file mode 100644 index 000000000..845a02be2 --- /dev/null +++ b/keyboards/converter/usb_usb/Makefile.8mhz @@ -0,0 +1,5 @@ +F_CPU = 8000000 +F_USB = 16000000 +UNIMAP_ENABLE = yes +KEYMAP_SECTION_ENABLE = yes +include Makefile diff --git a/keyboards/converter/usb_usb/Makefile.debug b/keyboards/converter/usb_usb/Makefile.debug new file mode 100644 index 000000000..e229cd780 --- /dev/null +++ b/keyboards/converter/usb_usb/Makefile.debug @@ -0,0 +1,6 @@ +TARGET = usb_usb_debug +UNIMAP_ENABLE = yes +#KEYMAP_SECTION_ENABLE = yes +#LUFA_DEBUG = yes +OPT_DEFS += -DDEBUG_USB_HOST +include Makefile diff --git a/keyboards/converter/usb_usb/Makefile.unimap b/keyboards/converter/usb_usb/Makefile.unimap new file mode 100644 index 000000000..cc383edaf --- /dev/null +++ b/keyboards/converter/usb_usb/Makefile.unimap @@ -0,0 +1,5 @@ +TARGET = usb_usb_unimap +UNIMAP_ENABLE = yes +KEYMAP_SECTION_ENABLE = yes +#LUFA_DEBUG = yes +include Makefile diff --git a/keyboards/converter/usb_usb/README b/keyboards/converter/usb_usb/README new file mode 100644 index 000000000..742ec3292 --- /dev/null +++ b/keyboards/converter/usb_usb/README @@ -0,0 +1,100 @@ +USB to USB keyboard protocol converter +====================================== +See for detail and discussion. +https://geekhack.org/index.php?topic=69169.0 + + +Hardware requirement +-------------------- +There are two options. + +### TMK USB-USB Converter +You can buy a fully assembled converter from me here. + + https://geekhack.org/index.php?topic=69169.0 + +### Arduino Leonardo + Circuit@Home USB Host Shield 2.0 +Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be better, you won't need even soldering iron. + + http://arduino.cc/en/Main/ArduinoBoardLeonardo + https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/ + +Other compatible boards like 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 +-------------- +Build. + + $ git clone git://github.com/tmk/tmk_keyboard.git + $ cd tmk_keyboard + $ git submodule init + $ git submodule update + $ cd converter/usb_usb + $ make + +And Program converter. Push button on TMK converter and just run this. + + $ make dfu + + +In case of Leonardo push reset button then run 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 + + + +Limitation +---------- +Only supports 'HID Boot protocol'. + +Note that the converter can host only USB "boot protocol" keyboard(6KRO), 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. + + + +Keymap editor +------------- +You can editor keymap and download firmware with web brwoser. + +- http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb + + + +Update +------ +2014/12/11 Added Hub support(confirmed with HHKB pro2) +2016/09/10 Unimap editor support +2016/10/18 Fix LED state at startup + + + +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/keyboards/converter/usb_usb/config.h b/keyboards/converter/usb_usb/config.h new file mode 100644 index 000000000..ff764ee4f --- /dev/null +++ b/keyboards/converter/usb_usb/config.h @@ -0,0 +1,37 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x005B +#define DEVICE_VER 0x0001 +#define MANUFACTURER QMK +#define PRODUCT QMK USB-USB Converter +#define DESCRIPTION USB to USB Keyboard Converter with QMK + + +/* matrix size */ +#define MATRIX_ROWS 16 +#define MATRIX_COLS 16 + +/* key combination for command */ +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) + +#endif diff --git a/keyboards/converter/usb_usb/keymap.c b/keyboards/converter/usb_usb/keymap.c new file mode 100644 index 000000000..16f2a2809 --- /dev/null +++ b/keyboards/converter/usb_usb/keymap.c @@ -0,0 +1,288 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ + +#include "keymap_common.h" + + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* 0: plain Qwerty without layer switching + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + // KEYMAP_ALL( + // F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + // ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + // GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + // TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + // CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + // LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + // LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + // ), + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + KEYMAP_ALL( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, + GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + CAPS,MPRV,VOLU,MNXT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,MUTE,VOLD,MPLY,TRNS,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ), +}; + +// const action_t fn_actions[] PROGMEM = {}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), +}; + + + +/* + * Keymap samples + */ +#if 0 + /* ANSI layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |-----------| | + * |CapsL | 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| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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, 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, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), + + /* ISO layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_ISO( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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,ENT, DEL, END, PGDN, P7, P8, P9, PPLS, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* JIS layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| @| [| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| ]| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_JIS( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JPY, 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,NUHS, P4, P5, P6, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* Colemak http://colemak.com + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \| + * |-----------------------------------------------------------| + * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| + * |-----------------------------------------------------------| + * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \| + * |-----------------------------------------------------------| + * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return | + * |-----------------------------------------------------------| + * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, O, E, U, I, D, H, T, N, S, MINS, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,SCLN,Q, J, K, X, B, M, W, V, Z, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \| + * |-----------------------------------------------------------| + * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, S, H, T, G, Y, N, E, O, I, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + +/* + * SpaceFN layout + * http://geekhack.org/index.php?topic=51069.0 + */ +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: plain Qwerty + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |LCtrl | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + [0] = KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, FN0, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* 1: SpaceFN + * ,-----------------------------------------------------------. + * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | + * |-----------------------------------------------------------| + * |Caps | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | + * |-----------------------------------------------------------| + * | | | | | | |PgU|Lef|Dow|Rig| | | | + * |-----------------------------------------------------------| + * | | | | | |Spc|PgD|` |~ | |Men| | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + */ + [1] = KEYMAP_ALL( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ), +}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), + [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde +}; + +#endif diff --git a/keyboards/converter/usb_usb/keymaps/default/Makefile b/keyboards/converter/usb_usb/keymaps/default/Makefile new file mode 100644 index 000000000..05c674ae1 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/default/Makefile @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/converter/usb_usb/keymaps/default/config.h b/keyboards/converter/usb_usb/keymaps/default/config.h new file mode 100644 index 000000000..7fa3bf328 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/default/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/converter/usb_usb/keymaps/default/keymap.c b/keyboards/converter/usb_usb/keymaps/default/keymap.c new file mode 100644 index 000000000..fbbbd1cfa --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/default/keymap.c @@ -0,0 +1,297 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ + +#include +#include +#include "keycode.h" +#include "print.h" +#include "debug.h" +//#include "action.h" +//#include "action_macro.h" +//#include "report.h" + +#include "usb_usb.h" + + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* 0: plain Qwerty without layer switching + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + // KEYMAP_ALL( + // F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + // ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + // GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + // TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + // CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + // LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + // LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + // ), + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + KEYMAP_ALL( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, + GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + CAPS,MPRV,VOLU,MNXT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,MUTE,VOLD,MPLY,TRNS,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ), +}; + +// const action_t fn_actions[] PROGMEM = {}; + +// const action_t PROGMEM fn_actions[] = { +// [0] = ACTION_LAYER_MOMENTARY(1), +// }; + + + +/* + * Keymap samples + */ +#if 0 + /* ANSI layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |-----------| | + * |CapsL | 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| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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, 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, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), + + /* ISO layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_ISO( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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,ENT, DEL, END, PGDN, P7, P8, P9, PPLS, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* JIS layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| @| [| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| ]| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_JIS( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JPY, 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,NUHS, P4, P5, P6, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* Colemak http://colemak.com + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \| + * |-----------------------------------------------------------| + * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| + * |-----------------------------------------------------------| + * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \| + * |-----------------------------------------------------------| + * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return | + * |-----------------------------------------------------------| + * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, O, E, U, I, D, H, T, N, S, MINS, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,SCLN,Q, J, K, X, B, M, W, V, Z, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \| + * |-----------------------------------------------------------| + * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, S, H, T, G, Y, N, E, O, I, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + +/* + * SpaceFN layout + * http://geekhack.org/index.php?topic=51069.0 + */ +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: plain Qwerty + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |LCtrl | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + [0] = KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, FN0, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* 1: SpaceFN + * ,-----------------------------------------------------------. + * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | + * |-----------------------------------------------------------| + * |Caps | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | + * |-----------------------------------------------------------| + * | | | | | | |PgU|Lef|Dow|Rig| | | | + * |-----------------------------------------------------------| + * | | | | | |Spc|PgD|` |~ | |Men| | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + */ + [1] = KEYMAP_ALL( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ), +}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), + [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde +}; + +#endif diff --git a/keyboards/converter/usb_usb/main.c b/keyboards/converter/usb_usb/main.c new file mode 100644 index 000000000..76e88922c --- /dev/null +++ b/keyboards/converter/usb_usb/main.c @@ -0,0 +1,102 @@ +#include +#include +#include +#include + +// LUFA +#include "lufa.h" + +#include "sendchar.h" +#include "debug.h" +#include "keyboard.h" +#include "led.h" + + +/* LED ping configuration */ +#define TMK_LED +//#define LEONARDO_LED +#if defined(TMK_LED) +// For TMK converter and Teensy +#define LED_TX_INIT (DDRD |= (1<<6)) +#define LED_TX_ON (PORTD |= (1<<6)) +#define LED_TX_OFF (PORTD &= ~(1<<6)) +#define LED_TX_TOGGLE (PORTD ^= (1<<6)) +#elif defined(LEONARDO_LED) +// For Leonardo(TX LED) +#define LED_TX_INIT (DDRD |= (1<<5)) +#define LED_TX_ON (PORTD &= ~(1<<5)) +#define LED_TX_OFF (PORTD |= (1<<5)) +#define LED_TX_TOGGLE (PORTD ^= (1<<5)) +#else +#define LED_TX_INIT +#define LED_TX_ON +#define LED_TX_OFF +#define LED_TX_TOGGLE +#endif + + +static void LUFA_setup(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ +#if (F_CPU == 8000000) + clock_prescale_set(clock_div_2); // 16MHz crystal divided by 2 +#else + clock_prescale_set(clock_div_1); +#endif + + // Leonardo needs. Without this USB device is not recognized. + USB_Disable(); + + USB_Init(); + + // for Console_Task + USB_Device_EnableSOFEvents(); + print_set_sendchar(sendchar); +} + + + +int main(void) +{ + // LED for debug + LED_TX_INIT; + LED_TX_ON; + + debug_enable = true; + debug_keyboard = true; + + host_set_driver(&lufa_driver); + keyboard_init(); + + LUFA_setup(); + + /* NOTE: Don't insert time consuming job here. + * It'll cause unclear initialization failure when DFU reset(worm start). + */ + sei(); + +/* Some keyboards bootup quickly and cannot be initialized with this startup wait. + // wait for startup of sendchar routine + while (USB_DeviceState != DEVICE_STATE_Configured) ; + if (debug_enable) { + _delay_ms(1000); + } +*/ + + debug("init: done\n"); + + for (;;) { + keyboard_task(); + +#if !defined(INTERRUPT_CONTROL_ENDPOINT) + // LUFA Task for control request + USB_USBTask(); +#endif + } + + return 0; +} diff --git a/keyboards/converter/usb_usb/matrix.cpp b/keyboards/converter/usb_usb/matrix.cpp new file mode 100644 index 000000000..88517afc9 --- /dev/null +++ b/keyboards/converter/usb_usb/matrix.cpp @@ -0,0 +1,234 @@ +/* +Copyright 2016 Jun Wako + +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 . +*/ + +#include +#include + +// USB HID host +#include "Usb.h" +#include "usbhub.h" +#include "hid.h" +#include "hidboot.h" +#include "parser.h" + +#include "keycode.h" +#include "util.h" +#include "print.h" +#include "debug.h" +#include "timer.h" +#include "matrix.h" +#include "led.h" +#include "host.h" +#include "keyboard.h" + + +/* KEY CODE to Matrix + * + * HID keycode(1 byte): + * Higher 5 bits indicates ROW and lower 3 bits COL. + * + * 7 6 5 4 3 2 1 0 + * +---------------+ + * | ROW | COL | + * +---------------+ + * + * Matrix space(16 * 16): + * r\c0123456789ABCDEF + * 0 +----------------+ + * : | | + * : | | + * 16 +----------------+ + */ +#define ROW_MASK 0xF0 +#define COL_MASK 0x0F +#define CODE(row, col) (((row) << 4) | (col)) +#define ROW(code) (((code) & ROW_MASK) >> 4) +#define COL(code) ((code) & COL_MASK) +#define ROW_BITS(code) (1 << COL(code)) + + +// Integrated key state of all keyboards +static report_keyboard_t keyboard_report; + +static bool matrix_is_mod = false; + +/* + * USB Host Shield HID keyboards + * This supports two cascaded hubs and four keyboards + */ +USB usb_host; +USBHub hub1(&usb_host); +USBHub hub2(&usb_host); +HIDBoot kbd1(&usb_host); +HIDBoot kbd2(&usb_host); +HIDBoot kbd3(&usb_host); +HIDBoot kbd4(&usb_host); +KBDReportParser kbd_parser1; +KBDReportParser kbd_parser2; +KBDReportParser kbd_parser3; +KBDReportParser kbd_parser4; + + +uint8_t matrix_rows(void) { return MATRIX_ROWS; } +uint8_t matrix_cols(void) { return MATRIX_COLS; } +bool matrix_has_ghost(void) { return false; } +void matrix_init(void) { + // USB Host Shield setup + usb_host.Init(); + kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1); + kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2); + kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3); + kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4); +} + +static void or_report(report_keyboard_t report) { + // integrate reports into keyboard_report + keyboard_report.mods |= report.mods; + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(report.keys[i])) { + for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { + if (! keyboard_report.keys[j]) { + keyboard_report.keys[j] = report.keys[i]; + break; + } + } + } + } +} + +uint8_t matrix_scan(void) { + static uint16_t last_time_stamp1 = 0; + static uint16_t last_time_stamp2 = 0; + static uint16_t last_time_stamp3 = 0; + static uint16_t last_time_stamp4 = 0; + + // check report came from keyboards + if (kbd_parser1.time_stamp != last_time_stamp1 || + kbd_parser2.time_stamp != last_time_stamp2 || + kbd_parser3.time_stamp != last_time_stamp3 || + kbd_parser4.time_stamp != last_time_stamp4) { + + last_time_stamp1 = kbd_parser1.time_stamp; + last_time_stamp2 = kbd_parser2.time_stamp; + last_time_stamp3 = kbd_parser3.time_stamp; + last_time_stamp4 = kbd_parser4.time_stamp; + + // clear and integrate all reports + keyboard_report = {}; + or_report(kbd_parser1.report); + or_report(kbd_parser2.report); + or_report(kbd_parser3.report); + or_report(kbd_parser4.report); + + matrix_is_mod = true; + + dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + dprintf(" %02X", keyboard_report.keys[i]); + } + dprint("\r\n"); + } else { + matrix_is_mod = false; + } + + uint16_t timer; + timer = timer_read(); + usb_host.Task(); + timer = timer_elapsed(timer); + if (timer > 100) { + dprintf("host.Task: %d\n", timer); + } + + static uint8_t usb_state = 0; + if (usb_state != usb_host.getUsbTaskState()) { + usb_state = usb_host.getUsbTaskState(); + dprintf("usb_state: %02X\n", usb_state); + + // restore LED state when keyboard comes up + if (usb_state == USB_STATE_RUNNING) { + dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); + keyboard_set_leds(host_keyboard_leds()); + } + } + return 1; +} + +bool matrix_is_modified(void) { + return matrix_is_mod; +} + +bool matrix_is_on(uint8_t row, uint8_t col) { + uint8_t code = CODE(row, col); + + if (IS_MOD(code)) { + if (keyboard_report.mods & ROW_BITS(code)) { + return true; + } + } + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (keyboard_report.keys[i] == code) { + return true; + } + } + return false; +} + +matrix_row_t matrix_get_row(uint8_t row) { + uint16_t row_bits = 0; + + if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { + row_bits |= keyboard_report.mods; + } + + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + if (row == ROW(keyboard_report.keys[i])) { + row_bits |= ROW_BITS(keyboard_report.keys[i]); + } + } + } + return row_bits; +} + +uint8_t matrix_key_count(void) { + uint8_t count = 0; + + count += bitpop(keyboard_report.mods); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + count++; + } + } + return count; +} + +void matrix_print(void) { + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < matrix_rows(); row++) { + xprintf("%02d: ", row); + print_bin_reverse16(matrix_get_row(row)); + print("\n"); + } +} + +void led_set(uint8_t usb_led) +{ + kbd1.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); +} diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk new file mode 100644 index 000000000..2d1f284b9 --- /dev/null +++ b/keyboards/converter/usb_usb/rules.mk @@ -0,0 +1,149 @@ +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device. +# Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +# (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# Target file name (without extension). +TARGET ?= usb_usb + +TMK_DIR ?= ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR ?= . + +# MCU name +MCU ?= atmega32u4 + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU ?= 8000000 + + + +# +# 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 +EXTRAKEY_ENABLE ?= yes # Media control and System control +CONSOLE_ENABLE ?= yes # Console for debug +#COMMAND_ENABLE ?= yes # Commands for debug and configuration +#NKRO_ENABLE ?= yes # USB Nkey Rollover + +# Boot Section Size in bytes +# Teensy halfKay 512 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +#LDFLAGS += -Wl,--relax + +#OPT_DEFS += -DNO_ACTION_TAPPING +#OPT_DEFS += -DNO_ACTION_LAYER +#OPT_DEFS += -DNO_ACTION_MACRO + +SRC = matrix.cpp + +# +# Keymap file +# +# ifeq (yes,$(strip $(UNIMAP_ENABLE))) +# KEYMAP_FILE = unimap +# else +# ifeq (yes,$(strip $(ACTIONMAP_ENABLE))) +# KEYMAP_FILE = actionmap +# else +# KEYMAP_FILE = keymap +# endif +# endif +# ifdef KEYMAP +# SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) +# else +# SRC := $(KEYMAP_FILE).c $(SRC) +# endif + +# CONFIG_H ?= config.h + + + +# Search Path +# VPATH += $(TARGET_DIR) +# VPATH += $(TMK_DIR) + + + +# program Leonardo +# PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV) + + + +include $(TMK_DIR)/protocol/usb_hid.mk +include $(TMK_DIR)/protocol/lufa.mk +# include $(TMK_DIR)/common.mk +# include $(TMK_DIR)/rules.mk diff --git a/keyboards/converter/usb_usb/unimap.c b/keyboards/converter/usb_usb/unimap.c new file mode 100644 index 000000000..0f34ece85 --- /dev/null +++ b/keyboards/converter/usb_usb/unimap.c @@ -0,0 +1,45 @@ +/* +Copyright 2016 Jun Wako + +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 . +*/ +#include "unimap_trans.h" + + +#define AC_FN0 ACTION_LAYER_MOMENTARY(1) + +#ifdef KEYMAP_SECTION_ENABLE +const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = { +#else +const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { +#endif + UNIMAP( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,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, PPLS, + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,FN0, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PEQL + ), + UNIMAP( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, INS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN, TRNS,TRNS, PGUP, TRNS,TRNS,TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS + ), +}; diff --git a/keyboards/converter/usb_usb/usb_usb.c b/keyboards/converter/usb_usb/usb_usb.c new file mode 100644 index 000000000..e7657938d --- /dev/null +++ b/keyboards/converter/usb_usb/usb_usb.c @@ -0,0 +1 @@ +#include "usb_usb.h" \ No newline at end of file diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h new file mode 100644 index 000000000..7f257ca49 --- /dev/null +++ b/keyboards/converter/usb_usb/usb_usb.h @@ -0,0 +1,200 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ +#ifndef USB_USB_H +#define USB_USB_H + +#include "quantum.h" + +/* ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + * + * + * App: Windows Menu key + * Gui: Windows key, Mac ⌘ key or Meta key + * + * Pwr: Power for Unix and Mac + * VDn,Vup,Mut: Volume control for Unix and Mac + * Stp,Agn..: for Unix + * + * KP,: Brazilian Keypad Comma + * KP=: Keypad = for Mac + * <,#: ISO keys(UK legend) + * JPY: Japanese Yen(¥) + * RO: Japanese ろ or Brazilian / + * MHEN: Japanese 無変換 Non Conversion + * HENK: Japanese 変換 Conversion + * KANA: Japanese かな Hiragana/Katakana + * https://en.wikipedia.org/wiki/Keyboard_layout#Japanese + * H/E: Korean 한/영 Hangul/English + * HNJ: Korean 한자 Hanja + * https://en.wikipedia.org/wiki/Keyboard_layout#Hangul_.28for_Korean.29 + * + * TODO: use same keycode to pass through instead of KC_NO? + */ +#define KEYMAP_ALL( \ + K68,K69,K6A,K6B,K6C,K6D,K6E,K6F,K70,K71,K72,K73, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, K81,K80,K7F,K66, K75, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, K78,K79, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, K76,K7A, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,K85, K77,K7C, \ + KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K67, K74,K7D, \ + KE0,KE3,KE2,K8B,K91, K2C, K90,K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, K7E,K7B \ +) { \ + { 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_##K32, 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_##K64, KC_##K65, KC_##K66, KC_##K67, /* 60-67 */ \ + KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, /* 68-6F */ \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, /* 70-77 */ \ + KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_##K7F }, /* 78-7F */ \ + { KC_##K80, KC_##K81, KC_NO, KC_NO, KC_NO, KC_##K85, KC_NO, KC_##K87, /* 80-87 */ \ + KC_##K88, KC_##K89, KC_##K8A, KC_##K8B, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ + { KC_##K90, KC_##K91, 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 */ \ +} + +/* ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |-----------| | + * |CapsL | 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| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ +#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 \ +) KEYMAP_ALL( \ + NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, NO, K28, K5C,K5D,K5E,NO, NO, NO, \ + KE1,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, NO, KE5, K52, K59,K5A,K5B,NO, NO, NO, \ + KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, NO \ +) + +/* ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ +#define KEYMAP_ISO( \ + 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,K28, K4C,K4D,K4E, K5F,K60,K61,K57, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K32, K5C,K5D,K5E, \ + KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B,K58, \ + KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ +) KEYMAP_ALL( \ + NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,NO, NO, NO, \ + KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, NO, KE5, K52, K59,K5A,K5B,NO, NO, NO, \ + KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, NO \ +) + +/* ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| @| [| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| ]| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ +#define KEYMAP_JIS( \ + 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,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K28, K4C,K4D,K4E, K5F,K60,K61,K57, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K32, K5C,K5D,K5E, \ + KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K58, \ + KE0,KE3,KE2,K8B, K2C, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ +) KEYMAP_ALL( \ + NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,NO, NO, NO, \ + KE1,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,NO, NO, NO, \ + KE0,KE3,KE2,K8B,NO, K2C, NO, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, NO \ +) +#endif -- cgit v1.2.3 From f4cdc9117c7090134df0ab301050593134db8520 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Tue, 20 Jun 2017 03:14:30 +0200 Subject: small changes following Jack's advice. --- keyboards/converter/usb_usb/rules.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index 2d1f284b9..138eee94c 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk @@ -39,7 +39,7 @@ #---------------------------------------------------------------------------- # Target file name (without extension). -TARGET ?= usb_usb +# TARGET ?= usb_usb TMK_DIR ?= ../../tmk_core @@ -108,6 +108,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 #OPT_DEFS += -DNO_ACTION_LAYER #OPT_DEFS += -DNO_ACTION_MACRO +CUSTOM_MATRIX=yes + SRC = matrix.cpp # @@ -143,7 +145,7 @@ SRC = matrix.cpp -include $(TMK_DIR)/protocol/usb_hid.mk -include $(TMK_DIR)/protocol/lufa.mk +# include $(TMK_DIR)/protocol/usb_hid.mk +# include $(TMK_DIR)/protocol/lufa.mk # include $(TMK_DIR)/common.mk # include $(TMK_DIR)/rules.mk -- cgit v1.2.3 From 42f895a4bc232515d95d1fb93396ecd2c0032c0e Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Tue, 20 Jun 2017 03:28:40 +0200 Subject: remove unused variables from makefile --- keyboards/converter/usb_usb/rules.mk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index 138eee94c..2ae908fec 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk @@ -41,10 +41,10 @@ # Target file name (without extension). # TARGET ?= usb_usb -TMK_DIR ?= ../../tmk_core +# TMK_DIR ?= ../../tmk_core # Directory keyboard dependent files exist -TARGET_DIR ?= . +# TARGET_DIR ?= . # MCU name MCU ?= atmega32u4 @@ -92,7 +92,8 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # #MOUSEKEY_ENABLE ?= yes # Mouse keys EXTRAKEY_ENABLE ?= yes # Media control and System control -CONSOLE_ENABLE ?= yes # Console for debug +# CONSOLE_ENABLE ?= yes # Console for debug +CONSOLE_ENABLE ?= no # Console for debug #COMMAND_ENABLE ?= yes # Commands for debug and configuration #NKRO_ENABLE ?= yes # USB Nkey Rollover @@ -108,7 +109,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 #OPT_DEFS += -DNO_ACTION_LAYER #OPT_DEFS += -DNO_ACTION_MACRO -CUSTOM_MATRIX=yes +CUSTOM_MATRIX = yes SRC = matrix.cpp -- cgit v1.2.3 From 2aa5e4464010a9292b50571243d8ef6e749a5ca4 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Sat, 12 Aug 2017 18:24:15 +0200 Subject: some major steps toward making the usb-usb converter work --- keyboards/converter/usb_usb/config.h | 2 + .../converter/usb_usb/keymaps/default/keymap.c | 2 +- keyboards/converter/usb_usb/rules.mk | 2 +- tmk_core/common/keycode.h | 8 + .../protocol/usb_hid/USB_Host_Shield_2.0/README.md | 351 +++++++++++++++++++++ .../examples/testusbhostFAT/README.md | 29 ++ .../examples/testusbhostFAT/readme.md | 29 -- .../protocol/usb_hid/USB_Host_Shield_2.0/readme.md | 351 --------------------- tmk_core/protocol/usb_hid/parser.cpp | 24 +- tmk_core/protocol/usb_hid/parser.h | 5 +- tmk_core/protocol/usb_hid/test/Makefile | 40 ++- 11 files changed, 439 insertions(+), 404 deletions(-) create mode 100644 tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md create mode 100644 tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md delete mode 100644 tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md delete mode 100644 tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/config.h b/keyboards/converter/usb_usb/config.h index ff764ee4f..fa059feea 100644 --- a/keyboards/converter/usb_usb/config.h +++ b/keyboards/converter/usb_usb/config.h @@ -31,6 +31,8 @@ along with this program. If not, see . #define MATRIX_ROWS 16 #define MATRIX_COLS 16 +#define DIODE_DIRECTION CUSTOM_MATRIX + /* key combination for command */ #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) diff --git a/keyboards/converter/usb_usb/keymaps/default/keymap.c b/keyboards/converter/usb_usb/keymaps/default/keymap.c index fbbbd1cfa..050332384 100644 --- a/keyboards/converter/usb_usb/keymaps/default/keymap.c +++ b/keyboards/converter/usb_usb/keymaps/default/keymap.c @@ -27,7 +27,7 @@ along with this program. If not, see . #include "usb_usb.h" -const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { +const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { /* 0: plain Qwerty without layer switching * ,---------------. ,---------------. ,---------------. * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index 2ae908fec..f6b816966 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk @@ -146,7 +146,7 @@ SRC = matrix.cpp -# include $(TMK_DIR)/protocol/usb_hid.mk +include $(TMK_DIR)/protocol/usb_hid.mk # include $(TMK_DIR)/protocol/lufa.mk # include $(TMK_DIR)/common.mk # include $(TMK_DIR)/rules.mk diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 54e9c322c..a1e0bc9a4 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -94,6 +94,9 @@ along with this program. If not, see . #define KC_JYEN KC_INT3 #define KC_HENK KC_INT4 #define KC_MHEN KC_INT5 +/* Korean specific */ +#define KC_HAEN KC_LANG1 +#define KC_HANJ KC_LANG2 /* Keypad */ #define KC_P1 KC_KP_1 #define KC_P2 KC_KP_2 @@ -113,6 +116,11 @@ along with this program. If not, see . #define KC_PPLS KC_KP_PLUS #define KC_PEQL KC_KP_EQUAL #define KC_PENT KC_KP_ENTER +/* Unix function key */ +#define KC_EXEC KC_EXECUTE +#define KC_SLCT KC_SELECT +#define KC_AGIN KC_AGAIN +#define KC_PSTE KC_PASTE /* Mousekey */ #define KC_MS_U KC_MS_UP #define KC_MS_D KC_MS_DOWN diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md new file mode 100644 index 000000000..49cd83e0a --- /dev/null +++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md @@ -0,0 +1,351 @@ +# USB Host Library Rev.2.0 + +The code is released under the GNU General Public License. +__________ + +# Summary +This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's. + +Project main web site is: . + +Some information can also be found at: . + +The shield can be purchased at the main site: or from [TKJ Electronics](http://tkjelectronics.com/): . + +![USB Host Shield](http://shop.tkjelectronics.dk/images/USB_Host_Shield1.jpg) + +For more information about the hardware see the [Hardware Manual](http://www.circuitsathome.com/usb-host-shield-hardware-manual). + +# Developed By + +* __Oleg Mazurov, Circuits@Home__ - +* __Alexei Glushchenko, Circuits@Home__ - + * Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries +* __Kristian Lauszus, TKJ Electronics__ - + * Developer of the [BTD](#bluetooth-libraries), [BTHID](#bthid-library), [SPP](#spp-library), [PS4](#ps4-library), [PS3](#ps3-library), [Wii](#wii-library), [Xbox](#xbox-library), and [PSBuzz](#ps-buzz-library) libraries +* __Andrew Kroll__ - + * Major contributor to mass storage code +* __guruthree__ + * [Xbox ONE](#xbox-one-library) controller support + +# Donate + +Help yourself by helping us support you! Many thousands of hours have been spent developing the USB Host Shield library. Since you find it useful, please consider donating via the button below. Donations will allow us to support you by ensuring hardware that you have can be acquired in order to add support for your microcontroller board. + +PayPal - The safer, easier way to pay online! + +# Table of Contents + +* [How to include the library](#how-to-include-the-library) + * [Arduino Library Manager](#arduino-library-manager) + * [Manual installation](#manual-installation) +* [How to use the library](#how-to-use-the-library) + * [Documentation](#documentation) + * [Enable debugging](#enable-debugging) + * [Boards](#boards) + * [Bluetooth libraries](#bluetooth-libraries) + * [BTHID library](#bthid-library) + * [SPP library](#spp-library) + * [PS4 Library](#ps4-library) + * [PS3 Library](#ps3-library) + * [Xbox Libraries](#xbox-libraries) + * [Xbox library](#xbox-library) + * [Xbox 360 Library](#xbox-360-library) + * [Xbox ONE Library](#xbox-one-library) + * [Wii library](#wii-library) + * [PS Buzz Library](#ps-buzz-library) +* [Interface modifications](#interface-modifications) +* [FAQ](#faq) + +# How to include the library + +### Arduino Library Manager + +First install Arduino IDE version 1.6.2 or newer, then simply use the Arduino Library Manager to install the library. + +Please see the following page for instructions: . + +### Manual installation + +First download the library by clicking on the following link: . + +Then uncompress the zip folder and rename the directory to "USB\_Host\_Shield\_20", as any special characters are not supported by the Arduino IDE. + +Now open up the Arduino IDE and open "File>Preferences". There you will see the location of your sketchbook. Open that directory and create a directory called "libraries" inside that directory. +Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory. + +The final structure should look like this: + +* Arduino/ + * libraries/ + * USB\_Host\_Shield\_20/ + +Now quit the Arduino IDE and reopen it. + +Now you should be able to go open all the examples codes by navigating to "File>Examples>USB\_Host\_Shield\_20" and then select the example you will like to open. + +For more information visit the following sites: and . + +# How to use the library + +### Documentation + +Documentation for the library can be found at the following link: . + +### Enable debugging + +By default serial debugging is disabled. To turn it on simply change ```ENABLE_UHS_DEBUGGING``` to 1 in [settings.h](settings.h) like so: + +```C++ +#define ENABLE_UHS_DEBUGGING 1 +``` + +### Boards + +Currently the following boards are supported by the library: + +* All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.) +* Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison + * Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information. +* Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, and Teensy 3.x) + * Note if you are using the Teensy 3.x you should download this SPI library as well: . You should then add ```#include ``` to your .ino file. +* Balanduino +* Sanguino +* Black Widdow +* RedBearLab nRF51822 +* Digilent chipKIT + * Please see: . + +The following boards need to be activated manually in [settings.h](settings.h): + +* Arduino Mega ADK + * If you are using Arduino 1.5.5 or newer there is no need to activate the Arduino Mega ADK manually +* Black Widdow + +Simply set the corresponding value to 1 instead of 0. + +### [Bluetooth libraries](BTD.cpp) + +The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle. +This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth. +Some different examples can be found in the [example directory](examples/Bluetooth). + +The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this: +[PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino). + +### [BTHID library](BTHID.cpp) + +The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Bluetooth to the USB Host Shield. + +Currently HID mice and keyboards are supported. + +It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: [BTHID.ino](examples/Bluetooth/BTHID/BTHID.ino) for more information. + +The [PS4 library](#ps4-library) also uses this class to handle all Bluetooth communication. + +For information see the following blog post: . + +### [SPP library](SPP.cpp) + +SPP stands for "Serial Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth. +It has been tested successfully on Windows, Mac OS X, Linux, and Android. + +Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information. + +More information can be found at these blog posts: + +* +* + +To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple. +It enables me to see the Bluetooth communication between my Mac and any device. + +### PS4 Library + +The PS4BT library is split up into the [PS4BT](PS4BT.h) and the [PS4USB](PS4USB.h) library. These allow you to use the Sony PS4 controller via Bluetooth and USB. + +The [PS4BT.ino](examples/Bluetooth/PS4BT/PS4BT.ino) and [PS4USB.ino](examples/PS4USB/PS4USB.ino) examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. It is also possible to control the rumble and light on the controller and get the battery level. + +Before you can use the PS4 controller via Bluetooth you will need to pair with it. + +Simply create the PS4BT instance like so: ```PS4BT PS4(&Btd, PAIR);``` and then hold down the Share button and then hold down the PS without releasing the Share button. The PS4 controller will then start to blink rapidly indicating that it is in paring mode. + +It should then automatically pair the dongle with your controller. This only have to be done once. + +For information see the following blog post: . + +Also check out this excellent Wiki by Frank Zhao about the PS4 controller: and this Linux driver: . + +### PS3 Library + +These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB. + +In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by first plugging in the Bluetooth dongle and wait a few seconds. Now plug in the controller via USB and wait until the LEDs start to flash. The library has now written the Bluetooth address of the dongle to the PS3 controller. + +Finally simply plug in the Bluetooth dongle again and press PS on the PS3 controller. After a few seconds it should be connected to the dongle and ready to use. + +__Note:__ You will have to plug in the Bluetooth dongle before connecting the controller, as the library needs to read the address of the dongle. Alternatively you could set it in code like so: [PS3BT.ino#L20](examples/Bluetooth/PS3BT/PS3BT.ino#L20). + +For more information about the PS3 protocol see the official wiki: . + +Also take a look at the blog posts: + +* +* +* + +A special thanks go to the following people: + +1. _Richard Ibbotson_ who made this excellent guide: +2. _Tomoyuki Tanaka_ for releasing his code for the Arduino USB Host shield connected to the wiimote: + +Also a big thanks all the people behind these sites about the Motion controller: + +* +* +* +* + +### Xbox Libraries + +The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly. + +#### Xbox library + +The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB. + +All the information are from the following sites: + +* +* +* +* + +#### Xbox 360 Library + +The library support one Xbox 360 via USB or up to four Xbox 360 controllers wirelessly by using a [Xbox 360 wireless receiver](http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg). + +To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library. + +__Note that a Wireless controller can NOT be used via USB!__ + +Examples code can be found in the [examples directory](examples/Xbox). + +Also see the following blog posts: + +* +* +* + +All the information regarding the Xbox 360 controller protocol are form these sites: + +* +* +* + +#### Xbox ONE Library + +An Xbox ONE controller is supported via USB in the [XBOXONE](XBOXONE.cpp) class. It is heavily based on the 360 library above. In addition to cross referencing the above, information on the protocol was found at: + +* +* +* + +### [Wii library](Wii.cpp) + +The [Wii](Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller and Wii Balance Board are also supported via Bluetooth. + +First you have to pair with the controller, this is done automatically by the library if you create the instance like so: + +```C++ +WII Wii(&Btd, PAIR); +``` + +And then press 1 & 2 at once on the Wiimote or the SYNC buttons if you are using a Wii U Pro Controller or a Wii Balance Board. + +After that you can simply create the instance like so: + +```C++ +WII Wii(&Btd); +``` + +Then just press any button on the Wiimote and it will then connect to the dongle. + +Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino). + +Also take a look at the blog post: + +* + +The Wii IR camera can also be used, but you will have to activate the code for it manually as it is quite large. Simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h). + +The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used. + +All the information about the Wii controllers are from these sites: + +* +* +* +* +* +* The old library created by _Tomoyuki Tanaka_: also helped a lot. + +### [PS Buzz Library](PSBuzz.cpp) + +This library implements support for the Playstation Buzz controllers via USB. + +It is essentially just a wrapper around the [HIDUniversal](hiduniversal.cpp) which takes care of the initializing and reading of the controllers. The [PSBuzz](PSBuzz.cpp) class simply inherits this and parses the data, so it is easy for users to read the buttons and turn the big red button on the controllers on and off. + +The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code. + +More information about the controller can be found at the following sites: + +* http://www.developerfusion.com/article/84338/making-usb-c-friendly/ +* https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c + +# Interface modifications + +The shield is using SPI for communicating with the MAX3421E USB host controller. It uses the SCK, MISO and MOSI pins via the ICSP on your board. + +Note this means that it uses pin 13, 12, 11 on an Arduino Uno, so these pins can not be used for anything else than SPI communication! + +Furthermore it uses one pin as SS and one INT pin. These are by default located on pin 10 and 9 respectively. They can easily be reconfigured in case you need to use them for something else by cutting the jumper on the shield and then solder a wire from the pad to the new pin. + +After that you need modify the following entry in [UsbCore.h](UsbCore.h): + +```C++ +typedef MAX3421e MAX3421E; +``` + +For instance if you have rerouted SS to pin 7 it should read: + +```C++ +typedef MAX3421e MAX3421E; +``` + +See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information. + +# FAQ + +> When I plug my device into the USB connector nothing happens? + +* Try to connect a external power supply to the Arduino - this solves the problem in most cases. +* You can also use a powered hub between the device and the USB Host Shield. You should then include the USB hub library: ```#include ``` and create the instance like so: ```USBHub Hub1(&Usb);```. + +> When I connecting my PS3 controller I get a output like this: + +``` +Dualshock 3 Controller Enabled + +LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 +LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 +LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 +LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 +LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 +``` + +* This means that your dongle does not support 2.0+EDR, so you will need another dongle. Please see the following [list](https://github.com/felis/USB_Host_Shield_2.0/wiki/Bluetooth-dongles) for tested working dongles. + +> When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory". + +* Please make sure to include the SPI library like so: ```#include ``` in your .ino file. diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md new file mode 100644 index 000000000..d8b4296b1 --- /dev/null +++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md @@ -0,0 +1,29 @@ +This small sketch tests the USB host shield mass storage library. + +__Note:__ This will not run a Arduino Uno due to the limited ram available in the ATmega328p. + +The Arduino Mega (ATmega1280) and the Arduino Mega 2560 (ATmega2560) are confirmed to work with this test code. + +To compile this example you will need the following libraries as well: + +* [xmem2](https://github.com/xxxajk/xmem2) +* [generic_storage FATfs](https://github.com/xxxajk/generic_storage) +* [RTClib](https://github.com/xxxajk/RTClib) + +The following shield is recommended for larger projects: . + +You may use the bundled [Makefile](Makefile) to compile the code instead of the Arduino IDE if you have problems or want a smaller binary. The master makefile is bundled as a submodule, but can also be downloaded manually at the following link: . + +To download the USB Host library and all the needed libraries for this test. + +Run the following command in a terminal application: + +``` +git clone --recursive https://github.com/felis/USB_Host_Shield_2.0 +``` + +If you want to update all the submodules run: + +``` +git submodule foreach --recursive git pull origin master +``` diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md deleted file mode 100644 index d8b4296b1..000000000 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -This small sketch tests the USB host shield mass storage library. - -__Note:__ This will not run a Arduino Uno due to the limited ram available in the ATmega328p. - -The Arduino Mega (ATmega1280) and the Arduino Mega 2560 (ATmega2560) are confirmed to work with this test code. - -To compile this example you will need the following libraries as well: - -* [xmem2](https://github.com/xxxajk/xmem2) -* [generic_storage FATfs](https://github.com/xxxajk/generic_storage) -* [RTClib](https://github.com/xxxajk/RTClib) - -The following shield is recommended for larger projects: . - -You may use the bundled [Makefile](Makefile) to compile the code instead of the Arduino IDE if you have problems or want a smaller binary. The master makefile is bundled as a submodule, but can also be downloaded manually at the following link: . - -To download the USB Host library and all the needed libraries for this test. - -Run the following command in a terminal application: - -``` -git clone --recursive https://github.com/felis/USB_Host_Shield_2.0 -``` - -If you want to update all the submodules run: - -``` -git submodule foreach --recursive git pull origin master -``` diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md deleted file mode 100644 index 49cd83e0a..000000000 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md +++ /dev/null @@ -1,351 +0,0 @@ -# USB Host Library Rev.2.0 - -The code is released under the GNU General Public License. -__________ - -# Summary -This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's. - -Project main web site is: . - -Some information can also be found at: . - -The shield can be purchased at the main site: or from [TKJ Electronics](http://tkjelectronics.com/): . - -![USB Host Shield](http://shop.tkjelectronics.dk/images/USB_Host_Shield1.jpg) - -For more information about the hardware see the [Hardware Manual](http://www.circuitsathome.com/usb-host-shield-hardware-manual). - -# Developed By - -* __Oleg Mazurov, Circuits@Home__ - -* __Alexei Glushchenko, Circuits@Home__ - - * Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries -* __Kristian Lauszus, TKJ Electronics__ - - * Developer of the [BTD](#bluetooth-libraries), [BTHID](#bthid-library), [SPP](#spp-library), [PS4](#ps4-library), [PS3](#ps3-library), [Wii](#wii-library), [Xbox](#xbox-library), and [PSBuzz](#ps-buzz-library) libraries -* __Andrew Kroll__ - - * Major contributor to mass storage code -* __guruthree__ - * [Xbox ONE](#xbox-one-library) controller support - -# Donate - -Help yourself by helping us support you! Many thousands of hours have been spent developing the USB Host Shield library. Since you find it useful, please consider donating via the button below. Donations will allow us to support you by ensuring hardware that you have can be acquired in order to add support for your microcontroller board. - -PayPal - The safer, easier way to pay online! - -# Table of Contents - -* [How to include the library](#how-to-include-the-library) - * [Arduino Library Manager](#arduino-library-manager) - * [Manual installation](#manual-installation) -* [How to use the library](#how-to-use-the-library) - * [Documentation](#documentation) - * [Enable debugging](#enable-debugging) - * [Boards](#boards) - * [Bluetooth libraries](#bluetooth-libraries) - * [BTHID library](#bthid-library) - * [SPP library](#spp-library) - * [PS4 Library](#ps4-library) - * [PS3 Library](#ps3-library) - * [Xbox Libraries](#xbox-libraries) - * [Xbox library](#xbox-library) - * [Xbox 360 Library](#xbox-360-library) - * [Xbox ONE Library](#xbox-one-library) - * [Wii library](#wii-library) - * [PS Buzz Library](#ps-buzz-library) -* [Interface modifications](#interface-modifications) -* [FAQ](#faq) - -# How to include the library - -### Arduino Library Manager - -First install Arduino IDE version 1.6.2 or newer, then simply use the Arduino Library Manager to install the library. - -Please see the following page for instructions: . - -### Manual installation - -First download the library by clicking on the following link: . - -Then uncompress the zip folder and rename the directory to "USB\_Host\_Shield\_20", as any special characters are not supported by the Arduino IDE. - -Now open up the Arduino IDE and open "File>Preferences". There you will see the location of your sketchbook. Open that directory and create a directory called "libraries" inside that directory. -Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory. - -The final structure should look like this: - -* Arduino/ - * libraries/ - * USB\_Host\_Shield\_20/ - -Now quit the Arduino IDE and reopen it. - -Now you should be able to go open all the examples codes by navigating to "File>Examples>USB\_Host\_Shield\_20" and then select the example you will like to open. - -For more information visit the following sites: and . - -# How to use the library - -### Documentation - -Documentation for the library can be found at the following link: . - -### Enable debugging - -By default serial debugging is disabled. To turn it on simply change ```ENABLE_UHS_DEBUGGING``` to 1 in [settings.h](settings.h) like so: - -```C++ -#define ENABLE_UHS_DEBUGGING 1 -``` - -### Boards - -Currently the following boards are supported by the library: - -* All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.) -* Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison - * Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information. -* Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, and Teensy 3.x) - * Note if you are using the Teensy 3.x you should download this SPI library as well: . You should then add ```#include ``` to your .ino file. -* Balanduino -* Sanguino -* Black Widdow -* RedBearLab nRF51822 -* Digilent chipKIT - * Please see: . - -The following boards need to be activated manually in [settings.h](settings.h): - -* Arduino Mega ADK - * If you are using Arduino 1.5.5 or newer there is no need to activate the Arduino Mega ADK manually -* Black Widdow - -Simply set the corresponding value to 1 instead of 0. - -### [Bluetooth libraries](BTD.cpp) - -The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle. -This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth. -Some different examples can be found in the [example directory](examples/Bluetooth). - -The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this: -[PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino). - -### [BTHID library](BTHID.cpp) - -The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Bluetooth to the USB Host Shield. - -Currently HID mice and keyboards are supported. - -It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: [BTHID.ino](examples/Bluetooth/BTHID/BTHID.ino) for more information. - -The [PS4 library](#ps4-library) also uses this class to handle all Bluetooth communication. - -For information see the following blog post: . - -### [SPP library](SPP.cpp) - -SPP stands for "Serial Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth. -It has been tested successfully on Windows, Mac OS X, Linux, and Android. - -Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information. - -More information can be found at these blog posts: - -* -* - -To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple. -It enables me to see the Bluetooth communication between my Mac and any device. - -### PS4 Library - -The PS4BT library is split up into the [PS4BT](PS4BT.h) and the [PS4USB](PS4USB.h) library. These allow you to use the Sony PS4 controller via Bluetooth and USB. - -The [PS4BT.ino](examples/Bluetooth/PS4BT/PS4BT.ino) and [PS4USB.ino](examples/PS4USB/PS4USB.ino) examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. It is also possible to control the rumble and light on the controller and get the battery level. - -Before you can use the PS4 controller via Bluetooth you will need to pair with it. - -Simply create the PS4BT instance like so: ```PS4BT PS4(&Btd, PAIR);``` and then hold down the Share button and then hold down the PS without releasing the Share button. The PS4 controller will then start to blink rapidly indicating that it is in paring mode. - -It should then automatically pair the dongle with your controller. This only have to be done once. - -For information see the following blog post: . - -Also check out this excellent Wiki by Frank Zhao about the PS4 controller: and this Linux driver: . - -### PS3 Library - -These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB. - -In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by first plugging in the Bluetooth dongle and wait a few seconds. Now plug in the controller via USB and wait until the LEDs start to flash. The library has now written the Bluetooth address of the dongle to the PS3 controller. - -Finally simply plug in the Bluetooth dongle again and press PS on the PS3 controller. After a few seconds it should be connected to the dongle and ready to use. - -__Note:__ You will have to plug in the Bluetooth dongle before connecting the controller, as the library needs to read the address of the dongle. Alternatively you could set it in code like so: [PS3BT.ino#L20](examples/Bluetooth/PS3BT/PS3BT.ino#L20). - -For more information about the PS3 protocol see the official wiki: . - -Also take a look at the blog posts: - -* -* -* - -A special thanks go to the following people: - -1. _Richard Ibbotson_ who made this excellent guide: -2. _Tomoyuki Tanaka_ for releasing his code for the Arduino USB Host shield connected to the wiimote: - -Also a big thanks all the people behind these sites about the Motion controller: - -* -* -* -* - -### Xbox Libraries - -The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly. - -#### Xbox library - -The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB. - -All the information are from the following sites: - -* -* -* -* - -#### Xbox 360 Library - -The library support one Xbox 360 via USB or up to four Xbox 360 controllers wirelessly by using a [Xbox 360 wireless receiver](http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg). - -To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library. - -__Note that a Wireless controller can NOT be used via USB!__ - -Examples code can be found in the [examples directory](examples/Xbox). - -Also see the following blog posts: - -* -* -* - -All the information regarding the Xbox 360 controller protocol are form these sites: - -* -* -* - -#### Xbox ONE Library - -An Xbox ONE controller is supported via USB in the [XBOXONE](XBOXONE.cpp) class. It is heavily based on the 360 library above. In addition to cross referencing the above, information on the protocol was found at: - -* -* -* - -### [Wii library](Wii.cpp) - -The [Wii](Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller and Wii Balance Board are also supported via Bluetooth. - -First you have to pair with the controller, this is done automatically by the library if you create the instance like so: - -```C++ -WII Wii(&Btd, PAIR); -``` - -And then press 1 & 2 at once on the Wiimote or the SYNC buttons if you are using a Wii U Pro Controller or a Wii Balance Board. - -After that you can simply create the instance like so: - -```C++ -WII Wii(&Btd); -``` - -Then just press any button on the Wiimote and it will then connect to the dongle. - -Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino). - -Also take a look at the blog post: - -* - -The Wii IR camera can also be used, but you will have to activate the code for it manually as it is quite large. Simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h). - -The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used. - -All the information about the Wii controllers are from these sites: - -* -* -* -* -* -* The old library created by _Tomoyuki Tanaka_: also helped a lot. - -### [PS Buzz Library](PSBuzz.cpp) - -This library implements support for the Playstation Buzz controllers via USB. - -It is essentially just a wrapper around the [HIDUniversal](hiduniversal.cpp) which takes care of the initializing and reading of the controllers. The [PSBuzz](PSBuzz.cpp) class simply inherits this and parses the data, so it is easy for users to read the buttons and turn the big red button on the controllers on and off. - -The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code. - -More information about the controller can be found at the following sites: - -* http://www.developerfusion.com/article/84338/making-usb-c-friendly/ -* https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c - -# Interface modifications - -The shield is using SPI for communicating with the MAX3421E USB host controller. It uses the SCK, MISO and MOSI pins via the ICSP on your board. - -Note this means that it uses pin 13, 12, 11 on an Arduino Uno, so these pins can not be used for anything else than SPI communication! - -Furthermore it uses one pin as SS and one INT pin. These are by default located on pin 10 and 9 respectively. They can easily be reconfigured in case you need to use them for something else by cutting the jumper on the shield and then solder a wire from the pad to the new pin. - -After that you need modify the following entry in [UsbCore.h](UsbCore.h): - -```C++ -typedef MAX3421e MAX3421E; -``` - -For instance if you have rerouted SS to pin 7 it should read: - -```C++ -typedef MAX3421e MAX3421E; -``` - -See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information. - -# FAQ - -> When I plug my device into the USB connector nothing happens? - -* Try to connect a external power supply to the Arduino - this solves the problem in most cases. -* You can also use a powered hub between the device and the USB Host Shield. You should then include the USB hub library: ```#include ``` and create the instance like so: ```USBHub Hub1(&Usb);```. - -> When I connecting my PS3 controller I get a output like this: - -``` -Dualshock 3 Controller Enabled - -LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 -LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 -LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 -LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 -LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 -``` - -* This means that your dongle does not support 2.0+EDR, so you will need another dongle. Please see the following [list](https://github.com/felis/USB_Host_Shield_2.0/wiki/Bluetooth-dongles) for tested working dongles. - -> When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory". - -* Please make sure to include the SPI library like so: ```#include ``` in your .ino file. diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp index 1a152ff3f..94e747ca4 100644 --- a/tmk_core/protocol/usb_hid/parser.cpp +++ b/tmk_core/protocol/usb_hid/parser.cpp @@ -4,30 +4,14 @@ #include "debug.h" -report_keyboard_t usb_hid_keyboard_report; -uint16_t usb_hid_time_stamp; - - void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) { - bool is_error = false; - report_keyboard_t *report = (report_keyboard_t *)buf; + ::memcpy(&report, buf, sizeof(report_keyboard_t)); + time_stamp = millis(); - dprintf("KBDReport: %02X %02X", report->mods, report->reserved); + dprintf("input %d: %02X %02X", hid->GetAddress(), report.mods, report.reserved); for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ERROR(report->keys[i])) { - is_error = true; - } - dprintf(" %02X", report->keys[i]); + dprintf(" %02X", report.keys[i]); } dprint("\r\n"); - - // ignore error and not send report to computer - if (is_error) { - dprint("Error usage! \r\n"); - return; - } - - ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); - usb_hid_time_stamp = millis(); } diff --git a/tmk_core/protocol/usb_hid/parser.h b/tmk_core/protocol/usb_hid/parser.h index 703eb1ed4..036281fa6 100644 --- a/tmk_core/protocol/usb_hid/parser.h +++ b/tmk_core/protocol/usb_hid/parser.h @@ -2,11 +2,14 @@ #define PARSER_H #include "hid.h" +#include "report.h" class KBDReportParser : public HIDReportParser { public: - virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); + report_keyboard_t report; + uint16_t time_stamp; + virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); }; #endif diff --git a/tmk_core/protocol/usb_hid/test/Makefile b/tmk_core/protocol/usb_hid/test/Makefile index c093bbd4c..83bf2aed6 100644 --- a/tmk_core/protocol/usb_hid/test/Makefile +++ b/tmk_core/protocol/usb_hid/test/Makefile @@ -1,4 +1,42 @@ - +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device. +# Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +# (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- # Target file name (without extension). TARGET = usb_hid_test -- cgit v1.2.3 From fa86b10138512de8fd45af61ecf47b2f44ce2b13 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Sat, 12 Aug 2017 18:33:49 +0200 Subject: add extern "C" to matrix.cpp --- keyboards/converter/usb_usb/matrix.cpp | 246 +++++++++++++++++---------------- 1 file changed, 125 insertions(+), 121 deletions(-) (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/matrix.cpp b/keyboards/converter/usb_usb/matrix.cpp index 88517afc9..93d13edf0 100644 --- a/keyboards/converter/usb_usb/matrix.cpp +++ b/keyboards/converter/usb_usb/matrix.cpp @@ -83,152 +83,156 @@ KBDReportParser kbd_parser3; KBDReportParser kbd_parser4; -uint8_t matrix_rows(void) { return MATRIX_ROWS; } -uint8_t matrix_cols(void) { return MATRIX_COLS; } -bool matrix_has_ghost(void) { return false; } -void matrix_init(void) { - // USB Host Shield setup - usb_host.Init(); - kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1); - kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2); - kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3); - kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4); -} - -static void or_report(report_keyboard_t report) { - // integrate reports into keyboard_report - keyboard_report.mods |= report.mods; - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(report.keys[i])) { - for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { - if (! keyboard_report.keys[j]) { - keyboard_report.keys[j] = report.keys[i]; - break; +extern "C" +{ + uint8_t matrix_rows(void) { return MATRIX_ROWS; } + uint8_t matrix_cols(void) { return MATRIX_COLS; } + bool matrix_has_ghost(void) { return false; } + void matrix_init(void) { + // USB Host Shield setup + usb_host.Init(); + kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1); + kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2); + kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3); + kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4); + } + + static void or_report(report_keyboard_t report) { + // integrate reports into keyboard_report + keyboard_report.mods |= report.mods; + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(report.keys[i])) { + for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { + if (! keyboard_report.keys[j]) { + keyboard_report.keys[j] = report.keys[i]; + break; + } } } } } -} - -uint8_t matrix_scan(void) { - static uint16_t last_time_stamp1 = 0; - static uint16_t last_time_stamp2 = 0; - static uint16_t last_time_stamp3 = 0; - static uint16_t last_time_stamp4 = 0; - - // check report came from keyboards - if (kbd_parser1.time_stamp != last_time_stamp1 || - kbd_parser2.time_stamp != last_time_stamp2 || - kbd_parser3.time_stamp != last_time_stamp3 || - kbd_parser4.time_stamp != last_time_stamp4) { - - last_time_stamp1 = kbd_parser1.time_stamp; - last_time_stamp2 = kbd_parser2.time_stamp; - last_time_stamp3 = kbd_parser3.time_stamp; - last_time_stamp4 = kbd_parser4.time_stamp; - - // clear and integrate all reports - keyboard_report = {}; - or_report(kbd_parser1.report); - or_report(kbd_parser2.report); - or_report(kbd_parser3.report); - or_report(kbd_parser4.report); - - matrix_is_mod = true; - - dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - dprintf(" %02X", keyboard_report.keys[i]); + + uint8_t matrix_scan(void) { + static uint16_t last_time_stamp1 = 0; + static uint16_t last_time_stamp2 = 0; + static uint16_t last_time_stamp3 = 0; + static uint16_t last_time_stamp4 = 0; + + // check report came from keyboards + if (kbd_parser1.time_stamp != last_time_stamp1 || + kbd_parser2.time_stamp != last_time_stamp2 || + kbd_parser3.time_stamp != last_time_stamp3 || + kbd_parser4.time_stamp != last_time_stamp4) { + + last_time_stamp1 = kbd_parser1.time_stamp; + last_time_stamp2 = kbd_parser2.time_stamp; + last_time_stamp3 = kbd_parser3.time_stamp; + last_time_stamp4 = kbd_parser4.time_stamp; + + // clear and integrate all reports + keyboard_report = {}; + or_report(kbd_parser1.report); + or_report(kbd_parser2.report); + or_report(kbd_parser3.report); + or_report(kbd_parser4.report); + + matrix_is_mod = true; + + dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + dprintf(" %02X", keyboard_report.keys[i]); + } + dprint("\r\n"); + } else { + matrix_is_mod = false; } - dprint("\r\n"); - } else { - matrix_is_mod = false; - } - uint16_t timer; - timer = timer_read(); - usb_host.Task(); - timer = timer_elapsed(timer); - if (timer > 100) { - dprintf("host.Task: %d\n", timer); - } + uint16_t timer; + timer = timer_read(); + usb_host.Task(); + timer = timer_elapsed(timer); + if (timer > 100) { + dprintf("host.Task: %d\n", timer); + } - static uint8_t usb_state = 0; - if (usb_state != usb_host.getUsbTaskState()) { - usb_state = usb_host.getUsbTaskState(); - dprintf("usb_state: %02X\n", usb_state); + static uint8_t usb_state = 0; + if (usb_state != usb_host.getUsbTaskState()) { + usb_state = usb_host.getUsbTaskState(); + dprintf("usb_state: %02X\n", usb_state); - // restore LED state when keyboard comes up - if (usb_state == USB_STATE_RUNNING) { - dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); - keyboard_set_leds(host_keyboard_leds()); + // restore LED state when keyboard comes up + if (usb_state == USB_STATE_RUNNING) { + dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); + keyboard_set_leds(host_keyboard_leds()); + } } + return 1; } - return 1; -} -bool matrix_is_modified(void) { - return matrix_is_mod; -} + bool matrix_is_modified(void) { + return matrix_is_mod; + } -bool matrix_is_on(uint8_t row, uint8_t col) { - uint8_t code = CODE(row, col); + bool matrix_is_on(uint8_t row, uint8_t col) { + uint8_t code = CODE(row, col); - if (IS_MOD(code)) { - if (keyboard_report.mods & ROW_BITS(code)) { - return true; + if (IS_MOD(code)) { + if (keyboard_report.mods & ROW_BITS(code)) { + return true; + } } - } - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (keyboard_report.keys[i] == code) { - return true; + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (keyboard_report.keys[i] == code) { + return true; + } } + return false; } - return false; -} -matrix_row_t matrix_get_row(uint8_t row) { - uint16_t row_bits = 0; + matrix_row_t matrix_get_row(uint8_t row) { + uint16_t row_bits = 0; - if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { - row_bits |= keyboard_report.mods; - } + if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { + row_bits |= keyboard_report.mods; + } - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(keyboard_report.keys[i])) { - if (row == ROW(keyboard_report.keys[i])) { - row_bits |= ROW_BITS(keyboard_report.keys[i]); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + if (row == ROW(keyboard_report.keys[i])) { + row_bits |= ROW_BITS(keyboard_report.keys[i]); + } } } + return row_bits; } - return row_bits; -} -uint8_t matrix_key_count(void) { - uint8_t count = 0; + uint8_t matrix_key_count(void) { + uint8_t count = 0; - count += bitpop(keyboard_report.mods); - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(keyboard_report.keys[i])) { - count++; + count += bitpop(keyboard_report.mods); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + count++; + } + } + return count; + } + + void matrix_print(void) { + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < matrix_rows(); row++) { + xprintf("%02d: ", row); + print_bin_reverse16(matrix_get_row(row)); + print("\n"); } } - return count; -} - -void matrix_print(void) { - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < matrix_rows(); row++) { - xprintf("%02d: ", row); - print_bin_reverse16(matrix_get_row(row)); - print("\n"); + + void led_set(uint8_t usb_led) + { + kbd1.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); } -} -void led_set(uint8_t usb_led) -{ - kbd1.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); -} +}; -- cgit v1.2.3 From c8222043fc6d803cc1029205af1b78c7da1f782c Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Sat, 12 Aug 2017 19:07:35 +0200 Subject: wow, it builds! added empty matrix.c and moved custom matrix code to custom_matrix.cpp still untested because of hardware availability :( --- keyboards/converter/usb_usb/custom_matrix.cpp | 238 ++++++++++++++++++++++++++ keyboards/converter/usb_usb/matrix.c | 1 + keyboards/converter/usb_usb/matrix.cpp | 238 -------------------------- keyboards/converter/usb_usb/rules.mk | 2 +- 4 files changed, 240 insertions(+), 239 deletions(-) create mode 100644 keyboards/converter/usb_usb/custom_matrix.cpp create mode 100644 keyboards/converter/usb_usb/matrix.c delete mode 100644 keyboards/converter/usb_usb/matrix.cpp (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp new file mode 100644 index 000000000..93d13edf0 --- /dev/null +++ b/keyboards/converter/usb_usb/custom_matrix.cpp @@ -0,0 +1,238 @@ +/* +Copyright 2016 Jun Wako + +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 . +*/ + +#include +#include + +// USB HID host +#include "Usb.h" +#include "usbhub.h" +#include "hid.h" +#include "hidboot.h" +#include "parser.h" + +#include "keycode.h" +#include "util.h" +#include "print.h" +#include "debug.h" +#include "timer.h" +#include "matrix.h" +#include "led.h" +#include "host.h" +#include "keyboard.h" + + +/* KEY CODE to Matrix + * + * HID keycode(1 byte): + * Higher 5 bits indicates ROW and lower 3 bits COL. + * + * 7 6 5 4 3 2 1 0 + * +---------------+ + * | ROW | COL | + * +---------------+ + * + * Matrix space(16 * 16): + * r\c0123456789ABCDEF + * 0 +----------------+ + * : | | + * : | | + * 16 +----------------+ + */ +#define ROW_MASK 0xF0 +#define COL_MASK 0x0F +#define CODE(row, col) (((row) << 4) | (col)) +#define ROW(code) (((code) & ROW_MASK) >> 4) +#define COL(code) ((code) & COL_MASK) +#define ROW_BITS(code) (1 << COL(code)) + + +// Integrated key state of all keyboards +static report_keyboard_t keyboard_report; + +static bool matrix_is_mod = false; + +/* + * USB Host Shield HID keyboards + * This supports two cascaded hubs and four keyboards + */ +USB usb_host; +USBHub hub1(&usb_host); +USBHub hub2(&usb_host); +HIDBoot kbd1(&usb_host); +HIDBoot kbd2(&usb_host); +HIDBoot kbd3(&usb_host); +HIDBoot kbd4(&usb_host); +KBDReportParser kbd_parser1; +KBDReportParser kbd_parser2; +KBDReportParser kbd_parser3; +KBDReportParser kbd_parser4; + + +extern "C" +{ + uint8_t matrix_rows(void) { return MATRIX_ROWS; } + uint8_t matrix_cols(void) { return MATRIX_COLS; } + bool matrix_has_ghost(void) { return false; } + void matrix_init(void) { + // USB Host Shield setup + usb_host.Init(); + kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1); + kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2); + kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3); + kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4); + } + + static void or_report(report_keyboard_t report) { + // integrate reports into keyboard_report + keyboard_report.mods |= report.mods; + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(report.keys[i])) { + for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { + if (! keyboard_report.keys[j]) { + keyboard_report.keys[j] = report.keys[i]; + break; + } + } + } + } + } + + uint8_t matrix_scan(void) { + static uint16_t last_time_stamp1 = 0; + static uint16_t last_time_stamp2 = 0; + static uint16_t last_time_stamp3 = 0; + static uint16_t last_time_stamp4 = 0; + + // check report came from keyboards + if (kbd_parser1.time_stamp != last_time_stamp1 || + kbd_parser2.time_stamp != last_time_stamp2 || + kbd_parser3.time_stamp != last_time_stamp3 || + kbd_parser4.time_stamp != last_time_stamp4) { + + last_time_stamp1 = kbd_parser1.time_stamp; + last_time_stamp2 = kbd_parser2.time_stamp; + last_time_stamp3 = kbd_parser3.time_stamp; + last_time_stamp4 = kbd_parser4.time_stamp; + + // clear and integrate all reports + keyboard_report = {}; + or_report(kbd_parser1.report); + or_report(kbd_parser2.report); + or_report(kbd_parser3.report); + or_report(kbd_parser4.report); + + matrix_is_mod = true; + + dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + dprintf(" %02X", keyboard_report.keys[i]); + } + dprint("\r\n"); + } else { + matrix_is_mod = false; + } + + uint16_t timer; + timer = timer_read(); + usb_host.Task(); + timer = timer_elapsed(timer); + if (timer > 100) { + dprintf("host.Task: %d\n", timer); + } + + static uint8_t usb_state = 0; + if (usb_state != usb_host.getUsbTaskState()) { + usb_state = usb_host.getUsbTaskState(); + dprintf("usb_state: %02X\n", usb_state); + + // restore LED state when keyboard comes up + if (usb_state == USB_STATE_RUNNING) { + dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); + keyboard_set_leds(host_keyboard_leds()); + } + } + return 1; + } + + bool matrix_is_modified(void) { + return matrix_is_mod; + } + + bool matrix_is_on(uint8_t row, uint8_t col) { + uint8_t code = CODE(row, col); + + if (IS_MOD(code)) { + if (keyboard_report.mods & ROW_BITS(code)) { + return true; + } + } + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (keyboard_report.keys[i] == code) { + return true; + } + } + return false; + } + + matrix_row_t matrix_get_row(uint8_t row) { + uint16_t row_bits = 0; + + if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { + row_bits |= keyboard_report.mods; + } + + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + if (row == ROW(keyboard_report.keys[i])) { + row_bits |= ROW_BITS(keyboard_report.keys[i]); + } + } + } + return row_bits; + } + + uint8_t matrix_key_count(void) { + uint8_t count = 0; + + count += bitpop(keyboard_report.mods); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ANY(keyboard_report.keys[i])) { + count++; + } + } + return count; + } + + void matrix_print(void) { + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < matrix_rows(); row++) { + xprintf("%02d: ", row); + print_bin_reverse16(matrix_get_row(row)); + print("\n"); + } + } + + void led_set(uint8_t usb_led) + { + kbd1.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); + kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); + } + +}; diff --git a/keyboards/converter/usb_usb/matrix.c b/keyboards/converter/usb_usb/matrix.c new file mode 100644 index 000000000..b077febd7 --- /dev/null +++ b/keyboards/converter/usb_usb/matrix.c @@ -0,0 +1 @@ +// Intentionally left empty. This file must exist for this board to build. diff --git a/keyboards/converter/usb_usb/matrix.cpp b/keyboards/converter/usb_usb/matrix.cpp deleted file mode 100644 index 93d13edf0..000000000 --- a/keyboards/converter/usb_usb/matrix.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* -Copyright 2016 Jun Wako - -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 . -*/ - -#include -#include - -// USB HID host -#include "Usb.h" -#include "usbhub.h" -#include "hid.h" -#include "hidboot.h" -#include "parser.h" - -#include "keycode.h" -#include "util.h" -#include "print.h" -#include "debug.h" -#include "timer.h" -#include "matrix.h" -#include "led.h" -#include "host.h" -#include "keyboard.h" - - -/* KEY CODE to Matrix - * - * HID keycode(1 byte): - * Higher 5 bits indicates ROW and lower 3 bits COL. - * - * 7 6 5 4 3 2 1 0 - * +---------------+ - * | ROW | COL | - * +---------------+ - * - * Matrix space(16 * 16): - * r\c0123456789ABCDEF - * 0 +----------------+ - * : | | - * : | | - * 16 +----------------+ - */ -#define ROW_MASK 0xF0 -#define COL_MASK 0x0F -#define CODE(row, col) (((row) << 4) | (col)) -#define ROW(code) (((code) & ROW_MASK) >> 4) -#define COL(code) ((code) & COL_MASK) -#define ROW_BITS(code) (1 << COL(code)) - - -// Integrated key state of all keyboards -static report_keyboard_t keyboard_report; - -static bool matrix_is_mod = false; - -/* - * USB Host Shield HID keyboards - * This supports two cascaded hubs and four keyboards - */ -USB usb_host; -USBHub hub1(&usb_host); -USBHub hub2(&usb_host); -HIDBoot kbd1(&usb_host); -HIDBoot kbd2(&usb_host); -HIDBoot kbd3(&usb_host); -HIDBoot kbd4(&usb_host); -KBDReportParser kbd_parser1; -KBDReportParser kbd_parser2; -KBDReportParser kbd_parser3; -KBDReportParser kbd_parser4; - - -extern "C" -{ - uint8_t matrix_rows(void) { return MATRIX_ROWS; } - uint8_t matrix_cols(void) { return MATRIX_COLS; } - bool matrix_has_ghost(void) { return false; } - void matrix_init(void) { - // USB Host Shield setup - usb_host.Init(); - kbd1.SetReportParser(0, (HIDReportParser*)&kbd_parser1); - kbd2.SetReportParser(0, (HIDReportParser*)&kbd_parser2); - kbd3.SetReportParser(0, (HIDReportParser*)&kbd_parser3); - kbd4.SetReportParser(0, (HIDReportParser*)&kbd_parser4); - } - - static void or_report(report_keyboard_t report) { - // integrate reports into keyboard_report - keyboard_report.mods |= report.mods; - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(report.keys[i])) { - for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { - if (! keyboard_report.keys[j]) { - keyboard_report.keys[j] = report.keys[i]; - break; - } - } - } - } - } - - uint8_t matrix_scan(void) { - static uint16_t last_time_stamp1 = 0; - static uint16_t last_time_stamp2 = 0; - static uint16_t last_time_stamp3 = 0; - static uint16_t last_time_stamp4 = 0; - - // check report came from keyboards - if (kbd_parser1.time_stamp != last_time_stamp1 || - kbd_parser2.time_stamp != last_time_stamp2 || - kbd_parser3.time_stamp != last_time_stamp3 || - kbd_parser4.time_stamp != last_time_stamp4) { - - last_time_stamp1 = kbd_parser1.time_stamp; - last_time_stamp2 = kbd_parser2.time_stamp; - last_time_stamp3 = kbd_parser3.time_stamp; - last_time_stamp4 = kbd_parser4.time_stamp; - - // clear and integrate all reports - keyboard_report = {}; - or_report(kbd_parser1.report); - or_report(kbd_parser2.report); - or_report(kbd_parser3.report); - or_report(kbd_parser4.report); - - matrix_is_mod = true; - - dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - dprintf(" %02X", keyboard_report.keys[i]); - } - dprint("\r\n"); - } else { - matrix_is_mod = false; - } - - uint16_t timer; - timer = timer_read(); - usb_host.Task(); - timer = timer_elapsed(timer); - if (timer > 100) { - dprintf("host.Task: %d\n", timer); - } - - static uint8_t usb_state = 0; - if (usb_state != usb_host.getUsbTaskState()) { - usb_state = usb_host.getUsbTaskState(); - dprintf("usb_state: %02X\n", usb_state); - - // restore LED state when keyboard comes up - if (usb_state == USB_STATE_RUNNING) { - dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); - keyboard_set_leds(host_keyboard_leds()); - } - } - return 1; - } - - bool matrix_is_modified(void) { - return matrix_is_mod; - } - - bool matrix_is_on(uint8_t row, uint8_t col) { - uint8_t code = CODE(row, col); - - if (IS_MOD(code)) { - if (keyboard_report.mods & ROW_BITS(code)) { - return true; - } - } - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (keyboard_report.keys[i] == code) { - return true; - } - } - return false; - } - - matrix_row_t matrix_get_row(uint8_t row) { - uint16_t row_bits = 0; - - if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { - row_bits |= keyboard_report.mods; - } - - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(keyboard_report.keys[i])) { - if (row == ROW(keyboard_report.keys[i])) { - row_bits |= ROW_BITS(keyboard_report.keys[i]); - } - } - } - return row_bits; - } - - uint8_t matrix_key_count(void) { - uint8_t count = 0; - - count += bitpop(keyboard_report.mods); - for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ANY(keyboard_report.keys[i])) { - count++; - } - } - return count; - } - - void matrix_print(void) { - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < matrix_rows(); row++) { - xprintf("%02d: ", row); - print_bin_reverse16(matrix_get_row(row)); - print("\n"); - } - } - - void led_set(uint8_t usb_led) - { - kbd1.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); - kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); - } - -}; diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index f6b816966..298bc5c40 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk @@ -111,7 +111,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 CUSTOM_MATRIX = yes -SRC = matrix.cpp +SRC = custom_matrix.cpp # # Keymap file -- cgit v1.2.3 From 80d082055b49aed5078534d2fc7558172025af94 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Mon, 14 Aug 2017 15:43:57 +0200 Subject: convert keymap into qmk-style --- .../converter/usb_usb/keymaps/default/keymap.c | 28 +++--- keyboards/converter/usb_usb/usb_usb.h | 108 +++++++++++---------- 2 files changed, 69 insertions(+), 67 deletions(-) (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/keymaps/default/keymap.c b/keyboards/converter/usb_usb/keymaps/default/keymap.c index 050332384..94e19565d 100644 --- a/keyboards/converter/usb_usb/keymaps/default/keymap.c +++ b/keyboards/converter/usb_usb/keymaps/default/keymap.c @@ -56,22 +56,22 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { // LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT // ), KEYMAP_ALL( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_MENU, KC_UNDO, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, + KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT ), KEYMAP_ALL( - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, - GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - CAPS,MPRV,VOLU,MNXT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,MUTE,VOLD,MPLY,TRNS,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______, + KC_GRV, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + ______, KC_MUTE, KC_VOLD, KC_MPLY, ______, ______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______, ______,______, ______,______ ), }; diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h index 7f257ca49..0e7d92b45 100644 --- a/keyboards/converter/usb_usb/usb_usb.h +++ b/keyboards/converter/usb_usb/usb_usb.h @@ -19,6 +19,8 @@ along with this program. If not, see . #include "quantum.h" +#define ______ KC_TRNS + /* ,---------------. ,---------------. ,---------------. * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. @@ -68,38 +70,38 @@ along with this program. If not, see . KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K67, K74,K7D, \ KE0,KE3,KE2,K8B,K91, K2C, K90,K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, K7E,K7B \ ) { \ - { 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_##K32, 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_##K64, KC_##K65, KC_##K66, KC_##K67, /* 60-67 */ \ - KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, /* 68-6F */ \ - { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, /* 70-77 */ \ - KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_##K7F }, /* 78-7F */ \ - { KC_##K80, KC_##K81, KC_NO, KC_NO, KC_NO, KC_##K85, KC_NO, KC_##K87, /* 80-87 */ \ - KC_##K88, KC_##K89, KC_##K8A, KC_##K8B, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { KC_##K90, KC_##K91, 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 */ \ + { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ + K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ + { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ + K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ + { K20, K21, K22, K23, K24, K25, K26, K27, /* 20-27 */ \ + K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, /* 28-2F */ \ + { K30, K31, K32, K33, K34, K35, K36, K37, /* 30-37 */ \ + K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, /* 38-3F */ \ + { K40, K41, K42, K43, K44, K45, K46, K47, /* 40-47 */ \ + K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, /* 48-4F */ \ + { K50, K51, K52, K53, K54, K55, K56, K57, /* 50-57 */ \ + K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, /* 58-5F */ \ + { K60, K61, K62, K63, K64, K65, K66, K67, /* 60-67 */ \ + K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, /* 68-6F */ \ + { K70, K71, K72, K73, K74, K75, K76, K77, /* 70-77 */ \ + K78, K79, K7A, K7B, K7C, K7D, K7E, K7F }, /* 78-7F */ \ + { K80, K81, KC_NO, KC_NO, KC_NO, K85, KC_NO, K87, /* 80-87 */ \ + K88, K89, K8A, K8B, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ + { K90, K91, 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 */ \ + { KE0, KE1, KE2, KE3, KE4, KE5, KE6, 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 */ \ } /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -125,13 +127,13 @@ along with this program. If not, see . 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 \ ) KEYMAP_ALL( \ - NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, NO, K28, K5C,K5D,K5E,NO, NO, NO, \ - KE1,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, NO, KE5, K52, K59,K5A,K5B,NO, NO, NO, \ - KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, 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, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,KC_NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, KC_NO, KC_NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, KC_NO, KC_NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, KC_NO, K28, K5C,K5D,K5E,KC_NO, KC_NO, KC_NO, \ + KE1,KC_NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KC_NO, KE5, K52, K59,K5A,K5B,KC_NO, KC_NO, KC_NO, \ + KE0,KE3,KE2,KC_NO, KC_NO, K2C, KC_NO, KC_NO, KC_NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, KC_NO, KC_NO \ ) /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -157,13 +159,13 @@ along with this program. If not, see . KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B,K58, \ KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ ) KEYMAP_ALL( \ - NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,NO, NO, NO, \ - KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, NO, KE5, K52, K59,K5A,K5B,NO, NO, NO, \ - KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, 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, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,KC_NO, K2A, K49,K4A,K4B, K53,K54,K55,K56, KC_NO, KC_NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, KC_NO, KC_NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,KC_NO, KC_NO, KC_NO, \ + KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KC_NO, KE5, K52, K59,K5A,K5B,KC_NO, KC_NO, KC_NO, \ + KE0,KE3,KE2,KC_NO, KC_NO, K2C, KC_NO, KC_NO, KC_NO, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, KC_NO, KC_NO \ ) /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -189,12 +191,12 @@ along with this program. If not, see . KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K58, \ KE0,KE3,KE2,K8B, K2C, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ ) KEYMAP_ALL( \ - NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, NO, NO, NO, NO, NO, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, NO, NO, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, NO, NO, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,NO, NO, NO, \ - KE1,NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,NO, NO, NO, \ - KE0,KE3,KE2,K8B,NO, K2C, NO, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, NO, 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, \ + K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, KC_NO, KC_NO, \ + K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K32, K4C,K4D,K4E, K5F,K60,K61,K57, KC_NO, KC_NO, \ + K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,KC_NO, KC_NO, KC_NO, \ + KE1,KC_NO, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,KC_NO, KC_NO, KC_NO, \ + KE0,KE3,KE2,K8B,KC_NO, K2C, KC_NO, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, KC_NO, KC_NO \ ) #endif -- cgit v1.2.3 From 7e5ccd50dc4d1142fe27a34006257a1fd4cbf4b9 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Mon, 14 Aug 2017 15:48:16 +0200 Subject: add RESET to keymap --- keyboards/converter/usb_usb/keymaps/default/keymap.c | 2 +- keyboards/converter/usb_usb/usb_usb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/keymaps/default/keymap.c b/keyboards/converter/usb_usb/keymaps/default/keymap.c index 94e19565d..b916855f5 100644 --- a/keyboards/converter/usb_usb/keymaps/default/keymap.c +++ b/keyboards/converter/usb_usb/keymaps/default/keymap.c @@ -71,7 +71,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, ______, KC_MUTE, KC_VOLD, KC_MPLY, ______, ______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, ______, ______, ______, ______, ______,______,______,______, ______,______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______, ______,______, ______,______ + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, RESET, ______,______,______, ______, ______,______, ______,______ ), }; diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h index 0e7d92b45..91c000731 100644 --- a/keyboards/converter/usb_usb/usb_usb.h +++ b/keyboards/converter/usb_usb/usb_usb.h @@ -70,7 +70,7 @@ along with this program. If not, see . KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K67, K74,K7D, \ KE0,KE3,KE2,K8B,K91, K2C, K90,K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, K7E,K7B \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ + { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ -- cgit v1.2.3 From 5bff9d61818c5dd692c505896aee287168af80cc Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Wed, 16 Aug 2017 01:34:46 +0200 Subject: cleanup usb-usb converter code --- keyboards/converter/usb_usb/Makefile | 2 +- keyboards/converter/usb_usb/Makefile.8mhz | 5 - keyboards/converter/usb_usb/Makefile.debug | 6 - keyboards/converter/usb_usb/Makefile.unimap | 5 - keyboards/converter/usb_usb/README | 100 ------- keyboards/converter/usb_usb/README.md | 84 ++++++ keyboards/converter/usb_usb/config.h | 28 +- .../usb_usb/keymaps/coloneljesus/Makefile | 3 + .../usb_usb/keymaps/coloneljesus/config.h | 6 + .../usb_usb/keymaps/coloneljesus/keymap.c | 307 +++++++++++++++++++++ .../converter/usb_usb/keymaps/default/Makefile | 2 +- .../converter/usb_usb/keymaps/default/keymap.c | 262 ++---------------- keyboards/converter/usb_usb/rules.mk | 120 ++------ keyboards/converter/usb_usb/unimap.c | 45 --- keyboards/converter/usb_usb/usb_usb.h | 1 + tmk_core/protocol/usb_hid.mk | 1 - 16 files changed, 471 insertions(+), 506 deletions(-) delete mode 100644 keyboards/converter/usb_usb/Makefile.8mhz delete mode 100644 keyboards/converter/usb_usb/Makefile.debug delete mode 100644 keyboards/converter/usb_usb/Makefile.unimap delete mode 100644 keyboards/converter/usb_usb/README create mode 100644 keyboards/converter/usb_usb/README.md create mode 100644 keyboards/converter/usb_usb/keymaps/coloneljesus/Makefile create mode 100644 keyboards/converter/usb_usb/keymaps/coloneljesus/config.h create mode 100644 keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c delete mode 100644 keyboards/converter/usb_usb/unimap.c (limited to 'keyboards/converter/usb_usb') diff --git a/keyboards/converter/usb_usb/Makefile b/keyboards/converter/usb_usb/Makefile index 191c6bb66..bd09e5885 100644 --- a/keyboards/converter/usb_usb/Makefile +++ b/keyboards/converter/usb_usb/Makefile @@ -1,3 +1,3 @@ ifndef MAKEFILE_INCLUDED include ../../../Makefile -endif \ No newline at end of file +endif diff --git a/keyboards/converter/usb_usb/Makefile.8mhz b/keyboards/converter/usb_usb/Makefile.8mhz deleted file mode 100644 index 845a02be2..000000000 --- a/keyboards/converter/usb_usb/Makefile.8mhz +++ /dev/null @@ -1,5 +0,0 @@ -F_CPU = 8000000 -F_USB = 16000000 -UNIMAP_ENABLE = yes -KEYMAP_SECTION_ENABLE = yes -include Makefile diff --git a/keyboards/converter/usb_usb/Makefile.debug b/keyboards/converter/usb_usb/Makefile.debug deleted file mode 100644 index e229cd780..000000000 --- a/keyboards/converter/usb_usb/Makefile.debug +++ /dev/null @@ -1,6 +0,0 @@ -TARGET = usb_usb_debug -UNIMAP_ENABLE = yes -#KEYMAP_SECTION_ENABLE = yes -#LUFA_DEBUG = yes -OPT_DEFS += -DDEBUG_USB_HOST -include Makefile diff --git a/keyboards/converter/usb_usb/Makefile.unimap b/keyboards/converter/usb_usb/Makefile.unimap deleted file mode 100644 index cc383edaf..000000000 --- a/keyboards/converter/usb_usb/Makefile.unimap +++ /dev/null @@ -1,5 +0,0 @@ -TARGET = usb_usb_unimap -UNIMAP_ENABLE = yes -KEYMAP_SECTION_ENABLE = yes -#LUFA_DEBUG = yes -include Makefile diff --git a/keyboards/converter/usb_usb/README b/keyboards/converter/usb_usb/README deleted file mode 100644 index 742ec3292..000000000 --- a/keyboards/converter/usb_usb/README +++ /dev/null @@ -1,100 +0,0 @@ -USB to USB keyboard protocol converter -====================================== -See for detail and discussion. -https://geekhack.org/index.php?topic=69169.0 - - -Hardware requirement --------------------- -There are two options. - -### TMK USB-USB Converter -You can buy a fully assembled converter from me here. - - https://geekhack.org/index.php?topic=69169.0 - -### Arduino Leonardo + Circuit@Home USB Host Shield 2.0 -Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be better, you won't need even soldering iron. - - http://arduino.cc/en/Main/ArduinoBoardLeonardo - https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/ - -Other compatible boards like 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 --------------- -Build. - - $ git clone git://github.com/tmk/tmk_keyboard.git - $ cd tmk_keyboard - $ git submodule init - $ git submodule update - $ cd converter/usb_usb - $ make - -And Program converter. Push button on TMK converter and just run this. - - $ make dfu - - -In case of Leonardo push reset button then run 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 - - - -Limitation ----------- -Only supports 'HID Boot protocol'. - -Note that the converter can host only USB "boot protocol" keyboard(6KRO), 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. - - - -Keymap editor -------------- -You can editor keymap and download firmware with web brwoser. - -- http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb - - - -Update ------- -2014/12/11 Added Hub support(confirmed with HHKB pro2) -2016/09/10 Unimap editor support -2016/10/18 Fix LED state at startup - - - -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/keyboards/converter/usb_usb/README.md b/keyboards/converter/usb_usb/README.md new file mode 100644 index 000000000..274e11956 --- /dev/null +++ b/keyboards/converter/usb_usb/README.md @@ -0,0 +1,84 @@ +USB to USB keyboard protocol converter +====================================== +Original code from Hasu's TMK firmware. Ported to QMK by Coloneljesus. + +This port has been tested only on the Pro Micro variant described in the next section. + +See for detail and discussion. +https://geekhack.org/index.php?topic=69169.0 + + +Hardware requirement +-------------------- +There are two options. + +### TMK USB-USB Converter +You can buy a fully assembled converter from me here. + + https://geekhack.org/index.php?topic=69169.0 + +### Arduino Leonardo + Circuit@Home USB Host Shield 2.0 +Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be better, you won't need even soldering iron. + + http://arduino.cc/en/Main/ArduinoBoardLeonardo + https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/ + +Other compatible boards like 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 +-------------- +Follow normal QMK build instructions to get a binary file. Flashing depends on you hardware. + +Limitation +---------- +Only supports 'HID Boot protocol'. + +Note that the converter can host only USB "boot protocol" keyboard(6KRO), 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. + + + +Keymap editor +------------- +You can editor keymap and download firmware with web brwoser. + +- http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb + + + +Update +------ +2014/12/11 Added Hub support(confirmed with HHKB pro2) +2016/09/10 Unimap editor support +2016/10/18 Fix LED state at startup +2017/08/16 Port to QMK + + +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/keyboards/converter/usb_usb/config.h b/keyboards/converter/usb_usb/config.h index fa059feea..591d80f32 100644 --- a/keyboards/converter/usb_usb/config.h +++ b/keyboards/converter/usb_usb/config.h @@ -1,5 +1,5 @@ /* -Copyright 2012 Jun Wako +Copyright 2017 Balz Guenat 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 @@ -18,7 +18,12 @@ along with this program. If not, see . #ifndef CONFIG_H #define CONFIG_H +// do not #include "config_common.h" because the pin names conflict with the USB HID code. +// CUSTOM_MATRIX is defined it that file, though, and we need it, so we define it ourselves. +// It's a hack, yeah... +#define CUSTOM_MATRIX 2 +/* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x005B #define DEVICE_VER 0x0001 @@ -27,13 +32,32 @@ along with this program. If not, see . #define DESCRIPTION USB to USB Keyboard Converter with QMK -/* matrix size */ +/* size of virtual matrix */ #define MATRIX_ROWS 16 #define MATRIX_COLS 16 +/* matrix scanning is done in custom_matrix.cpp */ #define DIODE_DIRECTION CUSTOM_MATRIX /* key combination for command */ #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + #endif diff --git a/keyboards/converter/usb_usb/keymaps/coloneljesus/Makefile b/keyboards/converter/usb_usb/keymaps/coloneljesus/Makefile new file mode 100644 index 000000000..f5c054505 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/coloneljesus/Makefile @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../../Makefile +endif diff --git a/keyboards/converter/usb_usb/keymaps/coloneljesus/config.h b/keyboards/converter/usb_usb/keymaps/coloneljesus/config.h new file mode 100644 index 000000000..7fa3bf328 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/coloneljesus/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c b/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c new file mode 100644 index 000000000..0cc66fd53 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c @@ -0,0 +1,307 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ + +#include "usb_usb.h" + +const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* 0: plain Qwerty without layer switching + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + // KEYMAP_ALL( + // F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + // ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + // GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + // TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + // CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + // LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + // LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + // ), + KEYMAP_ALL( + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_MENU, KC_UNDO, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, + KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT + ), + KEYMAP_ALL( + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______, + KC_GRV, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + ______, KC_MUTE, KC_VOLD, KC_MPLY, ______, ______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, RESET, ______,______,______, ______, ______,______, ______,______ + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch(id) { + default: + return MACRO_NONE; + } +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} + +/* + * Keymap samples + */ +#if 0 + /* ANSI layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| + * |-----------------------------------------------------------| `-----------' |-----------| | + * |CapsL | 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| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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, 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, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), + + /* ISO layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_ISO( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 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,ENT, DEL, END, PGDN, P7, P8, P9, PPLS, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* JIS layout + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| @| [| Retn| |Del|End|PgD| | 7| 8| 9| +| + * |------------------------------------------------------` | `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| ]| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_JIS( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JPY, 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,NUHS, P4, P5, P6, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), + + /* Colemak http://colemak.com + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \| + * |-----------------------------------------------------------| + * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| + * |-----------------------------------------------------------| + * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \| + * |-----------------------------------------------------------| + * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return | + * |-----------------------------------------------------------| + * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, O, E, U, I, D, H, T, N, S, MINS, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,SCLN,Q, J, K, X, B, M, W, V, Z, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ + * ,-----------------------------------------------------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| + * |-----------------------------------------------------------| + * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \| + * |-----------------------------------------------------------| + * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| + * `-----------------------------------------------------------' + */ + KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + CAPS,A, S, H, T, G, Y, N, E, O, I, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + +/* + * SpaceFN layout + * http://geekhack.org/index.php?topic=51069.0 + */ +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: plain Qwerty + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |LCtrl | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + [0] = KEYMAP_ALL( + F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, + LCTL,LGUI,LALT,MHEN,HANJ, FN0, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT + ), + + /* 1: SpaceFN + * ,-----------------------------------------------------------. + * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | + * |-----------------------------------------------------------| + * |Caps | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | + * |-----------------------------------------------------------| + * | | | | | | |PgU|Lef|Dow|Rig| | | | + * |-----------------------------------------------------------| + * | | | | | |Spc|PgD|` |~ | |Men| | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + */ + [1] = KEYMAP_ALL( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, + TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS + ), +}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), + [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde +}; + +#endif diff --git a/keyboards/converter/usb_usb/keymaps/default/Makefile b/keyboards/converter/usb_usb/keymaps/default/Makefile index 05c674ae1..f5c054505 100644 --- a/keyboards/converter/usb_usb/keymaps/default/Makefile +++ b/keyboards/converter/usb_usb/keymaps/default/Makefile @@ -1,3 +1,3 @@ ifndef QUANTUM_DIR include ../../../../../Makefile -endif \ No newline at end of file +endif diff --git a/keyboards/converter/usb_usb/keymaps/default/keymap.c b/keyboards/converter/usb_usb/keymaps/default/keymap.c index b916855f5..9817a607d 100644 --- a/keyboards/converter/usb_usb/keymaps/default/keymap.c +++ b/keyboards/converter/usb_usb/keymaps/default/keymap.c @@ -15,18 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include -#include -#include "keycode.h" -#include "print.h" -#include "debug.h" -//#include "action.h" -//#include "action_macro.h" -//#include "report.h" - #include "usb_usb.h" - const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { /* 0: plain Qwerty without layer switching * ,---------------. ,---------------. ,---------------. @@ -46,252 +36,50 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| * `-----------------------------------------------------------' `-----------' `---------------' `-------' */ - // KEYMAP_ALL( - // F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - // ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - // GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - // TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - // CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - // LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - // LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT - // ), - KEYMAP_ALL( + [0] = KEYMAP_ALL( KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_MENU, KC_UNDO, - MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT ), - KEYMAP_ALL( + [1] = KEYMAP_ALL( ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______, - KC_GRV, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, - KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, - ______, KC_MUTE, KC_VOLD, KC_MPLY, ______, ______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, ______, ______, ______, ______, ______,______,______,______, ______,______, - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, RESET, ______,______,______, ______, ______,______, ______,______ + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______, ______,______, ______,______ ), }; -// const action_t fn_actions[] PROGMEM = {}; - -// const action_t PROGMEM fn_actions[] = { -// [0] = ACTION_LAYER_MOMENTARY(1), -// }; - +const uint16_t PROGMEM fn_actions[] = { +}; -/* - * Keymap samples - */ -#if 0 - /* ANSI layout - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| - * `---' `---------------' `---------------' `---------------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| - * |-----------------------------------------------------------| `-----------' |-----------| | - * |CapsL | 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| | - * |-----------------------------------------------------------| ,-----------. |-----------| | - * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent| - * `-----------------------------------------------------------' `-----------' `---------------' - */ - KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, - GRV, 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, 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, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT - ), +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch(id) { + default: + return MACRO_NONE; + } +}; - /* ISO layout - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| - * `---' `---------------' `---------------' `---------------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Retn| |Del|End|PgD| | 7| 8| 9| +| - * |------------------------------------------------------` | `-----------' |-----------| | - * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| | - * |-----------------------------------------------------------| ,---. |---------------| - * |Shft|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3|Ent| - * |-----------------------------------------------------------| ,-----------. |-----------| | - * |Ctl|Gui|Alt| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | - * `-----------------------------------------------------------' `-----------' `---------------' - */ - KEYMAP_ISO( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, - GRV, 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,ENT, DEL, END, PGDN, P7, P8, P9, PPLS, - LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT - ), - /* JIS layout - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| - * `---' `---------------' `---------------' `---------------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| ^|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| @| [| Retn| |Del|End|PgD| | 7| 8| 9| +| - * |------------------------------------------------------` | `-----------' |-----------| | - * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| ]| | | 4| 5| 6| | - * |-----------------------------------------------------------| ,---. |---------------| - * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| - * |-----------------------------------------------------------| ,-----------. |-----------| | - * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | - * `-----------------------------------------------------------' `-----------' `---------------' - */ - KEYMAP_JIS( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JPY, 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,NUHS, P4, P5, P6, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, - LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT - ), +void matrix_init_user(void) { - /* Colemak http://colemak.com - * ,-----------------------------------------------------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| - * |-----------------------------------------------------------| - * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \| - * |-----------------------------------------------------------| - * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| - * `----------------------------------------------------------' - */ - KEYMAP_ALL( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - LSFT,NUBS,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT - ), +} - /* Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard - * ,-----------------------------------------------------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| - * |-----------------------------------------------------------| - * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \| - * |-----------------------------------------------------------| - * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return | - * |-----------------------------------------------------------| - * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift | - * |-----------------------------------------------------------| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| - * `-----------------------------------------------------------' - */ - KEYMAP_ALL( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - CAPS,A, O, E, U, I, D, H, T, N, S, MINS, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - LSFT,NUBS,SCLN,Q, J, K, X, B, M, W, V, Z, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT - ), +void matrix_scan_user(void) { - /* Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ - * ,-----------------------------------------------------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| - * |-----------------------------------------------------------| - * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \| - * |-----------------------------------------------------------| - * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| - * `-----------------------------------------------------------' - */ - KEYMAP_ALL( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - CAPS,A, S, H, T, G, Y, N, E, O, I, QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - LSFT,NUBS,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT - ), +} +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} -/* - * SpaceFN layout - * http://geekhack.org/index.php?topic=51069.0 - */ -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: plain Qwerty - * ,---------------. ,---------------. ,---------------. - * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| - * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | - * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| - * |-----------------------------------------------------------| |-----------| |---------------| |-------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| - * |-----------------------------------------------------------| `-----------' |---------------| |-------| - * |LCtrl | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| - * |-----------------------------------------------------------| ,---. |---------------| |-------| - * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| - * |-----------------------------------------------------------| ,-----------. |---------------| |-------| - * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| - * `-----------------------------------------------------------' `-----------' `---------------' `-------' - */ - [0] = KEYMAP_ALL( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,PWR, HELP, - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, STOP,AGIN, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, - LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, - LCTL,LGUI,LALT,MHEN,HANJ, FN0, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT - ), - - /* 1: SpaceFN - * ,-----------------------------------------------------------. - * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | - * |-----------------------------------------------------------| - * |Caps | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | - * |-----------------------------------------------------------| - * | | | | | | |PgU|Lef|Dow|Rig| | | | - * |-----------------------------------------------------------| - * | | | | | |Spc|PgD|` |~ | |Men| | - * |-----------------------------------------------------------| - * | | | | | | | | | - * `-----------------------------------------------------------' - */ - [1] = KEYMAP_ALL( - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS - ), -}; - -const action_t PROGMEM fn_actions[] = { - [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), - [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde -}; +void led_set_user(uint8_t usb_led) { -#endif +} diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index 298bc5c40..4ee6cdb1c 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk @@ -1,51 +1,3 @@ -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device. -# Please customize your programmer settings(PROGRAM_CMD) -# -# make teensy = Download the hex file to the device, using teensy_loader_cli. -# (must have teensy_loader_cli installed). -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - -# Target file name (without extension). -# TARGET ?= usb_usb - -# TMK_DIR ?= ../../tmk_core - -# Directory keyboard dependent files exist -# TARGET_DIR ?= . - # MCU name MCU ?= atmega32u4 @@ -64,12 +16,12 @@ MCU ?= atmega32u4 F_CPU ?= 8000000 - # # 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 @@ -82,71 +34,33 @@ ARCH ?= AVR8 # 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 -EXTRAKEY_ENABLE ?= yes # Media control and System control -# CONSOLE_ENABLE ?= yes # Console for debug -CONSOLE_ENABLE ?= no # Console for debug -#COMMAND_ENABLE ?= yes # Commands for debug and configuration -#NKRO_ENABLE ?= yes # USB Nkey Rollover - -# Boot Section Size in bytes +# Boot Section Size in *bytes* # Teensy halfKay 512 +# Teensy++ halfKay 1024 # Atmel DFU loader 4096 # LUFA bootloader 4096 +# USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 -#LDFLAGS += -Wl,--relax - -#OPT_DEFS += -DNO_ACTION_TAPPING -#OPT_DEFS += -DNO_ACTION_LAYER -#OPT_DEFS += -DNO_ACTION_MACRO -CUSTOM_MATRIX = yes - -SRC = custom_matrix.cpp - -# -# Keymap file +# Build Options +# comment out to disable the options. # -# ifeq (yes,$(strip $(UNIMAP_ENABLE))) -# KEYMAP_FILE = unimap -# else -# ifeq (yes,$(strip $(ACTIONMAP_ENABLE))) -# KEYMAP_FILE = actionmap -# else -# KEYMAP_FILE = keymap -# endif -# endif -# ifdef KEYMAP -# SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) -# else -# SRC := $(KEYMAP_FILE).c $(SRC) -# endif - -# CONFIG_H ?= config.h - - - -# Search Path -# VPATH += $(TARGET_DIR) -# VPATH += $(TMK_DIR) - - - -# program Leonardo -# PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV) - +# BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +# 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 +# SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend +# NKRO_ENABLE ?= yes # USB Nkey Rollover - not yet supported in LUFA +# BACKLIGHT_ENABLE ?= yes +CUSTOM_MATRIX = yes +SRC = custom_matrix.cpp include $(TMK_DIR)/protocol/usb_hid.mk -# include $(TMK_DIR)/protocol/lufa.mk -# include $(TMK_DIR)/common.mk -# include $(TMK_DIR)/rules.mk diff --git a/keyboards/converter/usb_usb/unimap.c b/keyboards/converter/usb_usb/unimap.c deleted file mode 100644 index 0f34ece85..000000000 --- a/keyboards/converter/usb_usb/unimap.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2016 Jun Wako - -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 . -*/ -#include "unimap_trans.h" - - -#define AC_FN0 ACTION_LAYER_MOMENTARY(1) - -#ifdef KEYMAP_SECTION_ENABLE -const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = { -#else -const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { -#endif - UNIMAP( - F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,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, PPLS, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT, - LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,FN0, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PEQL - ), - UNIMAP( - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, - GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, INS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, - TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN, TRNS,TRNS, PGUP, TRNS,TRNS,TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS - ), -}; diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h index 91c000731..c31fae1d0 100644 --- a/keyboards/converter/usb_usb/usb_usb.h +++ b/keyboards/converter/usb_usb/usb_usb.h @@ -14,6 +14,7 @@ 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 . */ + #ifndef USB_USB_H #define USB_USB_H diff --git a/tmk_core/protocol/usb_hid.mk b/tmk_core/protocol/usb_hid.mk index 1f79bda3b..e72008097 100644 --- a/tmk_core/protocol/usb_hid.mk +++ b/tmk_core/protocol/usb_hid.mk @@ -43,7 +43,6 @@ SRC += $(USB_HID_DIR)/override_Serial.cpp # replace arduino/wiring.c SRC += $(USB_HID_DIR)/override_wiring.c -SRC += common/avr/timer.c SRC += $(USB_HOST_SHIELD_SRC) SRC += $(ARDUINO_CORES_SRC) -- cgit v1.2.3