From b4e2d325f355a4d083106476393775e75e11f284 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 9 Apr 2015 16:20:42 +0900 Subject: Change TOP_DIR to TMK_DIR in makefiles --- converter/usb_usb/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index d6867bb002..a1ceaaa4e6 100644 --- a/converter/usb_usb/Makefile +++ b/converter/usb_usb/Makefile @@ -41,7 +41,7 @@ # Target file name (without extension). TARGET = usb_usb -TOP_DIR = ../.. +TMK_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . @@ -121,7 +121,7 @@ CONFIG_H = config.h # Search Path VPATH += $(TARGET_DIR) -VPATH += $(TOP_DIR) +VPATH += $(TMK_DIR) @@ -130,7 +130,7 @@ PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV) -include $(TOP_DIR)/protocol/usb_hid.mk -include $(TOP_DIR)/protocol/lufa.mk -include $(TOP_DIR)/common.mk -include $(TOP_DIR)/rules.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 7860d09914dba5e7d2d6c1c25b62b49d1bbd2591 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 10 Apr 2015 01:53:24 +0900 Subject: Change TMK_DIR setting --- converter/usb_usb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index a1ceaaa4e6..51c9271820 100644 --- a/converter/usb_usb/Makefile +++ b/converter/usb_usb/Makefile @@ -41,7 +41,7 @@ # Target file name (without extension). TARGET = usb_usb -TMK_DIR = ../.. +TMK_DIR = ../../tmk_core # Directory keyboard dependent files exist TARGET_DIR = . -- cgit v1.2.3 From 6057e915b53728f7b9d421b604c7c4654ca58743 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 13 May 2015 13:55:11 +0900 Subject: usb_usb: Fix initialize procedure --- converter/usb_usb/Makefile | 7 ++++++- converter/usb_usb/main.cpp | 23 +++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index 51c9271820..f1a1c24d36 100644 --- a/converter/usb_usb/Makefile +++ b/converter/usb_usb/Makefile @@ -27,7 +27,7 @@ # 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, +# 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. @@ -93,6 +93,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 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 @@ -101,7 +102,11 @@ CONSOLE_ENABLE = yes # Console for debug # 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 = \ keymap_common.c \ diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp index 30fd3348a3..011baf1d66 100644 --- a/converter/usb_usb/main.cpp +++ b/converter/usb_usb/main.cpp @@ -56,12 +56,11 @@ static void LUFA_setup(void) static void HID_setup() { if (usb_host.Init() == -1) { - debug("HID init: failed\n"); LED_TX_OFF; } - + _delay_ms(200); - + kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); } @@ -72,35 +71,27 @@ int main(void) LED_TX_ON; debug_enable = true; -/* - debug_matrix = true; - debug_keyboard = true; - debug_mouse = true; -*/ host_set_driver(&lufa_driver); keyboard_init(); LUFA_setup(); + HID_setup(); + /* NOTE: Don't insert time consuming job here. + * It'll cause unclear initialization failure when DFU reset(worm start). + */ sei(); -uint8_t ret; // wait for startup of sendchar routine while (USB_DeviceState != DEVICE_STATE_Configured) ; if (debug_enable) { _delay_ms(1000); } - debug("init: start\n"); - HID_setup(); - debug("init: done\n"); uint16_t timer; -// to see loop pulse with oscillo scope -DDRF = (1<<7); for (;;) { -PORTF ^= (1<<7); keyboard_task(); timer = timer_read(); @@ -115,6 +106,6 @@ if (timer > 100) { USB_USBTask(); #endif } - + return 0; } -- cgit v1.2.3 From b8fba54a20ef940565c1b443891d7c94a91cf1fb Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 13 May 2015 15:59:49 +0900 Subject: usb_usb: Change debug LED pin config --- converter/usb_usb/main.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp index 011baf1d66..57a5de3d35 100644 --- a/converter/usb_usb/main.cpp +++ b/converter/usb_usb/main.cpp @@ -18,7 +18,28 @@ #include "debug.h" #include "keyboard.h" -#include "leonardo_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 USB usb_host; -- cgit v1.2.3 From 9a7eeb4918b947b933216c64fe257ef6385e2065 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 13 May 2015 16:08:37 +0900 Subject: usb_usb: Fix keymap --- converter/usb_usb/keymap.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c index c14a8aa553..5397de519f 100644 --- a/converter/usb_usb/keymap.c +++ b/converter/usb_usb/keymap.c @@ -19,7 +19,7 @@ along with this program. If not, see . const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: default + /* 0: plain Qwerty without layer switching * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| * `---' `---------------' `---------------' `---------------' `-----------' `-----------' @@ -37,28 +37,6 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ KEYMAP( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT - ), - - /* 1: plain Qwerty without layer switching - * ,-----------------------------------------------------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| - * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - * |-----------------------------------------------------------| - * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | - * |-----------------------------------------------------------| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| - * `-----------------------------------------------------------' - */ - KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, @@ -66,7 +44,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), - /* 2: Colemak http://colemak.com + /* 1: Colemak http://colemak.com * ,-----------------------------------------------------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| * |-----------------------------------------------------------| @@ -88,7 +66,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), - /* 3: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard + /* 2: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard * ,-----------------------------------------------------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| * |-----------------------------------------------------------| @@ -110,7 +88,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), - /* 4: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ + /* 3: 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| * |-----------------------------------------------------------| -- cgit v1.2.3 From 6f5e8ce17e89005130cd0f9ecc6e346a77bb624b Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 15 Jul 2015 15:13:15 +0900 Subject: usb_usb: Support locking key indicator LED --- converter/usb_usb/Makefile | 1 - converter/usb_usb/led.c | 24 ------------------------ converter/usb_usb/main.cpp | 44 ++++++++++++++++++++++---------------------- 3 files changed, 22 insertions(+), 47 deletions(-) delete mode 100644 converter/usb_usb/led.c (limited to 'converter/usb_usb') diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index f1a1c24d36..0f25232b25 100644 --- a/converter/usb_usb/Makefile +++ b/converter/usb_usb/Makefile @@ -111,7 +111,6 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 SRC = \ keymap_common.c \ matrix.c \ - led.c \ main.cpp ifdef KEYMAP diff --git a/converter/usb_usb/led.c b/converter/usb_usb/led.c deleted file mode 100644 index fc0eeb0ff7..0000000000 --- a/converter/usb_usb/led.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -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 . -*/ - -#include "stdint.h" -#include "led.h" - - -void led_set(uint8_t usb_led) -{ -} diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp index 57a5de3d35..652c805734 100644 --- a/converter/usb_usb/main.cpp +++ b/converter/usb_usb/main.cpp @@ -5,10 +5,10 @@ // USB HID host #include "Usb.h" +#include "usbhub.h" #include "hid.h" #include "hidboot.h" #include "parser.h" -#include "usbhub.h" // LUFA #include "lufa.h" @@ -17,6 +17,7 @@ #include "sendchar.h" #include "debug.h" #include "keyboard.h" +#include "led.h" /* LED ping configuration */ @@ -42,19 +43,6 @@ #endif -static USB usb_host; -static HIDBoot kbd(&usb_host); -static KBDReportParser kbd_parser; -static USBHub hub1(&usb_host); // one hub is enough for HHKB pro2 -/* may be needed for other device with more hub -static USBHub hub2(&usb_host); -static USBHub hub3(&usb_host); -static USBHub hub4(&usb_host); -static USBHub hub5(&usb_host); -static USBHub hub6(&usb_host); -static USBHub hub7(&usb_host); -*/ - static void LUFA_setup(void) { /* Disable watchdog if enabled by bootloader/fuses */ @@ -74,17 +62,24 @@ static void LUFA_setup(void) print_set_sendchar(sendchar); } -static void HID_setup() -{ - if (usb_host.Init() == -1) { - LED_TX_OFF; - } - _delay_ms(200); - kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); +/* + * USB Host Shield HID keyboard + */ +USB usb_host; +USBHub hub1(&usb_host); +HIDBoot kbd(&usb_host); +KBDReportParser kbd_parser; + + +void led_set(uint8_t usb_led) +{ + kbd.SetReport(0, 0, 2, 0, 1, &usb_led); } + + int main(void) { // LED for debug @@ -92,12 +87,17 @@ int main(void) LED_TX_ON; debug_enable = true; + debug_keyboard = true; host_set_driver(&lufa_driver); keyboard_init(); LUFA_setup(); - HID_setup(); + + // USB Host Shield setup + usb_host.Init(); + kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); + /* NOTE: Don't insert time consuming job here. * It'll cause unclear initialization failure when DFU reset(worm start). */ -- cgit v1.2.3