From 292ffa0846a684d6c14128750ce375d3dfa6c836 Mon Sep 17 00:00:00 2001 From: Oleg Kostyuk Date: Thu, 20 Nov 2014 23:55:47 +0200 Subject: [PATCH 01/34] Documentation: small mistake Originally reported as https://github.com/cub-uanic/tmk_keyboard/issues/10, all credits to @olivierpons --- doc/keycode.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/keycode.txt b/doc/keycode.txt index 41375669..760c726e 100644 --- a/doc/keycode.txt +++ b/doc/keycode.txt @@ -81,7 +81,7 @@ KC_F12 45 Keyboard F12 KC_PSCREEN KC_PSCR 46 Keyboard PrintScreen1 KC_SCKLOCK KC_SLCK 47 Keyboard Scroll Lock11 KC_PAUSE KC_PAUS 48 Keyboard Pause1 -KC_INSERT KC_INT 49 Keyboard Insert1 +KC_INSERT KC_INS 49 Keyboard Insert1 KC_HOME 4A Keyboard Home1 KC_PGUP 4B Keyboard PageUp1 KC_DELETE KC_DELETE 4C Keyboard Delete Forward From 630e11e7c477eaa3347dd36a704f53a65b392e7a Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 22 Nov 2012 10:06:02 +0900 Subject: [PATCH 02/34] Fix endpoint buffer setting for AT90USB82/162. --- protocol/pjrc/MEMO.txt | 25 +++++++++++++++++++++++++ protocol/pjrc/usb.h | 2 +- protocol/pjrc/usb_mouse.h | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 protocol/pjrc/MEMO.txt diff --git a/protocol/pjrc/MEMO.txt b/protocol/pjrc/MEMO.txt new file mode 100644 index 00000000..b0f05983 --- /dev/null +++ b/protocol/pjrc/MEMO.txt @@ -0,0 +1,25 @@ +Endpoint configuration +---------------------- +0 Control endpoint +1 keyboard +2 mouse +3 debug +4 extra key(consumer/system) +5 nkro keyboard(supported only on ATmega32U4/16U4 and AT90USB64/128) + + +ATmega32U4/16U4, AT90USB64/128 +• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint +• Endpoints 1 programmable size FIFO up to 256 bytes in ping-pong mode. +• Endpoints 2 to 6: programmable size FIFO up to 64 bytes in ping-pong mode. + +AT90USB82/162, ATmega8U2/16U2/32U2 +• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint +• Endpoints 1 and 2: programmable size FIFO up to 64 bytes. +• Endpoints 3 and 4: programmable size FIFO up to 64 bytes with ping-pong mode. + +ping-pong mode means double buffer feature. + + +NOTE: ATmega8U2/16U2/32U2 is not supported with PJRC stack at this time. +TODO: Macro definition for ATmega8U2/16U2/32U2 in usb.h diff --git a/protocol/pjrc/usb.h b/protocol/pjrc/usb.h index 0eb58fc3..a195b671 100644 --- a/protocol/pjrc/usb.h +++ b/protocol/pjrc/usb.h @@ -122,7 +122,7 @@ void usb_remote_wakeup(void); #define KBD_INTERFACE 0 #define KBD_ENDPOINT 1 #define KBD_SIZE 8 -#define KBD_BUFFER EP_DOUBLE_BUFFER +#define KBD_BUFFER EP_SINGLE_BUFFER #define KBD_REPORT_KEYS (KBD_SIZE - 2) // secondary keyboard diff --git a/protocol/pjrc/usb_mouse.h b/protocol/pjrc/usb_mouse.h index eb305612..ce26887c 100644 --- a/protocol/pjrc/usb_mouse.h +++ b/protocol/pjrc/usb_mouse.h @@ -32,7 +32,7 @@ #define MOUSE_INTERFACE 1 #define MOUSE_ENDPOINT 2 #define MOUSE_SIZE 8 -#define MOUSE_BUFFER EP_DOUBLE_BUFFER +#define MOUSE_BUFFER EP_SINGLE_BUFFER #define MOUSE_BTN1 (1<<0) #define MOUSE_BTN2 (1<<1) From f6615d95579b58b4937a7da695e3e4052a378d4f Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Sun, 30 Nov 2014 13:27:59 -0500 Subject: [PATCH 03/34] Fixing typo in console mode --- common/command.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/command.c b/common/command.c index 971ef7f0..380f2d8c 100644 --- a/common/command.c +++ b/common/command.c @@ -302,7 +302,7 @@ static bool command_common(uint8_t code) #endif " " STR(BOOTLOADER_SIZE) "\n"); - print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) + print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); break; @@ -541,12 +541,12 @@ static void mousekey_console_help(void) print("4: select mk_time_to_max\n"); print("5: select mk_wheel_max_speed\n"); print("6: select mk_wheel_time_to_max\n"); - print("p: print prameters\n"); + print("p: print parameters\n"); print("d: set default values\n"); - print("up: increase prameters(+1)\n"); - print("down: decrease prameters(-1)\n"); - print("pgup: increase prameters(+10)\n"); - print("pgdown: decrease prameters(-10)\n"); + print("up: increase parameters(+1)\n"); + print("down: decrease parameters(-1)\n"); + print("pgup: increase parameters(+10)\n"); + print("pgdown: decrease parameters(-10)\n"); print("\nspeed = delta * max_speed * (repeat / time_to_max)\n"); print("where delta: cursor="); pdec(MOUSEKEY_MOVE_DELTA); print(", wheel="); pdec(MOUSEKEY_WHEEL_DELTA); print("\n"); From 3a5a8659800feeff5560481253f1ee2bb73af1a1 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 5 Dec 2014 09:59:08 +0900 Subject: [PATCH 04/34] usb_usb: Update for new core layout --- common/print.h | 5 ----- protocol/usb_hid.mk | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/common/print.h b/common/print.h index a8dbbc02..c0e9e143 100644 --- a/common/print.h +++ b/common/print.h @@ -38,12 +38,7 @@ #if defined(__AVR__) #include "avr/xprintf.h" - - -// TODO: avoid collision with arduino/Print.h -#ifndef __cplusplus #define print(s) xputs(PSTR(s)) -#endif #define println(s) xputs(PSTR(s "\r\n")) #ifdef __cplusplus diff --git a/protocol/usb_hid.mk b/protocol/usb_hid.mk index fb4916d5..6914dce8 100644 --- a/protocol/usb_hid.mk +++ b/protocol/usb_hid.mk @@ -42,7 +42,7 @@ SRC += $(USB_HID_DIR)/override_Serial.cpp # replace arduino/wiring.c SRC += $(USB_HID_DIR)/override_wiring.c -SRC += common/timer.c +SRC += common/avr/timer.c SRC += $(USB_HOST_SHIELD_SRC) SRC += $(ARDUINO_CORES_SRC) From f2712ee19ff60d4888089e0c40035f38910a30de Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Wed, 10 Dec 2014 15:20:32 +0900 Subject: [PATCH 05/34] Remove submodule USB_Host_Shield_2.0 --- .gitmodules | 3 --- protocol/usb_hid/USB_Host_Shield_2.0 | 1 - 2 files changed, 4 deletions(-) delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0 diff --git a/.gitmodules b/.gitmodules index 17a20dec..eef19ae0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "protocol/usb_hid/USB_Host_Shield_2.0"] - path = protocol/usb_hid/USB_Host_Shield_2.0 - url = git@github.com:tmk/USB_Host_Shield_2.0.git [submodule "protocol/lufa/LUFA-git"] path = protocol/lufa/LUFA-git url = https://github.com/abcminiuser/lufa.git diff --git a/protocol/usb_hid/USB_Host_Shield_2.0 b/protocol/usb_hid/USB_Host_Shield_2.0 deleted file mode 160000 index 8bb790f8..00000000 --- a/protocol/usb_hid/USB_Host_Shield_2.0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8bb790f83af298b5f3e5516259c9d8ec27efe522 From 66cfd88bd0796abc2ee4141adf8c541ab9a91165 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Wed, 10 Dec 2014 15:54:24 +0900 Subject: [PATCH 06/34] Add submodule legitimate USB_Host_Shield_2.0 --- .gitmodules | 3 +++ protocol/usb_hid/USB_Host_Shield_2.0 | 1 + 2 files changed, 4 insertions(+) create mode 160000 protocol/usb_hid/USB_Host_Shield_2.0 diff --git a/.gitmodules b/.gitmodules index eef19ae0..e21f4496 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "protocol/lufa/LUFA-git"] path = protocol/lufa/LUFA-git url = https://github.com/abcminiuser/lufa.git +[submodule "protocol/usb_hid/USB_Host_Shield_2.0"] + path = protocol/usb_hid/USB_Host_Shield_2.0 + url = https://github.com/felis/USB_Host_Shield_2.0.git diff --git a/protocol/usb_hid/USB_Host_Shield_2.0 b/protocol/usb_hid/USB_Host_Shield_2.0 new file mode 160000 index 00000000..2b4a56de --- /dev/null +++ b/protocol/usb_hid/USB_Host_Shield_2.0 @@ -0,0 +1 @@ +Subproject commit 2b4a56de3d090686f62d25ea34042759dc4352d6 From d59ab7148570b8362cdebea16168954c9433aa34 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Wed, 10 Dec 2014 23:52:38 +0900 Subject: [PATCH 07/34] Add USB Hub support --- protocol/usb_hid.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol/usb_hid.mk b/protocol/usb_hid.mk index 6914dce8..8fda76c2 100644 --- a/protocol/usb_hid.mk +++ b/protocol/usb_hid.mk @@ -8,6 +8,7 @@ USB_HOST_SHIELD_DIR = $(USB_HID_DIR)/USB_Host_Shield_2.0 USB_HOST_SHIELD_SRC = \ $(USB_HOST_SHIELD_DIR)/Usb.cpp \ $(USB_HOST_SHIELD_DIR)/hid.cpp \ + $(USB_HOST_SHIELD_DIR)/usbhub.cpp \ $(USB_HOST_SHIELD_DIR)/parsetools.cpp \ $(USB_HOST_SHIELD_DIR)/message.cpp From e8d098e7cf52be8683b941628174b876326fb00d Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 24 Dec 2014 11:11:07 +0900 Subject: [PATCH 08/34] [ps2,terminal_usb] Quick fix for build problem --- protocol.mk | 2 ++ protocol/ps2_io_avr.c | 1 + 2 files changed, 3 insertions(+) diff --git a/protocol.mk b/protocol.mk index e057d1d6..d9194b2b 100644 --- a/protocol.mk +++ b/protocol.mk @@ -15,11 +15,13 @@ endif ifdef PS2_USE_INT SRC += protocol/ps2_interrupt.c + SRC += protocol/ps2_io_avr.c OPT_DEFS += -DPS2_USE_INT endif ifdef PS2_USE_USART SRC += protocol/ps2_usart.c + SRC += protocol/ps2_io_avr.c OPT_DEFS += -DPS2_USE_USART endif diff --git a/protocol/ps2_io_avr.c b/protocol/ps2_io_avr.c index be13d669..ed462345 100644 --- a/protocol/ps2_io_avr.c +++ b/protocol/ps2_io_avr.c @@ -1,4 +1,5 @@ #include +#include #include /* Check port settings for clock and data line */ From 4b885ceb4458ebd41cb2b16fc56f185f5e4185b6 Mon Sep 17 00:00:00 2001 From: Colt Ma Date: Fri, 26 Dec 2014 11:02:25 +0800 Subject: [PATCH 09/34] Add keycode for Fast Forward & Rewind KC_MEDIA_FAST_FORWARD KC_MEDIA_REWIND --- common/keycode.h | 6 +++++- common/report.h | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/keycode.h b/common/keycode.h index 08c3cbf4..074e0f68 100644 --- a/common/keycode.h +++ b/common/keycode.h @@ -140,6 +140,8 @@ along with this program. If not, see . #define KC_VOLD KC_AUDIO_VOL_DOWN #define KC_MNXT KC_MEDIA_NEXT_TRACK #define KC_MPRV KC_MEDIA_PREV_TRACK +#define KC_MFFD KC_MEDIA_FAST_FORWARD +#define KC_MRWD KC_MEDIA_REWIND #define KC_MSTP KC_MEDIA_STOP #define KC_MPLY KC_MEDIA_PLAY_PAUSE #define KC_MSEL KC_MEDIA_SELECT @@ -420,7 +422,9 @@ enum internal_special_keycodes { KC_WWW_FORWARD, KC_WWW_STOP, KC_WWW_REFRESH, - KC_WWW_FAVORITES, /* 0xBA */ + KC_WWW_FAVORITES, + KC_MEDIA_FAST_FORWARD, + KC_MEDIA_REWIND, /* 0xBC */ /* Fn key */ KC_FN0 = 0xC0, diff --git a/common/report.h b/common/report.h index 62190469..f6c0a315 100644 --- a/common/report.h +++ b/common/report.h @@ -61,6 +61,7 @@ along with this program. If not, see . /* supplement for Bluegiga iWRAP HID(not supported by Windows?) */ #define AL_LOCK 0x019E #define TRANSPORT_RECORD 0x00B2 +#define TRANSPORT_FAST_FORWARD 0x00B3 #define TRANSPORT_REWIND 0x00B4 #define TRANSPORT_EJECT 0x00B8 #define AC_MINIMIZE 0x0206 @@ -158,6 +159,8 @@ typedef struct { (key == KC_AUDIO_VOL_DOWN ? AUDIO_VOL_DOWN : \ (key == KC_MEDIA_NEXT_TRACK ? TRANSPORT_NEXT_TRACK : \ (key == KC_MEDIA_PREV_TRACK ? TRANSPORT_PREV_TRACK : \ + (key == KC_MEDIA_FAST_FORWARD ? TRANSPORT_FAST_FORWARD : \ + (key == KC_MEDIA_REWIND ? TRANSPORT_REWIND : \ (key == KC_MEDIA_STOP ? TRANSPORT_STOP : \ (key == KC_MEDIA_EJECT ? TRANSPORT_STOP_EJECT : \ (key == KC_MEDIA_PLAY_PAUSE ? TRANSPORT_PLAY_PAUSE : \ @@ -171,7 +174,7 @@ typedef struct { (key == KC_WWW_FORWARD ? AC_FORWARD : \ (key == KC_WWW_STOP ? AC_STOP : \ (key == KC_WWW_REFRESH ? AC_REFRESH : \ - (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0))))))))))))))))))) + (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0))))))))))))))))))))) #ifdef __cplusplus } From d0ee08e1733f0016c331bf5afcb6d29be81806fa Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 26 Dec 2014 13:27:06 +0900 Subject: [PATCH 10/34] Remove unwanted white space --- common/keycode.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/keycode.h b/common/keycode.h index 074e0f68..ac4ef00d 100644 --- a/common/keycode.h +++ b/common/keycode.h @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* +/* * Keycodes based on HID Usage Keyboard/Keypad Page(0x07) plus special codes * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf */ @@ -392,7 +392,7 @@ enum hid_keyboard_keypad_usage { KC_RALT, KC_RGUI, - /* NOTE: 0xE8-FF are used for internal special purpose */ + /* NOTE: 0xE8-FF are used for internal special purpose */ }; /* Special keycodes */ @@ -422,7 +422,7 @@ enum internal_special_keycodes { KC_WWW_FORWARD, KC_WWW_STOP, KC_WWW_REFRESH, - KC_WWW_FAVORITES, + KC_WWW_FAVORITES, KC_MEDIA_FAST_FORWARD, KC_MEDIA_REWIND, /* 0xBC */ From 1100998502e2bd058b016a9d64ee10fb2b551936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Ov=C4=8D=C3=A1=C4=8D=C3=ADk?= Date: Sun, 28 Dec 2014 09:49:57 +0100 Subject: [PATCH 11/34] Added support for The Ghost Squid controller used for CM XT keyboard. - initial commit - created as clone of the kitten_paw subproject with pins adjusted for CM XT --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a01de8c6..550f1267 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired] * [KMAC](keyboard/kmac/) - Korean custom keyboard * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard +* [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt] [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 @@ -72,6 +73,8 @@ You can find some keyboard specific projects under `converter` and `keyboard` di [PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 [Sun]: http://en.wikipedia.org/wiki/Sun-3 [IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS +[ghost_squid]: http://deskthority.net/wiki/Costar_replacement_controllers#The_Ghost_Squid +[cmxt]: http://gaming.coolermaster.com/en/products/keyboards/quickfirext/ From c0880e5011043f37937d347295604fd03248ed15 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 1 Jan 2015 12:17:11 +0900 Subject: [PATCH 12/34] Fix modifier stuck of Lock command(#127) --- common/command.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/command.c b/common/command.c index 971ef7f0..1a507e3a 100644 --- a/common/command.c +++ b/common/command.c @@ -194,6 +194,7 @@ static bool command_common(uint8_t code) case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); + clear_keyboard(); host_set_driver(0); print("Locked.\n"); } else { From 9dd9deac0430b57ca8b2d516aa24d5de86ade8f8 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 3 Jan 2015 12:02:48 +0900 Subject: [PATCH 13/34] bluefruit, pjrc: Update protocols for new API --- protocol/bluefruit/bluefruit.c | 4 ++-- protocol/bluefruit/main.c | 2 +- protocol/pjrc/main.c | 3 ++- protocol/pjrc/usb_keyboard.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/protocol/bluefruit/bluefruit.c b/protocol/bluefruit/bluefruit.c index f991e4d0..cf26b83d 100644 --- a/protocol/bluefruit/bluefruit.c +++ b/protocol/bluefruit/bluefruit.c @@ -36,7 +36,7 @@ static void bluefruit_serial_send(uint8_t); void bluefruit_keyboard_print_report(report_keyboard_t *report) { if (!debug_keyboard) return; - dprintf("keys: "); for (int i = 0; i < REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); } + dprintf("keys: "); for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); } dprintf(" mods: "); debug_hex8(report->mods); dprintf(" reserved: "); debug_hex8(report->reserved); dprintf("\n"); @@ -99,7 +99,7 @@ static void send_keyboard(report_keyboard_t *report) bluefruit_trace_header(); #endif bluefruit_serial_send(0xFD); - for (uint8_t i = 0; i < REPORT_SIZE; i++) { + for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) { bluefruit_serial_send(report->raw[i]); } #ifdef BLUEFRUIT_TRACE_SERIAL diff --git a/protocol/bluefruit/main.c b/protocol/bluefruit/main.c index 871062ab..094fdb36 100644 --- a/protocol/bluefruit/main.c +++ b/protocol/bluefruit/main.c @@ -104,7 +104,7 @@ int main(void) dprintf("Starting main loop"); while (1) { while (suspend) { - suspend_power_down(); + suspend_power_down(WDTO_120MS); if (remote_wakeup && suspend_wakeup_condition()) { usb_remote_wakeup(); } diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c index 1ef87f86..4f87a173 100644 --- a/protocol/pjrc/main.c +++ b/protocol/pjrc/main.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "keyboard.h" #include "usb.h" @@ -60,7 +61,7 @@ int main(void) #endif while (1) { while (suspend) { - suspend_power_down(); + suspend_power_down(WDTO_120MS); if (remote_wakeup && suspend_wakeup_condition()) { usb_remote_wakeup(); } diff --git a/protocol/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c index 758a4edc..4b87b5d7 100644 --- a/protocol/pjrc/usb_keyboard.c +++ b/protocol/pjrc/usb_keyboard.c @@ -74,7 +74,7 @@ void usb_keyboard_print_report(report_keyboard_t *report) { if (!debug_keyboard) return; print("keys: "); - for (int i = 0; i < REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); } + for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); } print(" mods: "); phex(report->mods); print("\n"); } From b0363d2ecd5b05f5fbd12aef2850e21d3896a240 Mon Sep 17 00:00:00 2001 From: Oleg Kostyuk Date: Sat, 3 Jan 2015 15:10:45 +0200 Subject: [PATCH 14/34] Update other_projects.md - added TMK/Ergodox --- doc/other_projects.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/other_projects.md b/doc/other_projects.md index ce24e0ab..bf980b0a 100644 --- a/doc/other_projects.md +++ b/doc/other_projects.md @@ -29,6 +29,7 @@ Other Keyboard Firmware Projects ## ErgoDox[Ergo][Split][USB][AVR] - - +- ## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR] - From b4b17507b6d1a3675dc7fbfd885dd31fcc351efa Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 12 Dec 2014 14:05:05 +0900 Subject: [PATCH 15/34] Ad hoc fix of print and debug for mbed --- common/print.c | 12 ++++++++++-- tool/mbed/common.mk | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/print.c b/common/print.c index c13a29f3..ca94e1e5 100644 --- a/common/print.c +++ b/common/print.c @@ -22,13 +22,14 @@ * THE SOFTWARE. */ -#include -#include +#include #include "print.h" #ifndef NO_PRINT +#if defined(__AVR__) + #define sendchar(c) xputc(c) @@ -37,4 +38,11 @@ void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) xdev_out(sendchar_func); } +#elif defined(__arm__) + +// TODO +//void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { } + +#endif + #endif diff --git a/tool/mbed/common.mk b/tool/mbed/common.mk index 93a927a3..403da9ac 100644 --- a/tool/mbed/common.mk +++ b/tool/mbed/common.mk @@ -7,6 +7,8 @@ OBJECTS += \ $(OBJDIR)/common/host.o \ $(OBJDIR)/common/keymap.o \ $(OBJDIR)/common/keyboard.o \ + $(OBJDIR)/common/print.o \ + $(OBJDIR)/common/debug.o \ $(OBJDIR)/common/util.o \ $(OBJDIR)/common/mbed/suspend.o \ $(OBJDIR)/common/mbed/timer.o \ From 1f33eecf84d4fd10771a18f95c8890f47e4bad78 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 14 Dec 2014 13:59:22 +0900 Subject: [PATCH 16/34] Update makefiles to mbed-sdk 14666bb --- tool/mbed/gcc.mk | 37 +++++++---- tool/mbed/lpc11u35_501.mk | 49 ++++++++++++++ tool/mbed/mbed.mk | 132 ++++++++++++++++---------------------- 3 files changed, 128 insertions(+), 90 deletions(-) create mode 100644 tool/mbed/lpc11u35_501.mk diff --git a/tool/mbed/gcc.mk b/tool/mbed/gcc.mk index 032f7c6c..b8c7336b 100644 --- a/tool/mbed/gcc.mk +++ b/tool/mbed/gcc.mk @@ -1,4 +1,6 @@ -############################################################################### +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + GCC_BIN = AS = $(GCC_BIN)arm-none-eabi-as CC = $(GCC_BIN)arm-none-eabi-gcc @@ -9,13 +11,21 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump SIZE = $(GCC_BIN)arm-none-eabi-size CHKSUM = $(TMK_DIR)/tool/mbed/lpc-vector-checksum -CPU = -mcpu=cortex-m0 -mthumb - -CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections +CC_FLAGS += \ + $(CPU) \ + -c \ + -g \ + -fno-common \ + -fmessage-length=0 \ + -Wall \ + -fno-exceptions \ + -ffunction-sections \ + -fdata-sections \ + -fomit-frame-pointer CC_FLAGS += -MMD -MP -CC_SYMBOLS = -DTARGET_LPC11U35_401 -DTARGET_M0 -DTARGET_NXP -DTARGET_LPC11UXX -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M0 -DARM_MATH_CM0 -DMBED_BUILD_TIMESTAMP=1399108688.49 -D__MBED__=1 -LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs +LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs +#LD_FLAGS += -u _printf_float -u _scanf_float LD_FLAGS += -Wl,-Map=$(OBJDIR)/$(PROJECT).map,--cref LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys @@ -25,7 +35,7 @@ else CC_FLAGS += -DNDEBUG -Os endif -all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex size +all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex clean: rm -f $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).elf $(OBJDIR)/$(PROJECT).hex $(OBJDIR)/$(PROJECT).map $(OBJDIR)/$(PROJECT).lst $(OBJECTS) $(DEPS) @@ -41,22 +51,21 @@ $(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: %.cpp mkdir -p $(@D) - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $< $(OBJDIR)/$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS) - @echo "" - @echo "*****" - @echo "***** You must modify vector checksum value in *.bin and *.hex files." - @echo "*****" - @echo "" + $(SIZE) $@ $(OBJDIR)/$(PROJECT).bin: $(OBJDIR)/$(PROJECT).elf @$(OBJCOPY) -O binary $< $@ - @echo "Writing vector checksum value into $@ ..." +ifneq (,$(findstring TARGET_NXP,$(CC_SYMBOLS))) + @echo + @echo "For NXP writing vector checksum value into $@ ..." @$(CHKSUM) $@ @echo +endif $(OBJDIR)/$(PROJECT).hex: $(OBJDIR)/$(PROJECT).elf @$(OBJCOPY) -O ihex $< $@ diff --git a/tool/mbed/lpc11u35_501.mk b/tool/mbed/lpc11u35_501.mk new file mode 100644 index 00000000..af1aad79 --- /dev/null +++ b/tool/mbed/lpc11u35_501.mk @@ -0,0 +1,49 @@ +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + +CPU = -mcpu=cortex-m0 -mthumb + +CC_SYMBOLS = \ + -DTARGET_LPC11U35_501 \ + -DTARGET_M0 \ + -DTARGET_CORTEX_M \ + -DTARGET_NXP \ + -DTARGET_LPC11UXX \ + -DTARGET_MCU_LPC11U35_501 \ + -DTOOLCHAIN_GCC_ARM \ + -DTOOLCHAIN_GCC \ + -D__CORTEX_M0 \ + -DARM_MATH_CM0 \ + -D__MBED__=1 + +OBJECTS += \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/PeripheralPins.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.o + +INCLUDE_PATHS += \ + -I$(MBED_DIR)/libraries/mbed/targets \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 \ + +LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501/LPC11U35.ld diff --git a/tool/mbed/mbed.mk b/tool/mbed/mbed.mk index 0f12ee2a..242d7879 100644 --- a/tool/mbed/mbed.mk +++ b/tool/mbed/mbed.mk @@ -1,99 +1,79 @@ +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + OBJECTS += \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.o \ - $(OBJDIR)/libraries/mbed/common/board.o \ - $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ - $(OBJDIR)/libraries/mbed/common/exit.o \ - $(OBJDIR)/libraries/mbed/common/rtc_time.o \ - $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ - $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ - $(OBJDIR)/libraries/mbed/common/error.o \ - $(OBJDIR)/libraries/mbed/common/gpio.o \ - $(OBJDIR)/libraries/mbed/common/semihost_api.o \ - $(OBJDIR)/libraries/mbed/common/wait_api.o \ - $(OBJDIR)/libraries/mbed/common/RawSerial.o \ - $(OBJDIR)/libraries/mbed/common/Ticker.o \ - $(OBJDIR)/libraries/mbed/common/FilePath.o \ - $(OBJDIR)/libraries/mbed/common/I2C.o \ - $(OBJDIR)/libraries/mbed/common/FileBase.o \ - $(OBJDIR)/libraries/mbed/common/retarget.o \ - $(OBJDIR)/libraries/mbed/common/Serial.o \ - $(OBJDIR)/libraries/mbed/common/Stream.o \ - $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ - $(OBJDIR)/libraries/mbed/common/CallChain.o \ - $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ - $(OBJDIR)/libraries/mbed/common/SerialBase.o \ - $(OBJDIR)/libraries/mbed/common/BusInOut.o \ - $(OBJDIR)/libraries/mbed/common/SPISlave.o \ - $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ - $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ - $(OBJDIR)/libraries/mbed/common/Timer.o \ - $(OBJDIR)/libraries/mbed/common/SPI.o \ - $(OBJDIR)/libraries/mbed/common/Timeout.o \ - $(OBJDIR)/libraries/mbed/common/Ethernet.o \ - $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ - $(OBJDIR)/libraries/mbed/common/CAN.o \ - $(OBJDIR)/libraries/mbed/common/BusOut.o \ - $(OBJDIR)/libraries/mbed/common/FileLike.o \ $(OBJDIR)/libraries/mbed/common/BusIn.o \ + $(OBJDIR)/libraries/mbed/common/BusInOut.o \ + $(OBJDIR)/libraries/mbed/common/BusOut.o \ + $(OBJDIR)/libraries/mbed/common/CAN.o \ + $(OBJDIR)/libraries/mbed/common/CallChain.o \ + $(OBJDIR)/libraries/mbed/common/Ethernet.o \ + $(OBJDIR)/libraries/mbed/common/FileBase.o \ + $(OBJDIR)/libraries/mbed/common/FileLike.o \ + $(OBJDIR)/libraries/mbed/common/FilePath.o \ + $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ + $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ + $(OBJDIR)/libraries/mbed/common/I2C.o \ + $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ + $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ + $(OBJDIR)/libraries/mbed/common/RawSerial.o \ + $(OBJDIR)/libraries/mbed/common/SPI.o \ + $(OBJDIR)/libraries/mbed/common/SPISlave.o \ + $(OBJDIR)/libraries/mbed/common/Serial.o \ + $(OBJDIR)/libraries/mbed/common/SerialBase.o \ + $(OBJDIR)/libraries/mbed/common/Stream.o \ + $(OBJDIR)/libraries/mbed/common/Ticker.o \ + $(OBJDIR)/libraries/mbed/common/Timeout.o \ + $(OBJDIR)/libraries/mbed/common/Timer.o \ + $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ + $(OBJDIR)/libraries/mbed/common/assert.o \ + $(OBJDIR)/libraries/mbed/common/board.o \ + $(OBJDIR)/libraries/mbed/common/error.o \ + $(OBJDIR)/libraries/mbed/common/exit.o \ + $(OBJDIR)/libraries/mbed/common/gpio.o \ + $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ + $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ + $(OBJDIR)/libraries/mbed/common/retarget.o \ + $(OBJDIR)/libraries/mbed/common/rtc_time.o \ + $(OBJDIR)/libraries/mbed/common/semihost_api.o \ + $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ + $(OBJDIR)/libraries/mbed/common/wait_api.o \ + $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ + $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ - $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ + $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ + $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ - $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o + $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ + $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o INCLUDE_PATHS += \ - -I$(MBED_DIR)/libraries/mbed/targets \ - -I$(MBED_DIR)/libraries/mbed/targets/hal \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPC11U35_401 \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401 \ -I$(MBED_DIR)/libraries/mbed \ - -I$(MBED_DIR)/libraries/mbed/hal \ -I$(MBED_DIR)/libraries/mbed/api \ -I$(MBED_DIR)/libraries/mbed/common \ + -I$(MBED_DIR)/libraries/mbed/hal \ -I$(MBED_DIR)/libraries/USBDevice \ - -I$(MBED_DIR)/libraries/USBDevice/USBHID \ - -I$(MBED_DIR)/libraries/USBDevice/USBDevice \ -I$(MBED_DIR)/libraries/USBDevice/USBAudio \ - -I$(MBED_DIR)/libraries/USBDevice/USBSerial \ + -I$(MBED_DIR)/libraries/USBDevice/USBDevice \ + -I$(MBED_DIR)/libraries/USBDevice/USBHID \ + -I$(MBED_DIR)/libraries/USBDevice/USBMIDI \ -I$(MBED_DIR)/libraries/USBDevice/USBMSD \ - -I$(MBED_DIR)/libraries/USBDevice/USBMIDI + -I$(MBED_DIR)/libraries/USBDevice/USBSerial +# TMK mbed protocol OBJECTS += \ $(OBJDIR)/protocol/mbed/mbed_driver.o \ - $(OBJDIR)/protocol/mbed/HIDKeyboard.o \ + $(OBJDIR)/protocol/mbed/HIDKeyboard.o INCLUDE_PATHS += \ -I$(TMK_DIR)/protocol/mbed - -LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401/LPC11U35.ld From 37319210633c0972f969b41924a0f4f6f4e353e8 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 14 Dec 2014 15:52:33 +0900 Subject: [PATCH 17/34] Fix ps2 protocol build using ps2_io.h --- protocol/ps2_interrupt.c | 1 + protocol/ps2_usart.c | 1 + 2 files changed, 2 insertions(+) diff --git a/protocol/ps2_interrupt.c b/protocol/ps2_interrupt.c index 259d2540..8114442b 100644 --- a/protocol/ps2_interrupt.c +++ b/protocol/ps2_interrupt.c @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "ps2.h" +#include "ps2_io.h" #include "print.h" diff --git a/protocol/ps2_usart.c b/protocol/ps2_usart.c index c2d9d0a2..6936ca7b 100644 --- a/protocol/ps2_usart.c +++ b/protocol/ps2_usart.c @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "ps2.h" +#include "ps2_io.h" #include "print.h" From d239315cf13c2ad08e3836d25a7ca54721554a9f Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 2 Jan 2015 21:16:40 +0900 Subject: [PATCH 18/34] Add keyboard/infinity --- tool/mbed/lpc11u35_501.mk | 2 +- tool/mbed/mbed.mk | 114 ++++++++++++++++++++------------------ tool/mbed/mk20d50m.mk | 45 +++++++++++++++ 3 files changed, 105 insertions(+), 56 deletions(-) create mode 100644 tool/mbed/mk20d50m.mk diff --git a/tool/mbed/lpc11u35_501.mk b/tool/mbed/lpc11u35_501.mk index af1aad79..15e14910 100644 --- a/tool/mbed/lpc11u35_501.mk +++ b/tool/mbed/lpc11u35_501.mk @@ -44,6 +44,6 @@ INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501 \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501/LPC11U35.ld diff --git a/tool/mbed/mbed.mk b/tool/mbed/mbed.mk index 242d7879..db322b26 100644 --- a/tool/mbed/mbed.mk +++ b/tool/mbed/mbed.mk @@ -2,60 +2,64 @@ # see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded OBJECTS += \ - $(OBJDIR)/libraries/mbed/common/BusIn.o \ - $(OBJDIR)/libraries/mbed/common/BusInOut.o \ - $(OBJDIR)/libraries/mbed/common/BusOut.o \ - $(OBJDIR)/libraries/mbed/common/CAN.o \ - $(OBJDIR)/libraries/mbed/common/CallChain.o \ - $(OBJDIR)/libraries/mbed/common/Ethernet.o \ - $(OBJDIR)/libraries/mbed/common/FileBase.o \ - $(OBJDIR)/libraries/mbed/common/FileLike.o \ - $(OBJDIR)/libraries/mbed/common/FilePath.o \ - $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ - $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ - $(OBJDIR)/libraries/mbed/common/I2C.o \ - $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ - $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ - $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ - $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ - $(OBJDIR)/libraries/mbed/common/RawSerial.o \ - $(OBJDIR)/libraries/mbed/common/SPI.o \ - $(OBJDIR)/libraries/mbed/common/SPISlave.o \ - $(OBJDIR)/libraries/mbed/common/Serial.o \ - $(OBJDIR)/libraries/mbed/common/SerialBase.o \ - $(OBJDIR)/libraries/mbed/common/Stream.o \ - $(OBJDIR)/libraries/mbed/common/Ticker.o \ - $(OBJDIR)/libraries/mbed/common/Timeout.o \ - $(OBJDIR)/libraries/mbed/common/Timer.o \ - $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ - $(OBJDIR)/libraries/mbed/common/assert.o \ - $(OBJDIR)/libraries/mbed/common/board.o \ - $(OBJDIR)/libraries/mbed/common/error.o \ - $(OBJDIR)/libraries/mbed/common/exit.o \ $(OBJDIR)/libraries/mbed/common/gpio.o \ - $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ - $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ - $(OBJDIR)/libraries/mbed/common/retarget.o \ - $(OBJDIR)/libraries/mbed/common/rtc_time.o \ - $(OBJDIR)/libraries/mbed/common/semihost_api.o \ $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ - $(OBJDIR)/libraries/mbed/common/wait_api.o \ - $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ - $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ - $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ - $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ - $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ - $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o + $(OBJDIR)/libraries/mbed/common/wait_api.o + +# $(OBJDIR)/libraries/mbed/common/assert.o \ +# $(OBJDIR)/libraries/mbed/common/board.o \ +# $(OBJDIR)/libraries/mbed/common/BusIn.o \ +# $(OBJDIR)/libraries/mbed/common/BusInOut.o \ +# $(OBJDIR)/libraries/mbed/common/BusOut.o \ +# $(OBJDIR)/libraries/mbed/common/CallChain.o \ +# $(OBJDIR)/libraries/mbed/common/CAN.o \ +# $(OBJDIR)/libraries/mbed/common/error.o \ +# $(OBJDIR)/libraries/mbed/common/Ethernet.o \ +# $(OBJDIR)/libraries/mbed/common/exit.o \ +# $(OBJDIR)/libraries/mbed/common/FileBase.o \ +# $(OBJDIR)/libraries/mbed/common/FileLike.o \ +# $(OBJDIR)/libraries/mbed/common/FilePath.o \ +# $(OBJDIR)/libraries/mbed/common/FileSystemLike.o \ +# $(OBJDIR)/libraries/mbed/common/FunctionPointer.o \ +# $(OBJDIR)/libraries/mbed/common/gpio.o \ +# $(OBJDIR)/libraries/mbed/common/I2C.o \ +# $(OBJDIR)/libraries/mbed/common/I2CSlave.o \ +# $(OBJDIR)/libraries/mbed/common/InterruptIn.o \ +# $(OBJDIR)/libraries/mbed/common/InterruptManager.o \ +# $(OBJDIR)/libraries/mbed/common/LocalFileSystem.o \ +# $(OBJDIR)/libraries/mbed/common/mbed_interface.o \ +# $(OBJDIR)/libraries/mbed/common/pinmap_common.o \ +# $(OBJDIR)/libraries/mbed/common/RawSerial.o \ +# $(OBJDIR)/libraries/mbed/common/retarget.o \ +# $(OBJDIR)/libraries/mbed/common/rtc_time.o \ +# $(OBJDIR)/libraries/mbed/common/semihost_api.o \ +# $(OBJDIR)/libraries/mbed/common/SerialBase.o \ +# $(OBJDIR)/libraries/mbed/common/Serial.o \ +# $(OBJDIR)/libraries/mbed/common/SPI.o \ +# $(OBJDIR)/libraries/mbed/common/SPISlave.o \ +# $(OBJDIR)/libraries/mbed/common/Stream.o \ +# $(OBJDIR)/libraries/mbed/common/Ticker.o \ +# $(OBJDIR)/libraries/mbed/common/Timeout.o \ +# $(OBJDIR)/libraries/mbed/common/TimerEvent.o \ +# $(OBJDIR)/libraries/mbed/common/Timer.o \ +# $(OBJDIR)/libraries/mbed/common/us_ticker_api.o \ +# $(OBJDIR)/libraries/mbed/common/wait_api.o \ +# $(OBJDIR)/libraries/USBDevice/USBAudio/USBAudio.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBDevice.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC11U.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC17.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_LPC40.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.o \ +# $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_STM32F4.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBHID.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBKeyboard.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBMouseKeyboard.o \ +# $(OBJDIR)/libraries/USBDevice/USBHID/USBMouse.o \ +# $(OBJDIR)/libraries/USBDevice/USBMIDI/USBMIDI.o \ +# $(OBJDIR)/libraries/USBDevice/USBMSD/USBMSD.o \ +# $(OBJDIR)/libraries/USBDevice/USBSerial/USBCDC.o \ +# $(OBJDIR)/libraries/USBDevice/USBSerial/USBSerial.o INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/mbed \ @@ -71,9 +75,9 @@ INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/USBDevice/USBSerial # TMK mbed protocol -OBJECTS += \ - $(OBJDIR)/protocol/mbed/mbed_driver.o \ - $(OBJDIR)/protocol/mbed/HIDKeyboard.o +#OBJECTS += \ +# $(OBJDIR)/protocol/mbed/mbed_driver.o \ +# $(OBJDIR)/protocol/mbed/HIDKeyboard.o INCLUDE_PATHS += \ -I$(TMK_DIR)/protocol/mbed diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk new file mode 100644 index 00000000..eb7bde64 --- /dev/null +++ b/tool/mbed/mk20d50m.mk @@ -0,0 +1,45 @@ +# based on Makefile exported form mbed.org +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded + +CPU = -mcpu=cortex-m4 -mthumb + +CC_SYMBOLS += \ + -DTARGET_K20D50M \ + -DTARGET_M4 \ + -DTARGET_CORTEX_M \ + -DTARGET_Freescale \ + -DTOOLCHAIN_GCC_ARM \ + -DTOOLCHAIN_GCC \ + -D__CORTEX_M4 \ + -DARM_MATH_CM4 \ + -D__MBED__=1 + +OBJECTS += \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.o \ + $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \ + $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o + +INCLUDE_PATHS += \ + -I$(MBED_DIR)/libraries/mbed/targets \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \ + -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \ + -I$(MBED_DIR)/libraries/mbed/targets/hal \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \ + -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M + +LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld +#LINKER_SCRIPT = infinity.ld From 629e3e17be543e55c5ff8f0096987c89ef4e78bb Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sat, 3 Jan 2015 20:21:23 +0900 Subject: [PATCH 19/34] Fix linker script for NVIC vector on RAM --- tool/mbed/mk20d50m.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk index eb7bde64..e62e39d2 100644 --- a/tool/mbed/mk20d50m.mk +++ b/tool/mbed/mk20d50m.mk @@ -41,5 +41,4 @@ INCLUDE_PATHS += \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M -LINKER_SCRIPT = $(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld -#LINKER_SCRIPT = infinity.ld +LINKER_SCRIPT = infinity.ld From 58284dd19b9dcce72966622fedec75cdd70092ec Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 4 Jan 2015 03:27:24 +0900 Subject: [PATCH 20/34] infinity: Move project specific files to local --- tool/mbed/mk20d50m.mk | 44 ------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tool/mbed/mk20d50m.mk diff --git a/tool/mbed/mk20d50m.mk b/tool/mbed/mk20d50m.mk deleted file mode 100644 index e62e39d2..00000000 --- a/tool/mbed/mk20d50m.mk +++ /dev/null @@ -1,44 +0,0 @@ -# based on Makefile exported form mbed.org -# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded - -CPU = -mcpu=cortex-m4 -mthumb - -CC_SYMBOLS += \ - -DTARGET_K20D50M \ - -DTARGET_M4 \ - -DTARGET_CORTEX_M \ - -DTARGET_Freescale \ - -DTOOLCHAIN_GCC_ARM \ - -DTOOLCHAIN_GCC \ - -D__CORTEX_M4 \ - -DARM_MATH_CM4 \ - -D__MBED__=1 - -OBJECTS += \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.o \ - $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \ - $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o - -INCLUDE_PATHS += \ - -I$(MBED_DIR)/libraries/mbed/targets \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \ - -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \ - -I$(MBED_DIR)/libraries/mbed/targets/hal \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \ - -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M - -LINKER_SCRIPT = infinity.ld From 9218133d0bbd35f6178fee717c87ebb927a86769 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sun, 4 Jan 2015 17:03:47 +0900 Subject: [PATCH 21/34] infinity: Add initial files for keyboard support --- README.md | 2 ++ common/matrix.h | 9 ++++++++- common/mbed/xprintf.cpp | 5 +++++ tool/mbed/lpc11u35_501.mk | 1 + tool/mbed/mbed.mk | 10 ++++++---- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a01de8c6..e077fc92 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired] * [KMAC](keyboard/kmac/) - Korean custom keyboard * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard +* [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity] [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 @@ -72,6 +73,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di [PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 [Sun]: http://en.wikipedia.org/wiki/Sun-3 [IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS +[Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit diff --git a/common/matrix.h b/common/matrix.h index 23fef78f..107ee726 100644 --- a/common/matrix.h +++ b/common/matrix.h @@ -35,6 +35,10 @@ typedef uint32_t matrix_row_t; #define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1< Date: Wed, 26 Nov 2014 11:25:45 +0900 Subject: [PATCH 22/34] Compensate timer during prower down --- common/avr/suspend.c | 27 ++++++++++++++++----------- common/suspend.h | 2 +- protocol/lufa/lufa.c | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/common/avr/suspend.c b/common/avr/suspend.c index 66a579fd..80243f02 100644 --- a/common/avr/suspend.c +++ b/common/avr/suspend.c @@ -7,6 +7,7 @@ #include "backlight.h" #include "suspend_avr.h" #include "suspend.h" +#include "timer.h" #ifdef PROTOCOL_LUFA #include "lufa.h" #endif @@ -52,11 +53,13 @@ void suspend_idle(uint8_t time) * WDTO_4S * WDTO_8S */ -void suspend_power_down(uint8_t wdto) +static uint8_t wdt_timeout = 0; +static void power_down(uint8_t wdto) { #ifdef PROTOCOL_LUFA if (USB_DeviceState == DEVICE_STATE_Configured) return; #endif + wdt_timeout = wdto; // Watchdog Interrupt Mode wdt_intr_enable(wdto); @@ -67,7 +70,6 @@ void suspend_power_down(uint8_t wdto) // - prescale clock // - BOD disable // - Power Reduction Register PRR - set_sleep_mode(SLEEP_MODE_PWR_DOWN); sleep_enable(); sei(); @@ -78,6 +80,11 @@ void suspend_power_down(uint8_t wdto) wdt_disable(); } +void suspend_power_down(void) +{ + power_down(WDTO_15MS); +} + bool suspend_wakeup_condition(void) { matrix_power_up(); @@ -103,15 +110,13 @@ void suspend_wakeup_init(void) /* watchdog timeout */ ISR(WDT_vect) { - /* wakeup from MCU sleep mode */ -/* - // blink LED - static uint8_t led_state = 0; - static uint8_t led_count = 0; - led_count++; - if ((led_count & 0x07) == 0) { - led_set((led_state ^= (1< Date: Sat, 29 Nov 2014 20:47:15 +0900 Subject: [PATCH 23/34] Fix lufa sendchar() infinite wait loop - FrameNumber is not updated when adapter powered - can be blocked in sendchar() when pluged into AC adapter --- protocol/lufa/lufa.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index ee15b7f4..3d6b3ea0 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -148,6 +148,7 @@ static void Console_Task(void) */ void EVENT_USB_Device_Connect(void) { + print("[C]"); /* For battery powered device */ if (!USB_IsInitialized) { USB_Init(); @@ -157,6 +158,7 @@ void EVENT_USB_Device_Connect(void) void EVENT_USB_Device_Disconnect(void) { + print("[D]"); /* For battery powered device */ /* TODO: This doesn't work. After several plug in/outs can not be enumerated. if (USB_IsInitialized) { @@ -169,10 +171,12 @@ void EVENT_USB_Device_Disconnect(void) void EVENT_USB_Device_Reset(void) { + print("[R]"); } void EVENT_USB_Device_Suspend() { + print("[S]"); #ifdef SLEEP_LED_ENABLE sleep_led_enable(); #endif @@ -180,6 +184,7 @@ void EVENT_USB_Device_Suspend() void EVENT_USB_Device_WakeUp() { + print("[W]"); suspend_wakeup_init(); #ifdef SLEEP_LED_ENABLE @@ -489,37 +494,28 @@ int8_t sendchar(uint8_t c) uint8_t ep = Endpoint_GetCurrentEndpoint(); Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM); if (!Endpoint_IsEnabled() || !Endpoint_IsConfigured()) { - Endpoint_SelectEndpoint(ep); - return -1; + goto ERROR_EXIT; } if (timeouted && !Endpoint_IsReadWriteAllowed()) { - Endpoint_SelectEndpoint(ep); - return - 1; + goto ERROR_EXIT; } timeouted = false; uint8_t timeout = SEND_TIMEOUT; - uint16_t prevFN = USB_Device_GetFrameNumber(); while (!Endpoint_IsReadWriteAllowed()) { - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - case DEVICE_STATE_Suspended: - return -1; + if (USB_DeviceState != DEVICE_STATE_Configured) { + goto ERROR_EXIT; } if (Endpoint_IsStalled()) { - Endpoint_SelectEndpoint(ep); - return -1; + goto ERROR_EXIT; } - if (prevFN != USB_Device_GetFrameNumber()) { - if (!(timeout--)) { - timeouted = true; - Endpoint_SelectEndpoint(ep); - return -1; - } - prevFN = USB_Device_GetFrameNumber(); + if (!(timeout--)) { + timeouted = true; + goto ERROR_EXIT; } + _delay_ms(1); } Endpoint_Write_8(c); @@ -530,6 +526,9 @@ int8_t sendchar(uint8_t c) Endpoint_SelectEndpoint(ep); return 0; +ERROR_EXIT: + Endpoint_SelectEndpoint(ep); + return -1; } #else int8_t sendchar(uint8_t c) @@ -587,6 +586,7 @@ int main(void) print("Keyboard start.\n"); while (1) { while (USB_DeviceState == DEVICE_STATE_Suspended) { + print("[s]"); suspend_power_down(); if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { USB_Device_SendRemoteWakeup(); From d61201e5e4f88624a468284ef64fc27102d88a08 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 3 Dec 2014 15:50:02 +0900 Subject: [PATCH 24/34] Fix power saving while USB suspended - doesn't pwoer save while Bluetooth turns on --- protocol/lufa/lufa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index 3d6b3ea0..cdfc7bc6 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -151,6 +151,7 @@ void EVENT_USB_Device_Connect(void) print("[C]"); /* For battery powered device */ if (!USB_IsInitialized) { + USB_Disable(); USB_Init(); USB_Device_EnableSOFEvents(); } @@ -160,6 +161,7 @@ void EVENT_USB_Device_Disconnect(void) { print("[D]"); /* For battery powered device */ + USB_IsInitialized = false; /* TODO: This doesn't work. After several plug in/outs can not be enumerated. if (USB_IsInitialized) { USB_Disable(); // Disable all interrupts @@ -177,6 +179,7 @@ void EVENT_USB_Device_Reset(void) void EVENT_USB_Device_Suspend() { print("[S]"); + matrix_power_down(); #ifdef SLEEP_LED_ENABLE sleep_led_enable(); #endif From 189b43b08b7320223b6440d9aa8e6b1e4cddbf96 Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Wed, 12 Nov 2014 14:05:57 +0100 Subject: [PATCH 25/34] Changed hotkey for bootloader jump --- common/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/command.c b/common/command.c index 1a507e3a..c50d3eb4 100644 --- a/common/command.c +++ b/common/command.c @@ -216,7 +216,7 @@ static bool command_common(uint8_t code) print("C> "); command_state = CONSOLE; break; - case KC_PAUSE: + case KC_B: clear_keyboard(); print("\n\nJump to bootloader... "); _delay_ms(1000); From a943e3e2184abefa50242c8f8a43b0edd2d326a5 Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Tue, 11 Nov 2014 14:49:16 +0100 Subject: [PATCH 26/34] Added NerD 60% support --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e077fc92..e918faa0 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [KMAC](keyboard/kmac/) - Korean custom keyboard * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard * [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity] +* [NerD](keyboard/nerd/) - Korean custom keyboard [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 From 97682e5505f28709c48cba393a5590f0ac733d9e Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Sun, 14 Dec 2014 12:15:17 +0100 Subject: [PATCH 27/34] Added missing keyboards to main README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e918faa0..31288640 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard * [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity] * [NerD](keyboard/nerd/) - Korean custom keyboard +* [KittenPaw](keyboard/kittenpaw) - Custom Majestouch controller +* [Lightpad](keyboard/lightpad) - Korean custom keypad [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 From 26f15278a9c33cd24bce295d4ff0fc264d7c99ba Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 19 Jan 2015 10:20:20 +0900 Subject: [PATCH 28/34] Revert "Changed hotkey for bootloader jump" This reverts commit f31cbc7219c9a1903331771c10056302817e68ca. --- common/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/command.c b/common/command.c index c50d3eb4..1a507e3a 100644 --- a/common/command.c +++ b/common/command.c @@ -216,7 +216,7 @@ static bool command_common(uint8_t code) print("C> "); command_state = CONSOLE; break; - case KC_B: + case KC_PAUSE: clear_keyboard(); print("\n\nJump to bootloader... "); _delay_ms(1000); From a3f3bbe1a50b0fde1d97a4d89c4e75c6af1fffe4 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 19 Jan 2015 10:35:06 +0900 Subject: [PATCH 29/34] Fix typo 'keyobard' #166 --- protocol/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/adb.c b/protocol/adb.c index f57afac9..bbff66df 100644 --- a/protocol/adb.c +++ b/protocol/adb.c @@ -360,7 +360,7 @@ Commands 3: mice Registers: - 0: application(keyobard uses this to store its data.) + 0: application(keyboard uses this to store its data.) 1: application 2: application(keyboard uses this for LEDs and state of modifiers) 3: status and command From 42be3086b226c39e439a52b73ab17a297db3f8c0 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 19 Jan 2015 12:43:30 +0900 Subject: [PATCH 30/34] Add external projects using tmk_keyboard --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3dceb963..28026257 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,11 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [Lightpad](keyboard/lightpad) - Korean custom keypad * [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt] +### Extenal projects using tmk_keyboard +* [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org] +* [mcdox][mcdox_tmk] - [mcdox][mcdox] + + [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 [GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618 @@ -80,6 +85,10 @@ You can find some keyboard specific projects under `converter` and `keyboard` di [Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit [ghost_squid]: http://deskthority.net/wiki/Costar_replacement_controllers#The_Ghost_Squid [cmxt]: http://gaming.coolermaster.com/en/products/keyboards/quickfirext/ +[ergodox_org]: http://ergodox.org/ +[cub-uanic]: https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox +[mcdox]: https://github.com/DavidMcEwan/mcdox +[mcdox_tmk]: https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox @@ -284,4 +293,4 @@ Coding Style Other Keyboard Firmware Projects ------------------ -See [doc/other_projects.md](doc/other_projects.md). +You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](doc/other_projects.md). From 30a606b44598bc0a7b5fe726ffa6dd2191e14b5d Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Tue, 20 Jan 2015 20:18:33 +0100 Subject: [PATCH 31/34] Kitten Paw, fix main README link to project. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28026257..dd03e140 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di * [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard * [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity] * [NerD](keyboard/nerd/) - Korean custom keyboard -* [KittenPaw](keyboard/kittenpaw) - Custom Majestouch controller +* [KittenPaw](keyboard/kitten_paw) - Custom Majestouch controller * [Lightpad](keyboard/lightpad) - Korean custom keypad * [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt] From e82c6007e33669e7de728691f16fad4ccc093b3e Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Mon, 26 Jan 2015 11:25:22 +0900 Subject: [PATCH 32/34] Fix call parameter of suspend_power_down() --- protocol/bluefruit/main.c | 2 +- protocol/pjrc/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/bluefruit/main.c b/protocol/bluefruit/main.c index 094fdb36..871062ab 100644 --- a/protocol/bluefruit/main.c +++ b/protocol/bluefruit/main.c @@ -104,7 +104,7 @@ int main(void) dprintf("Starting main loop"); while (1) { while (suspend) { - suspend_power_down(WDTO_120MS); + suspend_power_down(); if (remote_wakeup && suspend_wakeup_condition()) { usb_remote_wakeup(); } diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c index 4f87a173..e7bdcc05 100644 --- a/protocol/pjrc/main.c +++ b/protocol/pjrc/main.c @@ -61,7 +61,7 @@ int main(void) #endif while (1) { while (suspend) { - suspend_power_down(WDTO_120MS); + suspend_power_down(); if (remote_wakeup && suspend_wakeup_condition()) { usb_remote_wakeup(); } From 576345a918ca9563894fab8e3cd6ca8e737aa520 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Wed, 18 Mar 2015 15:56:07 +0900 Subject: [PATCH 33/34] m0110: Add support for international keyboard --- protocol/m0110.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/protocol/m0110.c b/protocol/m0110.c index 924ec316..0d3a5aaa 100644 --- a/protocol/m0110.c +++ b/protocol/m0110.c @@ -502,8 +502,10 @@ MODEL NUMBER: Scan Code --------- - m0110_recv_key() function returns following scan codes instead of raw key events. - Scan codes are 1 byte long and MSB(bit7) is set when key is released. + m0110_recv_key() function returns following scan codes instead of M0110 raw codes. + Scan codes are 1 byte size and MSB(bit7) is set when key is released. + + scancode = ((raw&0x80) | ((raw&0x7F)>>1)) M0110 M0120 ,---------------------------------------------------------. ,---------------. @@ -529,6 +531,19 @@ Scan Code | 3A| 37| 31 | 34| 3A| | 52| 41| | `------------------------------------------------' `---------------' + International keyboard(See page 22 of "Technical Info for 128K/512K") + ,---------------------------------------------------------. + | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| + |---------------------------------------------------------| + | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| + |------------------------------------------------------ | + | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | + |---------------------------------------------------------| + | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| + `---------------------------------------------------------' + | 3A| 37| 34 | 31| 3A| + `------------------------------------------------' + M0110A ,---------------------------------------------------------. ,---------------. | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| @@ -568,7 +583,7 @@ Connector: Signaling: http://www.kbdbabel.org/signaling/kbd_signaling_mac.png http://typematic.blog.shinobi.jp/Entry/14/ -Scan Codes: +M0110 raw scan codes: Page 22 of Tech Info for 128K/512K Page 07 of Tech Info for Plus http://m0115.web.fc2.com/m0110.jpg From f412e6f0b11d6865ed345bb389d2e963940854bb Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Thu, 26 Mar 2015 15:09:28 +0900 Subject: [PATCH 34/34] Fix for dfu-programmer 0.7 #182 --- rules.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rules.mk b/rules.mk index 83c9da5f..d0675663 100644 --- a/rules.mk +++ b/rules.mk @@ -419,6 +419,11 @@ flip: $(TARGET).hex batchisp -hardware usb -device $(MCU) -operation start reset 0 dfu: $(TARGET).hex +ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) + dfu-programmer $(MCU) erase --force +else + dfu-programmer $(MCU) erase +endif dfu-programmer $(MCU) erase dfu-programmer $(MCU) flash $(TARGET).hex dfu-programmer $(MCU) reset