From 37af88217d62f22fd5d64a7b58285ce9a94d2176 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 2 Jun 2015 23:59:16 +0900 Subject: [PATCH 001/179] sun_usb: Fix serial recv intrrupt trriger edge #228 --- converter/sun_usb/config.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h index cfd39cd5..66036da9 100644 --- a/converter/sun_usb/config.h +++ b/converter/sun_usb/config.h @@ -56,12 +56,18 @@ along with this program. If not, see . #define SERIAL_SOFT_RXD_BIT 2 #define SERIAL_SOFT_RXD_VECT INT2_vect /* RXD Interupt */ +#ifdef SERIAL_SOFT_LOGIC_NEGATIVE +/* enable interrupt: INT2(rising edge) */ +#define INTR_TRIG_EDGE ((1< Date: Wed, 3 Jun 2015 00:03:08 +0900 Subject: [PATCH 002/179] sun_usb: Fix LED status update at startup --- converter/sun_usb/led.c | 2 ++ converter/sun_usb/matrix.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/converter/sun_usb/led.c b/converter/sun_usb/led.c index 48c3f1c2..809398fa 100644 --- a/converter/sun_usb/led.c +++ b/converter/sun_usb/led.c @@ -18,6 +18,7 @@ along with this program. If not, see . #include "stdint.h" #include "serial.h" #include "led.h" +#include "debug.h" void led_set(uint8_t usb_led) @@ -27,6 +28,7 @@ void led_set(uint8_t usb_led) if (usb_led & (1< Date: Wed, 3 Jun 2015 00:49:55 +0900 Subject: [PATCH 003/179] sun_usb: LED update for hotplug keyboard into converter --- converter/sun_usb/matrix.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/converter/sun_usb/matrix.c b/converter/sun_usb/matrix.c index 71c818f5..3126bd33 100644 --- a/converter/sun_usb/matrix.c +++ b/converter/sun_usb/matrix.c @@ -101,17 +101,26 @@ uint8_t matrix_scan(void) debug_hex(code); debug(" "); switch (code) { - case 0xFF: // reset success - case 0xFE: // layout - case 0x7E: // reset fail - if (code == 0xFF) print("reset: 0xFF "); - if (code == 0x7E) print("reset fail: 0x7E "); - if (code == 0xFE) print("layout: 0xFE "); - // response byte + case 0xFF: // reset success: FF 04 + print("reset: "); _delay_ms(500); - if (code = serial_recv()) print_hex8(code); - print("\n"); - // FALL THROUGH + code = serial_recv(); + xprintf("%02X\n", code); + if (code == 0x04) { + // LED status + led_set(host_keyboard_leds()); + } + return 0; + case 0xFE: // layout: FE + print("layout: "); + _delay_ms(500); + xprintf("%02X\n", serial_recv()); + return 0; + case 0x7E: // reset fail: 7E 01 + print("reset fail: "); + _delay_ms(500); + xprintf("%02X\n", serial_recv()); + return 0; case 0x7F: // all keys up for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; From 070a6be63808cdb6c4ec9e12ad708718cfdc3dfb Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 26 Jun 2015 08:34:10 +0900 Subject: [PATCH 004/179] Add description for non-US keys on keycode.h --- tmk_core/common/keycode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index ac4ef00d..fc66dc0e 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -214,7 +214,7 @@ enum hid_keyboard_keypad_usage { KC_LBRACKET, KC_RBRACKET, /* 0x30 */ KC_BSLASH, /* \ (and |) */ - KC_NONUS_HASH, /* Non-US # and ~ */ + KC_NONUS_HASH, /* Non-US # and ~ (Typically near the Enter key) */ KC_SCOLON, /* ; (and :) */ KC_QUOTE, /* ' and " */ KC_GRAVE, /* Grave accent and tilde */ @@ -264,7 +264,7 @@ enum hid_keyboard_keypad_usage { KC_KP_9, KC_KP_0, KC_KP_DOT, - KC_NONUS_BSLASH, /* Non-US \ and | */ + KC_NONUS_BSLASH, /* Non-US \ and | (Typically near the Left-Shift key) */ KC_APPLICATION, KC_POWER, KC_KP_EQUAL, From 507ebb34f5e7ca0eb2543f3c755ae39671a9b44c Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 26 Jun 2015 08:49:03 +0900 Subject: [PATCH 005/179] alps64: Change keymaps and USB descriptors. --- keyboard/alps64/config.h | 4 ++-- keyboard/alps64/keymap_common.h | 6 +++--- keyboard/alps64/keymap_plain.c | 8 ++++---- keyboard/alps64/matrix.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/keyboard/alps64/config.h b/keyboard/alps64/config.h index 06649a09..824d3e83 100644 --- a/keyboard/alps64/config.h +++ b/keyboard/alps64/config.h @@ -23,9 +23,9 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6464 #define DEVICE_VER 0x0001 -#define MANUFACTURER geekhack +#define MANUFACTURER TMK #define PRODUCT Alps64 -#define DESCRIPTION t.m.k. keyboard firmware for Alps64 +#define DESCRIPTION TMK keyboard firmware for Alps64 /* key matrix size */ #define MATRIX_ROWS 8 diff --git a/keyboard/alps64/keymap_common.h b/keyboard/alps64/keymap_common.h index b2d6ad5c..957db579 100644 --- a/keyboard/alps64/keymap_common.h +++ b/keyboard/alps64/keymap_common.h @@ -60,11 +60,11 @@ extern const uint16_t fn_actions[]; K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \ K30, K40, K50, K60, K00, K10, K20 \ ) KEYMAP( \ - K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NO, K27, \ + K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NUHS,K27, \ K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \ K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \ - K31, NO, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, NO, \ - K30, K40, K50, K60, NO, K00, K10, K20 \ + K31, NUBS,K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, ESC, \ + K30, K40, K50, K60, APP, K00, K10, K20 \ ) #endif diff --git a/keyboard/alps64/keymap_plain.c b/keyboard/alps64/keymap_plain.c index 13a4407f..a5489919 100644 --- a/keyboard/alps64/keymap_plain.c +++ b/keyboard/alps64/keymap_plain.c @@ -2,11 +2,11 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 0: qwerty */ - KEYMAP_AEK( \ - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + KEYMAP( \ + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \ - LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL), + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,ESC, \ + LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,RCTL), }; const uint16_t PROGMEM fn_actions[] = {}; diff --git a/keyboard/alps64/matrix.c b/keyboard/alps64/matrix.c index a49755c3..aa991e0a 100644 --- a/keyboard/alps64/matrix.c +++ b/keyboard/alps64/matrix.c @@ -55,6 +55,10 @@ uint8_t matrix_cols(void) return MATRIX_COLS; } +#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0) +#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0) +#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0) + void matrix_init(void) { // initialize row and col @@ -66,6 +70,12 @@ void matrix_init(void) matrix[i] = 0; matrix_debouncing[i] = 0; } + + //debug + debug_matrix = true; + LED_ON(); + _delay_ms(500); + LED_OFF(); } uint8_t matrix_scan(void) From 0c40b669f01a3bc63545d271b1fb05cf820f02e5 Mon Sep 17 00:00:00 2001 From: jerryen Date: Sat, 27 Jun 2015 21:37:09 -0700 Subject: [PATCH 006/179] Add KEYBOARD_LOCK_ENABLE to makefile Allow keyboard lock to work --- tmk_core/common.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index d22adff5..04ba0d60 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -53,6 +53,10 @@ ifdef USB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE endif +ifdef KEYBOARD_LOCK_ENABLE + OPT_DEFS += -DKEYBOARD_LOCK_ENABLE +endif + ifdef SLEEP_LED_ENABLE SRC += $(COMMON_DIR)/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE From ce8b1e5f1347bb04ee26ef21c24aa52e8fdf23d7 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 11 Jul 2015 17:01:07 +0900 Subject: [PATCH 007/179] m0110_usb: Change keymap and Makefile --- .../{Makefile.pjrc => Makefile.tmk_rev1} | 41 ++++-- converter/m0110_usb/Makefile.tmk_rev2 | 96 ++++++++++++++ converter/m0110_usb/README.md | 11 +- converter/m0110_usb/keymap_common.h | 116 ++++++++--------- converter/m0110_usb/keymap_default.c | 72 +++++++++-- converter/m0110_usb/keymap_for_editor.c | 118 ------------------ converter/m0110_usb/keymap_intl.c | 28 ++--- converter/m0110_usb/keymap_plain.c | 64 ---------- 8 files changed, 255 insertions(+), 291 deletions(-) rename converter/m0110_usb/{Makefile.pjrc => Makefile.tmk_rev1} (58%) create mode 100644 converter/m0110_usb/Makefile.tmk_rev2 delete mode 100644 converter/m0110_usb/keymap_for_editor.c delete mode 100644 converter/m0110_usb/keymap_plain.c diff --git a/converter/m0110_usb/Makefile.pjrc b/converter/m0110_usb/Makefile.tmk_rev1 similarity index 58% rename from converter/m0110_usb/Makefile.pjrc rename to converter/m0110_usb/Makefile.tmk_rev1 index e8256421..f36fcc4b 100644 --- a/converter/m0110_usb/Makefile.pjrc +++ b/converter/m0110_usb/Makefile.tmk_rev1 @@ -1,5 +1,5 @@ # Target file name (without extension). -TARGET = m0110_pjrc +TARGET = m0110_lufa # Directory common source filess exist TMK_DIR = ../../tmk_core @@ -10,13 +10,14 @@ TARGET_DIR = . # keyboard dependent files SRC = matrix.c \ led.c \ + keymap_common.c \ m0110.c # To use own keymap file run make like: make keymap=hasu -ifdef keymap - SRC += keymap_$(keymap).c +ifdef KEYMAP + SRC += keymap_$(KEYMAP).c else - SRC += keymap.c + SRC += keymap_default.c endif CONFIG_H = config.h @@ -24,10 +25,8 @@ CONFIG_H = config.h # MCU name, you MUST set this to match the board you are using # type "make clean" after changing this, so all files will be rebuilt -#MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 -#MCU = at90usb646 # Teensy++ 1.0 -#MCU = at90usb1286 # Teensy++ 2.0 +#MCU = atmega32u2 # TMK converter rev2 +MCU = atmega32u4 # TMK converter rev1 # Processor frequency. @@ -38,6 +37,29 @@ MCU = atmega32u4 # Teensy 2.0 F_CPU = 16000000 +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + # Boot Section Size in bytes # Teensy halfKay 512 # Atmel DFU loader 4096 @@ -55,6 +77,7 @@ 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 +#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor @@ -67,7 +90,7 @@ VPATH += $(TARGET_DIR) VPATH += $(TMK_DIR) -include $(TMK_DIR)/protocol/pjrc.mk +include $(TMK_DIR)/protocol/lufa.mk include $(TMK_DIR)/protocol.mk include $(TMK_DIR)/common.mk include $(TMK_DIR)/rules.mk diff --git a/converter/m0110_usb/Makefile.tmk_rev2 b/converter/m0110_usb/Makefile.tmk_rev2 new file mode 100644 index 00000000..e8364563 --- /dev/null +++ b/converter/m0110_usb/Makefile.tmk_rev2 @@ -0,0 +1,96 @@ +# Target file name (without extension). +TARGET = m0110_lufa + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = matrix.c \ + led.c \ + keymap_common.c \ + m0110.c + +# To use own keymap file run make like: make keymap=hasu +ifdef KEYMAP + SRC += keymap_$(KEYMAP).c +else + SRC += keymap_default.c +endif + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +MCU = atmega32u2 # TMK converter rev2 +#MCU = atmega32u4 # TMK converter rev1 + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in bytes +# Teensy halfKay 512 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# *Comment out* to disable the options. +# +#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 +#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor + + + +#---------------- Programming Options -------------------------- +PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + + +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md index c1ecb53b..bfd3261d 100644 --- a/converter/m0110_usb/README.md +++ b/converter/m0110_usb/README.md @@ -59,19 +59,16 @@ To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to $ git clone git://github.com/tmk/tmk_keyboard.git (or download source) $ cd m0110_usb - $ make -f Makefile clean - $ make -f Makefile [KEYMAP={default|plain|intl|spacefn|hasu}] + $ make -f Makefile.rev2 clean + $ make -f Makefile.rev2 [KEYMAP={default|intl|spacefn|hasu}] -Use `Makefile.teensy` instead for Teensy. +Use `Maefile.tmk_rev1` for TMK converter Rev.1, `Makefile.teensy` for Teensy instead. Keymap ------ -To create your own keymap copy existent keymap file to `keymap_name.c` and edit it. You can build it like this. - - $ make -f Makefile clean - $ make -f Makefile KEYMAP=name +To create your own keymap copy existent keymap file to `keymap_name.c` and edit it. diff --git a/converter/m0110_usb/keymap_common.h b/converter/m0110_usb/keymap_common.h index 8bde7473..925556d9 100644 --- a/converter/m0110_usb/keymap_common.h +++ b/converter/m0110_usb/keymap_common.h @@ -1,5 +1,5 @@ /* -Copyright 2011,2012,2014 Jun Wako +Copyright 2011,2012,2014,2015 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 @@ -24,52 +24,11 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; -/* - * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset - * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist - * on the M0110A, but since it generates a unique scan code which is not used for some other key in - * the M0110A, they are totally interchangeable. In fact, the M0110A is functionally (almost) - * identical to the combination of the M0110 along with the M0120 keypad. The only difference - * (which is causing some problems as you will read below) is that the M0110+M0120 don't have - * dedicated arrow keys, while the M0110A does. However, the M0120 did have arrow keys, which - * doubled as the [comma], [/], [*] and [+] keys, when used with the [Shift] key. The M0110A has - * substituted the [comma] key with the [=] key, however its scancode is the same. +/* Common layout for M0110 and M0110A + * This keymap works with both keyboards. As you can see, the M0110A is + * a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110 + * does not exist on the M0110A. * - * Physical layout: - * M0110A - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| - * |-----------------------------------------------------' | |---------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| - * |---------------------------------------------------------| |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - * |---------------------------------------------------------' |-----------|Ent| - * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| | - * `---------------------------------------------------------' `---------------' - * - * M0110 M0120 - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -| +| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| - * |---------------------------------------------------------| |---------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,| - * |---------------------------------------------------------| |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | - * `---------------------------------------------------------' |-----------|Ent| - * |Opt|Mac | Space |Ent |Opt| | 0| .| | - * `-----------------------------------------------' `---------------' - * With Shift keys on M0120 work as curosor.(-:Left *:Right /:Up ,:Down) - * - * NOTE: \ is located differently. - * NOTE: Enter on M0110 is different from Enter on keypad(M0120 and M0110A). - * NOTE: Left Shift and right Shift are logically same key. - * NOTE: Left Option and right Option are logically same key. - */ - -/* Keymap definition Macro * ,---------------------------------------------------------. ,---------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *| * |---------------------------------------------------------| |---------------| @@ -81,7 +40,33 @@ extern const uint16_t fn_actions[]; * |---------------------------------------------------------| |-----------|Ent| * |Opt |Mac | Space |Ent| \|Lft|Rgt|Dn | | 0| .| | * `---------------------------------------------------------' `---------------' - * NOTE: Ent between Space and \ means Enter on M0110. + * + * M0110A scan codes + * ,---------------------------------------------------------. ,---------------. + * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62| + * |---------------------------------------------------------| |---------------| + * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| | | 59| 5B| 5C| 4E| + * |-----------------------------------------------------' | |---------------| + * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66| + * |---------------------------------------------------------| |---------------| + * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| 4D| | 53| 54| 55| | + * `---------------------------------------------------------' |-----------| 4C| + * | 3A| 37| 31 | 2A| 46| 42| 48| | 52| 41| | + * `---------------------------------------------------------' `---------------' + * + * M0110 + M0120 scan codes + * ,---------------------------------------------------------. ,---------------. + * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62| + * |---------------------------------------------------------| |---------------| + * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E| + * |---------------------------------------------------------| |---------------| + * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66| + * |---------------------------------------------------------| |---------------| + * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| | 53| 54| 55| | + * `---------------------------------------------------------' |-----------| 4C| + * | 3A| 37| 31 | 34| 3A| | 52| 41| | + * `------------------------------------------------' `---------------' + * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two. */ #define KEYMAP( \ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \ @@ -106,25 +91,30 @@ extern const uint16_t fn_actions[]; { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \ } -/* International keyboard - * ,---------------------------------------------------------. - * | 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| - * `------------------------------------------------' +/* International keyboard layout for M0110 + M0120 + * https://en.wikipedia.org/wiki/File:Apple_Macintosh_Plus_Keyboard.jpg + * Probably International keyboard layout of M0110A doesn't exist. + * + * M0110 + M0120 scan codes + * ,---------------------------------------------------------. ,---------------. + * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62| + * |---------------------------------------------------------| |---------------| + * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E| + * |------------------------------------------------------, | |---------------| + * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | | 56| 57| 58| 66| + * |---------------------------------------------------------| |---------------| + * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| | 53| 54| 55| | + * `---------------------------------------------------------' |-----------| 4C| + * | 3A| 37| 34 | 31| 3A| | 52| 41| | + * `------------------------------------------------' `---------------' + * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two. */ #define KEYMAP_INTL( \ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K59,K5B,K5C,K4E, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24, K56,K57,K58,K66, \ - K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K4D, K53,K54,K55,K4C, \ - K3A,K37, K34, K31, K46,K42,K48, K52, K41 \ + K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K53,K54,K55,K4C, \ + K3A,K37, K34, K31, K52, K41 \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ @@ -134,8 +124,8 @@ extern const uint16_t fn_actions[]; { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_NO, KC_##K37 }, \ { KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_##K47 }, \ - { KC_##K48, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \ + { KC_NO, KC_##K41, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K47 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \ { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \ { KC_NO, KC_NO, KC_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \ diff --git a/converter/m0110_usb/keymap_default.c b/converter/m0110_usb/keymap_default.c index b0b8ee22..ff7478d1 100644 --- a/converter/m0110_usb/keymap_default.c +++ b/converter/m0110_usb/keymap_default.c @@ -20,15 +20,19 @@ along with this program. If not, see . +#ifdef KEYMAP_SECTION_ENABLE +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { +#else const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { +#endif /* Default: * M0110 M0120 * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *| + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *| * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| -| * |---------------------------------------------------------| |---------------| - * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,| + * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| * |---------------------------------------------------------| |---------------| * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | * `---------------------------------------------------------' |-----------|Ent| @@ -52,27 +56,40 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, 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, UP, P1, P2, P3, PENT, - LALT,LGUI, SPC, FN0, BSLS,LEFT,RGHT,DOWN, P0, PDOT + LALT,LGUI, SPC, FN0, FN13,LEFT,RGHT,DOWN, P0, PDOT ), - /* Cursor Layer + /* Cursor Layer: + * M0110 M0120 * ,---------------------------------------------------------. ,---------------. - * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -| +| *| + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| * |---------------------------------------------------------| |---------------| - * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |INS| | 7| 8| 9| /| + * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -| * |---------------------------------------------------------| |---------------| - * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| ,| + * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +| * |---------------------------------------------------------| |---------------| * |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| | * `---------------------------------------------------------' |-----------|Ent| * |Opt|Mac | Space |Fn |Opt| | 0| .| | * `-----------------------------------------------' `---------------' + * M0110A + * ,---------------------------------------------------------. ,---------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| + * |---------------------------------------------------------| |---------------| + * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -| + * |-----------------------------------------------------' | |---------------| + * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +| + * |---------------------------------------------------------| |---------------| + * |Shift |End| |PgD| | | | |End|PgD|Dow|Shft|PgU| | 1| 2| 3| | + * |---------------------------------------------------------| |-----------|Ent| + * |Opt |Mac | Space | \|Hom|End|PgD| | 0| .| | + * `---------------------------------------------------------' `---------------' */ [1] = KEYMAP( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, - CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, P7, P8, P9, PMNS, + CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS, LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS, LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT, - LALT,LGUI, SPC, FN0, INS, HOME,END, PGDN, P0, PDOT + LALT,LGUI, SPC, FN0, FN13,HOME,END, PGDN, P0, PDOT ), }; @@ -80,6 +97,41 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { /* * Fn action definition */ +#ifdef KEYMAP_SECTION_ENABLE +const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { +#else const uint16_t fn_actions[] PROGMEM = { +#endif [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_MOMENTARY(3), + [3] = ACTION_LAYER_MOMENTARY(4), + [4] = ACTION_LAYER_MOMENTARY(5), + [5] = ACTION_LAYER_MOMENTARY(6), + [6] = ACTION_LAYER_MOMENTARY(7), + [7] = ACTION_LAYER_TOGGLE(1), + [8] = ACTION_LAYER_TOGGLE(2), + [9] = ACTION_LAYER_TOGGLE(3), + [10] = ACTION_LAYER_TAP_TOGGLE(1), + [11] = ACTION_LAYER_TAP_TOGGLE(2), + [12] = ACTION_LAYER_TAP_TOGGLE(3), + [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), + [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), + [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), + [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), + [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), + [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), + [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), + [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), + [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), + [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), + [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), + [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), + [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), + [26] = ACTION_MODS_ONESHOT(MOD_LCTL), + [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), + [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), + [29] = ACTION_MODS_ONESHOT(MOD_LSFT), + [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), + [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH), }; diff --git a/converter/m0110_usb/keymap_for_editor.c b/converter/m0110_usb/keymap_for_editor.c deleted file mode 100644 index d20f298f..00000000 --- a/converter/m0110_usb/keymap_for_editor.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright 2014 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 "keycode.h" -#include "keymap_common.h" - - -#ifdef KEYMAP_SECTION_ENABLE -const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { -#else -const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { -#endif - /* Default: - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| - * |-----------------------------------------------------' | |---------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +| - * |---------------------------------------------------------| |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - * |---------------------------------------------------------| |-----------|Ent| - * |Ctl |Gui | Space |Alt| \|Lft|Rgt|Dn | | 0| .| | - * `---------------------------------------------------------' `---------------' - */ - [0] = KEYMAP( - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, CLR, EQL, PSLS,PAST, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, - LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, FN15, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, - LCTL,LGUI, FN16, LALT,FN31,LEFT,RGHT,DOWN, P0, PDOT - ), - /* Cursor Layer(WASD, IJKL) - * ,---------------------------------------------------------. ,---------------. - * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| - * |---------------------------------------------------------| |---------------| - * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -| - * |-----------------------------------------------------' | |---------------| - * |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +| - * |---------------------------------------------------------| |---------------| - * |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| | - * |---------------------------------------------------------| |-----------|Ent| - * |Ctl |Gui | Space |Alt | \|Hom|End|PgD| | 0| .| | - * `---------------------------------------------------------' `---------------' - */ - [3] = KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, - CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS, - LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN15, P4, P5, P6, PPLS, - LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT, - LCTL,LGUI, FN16, LALT,FN31,HOME,END, PGDN, P0, PDOT - ), - [4] = KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, - CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS, - LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN15, P4, P5, P6, PPLS, - LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT, - LCTL,LGUI, FN16, LALT,FN31,HOME,END, PGDN, P0, PDOT - ), - [7] = {}, -}; - - -/* - * Fn action definition - */ -#ifdef KEYMAP_SECTION_ENABLE -const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { -#else -const uint16_t fn_actions[] PROGMEM = { -#endif - [0] = ACTION_LAYER_MOMENTARY(1), - [1] = ACTION_LAYER_MOMENTARY(2), - [2] = ACTION_LAYER_MOMENTARY(3), - [3] = ACTION_LAYER_MOMENTARY(4), - [4] = ACTION_LAYER_MOMENTARY(5), - [5] = ACTION_LAYER_MOMENTARY(6), - [6] = ACTION_LAYER_MOMENTARY(7), - [7] = ACTION_LAYER_TOGGLE(1), - [8] = ACTION_LAYER_TOGGLE(2), - [9] = ACTION_LAYER_TOGGLE(3), - [10] = ACTION_LAYER_TAP_TOGGLE(1), - [11] = ACTION_LAYER_TAP_TOGGLE(2), - [12] = ACTION_LAYER_TAP_TOGGLE(3), - [13] = ACTION_LAYER_TAP_KEY(1, KC_F), - [14] = ACTION_LAYER_TAP_KEY(2, KC_J), - [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), - [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), - [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), - [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), - [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), - [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), - [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), - [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), - [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), - [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), - [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), - [26] = ACTION_MODS_ONESHOT(MOD_LCTL), - [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), - [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), - [29] = ACTION_MODS_ONESHOT(MOD_LSFT), - [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), - [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH), -}; diff --git a/converter/m0110_usb/keymap_intl.c b/converter/m0110_usb/keymap_intl.c index 80b02930..6cc251a2 100644 --- a/converter/m0110_usb/keymap_intl.c +++ b/converter/m0110_usb/keymap_intl.c @@ -30,29 +30,17 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { * |------------------------------------------------------, | |---------------| * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| ,| * |---------------------------------------------------------| |---------------| - * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | + * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /| | | 1| 2| 3| | * `---------------------------------------------------------' |-----------|Ent| - * |Opt|Mac | Space |Fn |Opt| | 0| .| | + * |Opt|Mac | Space |Fn | | | 0| .| | * `-----------------------------------------------' `---------------' - * M0110A(not existent?) - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Ret| | 7| 8| 9| -| - * |------------------------------------------------------, | |---------------| - * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| +| - * |---------------------------------------------------------| |---------------| - * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - * |---------------------------------------------------------| |-----------|Ent| - * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| | - * `---------------------------------------------------------' `---------------' */ [0] = KEYMAP_INTL( GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, P7, P8, P9, PMNS, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, P4, P5, P6, PPLS, - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, - LALT,LGUI, SPC, FN0, LEFT,RGHT,DOWN, P0, PDOT + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, P1, P2, P3, PENT, + LALT,LGUI, SPC, FN0, P0, PDOT ), /* Cursor Layer * ,---------------------------------------------------------. ,---------------. @@ -62,17 +50,17 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { * |------------------------------------------------------, | |---------------| * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Ins| | | 4| 5| 6| ,| * |---------------------------------------------------------| |---------------| - * |Shif| <|End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| | + * |Shif| <|End| |PgD| | | | |End|PgD|Dow| | | 1| 2| 3| | * `---------------------------------------------------------' |-----------|Ent| - * |Opt|Mac | Space |Fn |Opt| | 0| .| | + * |Opt|Mac | Space |Fn | | | 0| .| | * `-----------------------------------------------' `---------------' */ [1] = KEYMAP_INTL( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, ENT, P7, P8, P9, PMNS, LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT,INS, P4, P5, P6, PPLS, - LSFT,NO, END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT, - LALT,LGUI, SPC, FN0, HOME,END, PGDN, P0, PDOT + LSFT,NO, END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, P1, P2, P3, PENT, + LALT,LGUI, SPC, FN0, P0, PDOT ), }; diff --git a/converter/m0110_usb/keymap_plain.c b/converter/m0110_usb/keymap_plain.c deleted file mode 100644 index d1507fca..00000000 --- a/converter/m0110_usb/keymap_plain.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2014 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 "keycode.h" -#include "keymap_common.h" - - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Default: - * M0110 M0120 - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /| - * |---------------------------------------------------------| |---------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,| - * |---------------------------------------------------------| |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| | - * `---------------------------------------------------------' |-----------|Ent| - * |Opt|Mac | Space |Mac |Opt| | 0| .| | - * `-----------------------------------------------' `---------------' - * M0110A - * ,---------------------------------------------------------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Nlk| =| /| *| - * |---------------------------------------------------------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| - * |-----------------------------------------------------' | |---------------| - * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| - * |---------------------------------------------------------| |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - * |---------------------------------------------------------' |-----------|Ent| - * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| | - * `---------------------------------------------------------' `---------------' - */ - [0] = KEYMAP( - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,PEQL,PSLS,PAST, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, - LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT, - LALT,LGUI, SPC, RGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT - ), -}; - -/* - * Fn action definition - */ -const uint16_t fn_actions[] PROGMEM = { -}; - - From 8746ad98ccc6ae56c8452afa6bef170777ea5b26 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 12 Jul 2015 05:44:10 +0900 Subject: [PATCH 008/179] core: Add keymap section ldscript for ATMega32U2 --- tmk_core/common.mk | 9 +- tmk_core/ldscript_keymap_avr35.x | 268 +++++++++++++++++++++++++++++++ tmk_core/ldscript_keymap_avr5.x | 6 +- 3 files changed, 279 insertions(+), 4 deletions(-) create mode 100644 tmk_core/ldscript_keymap_avr35.x diff --git a/tmk_core/common.mk b/tmk_core/common.mk index d22adff5..cb030b33 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -66,7 +66,14 @@ endif ifdef KEYMAP_SECTION_ENABLE OPT_DEFS += -DKEYMAP_SECTION_ENABLE - EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + + ifeq ($(strip $(MCU)),atmega32u2) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x + else ifeq ($(strip $(MCU)),atmega32u4) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + else + EXTRALDFLAGS = $(error no ldscript for keymap section) + endif endif # Version string diff --git a/tmk_core/ldscript_keymap_avr35.x b/tmk_core/ldscript_keymap_avr35.x new file mode 100644 index 00000000..6665020a --- /dev/null +++ b/tmk_core/ldscript_keymap_avr35.x @@ -0,0 +1,268 @@ +/* + * linker script for configurable keymap + * + * This adds keymap section which places keymap at fixed address and + * is based on binutils-avr ldscripts(/usr/lib/ldscripts/avr5.x). + */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:35) +MEMORY +{ + /* With keymap section + * + * Flash Map of ATMega32U4(32KB) + * +------------+ 0x0000 + * | .vectors | + * | .progmem | + * | .init0-9 | > text region + * | .text | + * | .fini9-0 | + * | | + * |------------| _etext + * | .data | + * | .bss | > data region + * | .noinit | + * | | + * |------------| 0x6800 + * | .keymap | > keymap region(2KB) + * |------------| 0x7000 + * | bootloader | 4KB + * +------------+ 0x7FFF + */ + text (rx) : ORIGIN = 0, LENGTH = 64K + keymap (rw!x) : ORIGIN = 0x6800, LENGTH = 2K + data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K + lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K + signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + *(.progmem*) + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .data : AT (ADDR (.text) + SIZEOF (.text)) + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + *(.rodata*) /* with -fdata-sections. */ + *(.gnu.linkonce.d*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data + .bss : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit : + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + /* keymap region is located at end of flash + * .fn_actions Fn actions definitions + * .keymaps Mapping layers + */ + .keymap : + { + PROVIDE(__keymap_start = .) ; + *(.keymap.fn_actions) /* 32*actions = 64bytes */ + . = ALIGN(0x40); + *(.keymap.keymaps) /* rest of .keymap section */ + *(.keymap*) + /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */ + } > keymap = 0x00 /* zero fill */ + .eeprom : + { + *(.eeprom*) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } +} diff --git a/tmk_core/ldscript_keymap_avr5.x b/tmk_core/ldscript_keymap_avr5.x index c09693e5..9b46e6c3 100644 --- a/tmk_core/ldscript_keymap_avr5.x +++ b/tmk_core/ldscript_keymap_avr5.x @@ -1,4 +1,4 @@ -/* +/* * linker script for configurable keymap * * This adds keymap section which places keymap at fixed address and @@ -8,7 +8,7 @@ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:5) MEMORY { - /* With keymap section + /* With keymap section * * Flash Map of ATMega32U4(32KB) * +------------+ 0x0000 @@ -212,7 +212,7 @@ SECTIONS { PROVIDE(__keymap_start = .) ; *(.keymap.fn_actions) /* 32*actions = 64bytes */ - . = ALIGN(0x40); + . = ALIGN(0x40); *(.keymap.keymaps) /* rest of .keymap section */ *(.keymap*) /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */ From 448aa73c39155e2e9ce6abe2519620b392bb4bdd Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 12 Jul 2015 06:24:39 +0900 Subject: [PATCH 009/179] ps2_usb: Fix for mbed build --- converter/ps2_usb/Makefile.mbed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/ps2_usb/Makefile.mbed b/converter/ps2_usb/Makefile.mbed index eeb5ad9d..a7ea5bcf 100644 --- a/converter/ps2_usb/Makefile.mbed +++ b/converter/ps2_usb/Makefile.mbed @@ -1,7 +1,7 @@ PROJECT = ps2_usb TMK_DIR = ../../tmk_core -MBED_DIR = $(TMK_DIR)/mbed-sdk +MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk #VPATH += $(MBED_DIR):$(TMK_DIR) vpath %.s .:$(MBED_DIR):$(TMK_DIR) From 5f06f26e03c0d0902e2466a0312ad4a5650a41af Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 12 Jul 2015 06:32:53 +0900 Subject: [PATCH 010/179] ps2_usb: Fix for V-USB build --- converter/ps2_usb/Makefile.vusb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb index 8af5c5b0..d9fa12bc 100644 --- a/converter/ps2_usb/Makefile.vusb +++ b/converter/ps2_usb/Makefile.vusb @@ -18,13 +18,13 @@ else SRC := keymap_plain.c $(SRC) endif -# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful. -SRC += protocol/ps2_usart.c -OPT_DEFS += -DPS2_USE_USART - CONFIG_H = config.h +# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful. +PS2_USE_USART = yes + + # V-USB debug level: To use ps2_usart.c level must be 0 # ps2_usart.c requires USART to receive PS/2 signal. OPT_DEFS += -DDEBUG_LEVEL=0 From e1e0e5b4fb4320e5f9512776912775fb9f589d4c Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 12 Jul 2015 06:46:12 +0900 Subject: [PATCH 011/179] onekey: Add V-USB build --- keyboard/onekey/Makefile.vusb | 88 ++++++++ keyboard/onekey/usbconfig.h | 377 ++++++++++++++++++++++++++++++++++ 2 files changed, 465 insertions(+) create mode 100644 keyboard/onekey/Makefile.vusb create mode 100644 keyboard/onekey/usbconfig.h diff --git a/keyboard/onekey/Makefile.vusb b/keyboard/onekey/Makefile.vusb new file mode 100644 index 00000000..fb1fbdfe --- /dev/null +++ b/keyboard/onekey/Makefile.vusb @@ -0,0 +1,88 @@ +# Target file name (without extension). +TARGET = onekey_vusb + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = keymap.c \ + matrix.c \ + led.c + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +#MCU = atmega168p +MCU = atmega328p + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 12000000 + + +# Build Options +# comment out to disable the options. +# +#MOUSEKEY_ENABLE = yes # Mouse keys +#EXTRAKEY_ENABLE = yes # Audio control and System control +#NKRO_ENABLE = yes # USB Nkey Rollover + + + +#---------------- Programming Options -------------------------- +AVRDUDE = avrdude +# Type: avrdude -c ? to get a full listing. +AVRDUDE_PROGRAMMER = usbasp +AVRDUDE_PORT = +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + +PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + +# Boot Section Size in bytes +# Teensy halfKay 512 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBasp 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=2048 + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + + +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/protocol/vusb.mk +include $(TMK_DIR)/rules.mk diff --git a/keyboard/onekey/usbconfig.h b/keyboard/onekey/usbconfig.h new file mode 100644 index 00000000..d0ca4c71 --- /dev/null +++ b/keyboard/onekey/usbconfig.h @@ -0,0 +1,377 @@ +/* Name: usbconfig.h + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2005-04-01 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ + */ + +#ifndef __usbconfig_h_included__ +#define __usbconfig_h_included__ + + +/* +General Description: +This file is an example configuration (with inline documentation) for the USB +driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is +also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may +wire the lines to any other port, as long as D+ is also wired to INT0 (or any +other hardware interrupt, as long as it is the highest level interrupt, see +section at the end of this file). +*/ + +/* ---------------------------- Hardware Config ---------------------------- */ + +#define USB_CFG_IOPORTNAME D +/* This is the port where the USB bus is connected. When you configure it to + * "B", the registers PORTB, PINB and DDRB will be used. + */ +#define USB_CFG_DMINUS_BIT 3 +/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. + * This may be any bit in the port. + */ +#define USB_CFG_DPLUS_BIT 2 +/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. + * This may be any bit in the port. Please note that D+ must also be connected + * to interrupt pin INT0! [You can also use other interrupts, see section + * "Optional MCU Description" below, or you can connect D- to the interrupt, as + * it is required if you use the USB_COUNT_SOF feature. If you use D- for the + * interrupt, the USB interrupt will also be triggered at Start-Of-Frame + * markers every millisecond.] + */ +#define USB_CFG_CLOCK_KHZ (F_CPU/1000) +/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, + * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code + * require no crystal, they tolerate +/- 1% deviation from the nominal + * frequency. All other rates require a precision of 2000 ppm and thus a + * crystal! + * Since F_CPU should be defined to your actual clock rate anyway, you should + * not need to modify this setting. + */ +#define USB_CFG_CHECK_CRC 0 +/* Define this to 1 if you want that the driver checks integrity of incoming + * data packets (CRC checks). CRC checks cost quite a bit of code size and are + * currently only available for 18 MHz crystal clock. You must choose + * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. + */ + +/* ----------------------- Optional Hardware Config ------------------------ */ + +/* #define USB_CFG_PULLUP_IOPORTNAME D */ +/* If you connect the 1.5k pullup resistor from D- to a port pin instead of + * V+, you can connect and disconnect the device from firmware by calling + * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). + * This constant defines the port on which the pullup resistor is connected. + */ +/* #define USB_CFG_PULLUP_BIT 4 */ +/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined + * above) where the 1.5k pullup resistor is connected. See description + * above for details. + */ + +/* --------------------------- Functional Range ---------------------------- */ + +#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 +/* Define this to 1 if you want to compile a version with two endpoints: The + * default control endpoint 0 and an interrupt-in endpoint (any other endpoint + * number). + */ +#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1 +/* Define this to 1 if you want to compile a version with three endpoints: The + * default control endpoint 0, an interrupt-in endpoint 3 (or the number + * configured below) and a catch-all default interrupt-in endpoint as above. + * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. + */ +#define USB_CFG_EP3_NUMBER 3 +/* If the so-called endpoint 3 is used, it can now be configured to any other + * endpoint number (except 0) with this macro. Default if undefined is 3. + */ +/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ +/* The above macro defines the startup condition for data toggling on the + * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. + * Since the token is toggled BEFORE sending any data, the first packet is + * sent with the oposite value of this configuration! + */ +#define USB_CFG_IMPLEMENT_HALT 0 +/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature + * for endpoint 1 (interrupt endpoint). Although you may not need this feature, + * it is required by the standard. We have made it a config option because it + * bloats the code considerably. + */ +#define USB_CFG_SUPPRESS_INTR_CODE 0 +/* Define this to 1 if you want to declare interrupt-in endpoints, but don't + * want to send any data over them. If this macro is defined to 1, functions + * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if + * you need the interrupt-in endpoints in order to comply to an interface + * (e.g. HID), but never want to send any data. This option saves a couple + * of bytes in flash memory and the transmit buffers in RAM. + */ +#define USB_CFG_INTR_POLL_INTERVAL 10 +/* If you compile a version with endpoint 1 (interrupt-in), this is the poll + * interval. The value is in milliseconds and must not be less than 10 ms for + * low speed devices. + */ +#define USB_CFG_IS_SELF_POWERED 0 +/* Define this to 1 if the device has its own power supply. Set it to 0 if the + * device is powered from the USB bus. + */ +#define USB_CFG_MAX_BUS_POWER 100 +/* Set this variable to the maximum USB bus power consumption of your device. + * The value is in milliamperes. [It will be divided by two since USB + * communicates power requirements in units of 2 mA.] + */ +#define USB_CFG_IMPLEMENT_FN_WRITE 1 +/* Set this to 1 if you want usbFunctionWrite() to be called for control-out + * transfers. Set it to 0 if you don't need it and want to save a couple of + * bytes. + */ +#define USB_CFG_IMPLEMENT_FN_READ 0 +/* Set this to 1 if you need to send control replies which are generated + * "on the fly" when usbFunctionRead() is called. If you only want to send + * data from a static buffer, set it to 0 and return the data from + * usbFunctionSetup(). This saves a couple of bytes. + */ +#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 +/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. + * You must implement the function usbFunctionWriteOut() which receives all + * interrupt/bulk data sent to any endpoint other than 0. The endpoint number + * can be found in 'usbRxToken'. + */ +#define USB_CFG_HAVE_FLOWCONTROL 0 +/* Define this to 1 if you want flowcontrol over USB data. See the definition + * of the macros usbDisableAllRequests() and usbEnableAllRequests() in + * usbdrv.h. + */ +#define USB_CFG_DRIVER_FLASH_PAGE 0 +/* If the device has more than 64 kBytes of flash, define this to the 64 k page + * where the driver's constants (descriptors) are located. Or in other words: + * Define this to 1 for boot loaders on the ATMega128. + */ +#define USB_CFG_LONG_TRANSFERS 0 +/* Define this to 1 if you want to send/receive blocks of more than 254 bytes + * in a single control-in or control-out transfer. Note that the capability + * for long transfers increases the driver size. + */ +/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ +/* This macro is a hook if you want to do unconventional things. If it is + * defined, it's inserted at the beginning of received message processing. + * If you eat the received message and don't want default processing to + * proceed, do a return after doing your things. One possible application + * (besides debugging) is to flash a status LED on each packet. + */ +/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ +/* This macro is a hook if you need to know when an USB RESET occurs. It has + * one parameter which distinguishes between the start of RESET state and its + * end. + */ +/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ +/* This macro (if defined) is executed when a USB SET_ADDRESS request was + * received. + */ +#define USB_COUNT_SOF 0 +/* define this macro to 1 if you need the global variable "usbSofCount" which + * counts SOF packets. This feature requires that the hardware interrupt is + * connected to D- instead of D+. + */ +/* #ifdef __ASSEMBLER__ + * macro myAssemblerMacro + * in YL, TCNT0 + * sts timer0Snapshot, YL + * endm + * #endif + * #define USB_SOF_HOOK myAssemblerMacro + * This macro (if defined) is executed in the assembler module when a + * Start Of Frame condition is detected. It is recommended to define it to + * the name of an assembler macro which is defined here as well so that more + * than one assembler instruction can be used. The macro may use the register + * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages + * immediately after an SOF pulse may be lost and must be retried by the host. + * What can you do with this hook? Since the SOF signal occurs exactly every + * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in + * designs running on the internal RC oscillator. + * Please note that Start Of Frame detection works only if D- is wired to the + * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! + */ +#define USB_CFG_CHECK_DATA_TOGGLING 0 +/* define this macro to 1 if you want to filter out duplicate data packets + * sent by the host. Duplicates occur only as a consequence of communication + * errors, when the host does not receive an ACK. Please note that you need to + * implement the filtering yourself in usbFunctionWriteOut() and + * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable + * for each control- and out-endpoint to check for duplicate packets. + */ +#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 +/* define this macro to 1 if you want the function usbMeasureFrameLength() + * compiled in. This function can be used to calibrate the AVR's RC oscillator. + */ +#define USB_USE_FAST_CRC 0 +/* The assembler module has two implementations for the CRC algorithm. One is + * faster, the other is smaller. This CRC routine is only used for transmitted + * messages where timing is not critical. The faster routine needs 31 cycles + * per byte while the smaller one needs 61 to 69 cycles. The faster routine + * may be worth the 32 bytes bigger code size if you transmit lots of data and + * run the AVR close to its limit. + */ + +/* -------------------------- Device Description --------------------------- */ + +#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF) +/* USB vendor ID for the device, low byte first. If you have registered your + * own Vendor ID, define it here. Otherwise you may use one of obdev's free + * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF) +/* This is the ID of the product, low byte first. It is interpreted in the + * scope of the vendor ID. If you have registered your own VID with usb.org + * or if you have licensed a PID from somebody else, define it here. Otherwise + * you may use one of obdev's free shared VID/PID pairs. See the file + * USB-IDs-for-free.txt for details! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_VERSION 0x00, 0x01 +/* Version number of the device: Minor number first, then major number. + */ +#define USB_CFG_VENDOR_NAME 't', '.', 'm', '.', 'k', '.' +#define USB_CFG_VENDOR_NAME_LEN 6 +/* These two values define the vendor name returned by the USB device. The name + * must be given as a list of characters under single quotes. The characters + * are interpreted as Unicode (UTF-16) entities. + * If you don't want a vendor name string, undefine these macros. + * ALWAYS define a vendor name containing your Internet domain name if you use + * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for + * details. + */ +#define USB_CFG_DEVICE_NAME 'P', 'S', '/', '2', ' ', 'k', 'e', 'y', 'b', 'o', 'a', 'r', 'd', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 't', 'e', 'r' +#define USB_CFG_DEVICE_NAME_LEN 23 +/* Same as above for the device name. If you don't want a device name, undefine + * the macros. See the file USB-IDs-for-free.txt before you assign a name if + * you use a shared VID/PID. + */ +/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ +/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ +/* Same as above for the serial number. If you don't want a serial number, + * undefine the macros. + * It may be useful to provide the serial number through other means than at + * compile time. See the section about descriptor properties below for how + * to fine tune control over USB descriptors such as the string descriptor + * for the serial number. + */ +#define USB_CFG_DEVICE_CLASS 0 +#define USB_CFG_DEVICE_SUBCLASS 0 +/* See USB specification if you want to conform to an existing device class. + * Class 0xff is "vendor specific". + */ +#define USB_CFG_INTERFACE_CLASS 3 /* HID */ +#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */ +#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */ +/* See USB specification if you want to conform to an existing device class or + * protocol. The following classes must be set at interface level: + * HID class is 3, no subclass and protocol required (but may be useful!) + * CDC class is 2, use subclass 2 and protocol 1 for ACM + */ +#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 +/* Define this to the length of the HID report descriptor, if you implement + * an HID device. Otherwise don't define it or define it to 0. + * If you use this define, you must add a PROGMEM character array named + * "usbHidReportDescriptor" to your code which contains the report descriptor. + * Don't forget to keep the array and this define in sync! + */ + +/* #define USB_PUBLIC static */ +/* Use the define above if you #include usbdrv.c instead of linking against it. + * This technique saves a couple of bytes in flash memory. + */ + +/* ------------------- Fine Control over USB Descriptors ------------------- */ +/* If you don't want to use the driver's default USB descriptors, you can + * provide our own. These can be provided as (1) fixed length static data in + * flash memory, (2) fixed length static data in RAM or (3) dynamically at + * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more + * information about this function. + * Descriptor handling is configured through the descriptor's properties. If + * no properties are defined or if they are 0, the default descriptor is used. + * Possible properties are: + * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched + * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is + * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if + * you want RAM pointers. + * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found + * in static memory is in RAM, not in flash memory. + * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), + * the driver must know the descriptor's length. The descriptor itself is + * found at the address of a well known identifier (see below). + * List of static descriptor names (must be declared PROGMEM if in flash): + * char usbDescriptorDevice[]; + * char usbDescriptorConfiguration[]; + * char usbDescriptorHidReport[]; + * char usbDescriptorString0[]; + * int usbDescriptorStringVendor[]; + * int usbDescriptorStringDevice[]; + * int usbDescriptorStringSerialNumber[]; + * Other descriptors can't be provided statically, they must be provided + * dynamically at runtime. + * + * Descriptor properties are or-ed or added together, e.g.: + * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) + * + * The following descriptors are defined: + * USB_CFG_DESCR_PROPS_DEVICE + * USB_CFG_DESCR_PROPS_CONFIGURATION + * USB_CFG_DESCR_PROPS_STRINGS + * USB_CFG_DESCR_PROPS_STRING_0 + * USB_CFG_DESCR_PROPS_STRING_VENDOR + * USB_CFG_DESCR_PROPS_STRING_PRODUCT + * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER + * USB_CFG_DESCR_PROPS_HID + * USB_CFG_DESCR_PROPS_HID_REPORT + * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) + * + * Note about string descriptors: String descriptors are not just strings, they + * are Unicode strings prefixed with a 2 byte header. Example: + * int serialNumberDescriptor[] = { + * USB_STRING_DESCRIPTOR_HEADER(6), + * 'S', 'e', 'r', 'i', 'a', 'l' + * }; + */ + +#define USB_CFG_DESCR_PROPS_DEVICE 0 +#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 +#define USB_CFG_DESCR_PROPS_STRINGS 0 +#define USB_CFG_DESCR_PROPS_STRING_0 0 +#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 +#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 +#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 +//#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC +#define USB_CFG_DESCR_PROPS_HID 0 +#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_HID_REPORT 0 +#define USB_CFG_DESCR_PROPS_UNKNOWN 0 + +/* ----------------------- Optional MCU Description ------------------------ */ + +/* The following configurations have working defaults in usbdrv.h. You + * usually don't need to set them explicitly. Only if you want to run + * the driver on a device which is not yet supported or with a compiler + * which is not fully supported (such as IAR C) or if you use a differnt + * interrupt than INT0, you may have to define some of these. + */ +/* #define USB_INTR_CFG MCUCR */ +/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ +/* #define USB_INTR_CFG_CLR 0 */ +/* #define USB_INTR_ENABLE GIMSK */ +/* #define USB_INTR_ENABLE_BIT INT0 */ +/* #define USB_INTR_PENDING GIFR */ +/* #define USB_INTR_PENDING_BIT INTF0 */ +/* #define USB_INTR_VECTOR INT0_vect */ + +#endif /* __usbconfig_h_included__ */ From 6f5e8ce17e89005130cd0f9ecc6e346a77bb624b Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 15 Jul 2015 15:13:15 +0900 Subject: [PATCH 012/179] usb_usb: Support locking key indicator LED --- converter/usb_usb/Makefile | 1 - converter/usb_usb/led.c | 24 -------------------- converter/usb_usb/main.cpp | 46 +++++++++++++++++++------------------- tmk_core/common/led.h | 8 +++++++ 4 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 converter/usb_usb/led.c diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index f1a1c24d..0f25232b 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 fc0eeb0f..00000000 --- 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 57a5de3d..652c8057 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() + + +/* + * 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) { - if (usb_host.Init() == -1) { - LED_TX_OFF; - } - - _delay_ms(200); - - kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); + 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). */ diff --git a/tmk_core/common/led.h b/tmk_core/common/led.h index 402a247b..d5fc051b 100644 --- a/tmk_core/common/led.h +++ b/tmk_core/common/led.h @@ -28,6 +28,14 @@ along with this program. If not, see . #define USB_LED_KANA 4 +#ifdef __cplusplus +extern "C" { +#endif + void led_set(uint8_t usb_led); +#ifdef __cplusplus +} +#endif + #endif From 1efdd867c8f88ad779ad82e1b22df62bf6be8fe9 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 15 Jul 2015 16:02:20 +0900 Subject: [PATCH 013/179] usb_usb: Ignore error usage(0x01-03) report --- tmk_core/protocol/usb_hid/parser.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp index 28151f9d..1a152ff3 100644 --- a/tmk_core/protocol/usb_hid/parser.cpp +++ b/tmk_core/protocol/usb_hid/parser.cpp @@ -10,15 +10,24 @@ 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; + + dprintf("KBDReport: %02X %02X", 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]); + } + 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(); - - debug("KBDReport: "); - debug_hex(usb_hid_keyboard_report.mods); - debug(" --"); - for (uint8_t i = 0; i < 6; i++) { - debug(" "); - debug_hex(usb_hid_keyboard_report.keys[i]); - } - debug("\r\n"); } From d4220ac9f36209ba7e641f35181b41f84b9c98da Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 23 Jul 2015 11:57:15 +0900 Subject: [PATCH 014/179] hhkb: Add power saving code of matrix scan for JP --- keyboard/hhkb/hhkb_avr.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h index 7ea6322c..c3e176fa 100644 --- a/keyboard/hhkb/hhkb_avr.h +++ b/keyboard/hhkb/hhkb_avr.h @@ -45,12 +45,20 @@ static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); } static inline void KEY_POWER_ON(void) { DDRB = 0xFF; PORTB = 0x40; // change pins output DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on +#ifdef HHKB_JP + DDRC |= (1<<6|1<<7); + PORTC |= (1<<6|1<<7); +#endif /* Without this wait you will miss or get false key events. */ _delay_ms(5); // wait for powering up } static inline void KEY_POWER_OFF(void) { /* input with pull-up consumes less than without it when pin is open. */ DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up +#ifdef HHKB_JP + DDRC &= ~(1<<6|1<<7); + PORTC |= (1<<6|1<<7); +#endif DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off } static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); } From 35203cad6ad4294409bd39dd85ff7858b353570d Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 23 Jul 2015 11:58:15 +0900 Subject: [PATCH 015/179] core: Fix lufa suspend callback(#234) With matrix_power_down() in suspend event HHKB JP doesn't start up for some reason. It is unneeded in actual and removed. --- tmk_core/protocol/lufa/lufa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 85fdeabd..65c215bf 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -179,7 +179,6 @@ 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 79cf2d59aeb53f47ddb665db0eb9366c4aa73057 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 8 Aug 2015 16:01:26 +0900 Subject: [PATCH 016/179] Fix #239 unresponsive keys of HHKB JP during power saving --- keyboard/hhkb/hhkb_avr.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h index c3e176fa..7ea6322c 100644 --- a/keyboard/hhkb/hhkb_avr.h +++ b/keyboard/hhkb/hhkb_avr.h @@ -45,20 +45,12 @@ static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); } static inline void KEY_POWER_ON(void) { DDRB = 0xFF; PORTB = 0x40; // change pins output DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on -#ifdef HHKB_JP - DDRC |= (1<<6|1<<7); - PORTC |= (1<<6|1<<7); -#endif /* Without this wait you will miss or get false key events. */ _delay_ms(5); // wait for powering up } static inline void KEY_POWER_OFF(void) { /* input with pull-up consumes less than without it when pin is open. */ DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up -#ifdef HHKB_JP - DDRC &= ~(1<<6|1<<7); - PORTC |= (1<<6|1<<7); -#endif DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off } static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); } From 455fd51a87693e8368a520730082fdc0a7c377eb Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 5 Sep 2015 09:00:33 +0900 Subject: [PATCH 017/179] Fix 'enable break' commands for Alps models https://geekhack.org/index.php?topic=54706.msg1856618#msg1856618 --- converter/ibm4704_usb/matrix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/converter/ibm4704_usb/matrix.c b/converter/ibm4704_usb/matrix.c index 155df9c3..5b91d49f 100644 --- a/converter/ibm4704_usb/matrix.c +++ b/converter/ibm4704_usb/matrix.c @@ -68,8 +68,9 @@ uint8_t matrix_cols(void) static void enable_break(void) { print("Enable break: "); + while (ibm4704_send(0xFC)) { _delay_ms(10); } // valid scancode: 00-79h - for (uint8_t code = 0; code < 0x7A; code++) { + for (uint8_t code = 0; code < 0x7F; code++) { while (ibm4704_send(0x80|code)) _delay_ms(10); _delay_ms(5); // wait for response // No response(FF) when ok, FD when out of bound From a63a9c7845c46b2b10a7a33b56001b89cbc93203 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 7 Sep 2015 08:58:18 +0900 Subject: [PATCH 018/179] ibm4704: Add keymap for Alps models https://geekhack.org/index.php?topic=54706.msg1858175#msg1858175 --- converter/ibm4704_usb/README.md | 3 +++ converter/ibm4704_usb/keymap_common.h | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md index 15c826ab..68db4bd0 100644 --- a/converter/ibm4704_usb/README.md +++ b/converter/ibm4704_usb/README.md @@ -7,6 +7,7 @@ Keyboard initialization process takes a few seconds at start up. During that you Update ------ +2015/09/07 Added keymap for Alps 102-key. Thanks, tai @ geekhack! 2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack! 2015/05/19 Fixed a protocol handling bug. @@ -67,3 +68,5 @@ To select keymap: Keymap ------ Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_.c` and see keymap document(you can find in top README.md) and existent keymap files. + +Use `KEYMAP_ALPS102()` to define your keymap for Alps models. diff --git a/converter/ibm4704_usb/keymap_common.h b/converter/ibm4704_usb/keymap_common.h index 30eba6ab..9cb23b0b 100644 --- a/converter/ibm4704_usb/keymap_common.h +++ b/converter/ibm4704_usb/keymap_common.h @@ -116,4 +116,31 @@ extern const uint16_t fn_actions[]; { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, } \ } +/* Alps 102-key */ +#define KEYMAP_ALPS102( \ + K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K44, K45, K46, K43, K41, K42, K4A, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K54, K55, K56, K50, K51, K52, K5A, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K64, K65, K66, K60, K61, K62, K6B, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K74, K75, K76, K70, K71, K72, K7B, \ + K31, K47, K3F, K40, K4F, K48, K2F, K77, K67, K57, K73, K63, K53, K4E \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ + { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO, }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ + { KC_##K48, KC_NO, KC_##K4A, KC_NO, KC_NO, KC_NO, KC_##K4E, KC_##K4F }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ + { KC_NO, KC_NO, KC_##K5A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ + { KC_NO, KC_NO, KC_NO, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO, }, \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ + { KC_NO, KC_NO, KC_NO, KC_##K7B, KC_NO, KC_NO, KC_NO, KC_NO, } \ +} + + #endif From be9be90483ce083490c11b1ae4695ec5149bc783 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 7 Sep 2015 21:33:06 +0100 Subject: [PATCH 019/179] Modularity and gcc warnings fixes. --- tmk_core/common.mk | 2 +- tmk_core/common/action_tapping.c | 2 +- tmk_core/common/bootmagic.c | 2 +- tmk_core/common/command.c | 15 ++++++++++++--- tmk_core/common/keymap.c | 6 ++++++ tmk_core/common/progmem.h | 4 ++-- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index cb030b33..f5a464d0 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -1,4 +1,4 @@ -COMMON_DIR = common +COMMON_DIR = $(TMK_DIR)/common SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ $(COMMON_DIR)/action.c \ diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 826c2330..487c62f1 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -257,7 +257,7 @@ bool process_tapping(keyrecord_t *keyp) return true; } } else { - if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n"); + if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; process_action(keyp); return true; } diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index b002a585..d6684b2d 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -19,7 +19,7 @@ void bootmagic(void) } /* do scans in case of bounce */ - print("boogmagic scan: ... "); + print("bootmagic scan: ... "); uint8_t scan = 100; while (scan--) { matrix_scan(); _delay_ms(10); } print("done.\n"); diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 1b6808be..b017f2e2 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -16,7 +16,7 @@ along with this program. If not, see . */ #include #include -#include +#include "wait.h" #include "keycode.h" #include "host.h" #include "keymap.h" @@ -97,12 +97,14 @@ bool command_proc(uint8_t code) bool command_extra(uint8_t code) __attribute__ ((weak)); bool command_extra(uint8_t code) { + (void)code; return false; } bool command_console_extra(uint8_t code) __attribute__ ((weak)); bool command_console_extra(uint8_t code) { + (void)code; return false; } @@ -178,7 +180,9 @@ static void print_eeconfig(void) static bool command_common(uint8_t code) { +#ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; +#endif switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: @@ -223,7 +227,7 @@ static bool command_common(uint8_t code) case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); - _delay_ms(1000); + wait_ms(1000); bootloader_jump(); // not return break; case KC_D: @@ -307,15 +311,20 @@ static bool command_common(uint8_t code) " " STR(BOOTLOADER_SIZE) "\n"); print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) +#if defined(__AVR__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); +#elif defined(__arm__) + // TODO + ); +#endif break; case KC_S: print("\n\t- Status -\n"); print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); - print_val_hex32(timer_count); + print_val_hex32(timer_read32()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index 9f4fab52..be00076c 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -108,6 +108,9 @@ action_t action_for_key(uint8_t layer, keypos_t key) __attribute__ ((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; return MACRO_NONE; } @@ -115,6 +118,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) __attribute__ ((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; } diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h index 199b1bed..5b276562 100644 --- a/tmk_core/common/progmem.h +++ b/tmk_core/common/progmem.h @@ -5,8 +5,8 @@ # include #elif defined(__arm__) # define PROGMEM -# define pgm_read_byte(p) *(p) -# define pgm_read_word(p) *(p) +# define pgm_read_byte(p) *((unsigned char*)p) +# define pgm_read_word(p) *((uint16_t*)p) #endif #endif From 27dec2db7bb33cc45b04b89b6855bac6b98de2e5 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 7 Sep 2015 21:57:04 +0100 Subject: [PATCH 020/179] Add ChibiOS support (USB stack + support files). --- tmk_core/common/chibios/bootloader.c | 7 + tmk_core/common/chibios/printf.c | 240 +++++ tmk_core/common/chibios/printf.h | 111 +++ tmk_core/common/chibios/suspend.c | 8 + tmk_core/common/chibios/timer.c | 27 + tmk_core/common/command.c | 3 + tmk_core/common/print.c | 8 +- tmk_core/common/print.h | 10 +- tmk_core/common/wait.h | 8 +- tmk_core/protocol/chibios/.gitignore | 1 + tmk_core/protocol/chibios/README.md | 25 + tmk_core/protocol/chibios/chibios.mk | 225 +++++ tmk_core/protocol/chibios/main.c | 91 ++ tmk_core/protocol/chibios/usb_main.c | 1251 ++++++++++++++++++++++++++ tmk_core/protocol/chibios/usb_main.h | 149 +++ tmk_core/tool/chibios/common.mk | 86 ++ 16 files changed, 2245 insertions(+), 5 deletions(-) create mode 100644 tmk_core/common/chibios/bootloader.c create mode 100644 tmk_core/common/chibios/printf.c create mode 100644 tmk_core/common/chibios/printf.h create mode 100644 tmk_core/common/chibios/suspend.c create mode 100644 tmk_core/common/chibios/timer.c create mode 100644 tmk_core/protocol/chibios/.gitignore create mode 100644 tmk_core/protocol/chibios/README.md create mode 100644 tmk_core/protocol/chibios/chibios.mk create mode 100644 tmk_core/protocol/chibios/main.c create mode 100644 tmk_core/protocol/chibios/usb_main.c create mode 100644 tmk_core/protocol/chibios/usb_main.h create mode 100644 tmk_core/tool/chibios/common.mk diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c new file mode 100644 index 00000000..6c34e2e0 --- /dev/null +++ b/tmk_core/common/chibios/bootloader.c @@ -0,0 +1,7 @@ +/* TODO */ +/* ... chip dependent ... */ + +#include "bootloader.h" + + +void bootloader_jump(void) {} diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c new file mode 100644 index 00000000..72e3d4f8 --- /dev/null +++ b/tmk_core/common/chibios/printf.c @@ -0,0 +1,240 @@ +/* + * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php + * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php + */ + +/* +File: printf.c + +Copyright (C) 2004 Kustaa Nyholm + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "printf.h" + +typedef void (*putcf) (void*,char); +static putcf stdout_putf; +static void* stdout_putp; + +// this adds cca 400 bytes +#define PRINTF_LONG_SUPPORT + +#ifdef PRINTF_LONG_SUPPORT + +static void uli2a(unsigned long int num, unsigned int base, int uc,char * bf) + { + int n=0; + unsigned int d=1; + while (num/d >= base) + d*=base; + while (d!=0) { + int dgt = num / d; + num%=d; + d/=base; + if (n || dgt>0|| d==0) { + *bf++ = dgt+(dgt<10 ? '0' : (uc ? 'A' : 'a')-10); + ++n; + } + } + *bf=0; + } + +static void li2a (long num, char * bf) + { + if (num<0) { + num=-num; + *bf++ = '-'; + } + uli2a(num,10,0,bf); + } + +#endif + +static void ui2a(unsigned int num, unsigned int base, int uc,char * bf) + { + int n=0; + unsigned int d=1; + while (num/d >= base) + d*=base; + while (d!=0) { + int dgt = num / d; + num%= d; + d/=base; + if (n || dgt>0 || d==0) { + *bf++ = dgt+(dgt<10 ? '0' : (uc ? 'A' : 'a')-10); + ++n; + } + } + *bf=0; + } + +static void i2a (int num, char * bf) + { + if (num<0) { + num=-num; + *bf++ = '-'; + } + ui2a(num,10,0,bf); + } + +static int a2d(char ch) + { + if (ch>='0' && ch<='9') + return ch-'0'; + else if (ch>='a' && ch<='f') + return ch-'a'+10; + else if (ch>='A' && ch<='F') + return ch-'A'+10; + else return -1; + } + +static char a2i(char ch, char** src,int base,int* nump) + { + char* p= *src; + int num=0; + int digit; + while ((digit=a2d(ch))>=0) { + if (digit>base) break; + num=num*base+digit; + ch=*p++; + } + *src=p; + *nump=num; + return ch; + } + +static void putchw(void* putp,putcf putf,int n, char z, char* bf) + { + char fc=z? '0' : ' '; + char ch; + char* p=bf; + while (*p++ && n > 0) + n--; + while (n-- > 0) + putf(putp,fc); + while ((ch= *bf++)) + putf(putp,ch); + } + +void tfp_format(void* putp,putcf putf,char *fmt, va_list va) + { + char bf[12]; + + char ch; + + + while ((ch=*(fmt++))) { + if (ch!='%') + putf(putp,ch); + else { + char lz=0; +#ifdef PRINTF_LONG_SUPPORT + char lng=0; +#endif + int w=0; + ch=*(fmt++); + if (ch=='0') { + ch=*(fmt++); + lz=1; + } + if (ch>='0' && ch<='9') { + ch=a2i(ch,&fmt,10,&w); + } +#ifdef PRINTF_LONG_SUPPORT + if (ch=='l') { + ch=*(fmt++); + lng=1; + } +#endif + switch (ch) { + case 0: + goto abort; + case 'u' : { +#ifdef PRINTF_LONG_SUPPORT + if (lng) + uli2a(va_arg(va, unsigned long int),10,0,bf); + else +#endif + ui2a(va_arg(va, unsigned int),10,0,bf); + putchw(putp,putf,w,lz,bf); + break; + } + case 'd' : { +#ifdef PRINTF_LONG_SUPPORT + if (lng) + li2a(va_arg(va, unsigned long int),bf); + else +#endif + i2a(va_arg(va, int),bf); + putchw(putp,putf,w,lz,bf); + break; + } + case 'x': case 'X' : +#ifdef PRINTF_LONG_SUPPORT + if (lng) + uli2a(va_arg(va, unsigned long int),16,(ch=='X'),bf); + else +#endif + ui2a(va_arg(va, unsigned int),16,(ch=='X'),bf); + putchw(putp,putf,w,lz,bf); + break; + case 'c' : + putf(putp,(char)(va_arg(va, int))); + break; + case 's' : + putchw(putp,putf,w,0,va_arg(va, char*)); + break; + case '%' : + putf(putp,ch); + default: + break; + } + } + } + abort:; + } + + +void init_printf(void* putp,void (*putf) (void*,char)) + { + stdout_putf=putf; + stdout_putp=putp; + } + +void tfp_printf(char *fmt, ...) + { + va_list va; + va_start(va,fmt); + tfp_format(stdout_putp,stdout_putf,fmt,va); + va_end(va); + } + +static void putcp(void* p,char c) + { + *(*((char**)p))++ = c; + } + + + +void tfp_sprintf(char* s,char *fmt, ...) + { + va_list va; + va_start(va,fmt); + tfp_format(&s,putcp,fmt,va); + putcp(&s,0); + va_end(va); + } diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h new file mode 100644 index 00000000..00813198 --- /dev/null +++ b/tmk_core/common/chibios/printf.h @@ -0,0 +1,111 @@ +/* + * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php + * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php + */ + +/* +File: printf.h + +Copyright (C) 2004 Kustaa Nyholm + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +This library is realy just two files: 'printf.h' and 'printf.c'. + +They provide a simple and small (+200 loc) printf functionality to +be used in embedded systems. + +I've found them so usefull in debugging that I do not bother with a +debugger at all. + +They are distributed in source form, so to use them, just compile them +into your project. + +Two printf variants are provided: printf and sprintf. + +The formats supported by this implementation are: 'd' 'u' 'c' 's' 'x' 'X'. + +Zero padding and field width are also supported. + +If the library is compiled with 'PRINTF_SUPPORT_LONG' defined then the +long specifier is also +supported. Note that this will pull in some long math routines (pun intended!) +and thus make your executable noticably longer. + +The memory foot print of course depends on the target cpu, compiler and +compiler options, but a rough guestimate (based on a H8S target) is about +1.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space. +Not too bad. Your milage may vary. By hacking the source code you can +get rid of some hunred bytes, I'm sure, but personally I feel the balance of +functionality and flexibility versus code size is close to optimal for +many embedded systems. + +To use the printf you need to supply your own character output function, +something like : + + void putc ( void* p, char c) + { + while (!SERIAL_PORT_EMPTY) ; + SERIAL_PORT_TX_REGISTER = c; + } + +Before you can call printf you need to initialize it to use your +character output function with something like: + + init_printf(NULL,putc); + +Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', +the NULL (or any pointer) you pass into the 'init_printf' will eventually be +passed to your 'putc' routine. This allows you to pass some storage space (or +anything realy) to the character output function, if necessary. +This is not often needed but it was implemented like that because it made +implementing the sprintf function so neat (look at the source code). + +The code is re-entrant, except for the 'init_printf' function, so it +is safe to call it from interupts too, although this may result in mixed output. +If you rely on re-entrancy, take care that your 'putc' function is re-entrant! + +The printf and sprintf functions are actually macros that translate to +'tfp_printf' and 'tfp_sprintf'. This makes it possible +to use them along with 'stdio.h' printf's in a single source file. +You just need to undef the names before you include the 'stdio.h'. +Note that these are not function like macros, so if you have variables +or struct members with these names, things will explode in your face. +Without variadic macros this is the best we can do to wrap these +fucnction. If it is a problem just give up the macros and use the +functions directly or rename them. + +For further details see source code. + +regs Kusti, 23.10.2004 +*/ + + +#ifndef __TFP_PRINTF__ +#define __TFP_PRINTF__ + +#include + +void init_printf(void* putp,void (*putf) (void*,char)); + +void tfp_printf(char *fmt, ...); +void tfp_sprintf(char* s,char *fmt, ...); + +void tfp_format(void* putp,void (*putf) (void*,char),char *fmt, va_list va); + +#define printf tfp_printf +#define sprintf tfp_sprintf + +#endif diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c new file mode 100644 index 00000000..49ecad43 --- /dev/null +++ b/tmk_core/common/chibios/suspend.c @@ -0,0 +1,8 @@ +/* TODO */ + +#include + + +void suspend_power_down(void) {} +bool suspend_wakeup_condition(void) { return true; } +void suspend_wakeup_init(void) {} diff --git a/tmk_core/common/chibios/timer.c b/tmk_core/common/chibios/timer.c new file mode 100644 index 00000000..c812994b --- /dev/null +++ b/tmk_core/common/chibios/timer.c @@ -0,0 +1,27 @@ +#include "ch.h" + +#include "timer.h" + +void timer_init(void) {} + +void timer_clear(void) {} + +uint16_t timer_read(void) +{ + return (uint16_t)ST2MS(chVTGetSystemTime()); +} + +uint32_t timer_read32(void) +{ + return ST2MS(chVTGetSystemTime()); +} + +uint16_t timer_elapsed(uint16_t last) +{ + return (uint16_t)(ST2MS(chVTTimeElapsedSinceX(MS2ST(last)))); +} + +uint32_t timer_elapsed32(uint32_t last) +{ + return ST2MS(chVTTimeElapsedSinceX(MS2ST(last))); +} diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index b017f2e2..8fb6db56 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -287,6 +287,9 @@ static bool command_common(uint8_t code) #ifdef PROTOCOL_VUSB " VUSB" #endif +#ifdef PROTOCOL_CHIBIOS + " CHIBIOS" +#endif #ifdef BOOTMAGIC_ENABLE " BOOTMAGIC" #endif diff --git a/tmk_core/common/print.c b/tmk_core/common/print.c index ca94e1e5..00489557 100644 --- a/tmk_core/common/print.c +++ b/tmk_core/common/print.c @@ -38,11 +38,15 @@ void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) xdev_out(sendchar_func); } -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ + +// don't need anything extra + +#elif defined(__arm__) /* __AVR__ */ // TODO //void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { } -#endif +#endif /* __AVR__ */ #endif diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index c0e9e143..1e1b9b40 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h @@ -47,7 +47,15 @@ extern "C" /* function pointer of sendchar to be used by print utility */ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ + +#include "chibios/printf.h" + +#define print(s) printf(s) +#define println(s) printf(s "\r\n") +#define xprintf printf + +#elif defined(__arm__) /* __AVR__ */ #include "mbed/xprintf.h" diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index 40d00b0c..82727be0 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h @@ -9,9 +9,13 @@ extern "C" { # include # define wait_ms(ms) _delay_ms(ms) # define wait_us(us) _delay_us(us) -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ +# include "ch.h" +# define wait_ms(ms) chThdSleepMilliseconds(ms) +# define wait_us(us) chThdSleepMicroseconds(us) +#elif defined(__arm__) /* __AVR__ */ # include "wait_api.h" -#endif +#endif /* __AVR__ */ #ifdef __cplusplus } diff --git a/tmk_core/protocol/chibios/.gitignore b/tmk_core/protocol/chibios/.gitignore new file mode 100644 index 00000000..3118dbef --- /dev/null +++ b/tmk_core/protocol/chibios/.gitignore @@ -0,0 +1 @@ +chibios diff --git a/tmk_core/protocol/chibios/README.md b/tmk_core/protocol/chibios/README.md new file mode 100644 index 00000000..38fd495e --- /dev/null +++ b/tmk_core/protocol/chibios/README.md @@ -0,0 +1,25 @@ +## USB stack implementation using ChibiOS + +### Notes + +- To use, unpack or symlink ChibiOS here, to `chibios`. +- For gcc options, inspect `chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of hits on that. +Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. +- USB string descriptors are a mess. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. +- There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task` in `main.c`. There should be no such in `usb_main.c`. Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). +- It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. +- The USB stack works pretty completely; however there are bits of other TMK stuff that are not done yet: + +### Immediate todo + +- suspend / sleep led + +### Missing / not working (TMK vs ChibiOS bits) + +- eeprom / bootmagic (will be chip dependent) +- bootloader jump (chip dependent) + +### Tried with + +- ChibiOS 3.0.1 and ST F072RB DISCOVERY board. +- Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. diff --git a/tmk_core/protocol/chibios/chibios.mk b/tmk_core/protocol/chibios/chibios.mk new file mode 100644 index 00000000..d667f60e --- /dev/null +++ b/tmk_core/protocol/chibios/chibios.mk @@ -0,0 +1,225 @@ +############################################################################## +# Build global options +# NOTE: Can be overridden externally. +# + +# Compiler options here. +ifeq ($(USE_OPT),) + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -DPROTOCOL_CHIBIOS +endif + +# C specific options here (added to USE_OPT). +ifeq ($(USE_COPT),) + USE_COPT = +endif + +# include specific config.h? +ifdef CONFIG_H + USE_COPT += -include $(CONFIG_H) +endif + +# C++ specific options here (added to USE_OPT). +ifeq ($(USE_CPPOPT),) + USE_CPPOPT = -fno-rtti +endif + +# Enable this if you want the linker to remove unused code and data +ifeq ($(USE_LINK_GC),) + USE_LINK_GC = yes +endif + +# Linker extra options here. +ifeq ($(USE_LDOPT),) + USE_LDOPT = +endif + +# Enable this if you want link time optimizations (LTO) +ifeq ($(USE_LTO),) + USE_LTO = yes +endif + +# If enabled, this option allows to compile the application in THUMB mode. +ifeq ($(USE_THUMB),) + USE_THUMB = yes +endif + +# Enable this if you want to see the full log while compiling. +ifeq ($(USE_VERBOSE_COMPILE),) + USE_VERBOSE_COMPILE = no +endif + +# If enabled, this option makes the build process faster by not compiling +# modules not used in the current configuration. +ifeq ($(USE_SMART_BUILD),) + USE_SMART_BUILD = yes +endif + +# +# Build global options +############################################################################## + +############################################################################## +# Architecture or project specific options +# + +# Stack size to be allocated to the Cortex-M process stack. This stack is +# the stack used by the main() thread. +ifeq ($(USE_PROCESS_STACKSIZE),) + USE_PROCESS_STACKSIZE = 0x200 +endif + +# Stack size to the allocated to the Cortex-M main/exceptions stack. This +# stack is used for processing interrupts and exceptions. +ifeq ($(USE_EXCEPTIONS_STACKSIZE),) + USE_EXCEPTIONS_STACKSIZE = 0x400 +endif + +# +# Architecture or project specific options +############################################################################## + +############################################################################## +# Project, sources and paths +# + +# Imported source files and paths +CHIBIOS = $(TMK_DIR)/protocol/chibios/chibios +# Startup files. +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]').mk +# HAL-OSAL files (optional). +include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk +ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD))","") + include $(TARGET_DIR)/boards/$(BOARD)/board.mk +else + include $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk +endif +include $(CHIBIOS)/os/hal/osal/rt/osal.mk +# RTOS files (optional). +include $(CHIBIOS)/os/rt/rt.mk +include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +# Other files (optional). + +# Define linker script file here +ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_MODEL_FAMILY).ld)","") +LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_MODEL_FAMILY).ld +else +LDSCRIPT = $(STARTUPLD)/$(MCU_MODEL_FAMILY).ld +endif + +# C sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CSRC = $(STARTUPSRC) \ + $(KERNSRC) \ + $(PORTSRC) \ + $(OSALSRC) \ + $(HALSRC) \ + $(PLATFORMSRC) \ + $(BOARDSRC) \ + $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ + $(TMK_DIR)/protocol/chibios/usb_main.c \ + $(TMK_DIR)/protocol/chibios/main.c \ + $(SRC) + +# C++ sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CPPSRC = + +# C sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACSRC = + +# C++ sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACPPSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCPPSRC = + +# List ASM source files here +ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) + +INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ + $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \ + $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \ + $(TARGET_DIR) + +# +# Project, sources and paths +############################################################################## + +############################################################################## +# Compiler settings +# + +MCU = cortex-m0 + +#TRGT = arm-elf- +TRGT = arm-none-eabi- +CC = $(TRGT)gcc +CPPC = $(TRGT)g++ +# Enable loading with g++ only if you need C++ runtime support. +# NOTE: You can use C++ even without C++ support if you are careful. C++ +# runtime support makes code size explode. +LD = $(TRGT)gcc +#LD = $(TRGT)g++ +CP = $(TRGT)objcopy +AS = $(TRGT)gcc -x assembler-with-cpp +AR = $(TRGT)ar +OD = $(TRGT)objdump +SZ = $(TRGT)size +HEX = $(CP) -O ihex +BIN = $(CP) -O binary + +# ARM-specific options here +AOPT = + +# THUMB-specific options here +TOPT = -mthumb -DTHUMB + +# Define C warning options here +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-missing-field-initializers + +# Define C++ warning options here +CPPWARN = -Wall -Wextra -Wundef + +# +# Compiler settings +############################################################################## + +############################################################################## +# Start of user section +# + +# List all user C define here, like -D_DEBUG=1 +## Select which interfaces to include here! +UDEFS = $(OPT_DEFS) + +# Define ASM defines here +UADEFS = + +# List all user directories here +UINCDIR = + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# +# End of user defines +############################################################################## + +RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +include $(RULESPATH)/rules.mk diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c new file mode 100644 index 00000000..ce7cd8e3 --- /dev/null +++ b/tmk_core/protocol/chibios/main.c @@ -0,0 +1,91 @@ +/* + * (c) 2015 flabberast + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + +#include "ch.h" +#include "hal.h" + +#include "usb_main.h" + +/* TMK includes */ +#include "report.h" +#include "host.h" +#include "host_driver.h" +#include "keyboard.h" +#include "action.h" +#include "led.h" +#include "sendchar.h" +#include "debug.h" +#ifdef SLEEP_LED_ENABLE +#include "sleep_led.h" +#endif +#include "suspend.h" + + +/* ------------------------- + * TMK host driver defs + * ------------------------- + */ + +host_driver_t chibios_driver = { + keyboard_leds, + send_keyboard, + send_mouse, + send_system, + send_consumer +}; + +/* Main thread + */ +int main(void) { + /* ChibiOS/RT init */ + halInit(); + chSysInit(); + + palSetPad(GPIOC, GPIOC_LED_BLUE); + chThdSleepMilliseconds(400); + palClearPad(GPIOC, GPIOC_LED_BLUE); + + /* Init USB */ + init_usb_driver(); + + /* init printf */ + init_printf(NULL,sendchar_pf); + + /* Wait until the USB is active */ + while(USB_DRIVER.state != USB_ACTIVE) + chThdSleepMilliseconds(50); + + print("USB configured.\n"); + + /* init TMK modules */ + keyboard_init(); + host_set_driver(&chibios_driver); + +#ifdef SLEEP_LED_ENABLE + sleep_led_init(); +#endif + + print("Keyboard start.\n"); + + /* Main loop */ + while(true) { + /* TODO: check for suspended event */ + + keyboard_task(); + chThdSleepMilliseconds(5); + } +} diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c new file mode 100644 index 00000000..875f47dc --- /dev/null +++ b/tmk_core/protocol/chibios/usb_main.c @@ -0,0 +1,1251 @@ +/* + * (c) 2015 flabberast + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + +#include "ch.h" +#include "hal.h" + +#include "usb_main.h" + +/* --------------------------------------------------------- + * Global interface variables and declarations + * --------------------------------------------------------- + */ + +uint8_t keyboard_idle = 0; +uint8_t keyboard_protocol = 1; +uint16_t keyboard_led_stats = 0; +volatile uint16_t keyboard_idle_count = 0; +static virtual_timer_t keyboard_idle_timer; +static void keyboard_idle_timer_cb(void *arg); +#ifdef NKRO_ENABLE +bool keyboard_nkro = true; +#endif /* NKRO_ENABLE */ + +report_keyboard_t keyboard_report_sent = {{0}}; + +#ifdef CONSOLE_ENABLE +/* The emission queue */ +output_queue_t console_queue; +static uint8_t console_queue_buffer[CONSOLE_QUEUE_BUFFER_SIZE]; +static virtual_timer_t console_flush_timer; +void console_queue_onotify(io_queue_t *qp); +static void console_flush_cb(void *arg); +#endif /* CONSOLE_ENABLE */ + +/* --------------------------------------------------------- + * Descriptors and USB driver objects + * --------------------------------------------------------- + */ + +/* HID specific constants */ +#define USB_DESCRIPTOR_HID 0x21 +#define USB_DESCRIPTOR_HID_REPORT 0x22 +#define HID_GET_REPORT 0x01 +#define HID_GET_IDLE 0x02 +#define HID_GET_PROTOCOL 0x03 +#define HID_SET_REPORT 0x09 +#define HID_SET_IDLE 0x0A +#define HID_SET_PROTOCOL 0x0B + +/* USB Device Descriptor */ +static const uint8_t usb_device_descriptor_data[] = { + USB_DESC_DEVICE(0x0200, // bcdUSB (1.1) + 0, // bDeviceClass (defined in later in interface) + 0, // bDeviceSubClass + 0, // bDeviceProtocol + 64, // bMaxPacketSize (64 bytes) (the driver didn't work with 32) + VENDOR_ID, // idVendor + PRODUCT_ID, // idProduct + DEVICE_VER, // bcdDevice + 1, // iManufacturer + 2, // iProduct + 3, // iSerialNumber + 1) // bNumConfigurations +}; + +/* Device Descriptor wrapper */ +static const USBDescriptor usb_device_descriptor = { + sizeof usb_device_descriptor_data, + usb_device_descriptor_data +}; + +/* + * HID Report Descriptor + * + * See "Device Class Definition for Human Interface Devices (HID)" + * (http://www.usb.org/developers/hidpage/HID1_11.pdf) for the + * detailed descrition of all the fields + */ + +/* Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60 */ +static const uint8_t keyboard_hid_report_desc_data[] = { + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x06, // Usage (Keyboard), + 0xA1, 0x01, // Collection (Application), + 0x75, 0x01, // Report Size (1), + 0x95, 0x08, // Report Count (8), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0xE0, // Usage Minimum (224), + 0x29, 0xE7, // Usage Maximum (231), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte + 0x95, 0x01, // Report Count (1), + 0x75, 0x08, // Report Size (8), + 0x81, 0x03, // Input (Constant), ;Reserved byte + 0x95, 0x05, // Report Count (5), + 0x75, 0x01, // Report Size (1), + 0x05, 0x08, // Usage Page (LEDs), + 0x19, 0x01, // Usage Minimum (1), + 0x29, 0x05, // Usage Maximum (5), + 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report + 0x95, 0x01, // Report Count (1), + 0x75, 0x03, // Report Size (3), + 0x91, 0x03, // Output (Constant), ;LED report padding + 0x95, KBD_REPORT_KEYS, // Report Count (), + 0x75, 0x08, // Report Size (8), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0xFF, // Logical Maximum(255), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0x00, // Usage Minimum (0), + 0x29, 0xFF, // Usage Maximum (255), + 0x81, 0x00, // Input (Data, Array), + 0xc0 // End Collection +}; +/* wrapper */ +static const USBDescriptor keyboard_hid_report_descriptor = { + sizeof keyboard_hid_report_desc_data, + keyboard_hid_report_desc_data +}; + +#ifdef NKRO_ENABLE +static const uint8_t nkro_hid_report_desc_data[] = { + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x06, // Usage (Keyboard), + 0xA1, 0x01, // Collection (Application), + // bitmap of modifiers + 0x75, 0x01, // Report Size (1), + 0x95, 0x08, // Report Count (8), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0xE0, // Usage Minimum (224), + 0x29, 0xE7, // Usage Maximum (231), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte + // LED output report + 0x95, 0x05, // Report Count (5), + 0x75, 0x01, // Report Size (1), + 0x05, 0x08, // Usage Page (LEDs), + 0x19, 0x01, // Usage Minimum (1), + 0x29, 0x05, // Usage Maximum (5), + 0x91, 0x02, // Output (Data, Variable, Absolute), + 0x95, 0x01, // Report Count (1), + 0x75, 0x03, // Report Size (3), + 0x91, 0x03, // Output (Constant), + // bitmap of keys + 0x95, NKRO_REPORT_KEYS * 8, // Report Count (), + 0x75, 0x01, // Report Size (1), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum(1), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0x00, // Usage Minimum (0), + 0x29, NKRO_REPORT_KEYS * 8 - 1, // Usage Maximum (), + 0x81, 0x02, // Input (Data, Variable, Absolute), + 0xc0 // End Collection +}; +/* wrapper */ +static const USBDescriptor nkro_hid_report_descriptor = { + sizeof nkro_hid_report_desc_data, + nkro_hid_report_desc_data +}; +#endif /* NKRO_ENABLE */ + +#ifdef MOUSE_ENABLE +/* Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension + * http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 + * http://www.keil.com/forum/15671/ + * http://www.microsoft.com/whdc/device/input/wheel.mspx */ +static const uint8_t mouse_hid_report_desc_data[] = { + /* mouse */ + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x02, // USAGE (Mouse) + 0xa1, 0x01, // COLLECTION (Application) + //0x85, REPORT_ID_MOUSE, // REPORT_ID (1) + 0x09, 0x01, // USAGE (Pointer) + 0xa1, 0x00, // COLLECTION (Physical) + // ---------------------------- Buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x05, // USAGE_MAXIMUM (Button 5) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x05, // REPORT_COUNT (5) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x03, // REPORT_SIZE (3) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + // ---------------------------- X,Y position + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Vertical wheel + 0x09, 0x38, // USAGE (Wheel) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x35, 0x00, // PHYSICAL_MINIMUM (0) - reset physical + 0x45, 0x00, // PHYSICAL_MAXIMUM (0) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Horizontal wheel + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x0a, 0x38, 0x02, // USAGE (AC Pan) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +}; +/* wrapper */ +static const USBDescriptor mouse_hid_report_descriptor = { + sizeof mouse_hid_report_desc_data, + mouse_hid_report_desc_data +}; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +static const uint8_t console_hid_report_desc_data[] = { + 0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined) + 0x09, 0x74, // Usage 0x74 + 0xA1, 0x53, // Collection 0x53 + 0x75, 0x08, // report size = 8 bits + 0x15, 0x00, // logical minimum = 0 + 0x26, 0xFF, 0x00, // logical maximum = 255 + 0x95, CONSOLE_SIZE, // report count + 0x09, 0x75, // usage + 0x81, 0x02, // Input (array) + 0xC0 // end collection +}; +/* wrapper */ +static const USBDescriptor console_hid_report_descriptor = { + sizeof console_hid_report_desc_data, + console_hid_report_desc_data +}; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +/* audio controls & system controls + * http://www.microsoft.com/whdc/archive/w2kbd.mspx */ +static const uint8_t extra_hid_report_desc_data[] = { + /* system control */ + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x80, // USAGE (System Control) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) + 0x15, 0x01, // LOGICAL_MINIMUM (0x1) + 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) + 0x19, 0x01, // USAGE_MINIMUM (0x1) + 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x00, // INPUT (Data,Array,Abs) + 0xc0, // END_COLLECTION + /* consumer */ + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x09, 0x01, // USAGE (Consumer Control) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, REPORT_ID_CONSUMER, // REPORT_ID (3) + 0x15, 0x01, // LOGICAL_MINIMUM (0x1) + 0x26, 0x9c, 0x02, // LOGICAL_MAXIMUM (0x29c) + 0x19, 0x01, // USAGE_MINIMUM (0x1) + 0x2a, 0x9c, 0x02, // USAGE_MAXIMUM (0x29c) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x00, // INPUT (Data,Array,Abs) + 0xc0, // END_COLLECTION +}; +/* wrapper */ +static const USBDescriptor extra_hid_report_descriptor = { + sizeof extra_hid_report_desc_data, + extra_hid_report_desc_data +}; +#endif /* EXTRAKEY_ENABLE */ + + +/* + * Configuration Descriptor tree for a HID device + * + * The HID Specifications version 1.11 require the following order: + * - Configuration Descriptor + * - Interface Descriptor + * - HID Descriptor + * - Endpoints Descriptors + */ +#define KBD_HID_DESC_NUM 0 +#define KBD_HID_DESC_OFFSET (9 + (9 + 9 + 7) * KBD_HID_DESC_NUM + 9) + +#ifdef MOUSE_ENABLE +# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1) +# define MOUSE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * MOUSE_HID_DESC_NUM + 9) +#else /* MOUSE_ENABLE */ +# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0) +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +#define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) +#define CONSOLE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * CONSOLE_HID_DESC_NUM + 9) +#else /* CONSOLE_ENABLE */ +# define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 0) +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 1) +# define EXTRA_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) +#else /* EXTRAKEY_ENABLE */ +# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 0) +#endif /* EXTRAKEY_ENABLE */ + +#ifdef NKRO_ENABLE +# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1) +# define NKRO_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) +#else /* NKRO_ENABLE */ +# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 0) +#endif /* NKRO_ENABLE */ + +#define NUM_INTERFACES (NKRO_HID_DESC_NUM + 1) +#define CONFIG1_DESC_SIZE (9 + (9 + 9 + 7) * NUM_INTERFACES) + +static const uint8_t hid_configuration_descriptor_data[] = { + /* Configuration Descriptor (9 bytes) USB spec 9.6.3, page 264-266, Table 9-10 */ + USB_DESC_CONFIGURATION(CONFIG1_DESC_SIZE, // wTotalLength + NUM_INTERFACES, // bNumInterfaces + 1, // bConfigurationValue + 0, // iConfiguration + 0xA0, // bmAttributes + 50), // bMaxPower (100mA) + + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(KBD_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x01, // bInterfaceSubClass: Boot + 0x01, // bInterfaceProtocol: Keyboard + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(keyboard_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(KBD_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + KBD_SIZE, // wMaxPacketSize + 10), // bInterval + + #ifdef MOUSE_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(MOUSE_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass (0x03 = HID) + // ThinkPad T23 BIOS doesn't work with boot mouse. + 0x00, // bInterfaceSubClass (0x01 = Boot) + 0x00, // bInterfaceProtocol (0x02 = Mouse) + /* + 0x01, // bInterfaceSubClass (0x01 = Boot) + 0x02, // bInterfaceProtocol (0x02 = Mouse) + */ + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(mouse_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(MOUSE_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + MOUSE_SIZE, // wMaxPacketSize + 1), // bInterval + #endif /* MOUSE_ENABLE */ + + #ifdef CONSOLE_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(CONSOLE_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(console_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(CONSOLE_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + CONSOLE_SIZE, // wMaxPacketSize + 1), // bInterval + #endif /* CONSOLE_ENABLE */ + + #ifdef EXTRAKEY_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(EXTRA_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(extra_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(EXTRA_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + EXTRA_SIZE, // wMaxPacketSize + 10), // bInterval + #endif /* EXTRAKEY_ENABLE */ + + #ifdef NKRO_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(NKRO_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(nkro_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(NKRO_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + NKRO_SIZE, // wMaxPacketSize + 1), // bInterval + #endif /* NKRO_ENABLE */ +}; + +/* Configuration Descriptor wrapper */ +static const USBDescriptor hid_configuration_descriptor = { + sizeof hid_configuration_descriptor_data, + hid_configuration_descriptor_data +}; + +/* wrappers */ +#define HID_DESCRIPTOR_SIZE 9 +static const USBDescriptor keyboard_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[KBD_HID_DESC_OFFSET] +}; +#ifdef MOUSE_ENABLE +static const USBDescriptor mouse_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[MOUSE_HID_DESC_OFFSET] +}; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE +static const USBDescriptor console_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[CONSOLE_HID_DESC_OFFSET] +}; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE +static const USBDescriptor extra_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[EXTRA_HID_DESC_OFFSET] +}; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE +static const USBDescriptor nkro_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[NKRO_HID_DESC_OFFSET] +}; +#endif /* NKRO_ENABLE */ + + +/* U.S. English language identifier */ +static const uint8_t usb_string_langid[] = { + USB_DESC_BYTE(4), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USB_DESC_WORD(0x0409) // wLANGID (U.S. English) +}; + +/* ugly ugly hack */ +#define PP_NARG(...) \ + PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) +#define PP_NARG_(...) \ + PP_ARG_N(__VA_ARGS__) +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63,N,...) N +#define PP_RSEQ_N() \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9,8,7,6,5,4,3,2,1,0 + +/* Vendor string = manufacturer */ +static const uint8_t usb_string_vendor[] = { + USB_DESC_BYTE(PP_NARG(USBSTR_MANUFACTURER)+2), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USBSTR_MANUFACTURER +}; + +/* Device Description string = product */ +static const uint8_t usb_string_description[] = { + USB_DESC_BYTE(PP_NARG(USBSTR_PRODUCT)+2), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USBSTR_PRODUCT +}; + +/* Serial Number string (will be filled by the function init_usb_serial_string) */ +static uint8_t usb_string_serial[] = { + USB_DESC_BYTE(22), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + '0', 0, 'x', 0, 'D', 0, 'E', 0, 'A', 0, 'D', 0, 'B', 0, 'E', 0, 'E', 0, 'F', 0 +}; + +/* Strings wrappers array */ +static const USBDescriptor usb_strings[] = { + { sizeof usb_string_langid, usb_string_langid } + , + { sizeof usb_string_vendor, usb_string_vendor } + , + { sizeof usb_string_description, usb_string_description } + , + { sizeof usb_string_serial, usb_string_serial } +}; + +/* + * Handles the GET_DESCRIPTOR callback + * + * Returns the proper descriptor + */ +static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang) { + (void)usbp; + (void)lang; + switch(dtype) { + /* Generic descriptors */ + case USB_DESCRIPTOR_DEVICE: /* Device Descriptor */ + return &usb_device_descriptor; + + case USB_DESCRIPTOR_CONFIGURATION: /* Configuration Descriptor */ + return &hid_configuration_descriptor; + + case USB_DESCRIPTOR_STRING: /* Strings */ + if(dindex < 4) + return &usb_strings[dindex]; + break; + + /* HID specific descriptors */ + case USB_DESCRIPTOR_HID: /* HID Descriptors */ + switch(lang) { /* yea, poor label, it's actually wIndex from the setup packet */ + case KBD_INTERFACE: + return &keyboard_hid_descriptor; + +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + return &mouse_hid_descriptor; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + return &console_hid_descriptor; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + return &extra_hid_descriptor; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: + return &nkro_hid_descriptor; +#endif /* NKRO_ENABLE */ + } + + case USB_DESCRIPTOR_HID_REPORT: /* HID Report Descriptor */ + switch(lang) { + case KBD_INTERFACE: + return &keyboard_hid_report_descriptor; + +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + return &mouse_hid_report_descriptor; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + return &console_hid_report_descriptor; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + return &extra_hid_report_descriptor; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: + return &nkro_hid_report_descriptor; +#endif /* NKRO_ENABLE */ + } + } + return NULL; +} + +/* keyboard endpoint state structure */ +static USBInEndpointState kbd_ep_state; +/* keyboard endpoint initialization structure (IN) */ +static const USBEndpointConfig kbd_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + kbd_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + KBD_SIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &kbd_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; + +#ifdef MOUSE_ENABLE +/* mouse endpoint state structure */ +static USBInEndpointState mouse_ep_state; + +/* mouse endpoint initialization structure (IN) */ +static const USBEndpointConfig mouse_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + mouse_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + MOUSE_SIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &mouse_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +/* console endpoint state structure */ +static USBInEndpointState console_ep_state; + +/* console endpoint initialization structure (IN) */ +static const USBEndpointConfig console_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + console_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + CONSOLE_SIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &console_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +/* extrakey endpoint state structure */ +static USBInEndpointState extra_ep_state; + +/* extrakey endpoint initialization structure (IN) */ +static const USBEndpointConfig extra_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + extra_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + EXTRA_SIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &extra_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* EXTRAKEY_ENABLE */ + +#ifdef NKRO_ENABLE +/* nkro endpoint state structure */ +static USBInEndpointState nkro_ep_state; + +/* nkro endpoint initialization structure (IN) */ +static const USBEndpointConfig nkro_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + nkro_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + NKRO_SIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &nkro_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* NKRO_ENABLE */ + +/* --------------------------------------------------------- + * USB driver functions + * --------------------------------------------------------- + */ + +/* Handles the USB driver global events + * TODO: maybe disable some things when connection is lost? */ +static void usb_event_cb(USBDriver *usbp, usbevent_t event) { + switch(event) { + case USB_EVENT_RESET: + return; + + case USB_EVENT_ADDRESS: + return; + + case USB_EVENT_CONFIGURED: + osalSysLockFromISR(); + /* Enable the endpoints specified into the configuration. */ + usbInitEndpointI(usbp, KBD_ENDPOINT, &kbd_ep_config); +#ifdef MOUSE_ENABLE + usbInitEndpointI(usbp, MOUSE_ENDPOINT, &mouse_ep_config); +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + usbInitEndpointI(usbp, CONSOLE_ENDPOINT, &console_ep_config); + /* don't need to start the flush timer, it starts from console_in_cb automatically */ +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + usbInitEndpointI(usbp, EXTRA_ENDPOINT, &extra_ep_config); +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + usbInitEndpointI(usbp, NKRO_ENDPOINT, &nkro_ep_config); +#endif /* NKRO_ENABLE */ + osalSysUnlockFromISR(); + return; + + case USB_EVENT_SUSPEND: + return; + + case USB_EVENT_WAKEUP: + return; + + case USB_EVENT_STALLED: + return; + } +} + +/* Function used locally in os/hal/src/usb.c for getting descriptors + * need it here for HID descriptor */ +static uint16_t get_hword(uint8_t *p) { + uint16_t hw; + + hw = (uint16_t)*p++; + hw |= (uint16_t)*p << 8U; + return hw; +} + +/* + * Appendix G: HID Request Support Requirements + * + * The following table enumerates the requests that need to be supported by various types of HID class devices. + * Device type GetReport SetReport GetIdle SetIdle GetProtocol SetProtocol + * ------------------------------------------------------------------------------------------ + * Boot Mouse Required Optional Optional Optional Required Required + * Non-Boot Mouse Required Optional Optional Optional Optional Optional + * Boot Keyboard Required Optional Required Required Required Required + * Non-Boot Keybrd Required Optional Required Required Optional Optional + * Other Device Required Optional Optional Optional Optional Optional + */ + +/* Callback for SETUP request on the endpoint 0 (control) */ +static bool usb_request_hook_cb(USBDriver *usbp) { + const USBDescriptor *dp; + + /* usbp->setup fields: + * 0: bmRequestType (bitmask) + * 1: bRequest + * 2,3: (LSB,MSB) wValue + * 4,5: (LSB,MSB) wIndex + * 6,7: (LSB,MSB) wLength (number of bytes to transfer if there is a data phase) */ + + /* Handle HID class specific requests */ + if(((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) && + ((usbp->setup[0] & USB_RTYPE_RECIPIENT_MASK) == USB_RTYPE_RECIPIENT_INTERFACE)) { + switch(usbp->setup[0] & USB_RTYPE_DIR_MASK) { + case USB_RTYPE_DIR_DEV2HOST: + switch(usbp->setup[1]) { /* bRequest */ + case HID_GET_REPORT: + switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0?) */ + case KBD_INTERFACE: +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: +#endif /* NKRO_ENABLE */ + usbSetupTransfer(usbp, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent), NULL); + return TRUE; + break; + + default: + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + } + break; + + case HID_GET_PROTOCOL: + if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + usbSetupTransfer(usbp, &keyboard_protocol, 1, NULL); + return TRUE; + } + break; + + case HID_GET_IDLE: + usbSetupTransfer(usbp, &keyboard_idle, 1, NULL); + return TRUE; + break; + } + break; + + case USB_RTYPE_DIR_HOST2DEV: + switch(usbp->setup[1]) { /* bRequest */ + case HID_SET_REPORT: + switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0 and wLength==1?) */ + case KBD_INTERFACE: +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: +#endif /* NKRO_ENABLE */ + /* keyboard_led_stats = + * keyboard_led_stats needs be word (or dword), otherwise we get an exception on F0 */ + usbSetupTransfer(usbp, (uint8_t *)&keyboard_led_stats, 1, NULL); + return TRUE; + break; + } + break; + + case HID_SET_PROTOCOL: + if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */ +#ifdef NKRO_ENABLE + keyboard_nkro = !!keyboard_protocol; + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + /* arm the idle timer if boot protocol & idle */ + osalSysLockFromISR(); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + osalSysUnlockFromISR(); + } + } + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + + case HID_SET_IDLE: + keyboard_idle = usbp->setup[3]; /* MSB(wValue) */ + /* arm the timer */ +#ifdef NKRO_ENABLE + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + osalSysLockFromISR(); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + osalSysUnlockFromISR(); + } + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + } + break; + } + } + + /* Handle the Get_Descriptor Request for HID class (not handled by the default hook) */ + if((usbp->setup[0] == 0x81) && (usbp->setup[1] == USB_REQ_GET_DESCRIPTOR)) { + dp = usbp->config->get_descriptor_cb(usbp, usbp->setup[3], usbp->setup[2], get_hword(&usbp->setup[4])); + if(dp == NULL) + return FALSE; + usbSetupTransfer(usbp, (uint8_t *)dp->ud_string, dp->ud_size, NULL); + return TRUE; + } + + return FALSE; +} + +/* Start-of-frame callback */ +static void usb_sof_cb(USBDriver *usbp) { + kbd_sof_cb(usbp); +} + + +/* USB driver configuration */ +static const USBConfig usbcfg = { + usb_event_cb, /* USB events callback */ + usb_get_descriptor_cb, /* Device GET_DESCRIPTOR request callback */ + usb_request_hook_cb, /* Requests hook callback */ + usb_sof_cb /* Start Of Frame callback */ +}; + +/* + * Initialize the USB driver + */ +void init_usb_driver(void) { + /* + * Activates the USB driver and then the USB bus pull-up on D+. + * Note, a delay is inserted in order to not have to disconnect the cable + * after a reset. + */ + usbDisconnectBus(&USB_DRIVER); + chThdSleepMilliseconds(1500); + usbStart(&USB_DRIVER, &usbcfg); + usbConnectBus(&USB_DRIVER); + + chVTObjectInit(&keyboard_idle_timer); +#ifdef CONSOLE_ENABLE + oqObjectInit(&console_queue, console_queue_buffer, sizeof(console_queue_buffer), console_queue_onotify, NULL); + chVTObjectInit(&console_flush_timer); +#endif +} + +/* --------------------------------------------------------- + * Keyboard functions + * --------------------------------------------------------- + */ + +/* keyboard IN callback hander (a kbd report has made it IN) */ +void kbd_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} + +#ifdef NKRO_ENABLE +/* nkro IN callback hander (a nkro report has made it IN) */ +void nkro_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} +#endif /* NKRO_ENABLE */ + +/* start-of-frame handler + * TODO: i guess it would be better to re-implement using timers, + * so that this is not going to have to be checked every 1ms */ +void kbd_sof_cb(USBDriver *usbp) { + (void)usbp; +} + +/* Idle requests timer code + * callback (called from ISR, unlocked state) */ +static void keyboard_idle_timer_cb(void *arg) { + (void)arg; + + osalSysLockFromISR(); + + /* check that the states of things are as they're supposed to */ + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + /* do not rearm the timer, should be enabled on IDLE request */ + osalSysUnlockFromISR(); + return; + } + +#ifdef NKRO_ENABLE + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + /* TODO: are we sure we want the KBD_ENDPOINT? */ + osalSysUnlockFromISR(); + usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); + osalSysLockFromISR(); + usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); + /* rearm the timer */ + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + } + + /* do not rearm the timer if the condition above fails + * it should be enabled again on either IDLE or SET_PROTOCOL requests */ + osalSysUnlockFromISR(); +} + +/* LED status */ +uint8_t keyboard_leds(void) { + return (uint8_t)(keyboard_led_stats & 0xFF); +} + +/* prepare and start sending a report IN + * not callable from ISR or locked state */ +void send_keyboard(report_keyboard_t *report) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + osalSysUnlock(); + +#ifdef NKRO_ENABLE + if(keyboard_nkro) { /* NKRO protocol */ + usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); + osalSysUnlock(); + } else +#endif /* NKRO_ENABLE */ + { /* boot protocol */ + usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); + osalSysUnlock(); + } + keyboard_report_sent = *report; +} + +/* --------------------------------------------------------- + * Mouse functions + * --------------------------------------------------------- + */ + +#ifdef MOUSE_ENABLE + +/* mouse IN callback hander (a mouse report has made it IN) */ +void mouse_in_cb(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; +} + +void send_mouse(report_mouse_t *report) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + osalSysUnlock(); + + /* TODO: LUFA manually waits for the endpoint to become ready + * for about 10ms for mouse, kbd, system; 1ms for nkro + * is this really needed? + */ + + usbPrepareTransmit(&USB_DRIVER, MOUSE_ENDPOINT, (uint8_t *)report, sizeof(report_mouse_t)); + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, MOUSE_ENDPOINT); + osalSysUnlock(); +} + +#else /* MOUSE_ENABLE */ +void send_mouse(report_mouse_t *report) { + (void)report; +} +#endif /* MOUSE_ENABLE */ + +/* --------------------------------------------------------- + * Extrakey functions + * --------------------------------------------------------- + */ + +#ifdef EXTRAKEY_ENABLE + +/* extrakey IN callback hander */ +void extra_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} + +static void send_extra_report(uint8_t report_id, uint16_t data) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + + report_extra_t report = { + .report_id = report_id, + .usage = data + }; + + osalSysUnlock(); + usbPrepareTransmit(&USB_DRIVER, EXTRA_ENDPOINT, (uint8_t *)&report, sizeof(report_extra_t)); + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, EXTRA_ENDPOINT); + osalSysUnlock(); +} + +void send_system(uint16_t data) { + send_extra_report(REPORT_ID_SYSTEM, data); +} + +void send_consumer(uint16_t data) { + send_extra_report(REPORT_ID_CONSUMER, data); +} + +#else /* EXTRAKEY_ENABLE */ +void send_system(uint16_t data) { + (void)data; +} +void send_consumer(uint16_t data) { + (void)data; +} +#endif /* EXTRAKEY_ENABLE */ + +/* --------------------------------------------------------- + * Console functions + * --------------------------------------------------------- + */ + +#ifdef CONSOLE_ENABLE + +/* debug IN callback hander */ +void console_in_cb(USBDriver *usbp, usbep_t ep) { + (void)ep; + osalSysLockFromISR(); + + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + + /* Check if there is data to send left in the output queue */ + if(chOQGetFullI(&console_queue) >= CONSOLE_SIZE) { + osalSysUnlockFromISR(); + usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); + osalSysLockFromISR(); + usbStartTransmitI(usbp, CONSOLE_ENDPOINT); + } + + osalSysUnlockFromISR(); +} + +/* Callback when data is inserted into the output queue + * Called from a locked state */ +void console_queue_onotify(io_queue_t *qp) { + (void)qp; + + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) + return; + + if(!usbGetTransmitStatusI(&USB_DRIVER, CONSOLE_ENDPOINT) + && (chOQGetFullI(&console_queue) >= CONSOLE_SIZE)) { + osalSysUnlock(); + usbPrepareQueuedTransmit(&USB_DRIVER, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, CONSOLE_ENDPOINT); + } +} + +/* Flush timer code + * callback (called from ISR, unlocked state) */ +static void console_flush_cb(void *arg) { + (void)arg; + size_t i, n; + uint8_t buf[CONSOLE_SIZE]; /* TODO: a solution without extra buffer? */ + osalSysLockFromISR(); + + /* check that the states of things are as they're supposed to */ + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + osalSysUnlockFromISR(); + return; + } + + /* don't do anything if the queue is empty or has enough stuff in it */ + if(((n = oqGetFullI(&console_queue)) == 0) || (n >= CONSOLE_SIZE)) { + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + osalSysUnlockFromISR(); + return; + } + + /* there's stuff hanging in the queue - so dequeue and send */ + for(i = 0; i < n; i++) + buf[i] = (uint8_t)oqGetI(&console_queue); + for(i = n; i < CONSOLE_SIZE; i++) + buf[i] = 0; + osalSysUnlockFromISR(); + usbPrepareTransmit(&USB_DRIVER, CONSOLE_ENDPOINT, buf, CONSOLE_SIZE); + osalSysLockFromISR(); + (void)usbStartTransmitI(&USB_DRIVER, CONSOLE_ENDPOINT); + + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + osalSysUnlockFromISR(); +} + + +int8_t sendchar(uint8_t c) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return 0; + } + osalSysUnlock(); + /* should get suspended and wait if the queue is full + * but it's not blocking even if noone is listening, + * because the USB packets are sent anyway */ + return(chOQPut(&console_queue, c)); +} + +#else /* CONSOLE_ENABLE */ +int8_t sendchar(uint8_t c) { + (void)c; + return 0; +} +#endif /* CONSOLE_ENABLE */ + +void sendchar_pf(void *p, char c) { + (void)p; + sendchar((uint8_t)c); +} diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h new file mode 100644 index 00000000..b7696643 --- /dev/null +++ b/tmk_core/protocol/chibios/usb_main.h @@ -0,0 +1,149 @@ +/* + * (c) 2015 flabberast + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + + +#ifndef _USB_MAIN_H_ +#define _USB_MAIN_H_ + +#include "ch.h" +#include "hal.h" + +/* ------------------------- + * General USB driver header + * ------------------------- + */ + +/* The USB driver to use */ +#define USB_DRIVER USBD1 + +/* Initialize the USB driver and bus */ +void init_usb_driver(void); + +/* --------------- + * Keyboard header + * --------------- + */ + +/* main keyboard (6kro) */ +#define KBD_INTERFACE 0 +#define KBD_ENDPOINT 1 +#define KBD_SIZE 8 +#define KBD_REPORT_KEYS (KBD_SIZE - 2) + +/* secondary keyboard */ +#ifdef NKRO_ENABLE +#define NKRO_INTERFACE 4 +#define NKRO_ENDPOINT 5 +#define NKRO_SIZE 16 +#define NKRO_REPORT_KEYS (NKRO_SIZE - 1) +#endif + +/* this defines report_keyboard_t and computes REPORT_SIZE defines */ +#include "report.h" + +/* extern report_keyboard_t keyboard_report_sent; */ + +/* keyboard IN request callback handler */ +void kbd_in_cb(USBDriver *usbp, usbep_t ep); + +/* start-of-frame handler */ +void kbd_sof_cb(USBDriver *usbp); + +#ifdef NKRO_ENABLE +/* nkro IN callback hander */ +void nkro_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* NKRO_ENABLE */ + +/* ------------ + * Mouse header + * ------------ + */ + +#ifdef MOUSE_ENABLE + +#define MOUSE_INTERFACE 1 +#define MOUSE_ENDPOINT 2 +#define MOUSE_SIZE 8 + +/* mouse IN request callback handler */ +void mouse_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* MOUSE_ENABLE */ + +/* --------------- + * Extrakey header + * --------------- + */ + +#ifdef EXTRAKEY_ENABLE + +#define EXTRA_INTERFACE 3 +#define EXTRA_ENDPOINT 4 +#define EXTRA_SIZE 8 + +/* extrakey IN request callback handler */ +void extra_in_cb(USBDriver *usbp, usbep_t ep); + +/* extra report structure */ +typedef struct { + uint8_t report_id; + uint16_t usage; +} __attribute__ ((packed)) report_extra_t; +#endif /* EXTRAKEY_ENABLE */ + +/* -------------- + * Console header + * -------------- + */ + +#ifdef CONSOLE_ENABLE + +#define CONSOLE_INTERFACE 2 +#define CONSOLE_ENDPOINT 3 +#define CONSOLE_SIZE 16 + +/* Number of IN reports that can be stored inside the output queue */ +#define CONSOLE_QUEUE_CAPACITY 2 +#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_SIZE) + +/* Console flush time */ +#define CONSOLE_FLUSH_MS 50 + +/* Putchar over the USB console */ +int8_t sendchar(uint8_t c); +/* wrapper for printf lib */ + +/* Flush output (send everything immediately) */ +void console_flush_output(void); + +/* console IN request callback handler */ +void console_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* CONSOLE_ENABLE */ + +void sendchar_pf(void *p, char c); + +/* --------------------------- + * Host driver functions (TMK) + * --------------------------- + */ + +uint8_t keyboard_leds(void); +void send_keyboard(report_keyboard_t *report); +void send_mouse(report_mouse_t *report); +void send_system(uint16_t data); +void send_consumer(uint16_t data); + +#endif /* _USB_MAIN_H_ */ diff --git a/tmk_core/tool/chibios/common.mk b/tmk_core/tool/chibios/common.mk new file mode 100644 index 00000000..952ec493 --- /dev/null +++ b/tmk_core/tool/chibios/common.mk @@ -0,0 +1,86 @@ +COMMON_DIR = $(TMK_DIR)/common +SRC += $(COMMON_DIR)/host.c \ + $(COMMON_DIR)/keyboard.c \ + $(COMMON_DIR)/action.c \ + $(COMMON_DIR)/action_tapping.c \ + $(COMMON_DIR)/action_macro.c \ + $(COMMON_DIR)/action_layer.c \ + $(COMMON_DIR)/action_util.c \ + $(COMMON_DIR)/keymap.c \ + $(COMMON_DIR)/print.c \ + $(COMMON_DIR)/debug.c \ + $(COMMON_DIR)/util.c \ + $(COMMON_DIR)/chibios/suspend.c \ + $(COMMON_DIR)/chibios/printf.c \ + $(COMMON_DIR)/chibios/timer.c \ + $(COMMON_DIR)/chibios/bootloader.c + + +# Option modules +ifdef BOOTMAGIC_ENABLE + $(error Bootmagic Not Supported) + SRC += $(COMMON_DIR)/bootmagic.c + SRC += $(COMMON_DIR)/chibios/eeconfig.c + OPT_DEFS += -DBOOTMAGIC_ENABLE +endif + +ifdef MOUSEKEY_ENABLE + SRC += $(COMMON_DIR)/mousekey.c + OPT_DEFS += -DMOUSEKEY_ENABLE + OPT_DEFS += -DMOUSE_ENABLE +endif + +ifdef EXTRAKEY_ENABLE + OPT_DEFS += -DEXTRAKEY_ENABLE +endif + +ifdef CONSOLE_ENABLE + OPT_DEFS += -DCONSOLE_ENABLE +else + OPT_DEFS += -DNO_PRINT + OPT_DEFS += -DNO_DEBUG +endif + +ifdef COMMAND_ENABLE + SRC += $(COMMON_DIR)/command.c + OPT_DEFS += -DCOMMAND_ENABLE +endif + +ifdef NKRO_ENABLE + OPT_DEFS += -DNKRO_ENABLE +endif + +ifdef USB_6KRO_ENABLE + OPT_DEFS += -DUSB_6KRO_ENABLE +endif + +ifdef SLEEP_LED_ENABLE + $(error Sleep LED Not Supported) + SRC += $(COMMON_DIR)/sleep_led.c + OPT_DEFS += -DSLEEP_LED_ENABLE + OPT_DEFS += -DNO_SUSPEND_POWER_DOWN +endif + +ifdef BACKLIGHT_ENABLE + SRC += $(COMMON_DIR)/backlight.c + OPT_DEFS += -DBACKLIGHT_ENABLE +endif + +ifdef KEYMAP_SECTION_ENABLE + OPT_DEFS += -DKEYMAP_SECTION_ENABLE + + ifeq ($(strip $(MCU)),atmega32u2) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x + else ifeq ($(strip $(MCU)),atmega32u4) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + else + EXTRALDFLAGS = $(error no ldscript for keymap section) + endif +endif + +# Version string +OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) + + +# Search Path +VPATH += $(TMK_DIR)/common From 1d115301d4134f59e8043a34400f08aac094704e Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 8 Sep 2015 15:35:02 +0100 Subject: [PATCH 021/179] Make usb_main more USB_DRIVER #define independent. --- tmk_core/protocol/chibios/chibios.mk | 2 +- tmk_core/protocol/chibios/main.c | 2 +- tmk_core/protocol/chibios/usb_main.c | 50 ++++++++++++++-------------- tmk_core/protocol/chibios/usb_main.h | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tmk_core/protocol/chibios/chibios.mk b/tmk_core/protocol/chibios/chibios.mk index d667f60e..2ae1e5f9 100644 --- a/tmk_core/protocol/chibios/chibios.mk +++ b/tmk_core/protocol/chibios/chibios.mk @@ -97,7 +97,7 @@ endif include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk # Other files (optional). # Define linker script file here diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index ce7cd8e3..0d79a91f 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -60,7 +60,7 @@ int main(void) { palClearPad(GPIOC, GPIOC_LED_BLUE); /* Init USB */ - init_usb_driver(); + init_usb_driver(&USB_DRIVER); /* init printf */ init_printf(NULL,sendchar_pf); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 875f47dc..b10e5daa 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -886,7 +886,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { #endif /* NKRO_ENABLE */ /* arm the idle timer if boot protocol & idle */ osalSysLockFromISR(); - chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); osalSysUnlockFromISR(); } } @@ -903,7 +903,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { if(keyboard_idle) { #endif /* NKRO_ENABLE */ osalSysLockFromISR(); - chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); osalSysUnlockFromISR(); } usbSetupTransfer(usbp, NULL, 0, NULL); @@ -943,20 +943,20 @@ static const USBConfig usbcfg = { /* * Initialize the USB driver */ -void init_usb_driver(void) { +void init_usb_driver(USBDriver *usbp) { /* * Activates the USB driver and then the USB bus pull-up on D+. * Note, a delay is inserted in order to not have to disconnect the cable * after a reset. */ - usbDisconnectBus(&USB_DRIVER); + usbDisconnectBus(usbp); chThdSleepMilliseconds(1500); - usbStart(&USB_DRIVER, &usbcfg); - usbConnectBus(&USB_DRIVER); + usbStart(usbp, &usbcfg); + usbConnectBus(usbp); chVTObjectInit(&keyboard_idle_timer); #ifdef CONSOLE_ENABLE - oqObjectInit(&console_queue, console_queue_buffer, sizeof(console_queue_buffer), console_queue_onotify, NULL); + oqObjectInit(&console_queue, console_queue_buffer, sizeof(console_queue_buffer), console_queue_onotify, (void *)usbp); chVTObjectInit(&console_flush_timer); #endif } @@ -992,12 +992,12 @@ void kbd_sof_cb(USBDriver *usbp) { /* Idle requests timer code * callback (called from ISR, unlocked state) */ static void keyboard_idle_timer_cb(void *arg) { - (void)arg; + USBDriver *usbp = (USBDriver *)arg; osalSysLockFromISR(); /* check that the states of things are as they're supposed to */ - if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + if(usbGetDriverStateI(usbp) != USB_ACTIVE) { /* do not rearm the timer, should be enabled on IDLE request */ osalSysUnlockFromISR(); return; @@ -1010,11 +1010,11 @@ static void keyboard_idle_timer_cb(void *arg) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ osalSysUnlockFromISR(); - usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); + usbPrepareTransmit(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); osalSysLockFromISR(); - usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); + usbStartTransmitI(usbp, KBD_ENDPOINT); /* rearm the timer */ - chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, NULL); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); } /* do not rearm the timer if the condition above fails @@ -1155,7 +1155,7 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) { osalSysLockFromISR(); /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); /* Check if there is data to send left in the output queue */ if(chOQGetFullI(&console_queue) >= CONSOLE_SIZE) { @@ -1171,32 +1171,32 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) { /* Callback when data is inserted into the output queue * Called from a locked state */ void console_queue_onotify(io_queue_t *qp) { - (void)qp; + USBDriver *usbp = qGetLink(qp); - if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) + if(usbGetDriverStateI(usbp) != USB_ACTIVE) return; - if(!usbGetTransmitStatusI(&USB_DRIVER, CONSOLE_ENDPOINT) + if(!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT) && (chOQGetFullI(&console_queue) >= CONSOLE_SIZE)) { osalSysUnlock(); - usbPrepareQueuedTransmit(&USB_DRIVER, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); + usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); osalSysLock(); - usbStartTransmitI(&USB_DRIVER, CONSOLE_ENDPOINT); + usbStartTransmitI(usbp, CONSOLE_ENDPOINT); } } /* Flush timer code * callback (called from ISR, unlocked state) */ static void console_flush_cb(void *arg) { - (void)arg; + USBDriver *usbp = (USBDriver *)arg; size_t i, n; uint8_t buf[CONSOLE_SIZE]; /* TODO: a solution without extra buffer? */ osalSysLockFromISR(); /* check that the states of things are as they're supposed to */ - if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + if(usbGetDriverStateI(usbp) != USB_ACTIVE) { /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); osalSysUnlockFromISR(); return; } @@ -1204,7 +1204,7 @@ static void console_flush_cb(void *arg) { /* don't do anything if the queue is empty or has enough stuff in it */ if(((n = oqGetFullI(&console_queue)) == 0) || (n >= CONSOLE_SIZE)) { /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); osalSysUnlockFromISR(); return; } @@ -1215,12 +1215,12 @@ static void console_flush_cb(void *arg) { for(i = n; i < CONSOLE_SIZE; i++) buf[i] = 0; osalSysUnlockFromISR(); - usbPrepareTransmit(&USB_DRIVER, CONSOLE_ENDPOINT, buf, CONSOLE_SIZE); + usbPrepareTransmit(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_SIZE); osalSysLockFromISR(); - (void)usbStartTransmitI(&USB_DRIVER, CONSOLE_ENDPOINT); + (void)usbStartTransmitI(usbp, CONSOLE_ENDPOINT); /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, NULL); + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); osalSysUnlockFromISR(); } diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index b7696643..baeae80a 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -31,7 +31,7 @@ #define USB_DRIVER USBD1 /* Initialize the USB driver and bus */ -void init_usb_driver(void); +void init_usb_driver(USBDriver *usbp); /* --------------- * Keyboard header From 8152d279a4a4aa01f7d3f0a0a7b09e2081aa0d93 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 8 Sep 2015 16:06:33 +0100 Subject: [PATCH 022/179] Move chibios to tool. --- tmk_core/{protocol => tool}/chibios/.gitignore | 0 tmk_core/{protocol => tool}/chibios/chibios.mk | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename tmk_core/{protocol => tool}/chibios/.gitignore (100%) rename tmk_core/{protocol => tool}/chibios/chibios.mk (99%) diff --git a/tmk_core/protocol/chibios/.gitignore b/tmk_core/tool/chibios/.gitignore similarity index 100% rename from tmk_core/protocol/chibios/.gitignore rename to tmk_core/tool/chibios/.gitignore diff --git a/tmk_core/protocol/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk similarity index 99% rename from tmk_core/protocol/chibios/chibios.mk rename to tmk_core/tool/chibios/chibios.mk index 2ae1e5f9..ee52082e 100644 --- a/tmk_core/protocol/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -83,7 +83,7 @@ endif # # Imported source files and paths -CHIBIOS = $(TMK_DIR)/protocol/chibios/chibios +CHIBIOS = $(TMK_DIR)/tool/chibios/chibios # Startup files. include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]').mk # HAL-OSAL files (optional). From d057e5157ed22508ce87f8fef113be52674ba209 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 8 Sep 2015 16:07:34 +0100 Subject: [PATCH 023/179] Implement jump-to-bootloader. --- tmk_core/common/chibios/bootloader.c | 15 ++- .../tool/chibios/ch-bootloader-jump.patch | 115 ++++++++++++++++++ tmk_core/tool/chibios/common.mk | 4 + 3 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 tmk_core/tool/chibios/ch-bootloader-jump.patch diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index 6c34e2e0..93f2e378 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -1,7 +1,16 @@ -/* TODO */ -/* ... chip dependent ... */ - #include "bootloader.h" +#include "ch.h" +#ifdef BOOTLOADER_ADDRESS +#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) +extern uint32_t __ram0_end__; + +void bootloader_jump(void) { + *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader + NVIC_SystemReset(); +} +#else /* BOOTLOADER_ADDRESS */ void bootloader_jump(void) {} +#endif /* BOOTLOADER_ADDRESS */ + diff --git a/tmk_core/tool/chibios/ch-bootloader-jump.patch b/tmk_core/tool/chibios/ch-bootloader-jump.patch new file mode 100644 index 00000000..7f33e8ac --- /dev/null +++ b/tmk_core/tool/chibios/ch-bootloader-jump.patch @@ -0,0 +1,115 @@ +diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s +index 38b4513..12a3f39 100644 +--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s ++++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s +@@ -98,6 +98,13 @@ + #define CRT0_CALL_DESTRUCTORS TRUE + #endif + ++/** ++ * @brief Magic number for jumping to bootloader. ++ */ ++#if !defined(MAGIC_BOOTLOADER_NUMBER) || defined(__DOXYGEN__) ++#define MAGIC_BOOTLOADER_NUMBER 0xDEADBEEF ++#endif ++ + /*===========================================================================*/ + /* Code section. */ + /*===========================================================================*/ +@@ -117,6 +124,17 @@ + .thumb_func + .global Reset_Handler + Reset_Handler: ++ ++#ifdef BOOTLOADER_ADDRESS ++ /* jump to bootloader code */ ++ ldr r0, =__ram0_end__-4 ++ ldr r1, =MAGIC_BOOTLOADER_NUMBER ++ ldr r2, [r0, #0] ++ str r0, [r0, #0] /* erase stored magic */ ++ cmp r2, r1 ++ beq Bootloader_Jump ++#endif /* BOOTLOADER_ADDRESS */ ++ + /* Interrupts are globally masked initially.*/ + cpsid i + +@@ -230,6 +248,21 @@ endfiniloop: + ldr r1, =__default_exit + bx r1 + ++#ifdef BOOTLOADER_ADDRESS ++/* ++ * Jump-to-bootloader function. ++ */ ++ ++ .align 2 ++ .thumb_func ++Bootloader_Jump: ++ ldr r0, =BOOTLOADER_ADDRESS ++ ldr r1, [r0, #0] ++ mov sp, r1 ++ ldr r0, [r0, #4] ++ bx r0 ++#endif /* BOOTLOADER_ADDRESS */ ++ + #endif + + /** @} */ +diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s +index fcfa4de..2d560da 100644 +--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s ++++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s +@@ -133,6 +133,13 @@ + #define CRT0_CPACR_INIT 0x00F00000 + #endif + ++/** ++ * @brief Magic number for jumping to bootloader. ++ */ ++#if !defined(MAGIC_BOOTLOADER_NUMBER) || defined(__DOXYGEN__) ++#define MAGIC_BOOTLOADER_NUMBER 0xDEADBEEF ++#endif ++ + /*===========================================================================*/ + /* Code section. */ + /*===========================================================================*/ +@@ -157,6 +164,16 @@ + .thumb_func + .global Reset_Handler + Reset_Handler: ++#ifdef BOOTLOADER_ADDRESS ++ /* jump to bootloader code */ ++ ldr r0, =__ram0_end__-4 ++ ldr r1, =MAGIC_BOOTLOADER_NUMBER ++ ldr r2, [r0, #0] ++ str r0, [r0, #0] /* erase stored magic */ ++ cmp r2, r1 ++ beq Bootloader_Jump ++#endif /* BOOTLOADER_ADDRESS */ ++ + /* Interrupts are globally masked initially.*/ + cpsid i + +@@ -289,6 +306,21 @@ endfiniloop: + /* Branching to the defined exit handler.*/ + b __default_exit + ++#ifdef BOOTLOADER_ADDRESS ++/* ++ * Jump-to-bootloader function. ++ */ ++ ++ .align 2 ++ .thumb_func ++Bootloader_Jump: ++ ldr r0, =BOOTLOADER_ADDRESS ++ ldr r1, [r0, #0] ++ mov sp, r1 ++ ldr r0, [r0, #4] ++ bx r0 ++#endif /* BOOTLOADER_ADDRESS */ ++ + #endif /* !defined(__DOXYGEN__) */ + + /** @} */ diff --git a/tmk_core/tool/chibios/common.mk b/tmk_core/tool/chibios/common.mk index 952ec493..0e9935dc 100644 --- a/tmk_core/tool/chibios/common.mk +++ b/tmk_core/tool/chibios/common.mk @@ -81,6 +81,10 @@ endif # Version string OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +# Bootloader address +ifdef BOOTLOADER_ADDRESS + OPT_DEFS += -DBOOTLOADER_ADDRESS=$(BOOTLOADER_ADDRESS) +endif # Search Path VPATH += $(TMK_DIR)/common From 9cc281b4efdf2dcd817189bb8e633578d638bc45 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 8 Sep 2015 19:22:00 +0100 Subject: [PATCH 024/179] Small updates. --- tmk_core/protocol/chibios/README.md | 5 +++-- tmk_core/protocol/chibios/main.c | 2 +- tmk_core/protocol/chibios/usb_main.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tmk_core/protocol/chibios/README.md b/tmk_core/protocol/chibios/README.md index 38fd495e..6fbc7c6e 100644 --- a/tmk_core/protocol/chibios/README.md +++ b/tmk_core/protocol/chibios/README.md @@ -8,16 +8,17 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - USB string descriptors are a mess. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. - There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task` in `main.c`. There should be no such in `usb_main.c`. Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. +- Jumping to bootloader works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and pass it to the compiler in the `Makefile`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. - The USB stack works pretty completely; however there are bits of other TMK stuff that are not done yet: ### Immediate todo -- suspend / sleep led +- suspend +- sleep led ### Missing / not working (TMK vs ChibiOS bits) - eeprom / bootmagic (will be chip dependent) -- bootloader jump (chip dependent) ### Tried with diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 0d79a91f..6b4ec350 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -76,7 +76,7 @@ int main(void) { host_set_driver(&chibios_driver); #ifdef SLEEP_LED_ENABLE - sleep_led_init(); + sleep_led_init(); #endif print("Keyboard start.\n"); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index b10e5daa..f8a31593 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -20,6 +20,11 @@ #include "usb_main.h" +#include "debug.h" +#ifdef SLEEP_LED_ENABLE +#include "sleep_led.h" +#endif + /* --------------------------------------------------------- * Global interface variables and declarations * --------------------------------------------------------- @@ -752,6 +757,7 @@ static const USBEndpointConfig nkro_ep_config = { static void usb_event_cb(USBDriver *usbp, usbevent_t event) { switch(event) { case USB_EVENT_RESET: + //TODO: from ISR! print("[R]"); return; case USB_EVENT_ADDRESS: @@ -778,9 +784,21 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { return; case USB_EVENT_SUSPEND: + //TODO: from ISR! print("[S]"); + //TODO: signal suspend? +#ifdef SLEEP_LED_ENABLE + sleep_led_enable(); +#endif /* SLEEP_LED_ENABLE */ return; case USB_EVENT_WAKEUP: + //TODO: from ISR! print("[W]"); + //TODO: suspend_wakeup_init(); +#ifdef SLEEP_LED_ENABLE + sleep_led_disable(); + // NOTE: converters may not accept this + led_set(host_keyboard_leds()); +#endif /* SLEEP_LED_ENABLE */ return; case USB_EVENT_STALLED: From 5248511209cb765c2548c7037801a8102c75f5a5 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 8 Sep 2015 20:15:05 +0100 Subject: [PATCH 025/179] Fix bootloader-jump compiling. --- tmk_core/tool/chibios/chibios.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index ee52082e..ed5fd5b8 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -206,7 +206,7 @@ CPPWARN = -Wall -Wextra -Wundef UDEFS = $(OPT_DEFS) # Define ASM defines here -UADEFS = +UADEFS = $(OPT_DEFS) # List all user directories here UINCDIR = From 7d4f3dd5a148f922007f321a0bb61a571d5bbbc9 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 10 Sep 2015 10:30:49 +0100 Subject: [PATCH 026/179] Move AVR specific sleep_led.c into avr. --- tmk_core/common.mk | 2 +- tmk_core/common/{ => avr}/sleep_led.c | 0 tmk_core/tool/chibios/common.mk | 3 +-- tmk_core/tool/mbed/common.mk | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) rename tmk_core/common/{ => avr}/sleep_led.c (100%) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index f5a464d0..159183a2 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -54,7 +54,7 @@ ifdef USB_6KRO_ENABLE endif ifdef SLEEP_LED_ENABLE - SRC += $(COMMON_DIR)/sleep_led.c + SRC += $(COMMON_DIR)/avr/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif diff --git a/tmk_core/common/sleep_led.c b/tmk_core/common/avr/sleep_led.c similarity index 100% rename from tmk_core/common/sleep_led.c rename to tmk_core/common/avr/sleep_led.c diff --git a/tmk_core/tool/chibios/common.mk b/tmk_core/tool/chibios/common.mk index 0e9935dc..f0d39f31 100644 --- a/tmk_core/tool/chibios/common.mk +++ b/tmk_core/tool/chibios/common.mk @@ -55,8 +55,7 @@ ifdef USB_6KRO_ENABLE endif ifdef SLEEP_LED_ENABLE - $(error Sleep LED Not Supported) - SRC += $(COMMON_DIR)/sleep_led.c + SRC += $(COMMON_DIR)/chibios/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif diff --git a/tmk_core/tool/mbed/common.mk b/tmk_core/tool/mbed/common.mk index 77bf7c3e..a0aa8717 100644 --- a/tmk_core/tool/mbed/common.mk +++ b/tmk_core/tool/mbed/common.mk @@ -63,7 +63,7 @@ endif ifdef SLEEP_LED_ENABLE $(error Not Supported) - SRC += common/sleep_led.c + SRC += common/mbed/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif From dc9fc9a7a457d44efc45f1dce51db3c5d4bc17c9 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 10 Sep 2015 10:31:19 +0100 Subject: [PATCH 027/179] Add basic sleep_led for chibios. --- tmk_core/common/chibios/printf.h | 12 ++++++------ tmk_core/common/chibios/sleep_led.c | 19 +++++++++++++++++++ tmk_core/common/chibios/timer.c | 2 +- tmk_core/protocol/chibios/README.md | 13 +++++++++---- tmk_core/protocol/chibios/main.c | 25 +++++++++++++++++++++++++ tmk_core/protocol/chibios/usb_main.c | 2 ++ tmk_core/protocol/chibios/usb_main.h | 3 +++ 7 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 tmk_core/common/chibios/sleep_led.c diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h index 00813198..678a100c 100644 --- a/tmk_core/common/chibios/printf.h +++ b/tmk_core/common/chibios/printf.h @@ -55,16 +55,16 @@ many embedded systems. To use the printf you need to supply your own character output function, something like : - void putc ( void* p, char c) - { - while (!SERIAL_PORT_EMPTY) ; - SERIAL_PORT_TX_REGISTER = c; - } + void putc ( void* p, char c) + { + while (!SERIAL_PORT_EMPTY) ; + SERIAL_PORT_TX_REGISTER = c; + } Before you can call printf you need to initialize it to use your character output function with something like: - init_printf(NULL,putc); + init_printf(NULL,putc); Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', the NULL (or any pointer) you pass into the 'init_printf' will eventually be diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c new file mode 100644 index 00000000..b08c9c2a --- /dev/null +++ b/tmk_core/common/chibios/sleep_led.c @@ -0,0 +1,19 @@ +#include "ch.h" + +#include "led.h" +#include "sleep_led.h" + +void sleep_led_init(void) { +} + +void sleep_led_enable(void) { + led_set(1< Date: Thu, 10 Sep 2015 10:32:15 +0100 Subject: [PATCH 028/179] Add chibi_onekey example. --- keyboard/chibi_onekey/Makefile | 51 +++ keyboard/chibi_onekey/chconf.h | 499 +++++++++++++++++++++++++++ keyboard/chibi_onekey/config.h | 74 ++++ keyboard/chibi_onekey/halconf.h | 334 ++++++++++++++++++ keyboard/chibi_onekey/keymap_plain.c | 44 +++ keyboard/chibi_onekey/led.c | 34 ++ keyboard/chibi_onekey/matrix.c | 163 +++++++++ keyboard/chibi_onekey/mcuconf.h | 171 +++++++++ 8 files changed, 1370 insertions(+) create mode 100644 keyboard/chibi_onekey/Makefile create mode 100644 keyboard/chibi_onekey/chconf.h create mode 100644 keyboard/chibi_onekey/config.h create mode 100644 keyboard/chibi_onekey/halconf.h create mode 100644 keyboard/chibi_onekey/keymap_plain.c create mode 100644 keyboard/chibi_onekey/led.c create mode 100644 keyboard/chibi_onekey/matrix.c create mode 100644 keyboard/chibi_onekey/mcuconf.h diff --git a/keyboard/chibi_onekey/Makefile b/keyboard/chibi_onekey/Makefile new file mode 100644 index 00000000..3e8e715c --- /dev/null +++ b/keyboard/chibi_onekey/Makefile @@ -0,0 +1,51 @@ +# Target file name (without extension). +PROJECT = ch +TARGET = alps64 + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +# chip/board +MCU_FAMILY = STM32 +MCU_SERIES = STM32F0xx +# linker script to use +MCU_MODEL_FAMILY = STM32F072xB +# the directory in board/ +BOARD = ST_STM32F072B_DISCOVERY +# ARM version, M0/M1 are 6, M3/M4/M7 are 7 +ARMV = 6 +# If you want to be able to jump to bootloader from firmware (on STM32 MCUs), +# set the correct BOOTLOADER_ADDRESS here. Otherwise leave commented out. +# It is chip dependent, the correct number can be looked up here (page 175): +# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf +# This also requires a patch to chibios: /tmk_core/ +BOOTLOADER_ADDRESS = 0x1FFFC800 + +# Build Options +# comment out to disable the options. +# +#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +#NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk diff --git a/keyboard/chibi_onekey/chconf.h b/keyboard/chibi_onekey/chconf.h new file mode 100644 index 00000000..da4160b6 --- /dev/null +++ b/keyboard/chibi_onekey/chconf.h @@ -0,0 +1,499 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 32 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 10000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 0 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_QUEUES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE FALSE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP FALSE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS FALSE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK FALSE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS FALSE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS FALSE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_TRACE FALSE + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK FALSE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS FALSE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/keyboard/chibi_onekey/config.h b/keyboard/chibi_onekey/config.h new file mode 100644 index 00000000..8063c57e --- /dev/null +++ b/keyboard/chibi_onekey/config.h @@ -0,0 +1,74 @@ +/* +Copyright 2015 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 + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +/* in python2: list(u"whatever".encode('utf-16-le')) */ +/* at most 32 characters or the ugly hack in usb_main.c borks */ +#define MANUFACTURER "TMK" +#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' +#define PRODUCT "ChibiOS TMK test" +#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' +#define DESCRIPTION "TMK keyboard firmware over ChibiOS" + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* 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/keyboard/chibi_onekey/halconf.h b/keyboard/chibi_onekey/halconf.h new file mode 100644 index 00000000..d3415c55 --- /dev/null +++ b/keyboard/chibi_onekey/halconf.h @@ -0,0 +1,334 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboard/chibi_onekey/keymap_plain.c b/keyboard/chibi_onekey/keymap_plain.c new file mode 100644 index 00000000..ea173935 --- /dev/null +++ b/keyboard/chibi_onekey/keymap_plain.c @@ -0,0 +1,44 @@ +/* +Copyright 2012,2013 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 "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "host.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + +static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + {{KC_A}}, +}; + +static const uint16_t fn_actions[] = { +}; + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return keymaps[(layer)][(key.row)][(key.col)]; +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = fn_actions[FN_INDEX(keycode)] }; +} diff --git a/keyboard/chibi_onekey/led.c b/keyboard/chibi_onekey/led.c new file mode 100644 index 00000000..18edb8ba --- /dev/null +++ b/keyboard/chibi_onekey/led.c @@ -0,0 +1,34 @@ +/* +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 "hal.h" + +#include "led.h" + + +void led_set(uint8_t usb_led) +{ + (void)usb_led; + if (usb_led & (1< + +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 "ch.h" +#include "hal.h" + +/* + * scan matrix + */ +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "wait.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif +static uint8_t debouncing = DEBOUNCE; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +#define LED_ON() do { palSetPad(GPIOC, GPIOC_LED_BLUE) ;} while (0) +#define LED_OFF() do { palClearPad(GPIOC, GPIOC_LED_BLUE); } while (0) +#define LED_TGL() do { palTogglePad(GPIOC, GPIOC_LED_BLUE); } while (0) + +void matrix_init(void) +{ + // initialize row and col + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + //debug + debug_matrix = true; + LED_ON(); + wait_ms(500); + LED_OFF(); +} + +uint8_t matrix_scan(void) +{ + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + select_row(i); + wait_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i] != cols) { + matrix_debouncing[i] = cols; + if (debouncing) { + debug("bounce!: "); debug_hex(debouncing); debug("\n"); + } + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + wait_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + return 1; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1< Date: Thu, 10 Sep 2015 10:49:47 +0100 Subject: [PATCH 029/179] Update chibios README. --- tmk_core/protocol/chibios/README.md | 31 +++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tmk_core/protocol/chibios/README.md b/tmk_core/protocol/chibios/README.md index 5df4c6e7..06569c51 100644 --- a/tmk_core/protocol/chibios/README.md +++ b/tmk_core/protocol/chibios/README.md @@ -1,12 +1,12 @@ -## USB stack implementation using ChibiOS +## TMK running on top of ChibiOS ### Notes -- To use, unpack or symlink ChibiOS here, to `chibios`. -- For gcc options, inspect `chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of hits on that. +- To use, unpack or symlink [ChibiOS] {currently 3.0.1} to `tmk_core/tool/chibios/chibios`. +- For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. -- USB string descriptors are a mess. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. -- There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task` in `main.c`. There should be no such in `usb_main.c`. Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). +- USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. +- There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task`, or 1.5sec wait for USB init, in `main.c`. There should be no such in `usb_main.c` (the main USB stack). Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. - Jumping to bootloader works, but it is not entirely pleasant, since it is very much MCU dependent. The code is now geared towards STM32 chips and their built-in bootloaders. So, one needs to dig out the right address to jump to, and pass it to the compiler in the `Makefile`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. - Sleep LED works, but at the moment only on/off, i.e. no breathing. @@ -14,6 +14,7 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ### Immediate todo +- host-wakeup packet sending during suspend - power saving for suspend? - PWM for sleep led @@ -23,9 +24,27 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ### Missing / not working (TMK vs ChibiOS bits) -- eeprom / bootmagic (will be chip dependent; eeprom needs to be emulated in flash, which means less writes; wear-levelling?) +- eeprom / bootmagic (will be chip dependent; eeprom needs to be emulated in flash, which means less writes; wear-levelling?) There is a semi-official ST "driver" for eeprom, with wear-levelling, but I think it consumes a lot of RAM (like 2 pages, i.e. 1kB or so). ### Tried with - ChibiOS 3.0.1 and ST F072RB DISCOVERY board. - Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. + +## STM32-based keyboard design considerations + +- STM32F0x2 chips can do crystal-less USB, but they still need a 3.3V voltage regulator. +- The BOOT0 pin should be tied to GND. +- For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. +- For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). + +## ChibiOS-supported MCUs (as of 3.0.1) + +- Pretty much all STM32 chips. +- There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. +- There is some support for K20 and KL25 Freescale chips (i.e. Teensy 3.0, mchck, FRDM-KL25Z, FRDM-K20D50M), but again, no USB stack yet. +- I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. + + + +[ChibiOS]: http://chibios.org From a24ddf3403670724b798d18e1d39bc3f0751aecf Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 10 Sep 2015 12:48:44 +0100 Subject: [PATCH 030/179] NKRO fixes. --- tmk_core/common/report.h | 5 ++++ tmk_core/protocol/chibios/main.c | 23 ++++++++++----- tmk_core/protocol/chibios/usb_main.c | 42 ++++++++++++++-------------- tmk_core/protocol/chibios/usb_main.h | 31 +++++++------------- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index f6c0a315..0c799eca 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -84,6 +84,11 @@ along with this program. If not, see . # define KEYBOARD_REPORT_SIZE NKRO_EPSIZE # define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) # define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) +#elif defined(PROTOCOL_CHIBIOS) && defined(NKRO_ENABLE) +# include "protocol/chibios/usb_main.h" +# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE +# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) +# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) #else # define KEYBOARD_REPORT_SIZE 8 diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 7aec7e3e..589675aa 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -40,6 +40,14 @@ * ------------------------- */ +/* declarations */ +uint8_t keyboard_leds(void); +void send_keyboard(report_keyboard_t *report); +void send_mouse(report_mouse_t *report); +void send_system(uint16_t data); +void send_consumer(uint16_t data); + +/* host struct */ host_driver_t chibios_driver = { keyboard_leds, send_keyboard, @@ -52,14 +60,15 @@ host_driver_t chibios_driver = { /* TESTING * Amber LED blinker thread, times are in milliseconds. */ -// uint8_t blinkLedState = 0; -// static THD_WORKING_AREA(waThread1, 128); -// static THD_FUNCTION(Thread1, arg) { +/* set this variable to non-zero anywhere to blink once */ +// uint8_t blinkLed = 0; +// static THD_WORKING_AREA(waBlinkerThread, 128); +// static THD_FUNCTION(blinkerThread, arg) { // (void)arg; -// chRegSetThreadName("blinker1"); +// chRegSetThreadName("blinkOrange"); // while(true) { -// if(blinkLedState) { -// blinkLedState = 0; +// if(blinkLed) { +// blinkLed = 0; // palSetPad(GPIOC, GPIOC_LED_ORANGE); // chThdSleepMilliseconds(100); // palClearPad(GPIOC, GPIOC_LED_ORANGE); @@ -82,7 +91,7 @@ int main(void) { palClearPad(GPIOC, GPIOC_LED_BLUE); // TESTING - // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); + // chThdCreateStatic(waBlinkerThread, sizeof(waBlinkerThread), NORMALPRIO, blinkerThread, NULL); /* Init USB */ init_usb_driver(&USB_DRIVER); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index daefc490..f5f2dad7 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -20,11 +20,11 @@ #include "usb_main.h" +#include "host.h" #include "debug.h" #ifdef SLEEP_LED_ENABLE #include "sleep_led.h" #include "led.h" -#include "host.h" #endif /* --------------------------------------------------------- @@ -39,7 +39,7 @@ volatile uint16_t keyboard_idle_count = 0; static virtual_timer_t keyboard_idle_timer; static void keyboard_idle_timer_cb(void *arg); #ifdef NKRO_ENABLE -bool keyboard_nkro = true; +extern bool keyboard_nkro; #endif /* NKRO_ENABLE */ report_keyboard_t keyboard_report_sent = {{0}}; @@ -250,7 +250,7 @@ static const uint8_t console_hid_report_desc_data[] = { 0x75, 0x08, // report size = 8 bits 0x15, 0x00, // logical minimum = 0 0x26, 0xFF, 0x00, // logical maximum = 255 - 0x95, CONSOLE_SIZE, // report count + 0x95, CONSOLE_EPSIZE, // report count 0x09, 0x75, // usage 0x81, 0x02, // Input (array) 0xC0 // end collection @@ -374,7 +374,7 @@ static const uint8_t hid_configuration_descriptor_data[] = { /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ USB_DESC_ENDPOINT(KBD_ENDPOINT | 0x80, // bEndpointAddress 0x03, // bmAttributes (Interrupt) - KBD_SIZE, // wMaxPacketSize + KBD_EPSIZE,// wMaxPacketSize 10), // bInterval #ifdef MOUSE_ENABLE @@ -404,7 +404,7 @@ static const uint8_t hid_configuration_descriptor_data[] = { /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ USB_DESC_ENDPOINT(MOUSE_ENDPOINT | 0x80, // bEndpointAddress 0x03, // bmAttributes (Interrupt) - MOUSE_SIZE, // wMaxPacketSize + MOUSE_EPSIZE, // wMaxPacketSize 1), // bInterval #endif /* MOUSE_ENABLE */ @@ -430,7 +430,7 @@ static const uint8_t hid_configuration_descriptor_data[] = { /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ USB_DESC_ENDPOINT(CONSOLE_ENDPOINT | 0x80, // bEndpointAddress 0x03, // bmAttributes (Interrupt) - CONSOLE_SIZE, // wMaxPacketSize + CONSOLE_EPSIZE, // wMaxPacketSize 1), // bInterval #endif /* CONSOLE_ENABLE */ @@ -456,7 +456,7 @@ static const uint8_t hid_configuration_descriptor_data[] = { /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ USB_DESC_ENDPOINT(EXTRA_ENDPOINT | 0x80, // bEndpointAddress 0x03, // bmAttributes (Interrupt) - EXTRA_SIZE, // wMaxPacketSize + EXTRA_EPSIZE, // wMaxPacketSize 10), // bInterval #endif /* EXTRAKEY_ENABLE */ @@ -482,7 +482,7 @@ static const uint8_t hid_configuration_descriptor_data[] = { /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ USB_DESC_ENDPOINT(NKRO_ENDPOINT | 0x80, // bEndpointAddress 0x03, // bmAttributes (Interrupt) - NKRO_SIZE, // wMaxPacketSize + NKRO_EPSIZE, // wMaxPacketSize 1), // bInterval #endif /* NKRO_ENABLE */ }; @@ -665,7 +665,7 @@ static const USBEndpointConfig kbd_ep_config = { NULL, /* SETUP packet notification callback */ kbd_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - KBD_SIZE, /* IN maximum packet size */ + KBD_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &kbd_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -683,7 +683,7 @@ static const USBEndpointConfig mouse_ep_config = { NULL, /* SETUP packet notification callback */ mouse_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - MOUSE_SIZE, /* IN maximum packet size */ + MOUSE_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &mouse_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -702,7 +702,7 @@ static const USBEndpointConfig console_ep_config = { NULL, /* SETUP packet notification callback */ console_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - CONSOLE_SIZE, /* IN maximum packet size */ + CONSOLE_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &console_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -721,7 +721,7 @@ static const USBEndpointConfig extra_ep_config = { NULL, /* SETUP packet notification callback */ extra_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - EXTRA_SIZE, /* IN maximum packet size */ + EXTRA_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &extra_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -740,7 +740,7 @@ static const USBEndpointConfig nkro_ep_config = { NULL, /* SETUP packet notification callback */ nkro_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - NKRO_SIZE, /* IN maximum packet size */ + NKRO_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &nkro_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -1178,9 +1178,9 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) { chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); /* Check if there is data to send left in the output queue */ - if(chOQGetFullI(&console_queue) >= CONSOLE_SIZE) { + if(chOQGetFullI(&console_queue) >= CONSOLE_EPSIZE) { osalSysUnlockFromISR(); - usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); + usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_EPSIZE); osalSysLockFromISR(); usbStartTransmitI(usbp, CONSOLE_ENDPOINT); } @@ -1197,9 +1197,9 @@ void console_queue_onotify(io_queue_t *qp) { return; if(!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT) - && (chOQGetFullI(&console_queue) >= CONSOLE_SIZE)) { + && (chOQGetFullI(&console_queue) >= CONSOLE_EPSIZE)) { osalSysUnlock(); - usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_SIZE); + usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_EPSIZE); osalSysLock(); usbStartTransmitI(usbp, CONSOLE_ENDPOINT); } @@ -1210,7 +1210,7 @@ void console_queue_onotify(io_queue_t *qp) { static void console_flush_cb(void *arg) { USBDriver *usbp = (USBDriver *)arg; size_t i, n; - uint8_t buf[CONSOLE_SIZE]; /* TODO: a solution without extra buffer? */ + uint8_t buf[CONSOLE_EPSIZE]; /* TODO: a solution without extra buffer? */ osalSysLockFromISR(); /* check that the states of things are as they're supposed to */ @@ -1222,7 +1222,7 @@ static void console_flush_cb(void *arg) { } /* don't do anything if the queue is empty or has enough stuff in it */ - if(((n = oqGetFullI(&console_queue)) == 0) || (n >= CONSOLE_SIZE)) { + if(((n = oqGetFullI(&console_queue)) == 0) || (n >= CONSOLE_EPSIZE)) { /* rearm the timer */ chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); osalSysUnlockFromISR(); @@ -1232,10 +1232,10 @@ static void console_flush_cb(void *arg) { /* there's stuff hanging in the queue - so dequeue and send */ for(i = 0; i < n; i++) buf[i] = (uint8_t)oqGetI(&console_queue); - for(i = n; i < CONSOLE_SIZE; i++) + for(i = n; i < CONSOLE_EPSIZE; i++) buf[i] = 0; osalSysUnlockFromISR(); - usbPrepareTransmit(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_SIZE); + usbPrepareTransmit(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); osalSysLockFromISR(); (void)usbStartTransmitI(usbp, CONSOLE_ENDPOINT); diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 5897375b..3a7e76fc 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -20,7 +20,7 @@ #define _USB_MAIN_H_ // TESTING -// extern uint8_t blinkLedState; +// extern uint8_t blinkLed; #include "ch.h" #include "hal.h" @@ -44,19 +44,19 @@ void init_usb_driver(USBDriver *usbp); /* main keyboard (6kro) */ #define KBD_INTERFACE 0 #define KBD_ENDPOINT 1 -#define KBD_SIZE 8 -#define KBD_REPORT_KEYS (KBD_SIZE - 2) +#define KBD_EPSIZE 8 +#define KBD_REPORT_KEYS (KBD_EPSIZE - 2) /* secondary keyboard */ #ifdef NKRO_ENABLE #define NKRO_INTERFACE 4 #define NKRO_ENDPOINT 5 -#define NKRO_SIZE 16 -#define NKRO_REPORT_KEYS (NKRO_SIZE - 1) +#define NKRO_EPSIZE 16 +#define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1) #endif /* this defines report_keyboard_t and computes REPORT_SIZE defines */ -#include "report.h" +// #include "report.h" /* extern report_keyboard_t keyboard_report_sent; */ @@ -80,7 +80,7 @@ void nkro_in_cb(USBDriver *usbp, usbep_t ep); #define MOUSE_INTERFACE 1 #define MOUSE_ENDPOINT 2 -#define MOUSE_SIZE 8 +#define MOUSE_EPSIZE 8 /* mouse IN request callback handler */ void mouse_in_cb(USBDriver *usbp, usbep_t ep); @@ -95,7 +95,7 @@ void mouse_in_cb(USBDriver *usbp, usbep_t ep); #define EXTRA_INTERFACE 3 #define EXTRA_ENDPOINT 4 -#define EXTRA_SIZE 8 +#define EXTRA_EPSIZE 8 /* extrakey IN request callback handler */ void extra_in_cb(USBDriver *usbp, usbep_t ep); @@ -116,11 +116,11 @@ typedef struct { #define CONSOLE_INTERFACE 2 #define CONSOLE_ENDPOINT 3 -#define CONSOLE_SIZE 16 +#define CONSOLE_EPSIZE 16 /* Number of IN reports that can be stored inside the output queue */ #define CONSOLE_QUEUE_CAPACITY 2 -#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_SIZE) +#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_EPSIZE) /* Console flush time */ #define CONSOLE_FLUSH_MS 50 @@ -138,15 +138,4 @@ void console_in_cb(USBDriver *usbp, usbep_t ep); void sendchar_pf(void *p, char c); -/* --------------------------- - * Host driver functions (TMK) - * --------------------------- - */ - -uint8_t keyboard_leds(void); -void send_keyboard(report_keyboard_t *report); -void send_mouse(report_mouse_t *report); -void send_system(uint16_t data); -void send_consumer(uint16_t data); - #endif /* _USB_MAIN_H_ */ From 1bcf15a8ea08b1728bc6caf27117a5ade0659a15 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 10 Sep 2015 12:50:41 +0100 Subject: [PATCH 031/179] Add comments to chibi_onekey Makefile. --- keyboard/chibi_onekey/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/keyboard/chibi_onekey/Makefile b/keyboard/chibi_onekey/Makefile index 3e8e715c..0a88f075 100644 --- a/keyboard/chibi_onekey/Makefile +++ b/keyboard/chibi_onekey/Makefile @@ -20,12 +20,17 @@ endif CONFIG_H = config.h -# chip/board +## chip/board settings +# the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) MCU_FAMILY = STM32 MCU_SERIES = STM32F0xx # linker script to use +# it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ MCU_MODEL_FAMILY = STM32F072xB -# the directory in board/ +# it should exist either in /os/hal/boards/ +# or /boards BOARD = ST_STM32F072B_DISCOVERY # ARM version, M0/M1 are 6, M3/M4/M7 are 7 ARMV = 6 @@ -45,7 +50,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -#NKRO_ENABLE = yes # USB Nkey Rollover +NKRO_ENABLE = yes # USB Nkey Rollover include $(TMK_DIR)/tool/chibios/common.mk include $(TMK_DIR)/tool/chibios/chibios.mk From 9f1d23bfe11d0a2db028ec2d585385094b80c098 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 12 Sep 2015 05:27:37 +0900 Subject: [PATCH 032/179] Add Ateml toolchain and remove specific chip name --- doc/build.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/build.md b/doc/build.md index 20702e94..beff191b 100644 --- a/doc/build.md +++ b/doc/build.md @@ -6,9 +6,9 @@ Download and Install -------------------- ### 1. Install Tools -1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager. +1. **Toolchain** On Windows install [Atmel AVR Toolchain][atmelgcc] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack] or your favorite package manager. On Linux you can install AVR GCC with your favorite package manager. -2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog]. +2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows. 3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver. @@ -53,7 +53,7 @@ Now you have **hex** file to program on current directory. This **hex** is only How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual. ### 2. Program with DFU bootloader -Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. +Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`. If you have a proper program command in `Makefile` just type this. @@ -68,7 +68,7 @@ Or to program with `dfu-programmer` run: $ make -f Makefile. dfu #### FLIP GUI tutorial -1. On menu bar click Device -> Select, then. `ATmega32u4`. +1. On menu bar click Device -> Select, then choose your chip name. 2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog. At this point you'll see grey-outed widgets on the app get colored and ready. @@ -99,10 +99,9 @@ You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or $ make -f Makefile. program +[atmelgcc]: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx [cygwin]: https://www.cygwin.com/ [mingw]: http://www.mingw.org/ -[mhv]: https://infernoembedded.com/products/avr-tools -[winavr]: http://winavr.sourceforge.net/ [crosspack]: http://www.obdev.at/products/crosspack/index.html [flip]: http://www.atmel.com/tools/FLIP.aspx [dfu-prog]: http://dfu-programmer.sourceforge.net/ From 0c21b263f9bc11e3999d7ea28e78d36663abf02c Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 12 Sep 2015 11:25:41 +0900 Subject: [PATCH 033/179] Fix weak modifier clear in action macro --- tmk_core/common/action_macro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c index ba93fc8b..ffaf125c 100644 --- a/tmk_core/common/action_macro.c +++ b/tmk_core/common/action_macro.c @@ -42,6 +42,7 @@ void action_macro_play(const macro_t *macro_p) dprintf("KEY_DOWN(%02X)\n", macro); if (IS_MOD(macro)) { add_weak_mods(MOD_BIT(macro)); + send_keyboard_report(); } else { register_code(macro); } @@ -51,6 +52,7 @@ void action_macro_play(const macro_t *macro_p) dprintf("KEY_UP(%02X)\n", macro); if (IS_MOD(macro)) { del_weak_mods(MOD_BIT(macro)); + send_keyboard_report(); } else { unregister_code(macro); } From a8d4daa7617c72cc32b5186271d4d35a7beffb82 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 12 Sep 2015 11:26:37 +0900 Subject: [PATCH 034/179] Fix parenthesis --- tmk_core/common/action_code.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index 32ef0721..4fe9c1d5 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -266,7 +266,7 @@ enum layer_pram_tap_op { #define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) #define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) #define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) -#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | (mods)&0x0f) +#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f)) /* With Tapping */ #define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) #define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE) From 438559f11dba792630201d66a2b690760550c2e2 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 15 Sep 2015 08:52:03 +0100 Subject: [PATCH 035/179] Rename some Makefile defines. --- keyboard/chibi_onekey/Makefile | 7 +++++-- tmk_core/protocol/chibios/usb_main.h | 1 - tmk_core/tool/chibios/chibios.mk | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/keyboard/chibi_onekey/Makefile b/keyboard/chibi_onekey/Makefile index 0a88f075..2d5ff8cd 100644 --- a/keyboard/chibi_onekey/Makefile +++ b/keyboard/chibi_onekey/Makefile @@ -28,11 +28,14 @@ MCU_SERIES = STM32F0xx # linker script to use # it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ # or /ld/ -MCU_MODEL_FAMILY = STM32F072xB +MCU_LDSCRIPT = STM32F072xB +# startup code to use +# is should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +MCU_STARTUP = stm32f0xx # it should exist either in /os/hal/boards/ # or /boards BOARD = ST_STM32F072B_DISCOVERY -# ARM version, M0/M1 are 6, M3/M4/M7 are 7 +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 6 # If you want to be able to jump to bootloader from firmware (on STM32 MCUs), # set the correct BOOTLOADER_ADDRESS here. Otherwise leave commented out. diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 3a7e76fc..85ea9153 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -127,7 +127,6 @@ typedef struct { /* Putchar over the USB console */ int8_t sendchar(uint8_t c); -/* wrapper for printf lib */ /* Flush output (send everything immediately) */ void console_flush_output(void); diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index ed5fd5b8..6ba783e3 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -85,7 +85,7 @@ endif # Imported source files and paths CHIBIOS = $(TMK_DIR)/tool/chibios/chibios # Startup files. -include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]').mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk @@ -101,10 +101,10 @@ include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk # Other files (optional). # Define linker script file here -ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_MODEL_FAMILY).ld)","") -LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_MODEL_FAMILY).ld +ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld)","") +LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld else -LDSCRIPT = $(STARTUPLD)/$(MCU_MODEL_FAMILY).ld +LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld endif # C sources that can be compiled in ARM or THUMB mode depending on the global From bb8c1d29fa123c430bccb5b8568d55a691bc1c81 Mon Sep 17 00:00:00 2001 From: skullY Date: Tue, 15 Sep 2015 09:17:02 -0700 Subject: [PATCH 036/179] Add an assignable RESET key --- tmk_core/common/keycode.h | 3 +++ tmk_core/common/keymap.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index fc66dc0e..b2417a6c 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -426,6 +426,9 @@ enum internal_special_keycodes { KC_MEDIA_FAST_FORWARD, KC_MEDIA_REWIND, /* 0xBC */ + /* Jump to bootloader */ + KC_RESET = 0xBF, + /* Fn key */ KC_FN0 = 0xC0, KC_FN1, diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index 9f4fab52..bf7ddee7 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -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 . */ +#include #include "keymap.h" #include "report.h" #include "keycode.h" @@ -21,6 +22,7 @@ along with this program. If not, see . #include "action.h" #include "action_macro.h" #include "debug.h" +#include "print.h" static action_t keycode_to_action(uint8_t keycode); @@ -140,6 +142,13 @@ static action_t keycode_to_action(uint8_t keycode) case KC_TRNS: action.code = ACTION_TRANSPARENT; break; + case KC_RESET: + clear_keyboard(); + print("\n\nJump to bootloader... "); + _delay_ms(50); + bootloader_jump(); + print("not supported.\n"); + break; default: action.code = ACTION_NO; break; From 498654fc4c693c8a40e9285063797b9a6324ac18 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 16 Sep 2015 12:42:38 +0900 Subject: [PATCH 037/179] Change to KC_BOOTLOADER(KC_BTLD) --- tmk_core/common/keycode.h | 4 +++- tmk_core/common/keymap.c | 11 ++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index b2417a6c..44819530 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -156,6 +156,8 @@ along with this program. If not, see . #define KC_WSTP KC_WWW_STOP #define KC_WREF KC_WWW_REFRESH #define KC_WFAV KC_WWW_FAVORITES +/* Jump to bootloader */ +#define KC_BTLD KC_BOOTLOADER /* Transparent */ #define KC_TRANSPARENT 1 #define KC_TRNS KC_TRANSPARENT @@ -427,7 +429,7 @@ enum internal_special_keycodes { KC_MEDIA_REWIND, /* 0xBC */ /* Jump to bootloader */ - KC_RESET = 0xBF, + KC_BOOTLOADER = 0xBF, /* Fn key */ KC_FN0 = 0xC0, diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index bf7ddee7..d4892380 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -14,15 +14,14 @@ 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 "keymap.h" #include "report.h" #include "keycode.h" #include "action_layer.h" #include "action.h" #include "action_macro.h" +#include "wait.h" #include "debug.h" -#include "print.h" static action_t keycode_to_action(uint8_t keycode); @@ -142,12 +141,10 @@ static action_t keycode_to_action(uint8_t keycode) case KC_TRNS: action.code = ACTION_TRANSPARENT; break; - case KC_RESET: + case KC_BOOTLOADER: clear_keyboard(); - print("\n\nJump to bootloader... "); - _delay_ms(50); - bootloader_jump(); - print("not supported.\n"); + wait_ms(50); + bootloader_jump(); // not return break; default: action.code = ACTION_NO; From 9b99f8f8649c25b5efa92c9fd49b7f4c0ce60a76 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 10:33:25 +0900 Subject: [PATCH 038/179] next_usb: Fix next_kbd_set_leds() --- tmk_core/protocol/next_kbd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/next_kbd.c b/tmk_core/protocol/next_kbd.c index a5a07a7a..fa3034b3 100644 --- a/tmk_core/protocol/next_kbd.c +++ b/tmk_core/protocol/next_kbd.c @@ -59,10 +59,16 @@ static inline void query(void); static inline void reset(void); static inline uint32_t response(void); -#define out_hi_delay(intervals) do { out_hi(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define out_lo_delay(intervals) do { out_lo(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define query_delay(intervals) do { query(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define reset_delay(intervals) do { reset(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); +/* The keyboard sends signal with 50us pulse width on OUT line + * while it seems to miss the 50us pulse on In line. + * next_kbd_set_leds() often fails to sync LED status with 50us + * but it works well with 51us(+1us) on TMK converter(ATMeaga32u2) at least. + * TODO: test on Teensy and Pro Micro configuration + */ +#define out_hi_delay(intervals) do { out_hi(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define out_lo_delay(intervals) do { out_lo(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define query_delay(intervals) do { query(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define reset_delay(intervals) do { reset(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); void next_kbd_init(void) { @@ -79,6 +85,7 @@ void next_kbd_init(void) void next_kbd_set_leds(bool left, bool right) { + cli(); out_lo_delay(9); out_hi_delay(3); @@ -98,6 +105,7 @@ void next_kbd_set_leds(bool left, bool right) out_lo_delay(7); out_hi(); + sei(); } #define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1< Date: Sun, 20 Sep 2015 10:35:12 +0900 Subject: [PATCH 039/179] next_usb: Fix keymap --- converter/next_usb/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/next_usb/keymap.c b/converter/next_usb/keymap.c index 3a510754..0041df54 100644 --- a/converter/next_usb/keymap.c +++ b/converter/next_usb/keymap.c @@ -159,7 +159,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, MS_L,MS_D,MS_R,WH_D, TRNS, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS, - TRNS,RALT, TRNS, RGUI,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS + TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS ) }; From 4fd703e9955356971d9610e05b734db860856382 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 10:41:54 +0900 Subject: [PATCH 040/179] next_usb: Change for TMK converter configuration --- converter/next_usb/Makefile | 4 ++-- converter/next_usb/config.h | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/converter/next_usb/Makefile b/converter/next_usb/Makefile index fe19e98c..7190f1ea 100644 --- a/converter/next_usb/Makefile +++ b/converter/next_usb/Makefile @@ -17,10 +17,10 @@ CONFIG_H = config.h # MCU name, you MUST set this to match the board you are using # type "make clean" after changing this, so all files will be rebuilt #MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 +#MCU = atmega32u4 # Teensy 2.0 #MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb1286 # Teensy++ 2.0 -#MCU = atmega32u2 # TMK converter +MCU = atmega32u2 # TMK converter # Processor frequency. diff --git a/converter/next_usb/config.h b/converter/next_usb/config.h index cd80b5af..a06affc5 100644 --- a/converter/next_usb/config.h +++ b/converter/next_usb/config.h @@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE. */ -#define VENDOR_ID 0xBCBC +#define VENDOR_ID 0xFEED #define PRODUCT_ID 0xBCBC #define DEVICE_VER 0x0500 #define MANUFACTURER t.m.k. @@ -56,14 +56,15 @@ POSSIBILITY OF SUCH DAMAGE. #define MATRIX_ROWS 12 // keycode bit: 3-0 #define MATRIX_COLS 8 // keycode bit: 6-4 -//#define DEBUG_ON_INIT 1 +#define DEBUG_ON_INIT 1 //#define TEENSY_CONFIG 1 -#define PRO_MICRO_CONFIG 1 -//#define TMK_CONFIG 1 +//#define PRO_MICRO_CONFIG 1 +#define TMK_CONFIG 1 -// comment out if you don't want the keyboard's LEDs to flash upon initialization -#define NEXT_KBD_INIT_FLASH_LEDS +// comment out if you don't want the keyboard's LEDs to flash upon initialization or pressing shift +//#define NEXT_KBD_INIT_FLASH_LEDS +//#define NEXT_KBD_SHIFT_FLASH_LEDS //============= Start of Arduino Pro Micro Configuration ============== #ifdef PRO_MICRO_CONFIG @@ -183,6 +184,7 @@ POSSIBILITY OF SUCH DAMAGE. /* key combination for command */ #define IS_COMMAND() ( \ - (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))|| \ - (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \ + (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \ + (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RALT))) || \ + (keyboard_report->mods == (MOD_BIT(KC_RGUI) | MOD_BIT(KC_RGUI))) \ ) From c1f36042b4a09bf2357406b83d5c97a652d56bdb Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 10:43:12 +0900 Subject: [PATCH 041/179] next_usb: Change LEDs usage for CapsLock status --- converter/next_usb/led.c | 7 ++++++- converter/next_usb/matrix.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/converter/next_usb/led.c b/converter/next_usb/led.c index 24db15e1..2bd0ef6d 100644 --- a/converter/next_usb/led.c +++ b/converter/next_usb/led.c @@ -47,9 +47,14 @@ POSSIBILITY OF SUCH DAMAGE. #include "stdint.h" #include "led.h" +#include "next_kbd.h" void led_set(uint8_t usb_led) { - + if (usb_led & (1< Date: Sun, 20 Sep 2015 10:44:09 +0900 Subject: [PATCH 042/179] next_usb: Fix for mssing key event --- converter/next_usb/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/next_usb/matrix.c b/converter/next_usb/matrix.c index 506378d9..d91cd257 100644 --- a/converter/next_usb/matrix.c +++ b/converter/next_usb/matrix.c @@ -160,7 +160,7 @@ void matrix_init(void) /* scan all key states on matrix */ uint8_t matrix_scan(void) { - _delay_ms(20); + _delay_ms(5); //next_kbd_set_leds(false, false); NEXT_KBD_LED1_OFF; From bf3d4b3c06a0f379ce5f1112b5033faf1a69aeb6 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 10:48:47 +0900 Subject: [PATCH 043/179] lufa: Fix endpoint bank mode for ATMega32u2 --- tmk_core/protocol/lufa/lufa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 65c215bf..188fb7b8 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -217,6 +217,9 @@ void EVENT_USB_Device_StartOfFrame(void) /** Event handler for the USB_ConfigurationChanged event. * This is fired when the host sets the current configuration of the USB device after enumeration. + * + * ATMega32u2 supports dual bank(ping-pong mode) only on endpoint 3 and 4, + * it is safe to use singl bank for all endpoints. */ void EVENT_USB_Device_ConfigurationChanged(void) { @@ -241,7 +244,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) #ifdef CONSOLE_ENABLE /* Setup Console HID Report Endpoints */ ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE); + CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); #if 0 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); From e8a4a63ec45cf5052d8a054182ab83fdbafc3ff6 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 10:51:30 +0900 Subject: [PATCH 044/179] core: Fix message print of debug command --- tmk_core/common/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 1b6808be..a53cac61 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -228,13 +228,13 @@ static bool command_common(uint8_t code) break; case KC_D: if (debug_enable) { - print("\ndebug: on\n"); + print("\ndebug: off\n"); debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; } else { - print("\ndebug: off\n"); + print("\ndebug: on\n"); debug_enable = true; } break; From ed9766a7d44cd727dbd59008eff4258745ff87cf Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 20 Sep 2015 14:34:13 +0900 Subject: [PATCH 045/179] core: Fix for disabling NKRO in Boot protocol --- tmk_core/common/action_util.c | 6 +++--- tmk_core/common/command.c | 1 + tmk_core/protocol/lufa/lufa.c | 8 +++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index dbee630d..f81877dd 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c @@ -76,7 +76,7 @@ void send_keyboard_report(void) { void add_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { add_key_bit(key); return; } @@ -87,7 +87,7 @@ void add_key(uint8_t key) void del_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { del_key_bit(key); return; } @@ -160,7 +160,7 @@ uint8_t has_anymod(void) uint8_t get_first_key(void) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { uint8_t i = 0; for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) ; diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index a53cac61..420e7eb9 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -315,6 +315,7 @@ static bool command_common(uint8_t code) print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); + print_val_hex8(keyboard_nkro); print_val_hex32(timer_count); #ifdef PROTOCOL_PJRC diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 188fb7b8..345630aa 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -53,6 +53,7 @@ #include "lufa.h" uint8_t keyboard_idle = 0; +/* 0: Boot Protocol, 1: Report Protocol(default) */ uint8_t keyboard_protocol = 1; static uint8_t keyboard_led_stats = 0; @@ -349,10 +350,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); - keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); -#ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; -#endif + keyboard_protocol = (USB_ControlRequest.wValue & 0xFF); clear_keyboard(); } } @@ -399,7 +397,7 @@ static void send_keyboard(report_keyboard_t *report) /* Select the Keyboard Report Endpoint */ #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { /* Report protocol - NKRO */ Endpoint_SelectEndpoint(NKRO_IN_EPNUM); From 79fd952da44df3414652faeb777437feeba70319 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Thu, 24 Sep 2015 01:33:50 +0900 Subject: [PATCH 046/179] ibm4704: Add keymap for Alps 102-key --- converter/ibm4704_usb/keymap_alps102key.c | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 converter/ibm4704_usb/keymap_alps102key.c diff --git a/converter/ibm4704_usb/keymap_alps102key.c b/converter/ibm4704_usb/keymap_alps102key.c new file mode 100644 index 00000000..f3dda718 --- /dev/null +++ b/converter/ibm4704_usb/keymap_alps102key.c @@ -0,0 +1,50 @@ +#include "keymap_common.h" + + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Layer 0: + * ,---------------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |PSC|SLK|PAU| |F1 |F2 |F3 |F4 | + * |---------------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 | + * |---------------------------------------------------------------| |-----------| |---------------| + * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12| + * |---------------------------------------------------------------| |-----------| |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |Up | | |F13|F14|F15|F16| + * |---------------------------------------------------------------| |-----------| |---------------| + * |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Lef|Dow|Rig| |F17|F18|F19|F20| + * `---------------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_ALPS102( + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,BSPC,F21, PSCR,SLCK,PAUS, F1, F2, F3, F4, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, F22, INS, HOME,PGUP, F5, F6, F7, F8, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, F23, DEL, END, PGDN, F9, F10, F11, F12, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,RSFT, F24, NO, UP, NO, F13, F14, F15, F16, \ + FN0, LGUI,LALT, SPC, RALT,RGUI, FN0, LEFT,DOWN,RGHT, F17, F18, F19, F20 \ + ), + + /* Layer 1: + * ,---------------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |VoD|VoU|Mut| |F1 |F2 |F3 |F4 | + * |---------------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 | + * |---------------------------------------------------------------| |-----------| |---------------| + * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12| + * |---------------------------------------------------------------| |-----------| |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |PgU| | |F13|F14|F15|F16| + * |---------------------------------------------------------------| |-----------| |---------------| + * |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Hom|PgD|End| |F17|F18|F19|F20| + * `---------------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP_ALPS102( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, VOLD,VOLU,MUTE, 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,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,PGUP,TRNS, TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS, HOME,PGDN,END, TRNS,TRNS,TRNS,TRNS \ + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), +}; From 77afc5a76f5d299d606ab5b6d870a40aee9cb0e3 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Thu, 24 Sep 2015 01:35:10 +0900 Subject: [PATCH 047/179] core: Fix NKRO ifdef --- tmk_core/common/command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 420e7eb9..d59bb01b 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -315,7 +315,9 @@ static bool command_common(uint8_t code) print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); +#ifdef NKRO_ENABLE print_val_hex8(keyboard_nkro); +#endif print_val_hex32(timer_count); #ifdef PROTOCOL_PJRC From fdc38ef3f92af7adeeb4de49550d8838c8a39b5c Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Thu, 24 Sep 2015 12:29:11 +0900 Subject: [PATCH 048/179] Squashed 'tmk_core/' changes from dc0e46e..57d27a8 57d27a8 Merge branch 'core_update_150924' into core 024abe3 core: Fix NKRO ifdef 7aa2d30 core: Fix for disabling NKRO in Boot protocol 95651fd core: Fix message print of debug command c20cd29 lufa: Fix endpoint bank mode for ATMega32u2 82ac21f next_usb: Fix next_kbd_set_leds() 537d9c7 Change to KC_BOOTLOADER(KC_BTLD) f2b3772 Add an assignable RESET key fc99257 Fix parenthesis e852582 Fix weak modifier clear in action macro c2a6c5c core: Fix lufa suspend callback(#234) fa548c5 usb_usb: Ignore error usage(0x01-03) report 513d95c usb_usb: Support locking key indicator LED cd78802 core: Add keymap section ldscript for ATMega32U2 70c9abd Add description for non-US keys on keycode.h 538c192 lufa: Fix console flush #223 87628c9 Revert "Make action_for_key a weak symbol" 3c0a1ba Make action_for_key a weak symbol 6bb0d7d ibm4704_usb: Fix protocol handling b6ef5cf Add keyboard_setup() and matrix_setup() f4bb8b2 ibm4704_usb: Fix interrupt of clock(rising edge) 0c1fcc1 usb_usb: Change debug LED pin config 595710d Reduce code size of magic commands 6bed174 Add description of AVR bootloader and boot section 54c6a01 Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5' d18d42e Merge branch 'core-update2' into core febec88 Add compile options '-fdata-sections' git-subtree-dir: tmk_core git-subtree-split: 57d27a8e39173a589b4abae74851f95c39940174 --- common.mk | 9 +- common/action_code.h | 2 +- common/action_macro.c | 2 + common/action_util.c | 6 +- common/avr/bootloader.c | 49 +++- common/avr/suspend.c | 2 + common/command.c | 198 ++++++------- common/keyboard.c | 6 + common/keyboard.h | 8 +- common/keycode.h | 9 +- common/keymap.c | 6 + common/led.h | 8 + common/matrix.h | 4 +- ldscript_keymap_avr35.x | 268 ++++++++++++++++++ ldscript_keymap_avr5.x | 6 +- protocol/ibm4704.c | 53 ++-- protocol/lufa/lufa.c | 47 ++- protocol/next_kbd.c | 16 +- protocol/pjrc/main.c | 2 + .../testusbhostFAT/Arduino_Makefile_master | 1 - .../examples/testusbhostFAT/RTClib | 1 - .../examples/testusbhostFAT/generic_storage | 1 - .../examples/testusbhostFAT/xmem2 | 1 - protocol/usb_hid/leonardo_led.h | 10 - protocol/usb_hid/parser.cpp | 27 +- rules.mk | 1 + 26 files changed, 554 insertions(+), 189 deletions(-) create mode 100644 ldscript_keymap_avr35.x delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Arduino_Makefile_master delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/RTClib delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/generic_storage delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/xmem2 delete mode 100644 protocol/usb_hid/leonardo_led.h diff --git a/common.mk b/common.mk index d22adff5..cb030b33 100644 --- a/common.mk +++ b/common.mk @@ -66,7 +66,14 @@ endif ifdef KEYMAP_SECTION_ENABLE OPT_DEFS += -DKEYMAP_SECTION_ENABLE - EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + + ifeq ($(strip $(MCU)),atmega32u2) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x + else ifeq ($(strip $(MCU)),atmega32u4) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + else + EXTRALDFLAGS = $(error no ldscript for keymap section) + endif endif # Version string diff --git a/common/action_code.h b/common/action_code.h index 32ef0721..4fe9c1d5 100644 --- a/common/action_code.h +++ b/common/action_code.h @@ -266,7 +266,7 @@ enum layer_pram_tap_op { #define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) #define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) #define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) -#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | (mods)&0x0f) +#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f)) /* With Tapping */ #define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) #define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE) diff --git a/common/action_macro.c b/common/action_macro.c index ba93fc8b..ffaf125c 100644 --- a/common/action_macro.c +++ b/common/action_macro.c @@ -42,6 +42,7 @@ void action_macro_play(const macro_t *macro_p) dprintf("KEY_DOWN(%02X)\n", macro); if (IS_MOD(macro)) { add_weak_mods(MOD_BIT(macro)); + send_keyboard_report(); } else { register_code(macro); } @@ -51,6 +52,7 @@ void action_macro_play(const macro_t *macro_p) dprintf("KEY_UP(%02X)\n", macro); if (IS_MOD(macro)) { del_weak_mods(MOD_BIT(macro)); + send_keyboard_report(); } else { unregister_code(macro); } diff --git a/common/action_util.c b/common/action_util.c index dbee630d..f81877dd 100644 --- a/common/action_util.c +++ b/common/action_util.c @@ -76,7 +76,7 @@ void send_keyboard_report(void) { void add_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { add_key_bit(key); return; } @@ -87,7 +87,7 @@ void add_key(uint8_t key) void del_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { del_key_bit(key); return; } @@ -160,7 +160,7 @@ uint8_t has_anymod(void) uint8_t get_first_key(void) { #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { uint8_t i = 0; for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) ; diff --git a/common/avr/bootloader.c b/common/avr/bootloader.c index cda295b1..7c744e8c 100644 --- a/common/avr/bootloader.c +++ b/common/avr/bootloader.c @@ -11,12 +11,49 @@ #endif -/* Boot Section Size in *BYTEs* - * Teensy halfKay 512 - * Teensy++ halfKay 1024 - * Atmel DFU loader 4096 - * LUFA bootloader 4096 - * USBaspLoader 2048 +/* Bootloader Size in *bytes* + * + * AVR Boot section size are defined by setting BOOTSZ fuse in fact. Consult with your MCU datasheet. + * Note that 'Word'(2 bytes) size and address are used in datasheet while TMK uses 'Byte'. + * + * + * Size of Bootloaders in bytes: + * Atmel DFU loader(ATmega32U4) 4096 + * Atmel DFU loader(AT90USB128) 8192 + * LUFA bootloader(ATmega32U4) 4096 + * Arduino Caterina(ATmega32U4) 4096 + * USBaspLoader(ATmega***) 2048 + * Teensy halfKay(ATmega32U4) 512 + * Teensy++ halfKay(AT90USB128) 1024 + * + * + * AVR Boot section is located at the end of Flash memory like the followings. + * + * + * byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB128) + * 0x0000 +---------------+ 0x00000 +---------------+ + * | | | | + * | | | | + * | Application | | Application | + * | | | | + * = = = = + * | | 32KB-4KB | | 128KB-8KB + * 0x6000 +---------------+ 0x1FC00 +---------------+ + * | Bootloader | 4KB | Bootloader | 8KB + * 0x7FFF +---------------+ 0x1FFFF +---------------+ + * + * + * byte Teensy(ATMega32u4) byte Teensy++(AT90SUB128) + * 0x0000 +---------------+ 0x00000 +---------------+ + * | | | | + * | | | | + * | Application | | Application | + * | | | | + * = = = = + * | | 32KB-512B | | 128KB-1KB + * 0x7E00 +---------------+ 0x1FC00 +---------------+ + * | Bootloader | 512B | Bootloader | 1KB + * 0x7FFF +---------------+ 0x1FFFF +---------------+ */ #ifndef BOOTLOADER_SIZE #warning To use bootloader_jump() you need to define BOOTLOADER_SIZE in config.h. diff --git a/common/avr/suspend.c b/common/avr/suspend.c index 80243f02..af99f52b 100644 --- a/common/avr/suspend.c +++ b/common/avr/suspend.c @@ -85,6 +85,8 @@ void suspend_power_down(void) power_down(WDTO_15MS); } +__attribute__ ((weak)) void matrix_power_up(void) {} +__attribute__ ((weak)) void matrix_power_down(void) {} bool suspend_wakeup_condition(void) { matrix_power_up(); diff --git a/common/command.c b/common/command.c index fbaa9f2d..d59bb01b 100644 --- a/common/command.c +++ b/common/command.c @@ -112,30 +112,33 @@ bool command_console_extra(uint8_t code) ***********************************************************/ static void command_common_help(void) { - print("\n\n----- Command Help -----\n"); - print("c: enter console mode\n"); - print("d: toggle debug enable\n"); - print("x: toggle matrix debug\n"); - print("k: toggle keyboard debug\n"); - print("m: toggle mouse debug\n"); -#ifdef SLEEP_LED_ENABLE - print("z: toggle sleep LED test\n"); + print("\n\t- Magic -\n" + "d: debug\n" + "x: debug matrix\n" + "k: debug keyboard\n" + "m: debug mouse\n" + "v: version\n" + "s: status\n" + "c: console mode\n" + "0-4: layer0-4(F10-F4)\n" + "Paus: bootloader\n" + +#ifdef KEYBOARD_LOCK_ENABLE + "Caps: Lock\n" #endif - print("v: print device version & info\n"); - print("t: print timer count\n"); - print("s: print status\n"); - print("e: print eeprom config\n"); + +#ifdef BOOTMAGIC_ENABLE + "e: eeprom\n" +#endif + #ifdef NKRO_ENABLE - print("n: toggle NKRO\n"); + "n: NKRO\n" #endif - print("0/F10: switch to Layer0 \n"); - print("1/F1: switch to Layer1 \n"); - print("2/F2: switch to Layer2 \n"); - print("3/F3: switch to Layer3 \n"); - print("4/F4: switch to Layer4 \n"); - print("PScr: power down/remote wake-up\n"); - print("Caps: Lock Keyboard(Child Proof)\n"); - print("Paus: jump to bootloader\n"); + +#ifdef SLEEP_LED_ENABLE + "z: sleep LED test\n" +#endif + ); } #ifdef BOOTMAGIC_ENABLE @@ -191,6 +194,7 @@ static bool command_common(uint8_t code) print_eeconfig(); break; #endif +#ifdef KEYBOARD_LOCK_ENABLE case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); @@ -202,6 +206,7 @@ static bool command_common(uint8_t code) print("Unlocked.\n"); } break; +#endif case KC_H: case KC_SLASH: /* ? */ command_common_help(); @@ -212,58 +217,56 @@ static bool command_common(uint8_t code) debug_mouse = false; debug_enable = false; command_console_help(); - print("\nEnter Console Mode\n"); print("C> "); command_state = CONSOLE; break; case KC_PAUSE: clear_keyboard(); - print("\n\nJump to bootloader... "); + print("\n\nbootloader... "); _delay_ms(1000); bootloader_jump(); // not return - print("not supported.\n"); break; case KC_D: if (debug_enable) { - print("\nDEBUG: disabled.\n"); + print("\ndebug: off\n"); debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; } else { - print("\nDEBUG: enabled.\n"); + print("\ndebug: on\n"); debug_enable = true; } break; case KC_X: // debug matrix toggle debug_matrix = !debug_matrix; if (debug_matrix) { - print("\nDEBUG: matrix enabled.\n"); + print("\nmatrix: on\n"); debug_enable = true; } else { - print("\nDEBUG: matrix disabled.\n"); + print("\nmatrix: off\n"); } break; case KC_K: // debug keyboard toggle debug_keyboard = !debug_keyboard; if (debug_keyboard) { - print("\nDEBUG: keyboard enabled.\n"); + print("\nkeyboard: on\n"); debug_enable = true; } else { - print("\nDEBUG: keyboard disabled.\n"); + print("\nkeyboard: off\n"); } break; case KC_M: // debug mouse toggle debug_mouse = !debug_mouse; if (debug_mouse) { - print("\nDEBUG: mouse enabled.\n"); + print("\nmouse: on\n"); debug_enable = true; } else { - print("\nDEBUG: mouse disabled.\n"); + print("\nmouse: off\n"); } break; case KC_V: // print version & information - print("\n\n----- Version -----\n"); + print("\n\t- Version -\n"); print("DESC: " STR(DESCRIPTION) "\n"); print("VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") " "PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") " @@ -307,14 +310,16 @@ static bool command_common(uint8_t code) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); break; - case KC_T: // print timer - print_val_hex32(timer_count); - break; case KC_S: - print("\n\n----- Status -----\n"); + print("\n\t- Status -\n"); print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); +#ifdef NKRO_ENABLE + print_val_hex8(keyboard_nkro); +#endif + print_val_hex32(timer_count); + #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); print_val_hex8(UDIEN); @@ -334,39 +339,21 @@ static bool command_common(uint8_t code) clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) - print("NKRO: enabled\n"); + print("NKRO: on\n"); else - print("NKRO: disabled\n"); - break; -#endif -#ifdef EXTRAKEY_ENABLE - case KC_PSCREEN: - // TODO: Power key should take this feature? otherwise any key during suspend. -#ifdef PROTOCOL_PJRC - if (suspend && remote_wakeup) { - usb_remote_wakeup(); - } else { - host_system_send(SYSTEM_POWER_DOWN); - host_system_send(0); - _delay_ms(500); - } -#else - host_system_send(SYSTEM_POWER_DOWN); - _delay_ms(100); - host_system_send(0); - _delay_ms(500); -#endif + print("NKRO: off\n"); break; #endif case KC_ESC: case KC_GRV: case KC_0: + case KC_F10: switch_default_layer(0); break; case KC_1 ... KC_9: switch_default_layer((code - KC_1) + 1); break; - case KC_F1 ... KC_F12: + case KC_F1 ... KC_F9: switch_default_layer((code - KC_F1) + 1); break; default: @@ -382,11 +369,12 @@ static bool command_common(uint8_t code) ***********************************************************/ static void command_console_help(void) { - print("\n\n----- Console Help -----\n"); - print("ESC/q: quit\n"); + print("\n\t- Console -\n" + "ESC/q: quit\n" #ifdef MOUSEKEY_ENABLE - print("m: mousekey\n"); + "m: mousekey\n" #endif + ); } static bool command_console(uint8_t code) @@ -398,14 +386,12 @@ static bool command_console(uint8_t code) break; case KC_Q: case KC_ESC: - print("\nQuit Console Mode\n"); command_state = ONESHOT; return false; #ifdef MOUSEKEY_ENABLE case KC_M: mousekey_console_help(); - print("\nEnter Mousekey Console\n"); - print("M0>"); + print("M> "); command_state = MOUSEKEY; return true; #endif @@ -426,16 +412,17 @@ static uint8_t mousekey_param = 0; static void mousekey_param_print(void) { - print("\n\n----- Mousekey Parameters -----\n"); - print("1: mk_delay(*10ms): "); pdec(mk_delay); print("\n"); - print("2: mk_interval(ms): "); pdec(mk_interval); print("\n"); - print("3: mk_max_speed: "); pdec(mk_max_speed); print("\n"); - print("4: mk_time_to_max: "); pdec(mk_time_to_max); print("\n"); - print("5: mk_wheel_max_speed: "); pdec(mk_wheel_max_speed); print("\n"); - print("6: mk_wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n"); + print("\n\t- Values -\n"); + print("1: delay(*10ms): "); pdec(mk_delay); print("\n"); + print("2: interval(ms): "); pdec(mk_interval); print("\n"); + print("3: max_speed: "); pdec(mk_max_speed); print("\n"); + print("4: time_to_max: "); pdec(mk_time_to_max); print("\n"); + print("5: wheel_max_speed: "); pdec(mk_wheel_max_speed); print("\n"); + print("6: wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n"); } -#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n"); +//#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n"); +#define PRINT_SET_VAL(v) xprintf(#v " = %d\n", (v)) static void mousekey_param_inc(uint8_t param, uint8_t inc) { switch (param) { @@ -534,24 +521,25 @@ static void mousekey_param_dec(uint8_t param, uint8_t dec) static void mousekey_console_help(void) { - print("\n\n----- Mousekey Parameters Help -----\n"); - print("ESC/q: quit\n"); - print("1: select mk_delay(*10ms)\n"); - print("2: select mk_interval(ms)\n"); - print("3: select mk_max_speed\n"); - 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 parameters\n"); - print("d: set default values\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"); - print("See http://en.wikipedia.org/wiki/Mouse_keys\n"); + print("\n\t- Mousekey -\n" + "ESC/q: quit\n" + "1: delay(*10ms)\n" + "2: interval(ms)\n" + "3: max_speed\n" + "4: time_to_max\n" + "5: wheel_max_speed\n" + "6: wheel_time_to_max\n" + "\n" + "p: print values\n" + "d: set defaults\n" + "up: +1\n" + "down: -1\n" + "pgup: +10\n" + "pgdown: -10\n" + "\n" + "speed = delta * max_speed * (repeat / time_to_max)\n"); + xprintf("where delta: cursor=%d, wheel=%d\n" + "See http://en.wikipedia.org/wiki/Mouse_keys\n", MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA); } static bool mousekey_console(uint8_t code) @@ -563,11 +551,14 @@ static bool mousekey_console(uint8_t code) break; case KC_Q: case KC_ESC: - mousekey_param = 0; - print("\nQuit Mousekey Console\n"); - print("C> "); - command_state = CONSOLE; - return false; + if (mousekey_param) { + mousekey_param = 0; + } else { + print("C> "); + command_state = CONSOLE; + return false; + } + break; case KC_P: mousekey_param_print(); break; @@ -577,12 +568,7 @@ static bool mousekey_console(uint8_t code) case KC_4: case KC_5: case KC_6: - case KC_7: - case KC_8: - case KC_9: - case KC_0: mousekey_param = numkey2num(code); - print("selected parameter: "); pdec(mousekey_param); print("\n"); break; case KC_UP: mousekey_param_inc(mousekey_param, 1); @@ -603,13 +589,16 @@ static bool mousekey_console(uint8_t code) mk_time_to_max = MOUSEKEY_TIME_TO_MAX; mk_wheel_max_speed = MOUSEKEY_WHEEL_MAX_SPEED; mk_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; - print("set default values.\n"); + print("set default\n"); break; default: print("?"); return false; } - print("M"); pdec(mousekey_param); print("> "); + if (mousekey_param) + xprintf("M%d> ", mousekey_param); + else + print("M>" ); return true; } #endif @@ -637,8 +626,7 @@ static uint8_t numkey2num(uint8_t code) static void switch_default_layer(uint8_t layer) { - print("switch_default_layer: "); print_dec(biton32(default_layer_state)); - print(" to "); print_dec(layer); print("\n"); + xprintf("L%d\n", layer); default_layer_set(1UL<. #define KC_WSTP KC_WWW_STOP #define KC_WREF KC_WWW_REFRESH #define KC_WFAV KC_WWW_FAVORITES +/* Jump to bootloader */ +#define KC_BTLD KC_BOOTLOADER /* Transparent */ #define KC_TRANSPARENT 1 #define KC_TRNS KC_TRANSPARENT @@ -214,7 +216,7 @@ enum hid_keyboard_keypad_usage { KC_LBRACKET, KC_RBRACKET, /* 0x30 */ KC_BSLASH, /* \ (and |) */ - KC_NONUS_HASH, /* Non-US # and ~ */ + KC_NONUS_HASH, /* Non-US # and ~ (Typically near the Enter key) */ KC_SCOLON, /* ; (and :) */ KC_QUOTE, /* ' and " */ KC_GRAVE, /* Grave accent and tilde */ @@ -264,7 +266,7 @@ enum hid_keyboard_keypad_usage { KC_KP_9, KC_KP_0, KC_KP_DOT, - KC_NONUS_BSLASH, /* Non-US \ and | */ + KC_NONUS_BSLASH, /* Non-US \ and | (Typically near the Left-Shift key) */ KC_APPLICATION, KC_POWER, KC_KP_EQUAL, @@ -426,6 +428,9 @@ enum internal_special_keycodes { KC_MEDIA_FAST_FORWARD, KC_MEDIA_REWIND, /* 0xBC */ + /* Jump to bootloader */ + KC_BOOTLOADER = 0xBF, + /* Fn key */ KC_FN0 = 0xC0, KC_FN1, diff --git a/common/keymap.c b/common/keymap.c index 9f4fab52..d4892380 100644 --- a/common/keymap.c +++ b/common/keymap.c @@ -20,6 +20,7 @@ along with this program. If not, see . #include "action_layer.h" #include "action.h" #include "action_macro.h" +#include "wait.h" #include "debug.h" @@ -140,6 +141,11 @@ static action_t keycode_to_action(uint8_t keycode) case KC_TRNS: action.code = ACTION_TRANSPARENT; break; + case KC_BOOTLOADER: + clear_keyboard(); + wait_ms(50); + bootloader_jump(); // not return + break; default: action.code = ACTION_NO; break; diff --git a/common/led.h b/common/led.h index 402a247b..d5fc051b 100644 --- a/common/led.h +++ b/common/led.h @@ -28,6 +28,14 @@ along with this program. If not, see . #define USB_LED_KANA 4 +#ifdef __cplusplus +extern "C" { +#endif + void led_set(uint8_t usb_led); +#ifdef __cplusplus +} +#endif + #endif diff --git a/common/matrix.h b/common/matrix.h index 107ee726..ec6f8cd4 100644 --- a/common/matrix.h +++ b/common/matrix.h @@ -43,7 +43,9 @@ extern "C" { uint8_t matrix_rows(void); /* number of matrix columns */ uint8_t matrix_cols(void); -/* intialize matrix for scaning. should be called once. */ +/* should be called at early stage of startup before matrix_init.(optional) */ +void matrix_setup(void); +/* intialize matrix for scaning. */ void matrix_init(void); /* scan all key states on matrix */ uint8_t matrix_scan(void); diff --git a/ldscript_keymap_avr35.x b/ldscript_keymap_avr35.x new file mode 100644 index 00000000..6665020a --- /dev/null +++ b/ldscript_keymap_avr35.x @@ -0,0 +1,268 @@ +/* + * linker script for configurable keymap + * + * This adds keymap section which places keymap at fixed address and + * is based on binutils-avr ldscripts(/usr/lib/ldscripts/avr5.x). + */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:35) +MEMORY +{ + /* With keymap section + * + * Flash Map of ATMega32U4(32KB) + * +------------+ 0x0000 + * | .vectors | + * | .progmem | + * | .init0-9 | > text region + * | .text | + * | .fini9-0 | + * | | + * |------------| _etext + * | .data | + * | .bss | > data region + * | .noinit | + * | | + * |------------| 0x6800 + * | .keymap | > keymap region(2KB) + * |------------| 0x7000 + * | bootloader | 4KB + * +------------+ 0x7FFF + */ + text (rx) : ORIGIN = 0, LENGTH = 64K + keymap (rw!x) : ORIGIN = 0x6800, LENGTH = 2K + data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K + lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K + signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + *(.progmem*) + . = ALIGN(2); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text) + . = ALIGN(2); + *(.text.*) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .data : AT (ADDR (.text) + SIZEOF (.text)) + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + *(.rodata*) /* with -fdata-sections. */ + *(.gnu.linkonce.d*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data + .bss : AT (ADDR (.bss)) + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit : + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + /* keymap region is located at end of flash + * .fn_actions Fn actions definitions + * .keymaps Mapping layers + */ + .keymap : + { + PROVIDE(__keymap_start = .) ; + *(.keymap.fn_actions) /* 32*actions = 64bytes */ + . = ALIGN(0x40); + *(.keymap.keymaps) /* rest of .keymap section */ + *(.keymap*) + /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */ + } > keymap = 0x00 /* zero fill */ + .eeprom : + { + *(.eeprom*) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } +} diff --git a/ldscript_keymap_avr5.x b/ldscript_keymap_avr5.x index c09693e5..9b46e6c3 100644 --- a/ldscript_keymap_avr5.x +++ b/ldscript_keymap_avr5.x @@ -1,4 +1,4 @@ -/* +/* * linker script for configurable keymap * * This adds keymap section which places keymap at fixed address and @@ -8,7 +8,7 @@ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:5) MEMORY { - /* With keymap section + /* With keymap section * * Flash Map of ATMega32U4(32KB) * +------------+ 0x0000 @@ -212,7 +212,7 @@ SECTIONS { PROVIDE(__keymap_start = .) ; *(.keymap.fn_actions) /* 32*actions = 64bytes */ - . = ALIGN(0x40); + . = ALIGN(0x40); *(.keymap.keymaps) /* rest of .keymap section */ *(.keymap*) /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */ diff --git a/protocol/ibm4704.c b/protocol/ibm4704.c index a10a5e74..6a03cd44 100644 --- a/protocol/ibm4704.c +++ b/protocol/ibm4704.c @@ -21,9 +21,10 @@ uint8_t ibm4704_error = 0; void ibm4704_init(void) { + inhibit(); // keep keyboard from sending IBM4704_INT_INIT(); IBM4704_INT_ON(); - idle(); + idle(); // allow keyboard sending } /* @@ -104,22 +105,6 @@ uint8_t ibm4704_recv_response(void) return rbuf_dequeue(); } -/* -Keyboard to Host ----------------- -Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. - - ____ __ __ __ __ __ __ __ __ __ ________ -Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ - ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ -Data ____/ X____X____X____X____X____X____X____X____X____X________ - Start 0 1 2 3 4 5 6 7 P Stop - -Start bit: can be long as 300-350us. -Inhibit: Pull Data line down to inhibit keyboard to send. -Timing: Host reads bit while Clock is hi. -Stop bit: Keyboard pulls down Data line to lo after 9th clock. -*/ uint8_t ibm4704_recv(void) { if (rbuf_has_data()) { @@ -129,26 +114,35 @@ uint8_t ibm4704_recv(void) } } +/* +Keyboard to Host +---------------- +Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. + + ____ __ __ __ __ __ __ __ __ __ _______ +Clock \_____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ + ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ +Data ____/ X____X____X____X____X____X____X____X____X____X________ + Start 0 1 2 3 4 5 6 7 P Stop + +Start bit: can be long as 300-350us. +Inhibit: Pull Data line down to inhibit keyboard to send. +Timing: Host reads bit while Clock is hi.(rising edge) +Stop bit: Keyboard pulls down Data line to lo after 9th clock. +*/ ISR(IBM4704_INT_VECT) { static enum { - INIT, START, BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, PARITY, - } state = INIT; + BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, PARITY, STOP + } state = BIT0; // LSB first static uint8_t data = 0; // Odd parity static uint8_t parity = false; ibm4704_error = 0; - // return unless falling edge - if (clock_in()) { goto RETURN; } // why this occurs? - state++; switch (state) { - case START: - // Data:Low - WAIT(data_hi, 10, state); - break; case BIT0: case BIT1: case BIT2: @@ -169,6 +163,10 @@ ISR(IBM4704_INT_VECT) } if (!parity) goto ERROR; + break; + case STOP: + // Data:Low + WAIT(data_lo, 100, state); rbuf_enqueue(data); ibm4704_error = IBM4704_ERR_NONE; goto DONE; @@ -176,13 +174,14 @@ ISR(IBM4704_INT_VECT) default: goto ERROR; } + state++; goto RETURN; ERROR: ibm4704_error = state; while (ibm4704_send(0xFE)) _delay_ms(1); // resend xprintf("R:%02X%02X\n", state, data); DONE: - state = INIT; + state = BIT0; data = 0; parity = false; RETURN: diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index cdfc7bc6..345630aa 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -53,6 +53,7 @@ #include "lufa.h" uint8_t keyboard_idle = 0; +/* 0: Boot Protocol, 1: Report Protocol(default) */ uint8_t keyboard_protocol = 1; static uint8_t keyboard_led_stats = 0; @@ -179,7 +180,6 @@ void EVENT_USB_Device_Reset(void) void EVENT_USB_Device_Suspend() { print("[S]"); - matrix_power_down(); #ifdef SLEEP_LED_ENABLE sleep_led_enable(); #endif @@ -197,13 +197,30 @@ void EVENT_USB_Device_WakeUp() #endif } +#ifdef CONSOLE_ENABLE +static bool console_flush = false; +#define CONSOLE_FLUSH_SET(b) do { \ + uint8_t sreg = SREG; cli(); console_flush = b; SREG = sreg; \ +} while (0) + +// called every 1ms void EVENT_USB_Device_StartOfFrame(void) { + static uint8_t count; + if (++count % 50) return; + count = 0; + + if (!console_flush) return; Console_Task(); + console_flush = false; } +#endif /** Event handler for the USB_ConfigurationChanged event. * This is fired when the host sets the current configuration of the USB device after enumeration. + * + * ATMega32u2 supports dual bank(ping-pong mode) only on endpoint 3 and 4, + * it is safe to use singl bank for all endpoints. */ void EVENT_USB_Device_ConfigurationChanged(void) { @@ -228,7 +245,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) #ifdef CONSOLE_ENABLE /* Setup Console HID Report Endpoints */ ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE); + CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); #if 0 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); @@ -333,10 +350,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); - keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); -#ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; -#endif + keyboard_protocol = (USB_ControlRequest.wValue & 0xFF); clear_keyboard(); } } @@ -383,7 +397,7 @@ static void send_keyboard(report_keyboard_t *report) /* Select the Keyboard Report Endpoint */ #ifdef NKRO_ENABLE - if (keyboard_nkro) { + if (keyboard_protocol && keyboard_nkro) { /* Report protocol - NKRO */ Endpoint_SelectEndpoint(NKRO_IN_EPNUM); @@ -491,6 +505,10 @@ int8_t sendchar(uint8_t c) // Because sendchar() is called so many times, waiting each call causes big lag. static bool timeouted = false; + // prevents Console_Task() from running during sendchar() runs. + // or char will be lost. These two function is mutually exclusive. + CONSOLE_FLUSH_SET(false); + if (USB_DeviceState != DEVICE_STATE_Configured) return -1; @@ -524,8 +542,12 @@ int8_t sendchar(uint8_t c) Endpoint_Write_8(c); // send when bank is full - if (!Endpoint_IsReadWriteAllowed()) + if (!Endpoint_IsReadWriteAllowed()) { + while (!(Endpoint_IsINReady())); Endpoint_ClearIN(); + } else { + CONSOLE_FLUSH_SET(true); + } Endpoint_SelectEndpoint(ep); return 0; @@ -544,7 +566,7 @@ int8_t sendchar(uint8_t c) /******************************************************************************* * main ******************************************************************************/ -static void SetupHardware(void) +static void setup_mcu(void) { /* Disable watchdog if enabled by bootloader/fuses */ MCUSR &= ~(1 << WDRF); @@ -552,7 +574,10 @@ static void SetupHardware(void) /* Disable clock division */ clock_prescale_set(clock_div_1); +} +static void setup_usb(void) +{ // Leonardo needs. Without this USB device is not recognized. USB_Disable(); @@ -566,7 +591,9 @@ static void SetupHardware(void) int main(void) __attribute__ ((weak)); int main(void) { - SetupHardware(); + setup_mcu(); + keyboard_setup(); + setup_usb(); sei(); /* wait for USB startup & debug output */ diff --git a/protocol/next_kbd.c b/protocol/next_kbd.c index a5a07a7a..fa3034b3 100644 --- a/protocol/next_kbd.c +++ b/protocol/next_kbd.c @@ -59,10 +59,16 @@ static inline void query(void); static inline void reset(void); static inline uint32_t response(void); -#define out_hi_delay(intervals) do { out_hi(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define out_lo_delay(intervals) do { out_lo(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define query_delay(intervals) do { query(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define reset_delay(intervals) do { reset(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); +/* The keyboard sends signal with 50us pulse width on OUT line + * while it seems to miss the 50us pulse on In line. + * next_kbd_set_leds() often fails to sync LED status with 50us + * but it works well with 51us(+1us) on TMK converter(ATMeaga32u2) at least. + * TODO: test on Teensy and Pro Micro configuration + */ +#define out_hi_delay(intervals) do { out_hi(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define out_lo_delay(intervals) do { out_lo(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define query_delay(intervals) do { query(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); +#define reset_delay(intervals) do { reset(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0); void next_kbd_init(void) { @@ -79,6 +85,7 @@ void next_kbd_init(void) void next_kbd_set_leds(bool left, bool right) { + cli(); out_lo_delay(9); out_hi_delay(3); @@ -98,6 +105,7 @@ void next_kbd_set_leds(bool left, bool right) out_lo_delay(7); out_hi(); + sei(); } #define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<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]); + } + 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(); - - debug("KBDReport: "); - debug_hex(usb_hid_keyboard_report.mods); - debug(" --"); - for (uint8_t i = 0; i < 6; i++) { - debug(" "); - debug_hex(usb_hid_keyboard_report.keys[i]); - } - debug("\r\n"); } diff --git a/rules.mk b/rules.mk index a790f874..860fc1a9 100644 --- a/rules.mk +++ b/rules.mk @@ -124,6 +124,7 @@ CFLAGS += -O$(OPT) CFLAGS += -funsigned-char CFLAGS += -funsigned-bitfields CFLAGS += -ffunction-sections +CFLAGS += -fdata-sections CFLAGS += -fno-inline-small-functions CFLAGS += -fpack-struct CFLAGS += -fshort-enums From 88c053f78e24d9906c0f469ab1862a468044a376 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 5 Oct 2015 10:23:31 +0100 Subject: [PATCH 049/179] Move STM32 bootloader address config to separate .h file. --- keyboard/chibi_onekey/Makefile | 12 ++++-- keyboard/chibi_onekey/bootloader_defs.h | 7 ++++ tmk_core/common/chibios/bootloader.c | 6 +-- tmk_core/protocol/chibios/README.md | 12 +++--- .../tool/chibios/ch-bootloader-jump.patch | 37 ++++++++++--------- tmk_core/tool/chibios/chibios.mk | 8 ++++ 6 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 keyboard/chibi_onekey/bootloader_defs.h diff --git a/keyboard/chibi_onekey/Makefile b/keyboard/chibi_onekey/Makefile index 2d5ff8cd..2c5af44b 100644 --- a/keyboard/chibi_onekey/Makefile +++ b/keyboard/chibi_onekey/Makefile @@ -37,12 +37,16 @@ MCU_STARTUP = stm32f0xx BOARD = ST_STM32F072B_DISCOVERY # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 6 -# If you want to be able to jump to bootloader from firmware (on STM32 MCUs), -# set the correct BOOTLOADER_ADDRESS here. Otherwise leave commented out. +# If you want to be able to jump to bootloader from firmware on STM32 MCUs, +# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in +# ./bootloader_defs.h or in ./boards//bootloader_defs.h (if you have +# a custom board definition that you plan to reuse). +# If you're not setting it here, leave it commented out. # It is chip dependent, the correct number can be looked up here (page 175): # http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: /tmk_core/ -BOOTLOADER_ADDRESS = 0x1FFFC800 +# This also requires a patch to chibios: +# /tmk_core/tool/chibios/ch-bootloader-jump.patch +#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 # Build Options # comment out to disable the options. diff --git a/keyboard/chibi_onekey/bootloader_defs.h b/keyboard/chibi_onekey/bootloader_defs.h new file mode 100644 index 00000000..02c48c4e --- /dev/null +++ b/keyboard/chibi_onekey/bootloader_defs.h @@ -0,0 +1,7 @@ +/* Address for jumping to bootloader on STM32 chips. */ +/* It is chip dependent, the correct number can be looked up here (page 175): + * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf + * This also requires a patch to chibios: + * /tmk_core/tool/chibios/ch-bootloader-jump.patch + */ +#define STM32_BOOTLOADER_ADDRESS 0x1FFFC800 diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index 93f2e378..f36eced4 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -2,7 +2,7 @@ #include "ch.h" -#ifdef BOOTLOADER_ADDRESS +#ifdef STM32_BOOTLOADER_ADDRESS #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) extern uint32_t __ram0_end__; @@ -10,7 +10,7 @@ void bootloader_jump(void) { *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader NVIC_SystemReset(); } -#else /* BOOTLOADER_ADDRESS */ +#else /* STM32_BOOTLOADER_ADDRESS */ void bootloader_jump(void) {} -#endif /* BOOTLOADER_ADDRESS */ +#endif /* STM32_BOOTLOADER_ADDRESS */ diff --git a/tmk_core/protocol/chibios/README.md b/tmk_core/protocol/chibios/README.md index 06569c51..676a5f4f 100644 --- a/tmk_core/protocol/chibios/README.md +++ b/tmk_core/protocol/chibios/README.md @@ -2,13 +2,13 @@ ### Notes -- To use, unpack or symlink [ChibiOS] {currently 3.0.1} to `tmk_core/tool/chibios/chibios`. +- To use, unpack or symlink [ChibiOS] {currently 3.0.2} to `tmk_core/tool/chibios/chibios`. - For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. - There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task`, or 1.5sec wait for USB init, in `main.c`. There should be no such in `usb_main.c` (the main USB stack). Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. -- Jumping to bootloader works, but it is not entirely pleasant, since it is very much MCU dependent. The code is now geared towards STM32 chips and their built-in bootloaders. So, one needs to dig out the right address to jump to, and pass it to the compiler in the `Makefile`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. +- Jumping to bootloader works, but it is not entirely pleasant, since it is very much MCU dependent. The code is now geared towards STM32 chips and their built-in bootloaders. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. - Sleep LED works, but at the moment only on/off, i.e. no breathing. - The USB stack works pretty completely; however there are bits of other TMK stuff that are not done yet: @@ -28,7 +28,7 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ### Tried with -- ChibiOS 3.0.1 and ST F072RB DISCOVERY board. +- ChibiOS 3.0.1, 3.0.2 and ST F072RB DISCOVERY board. - Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. ## STM32-based keyboard design considerations @@ -36,13 +36,13 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - STM32F0x2 chips can do crystal-less USB, but they still need a 3.3V voltage regulator. - The BOOT0 pin should be tied to GND. - For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. -- For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). +- For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). However this is not strictly necessary, because instead of direct output of a timer to a pin (better of course), it is easy to define timer callbacks in ChibiOS that turn on/off an arbitrary pin. -## ChibiOS-supported MCUs (as of 3.0.1) +## ChibiOS-supported MCUs (as of 3.0.2) - Pretty much all STM32 chips. - There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. -- There is some support for K20 and KL25 Freescale chips (i.e. Teensy 3.0, mchck, FRDM-KL25Z, FRDM-K20D50M), but again, no USB stack yet. +- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.0, mchck, FRDM-KL25Z, FRDM-K20D50M), but again, no official USB stack yet. This is being worked on, see the `kinetis` branch of [my ChibiOS fork](https://github.com/flabbergast/ChibiOS). It supports also Teensy LC, 3.1 and FRDM-KL26Z. - I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. diff --git a/tmk_core/tool/chibios/ch-bootloader-jump.patch b/tmk_core/tool/chibios/ch-bootloader-jump.patch index 7f33e8ac..d8865762 100644 --- a/tmk_core/tool/chibios/ch-bootloader-jump.patch +++ b/tmk_core/tool/chibios/ch-bootloader-jump.patch @@ -1,8 +1,8 @@ diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s -index 38b4513..12a3f39 100644 +index 51a79bb..42d07bd 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s +++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s -@@ -98,6 +98,13 @@ +@@ -105,6 +105,13 @@ #define CRT0_CALL_DESTRUCTORS TRUE #endif @@ -16,12 +16,12 @@ index 38b4513..12a3f39 100644 /*===========================================================================*/ /* Code section. */ /*===========================================================================*/ -@@ -117,6 +124,17 @@ +@@ -124,6 +131,17 @@ .thumb_func .global Reset_Handler Reset_Handler: + -+#ifdef BOOTLOADER_ADDRESS ++#ifdef STM32_BOOTLOADER_ADDRESS + /* jump to bootloader code */ + ldr r0, =__ram0_end__-4 + ldr r1, =MAGIC_BOOTLOADER_NUMBER @@ -29,16 +29,16 @@ index 38b4513..12a3f39 100644 + str r0, [r0, #0] /* erase stored magic */ + cmp r2, r1 + beq Bootloader_Jump -+#endif /* BOOTLOADER_ADDRESS */ ++#endif /* STM32_BOOTLOADER_ADDRESS */ + /* Interrupts are globally masked initially.*/ cpsid i -@@ -230,6 +248,21 @@ endfiniloop: +@@ -242,6 +260,21 @@ endfiniloop: ldr r1, =__default_exit bx r1 -+#ifdef BOOTLOADER_ADDRESS ++#ifdef STM32_BOOTLOADER_ADDRESS +/* + * Jump-to-bootloader function. + */ @@ -46,21 +46,21 @@ index 38b4513..12a3f39 100644 + .align 2 + .thumb_func +Bootloader_Jump: -+ ldr r0, =BOOTLOADER_ADDRESS ++ ldr r0, =STM32_BOOTLOADER_ADDRESS + ldr r1, [r0, #0] + mov sp, r1 + ldr r0, [r0, #4] + bx r0 -+#endif /* BOOTLOADER_ADDRESS */ ++#endif /* STM32_BOOTLOADER_ADDRESS */ + #endif /** @} */ diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s -index fcfa4de..2d560da 100644 +index 4812a29..dca9f88 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s +++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s -@@ -133,6 +133,13 @@ +@@ -140,6 +140,13 @@ #define CRT0_CPACR_INIT 0x00F00000 #endif @@ -74,11 +74,12 @@ index fcfa4de..2d560da 100644 /*===========================================================================*/ /* Code section. */ /*===========================================================================*/ -@@ -157,6 +164,16 @@ +@@ -164,6 +171,17 @@ .thumb_func .global Reset_Handler Reset_Handler: -+#ifdef BOOTLOADER_ADDRESS ++ ++#ifdef STM32_BOOTLOADER_ADDRESS + /* jump to bootloader code */ + ldr r0, =__ram0_end__-4 + ldr r1, =MAGIC_BOOTLOADER_NUMBER @@ -86,16 +87,16 @@ index fcfa4de..2d560da 100644 + str r0, [r0, #0] /* erase stored magic */ + cmp r2, r1 + beq Bootloader_Jump -+#endif /* BOOTLOADER_ADDRESS */ ++#endif /* STM32_BOOTLOADER_ADDRESS */ + /* Interrupts are globally masked initially.*/ cpsid i -@@ -289,6 +306,21 @@ endfiniloop: +@@ -305,6 +323,21 @@ endfiniloop: /* Branching to the defined exit handler.*/ b __default_exit -+#ifdef BOOTLOADER_ADDRESS ++#ifdef STM32_BOOTLOADER_ADDRESS +/* + * Jump-to-bootloader function. + */ @@ -103,12 +104,12 @@ index fcfa4de..2d560da 100644 + .align 2 + .thumb_func +Bootloader_Jump: -+ ldr r0, =BOOTLOADER_ADDRESS ++ ldr r0, =STM32_BOOTLOADER_ADDRESS + ldr r1, [r0, #0] + mov sp, r1 + ldr r0, [r0, #4] + bx r0 -+#endif /* BOOTLOADER_ADDRESS */ ++#endif /* STM32_BOOTLOADER_ADDRESS */ + #endif /* !defined(__DOXYGEN__) */ diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index 6ba783e3..bc8c61b3 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -207,6 +207,14 @@ UDEFS = $(OPT_DEFS) # Define ASM defines here UADEFS = $(OPT_DEFS) +# bootloader definitions may be used in the startup .s file +ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","") + UADEFS += -include $(TARGET_DIR)/bootloader_defs.h + UDEFS += -include $(TARGET_DIR)/bootloader_defs.h +else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","") + UADEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h + UDEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h +endif # List all user directories here UINCDIR = From 19bb28d102b8c9b226aae38e2d8d9e53e574d6ec Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 10 Oct 2015 15:20:55 +0100 Subject: [PATCH 050/179] Add ARM Teensies bootloader code. --- tmk_core/common/chibios/bootloader.c | 23 ++++++++++++++++++++--- tmk_core/protocol/chibios/main.c | 8 ++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index f36eced4..cac52209 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -1,8 +1,13 @@ #include "bootloader.h" #include "ch.h" +#include "hal.h" #ifdef STM32_BOOTLOADER_ADDRESS +/* STM32 */ + +#if defined(STM32F0XX) +/* This code should be checked whether it runs correctly on platforms */ #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) extern uint32_t __ram0_end__; @@ -10,7 +15,19 @@ void bootloader_jump(void) { *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader NVIC_SystemReset(); } -#else /* STM32_BOOTLOADER_ADDRESS */ -void bootloader_jump(void) {} -#endif /* STM32_BOOTLOADER_ADDRESS */ +#else /* defined(STM32F0XX) */ +#error Check that the bootloader code works on your platform and add it to bootloader.c! +#endif /* defined(STM32F0XX) */ + +#elif defined(KL2x) || defined(K20x) /* STM32_BOOTLOADER_ADDRESS */ +/* Kinetis */ + +void bootloader_jump(void) { + chThdSleepMilliseconds(100); + __BKPT(0); +} + +#else /* neither STM32 nor KINETIS */ +void bootloader_jump(void) {} +#endif \ No newline at end of file diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 589675aa..b2526d14 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -69,9 +69,9 @@ host_driver_t chibios_driver = { // while(true) { // if(blinkLed) { // blinkLed = 0; -// palSetPad(GPIOC, GPIOC_LED_ORANGE); +// palSetPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); // chThdSleepMilliseconds(100); -// palClearPad(GPIOC, GPIOC_LED_ORANGE); +// palClearPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); // } // chThdSleepMilliseconds(100); // } @@ -86,10 +86,6 @@ int main(void) { halInit(); chSysInit(); - palSetPad(GPIOC, GPIOC_LED_BLUE); - chThdSleepMilliseconds(400); - palClearPad(GPIOC, GPIOC_LED_BLUE); - // TESTING // chThdCreateStatic(waBlinkerThread, sizeof(waBlinkerThread), NORMALPRIO, blinkerThread, NULL); From 3c08375616beed21b9882231795b2fd05ff4f3ad Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 06:52:26 +0100 Subject: [PATCH 051/179] Fix chibios/usb_main GET_REPORT handing. --- tmk_core/protocol/chibios/usb_main.c | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index f5f2dad7..2625c425 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -43,6 +43,12 @@ extern bool keyboard_nkro; #endif /* NKRO_ENABLE */ report_keyboard_t keyboard_report_sent = {{0}}; +#ifdef MOUSE_ENABLE +report_mouse_t mouse_report_blank = {0}; +#endif /* MOUSE_ENABLE */ +#ifdef EXTRAKEY_ENABLE +uint8_t extra_report_blank[3] = {0}; +#endif /* EXTRAKEY_ENABLE */ #ifdef CONSOLE_ENABLE /* The emission queue */ @@ -858,6 +864,43 @@ static bool usb_request_hook_cb(USBDriver *usbp) { return TRUE; break; +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + usbSetupTransfer(usbp, (uint8_t *)&mouse_report_blank, sizeof(mouse_report_blank), NULL); + return TRUE; + break; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + usbSetupTransfer(usbp, console_queue_buffer, CONSOLE_EPSIZE, NULL); + return TRUE; + break; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + if(usbp->setup[3] == 1) { /* MSB(wValue) [Report Type] == 1 [Input Report] */ + switch(usbp->setup[2]) { /* LSB(wValue) [Report ID] */ + case REPORT_ID_SYSTEM: + extra_report_blank[0] = REPORT_ID_SYSTEM; + usbSetupTransfer(usbp, (uint8_t *)extra_report_blank, sizeof(extra_report_blank), NULL); + return TRUE; + break; + case REPORT_ID_CONSUMER: + extra_report_blank[0] = REPORT_ID_CONSUMER; + usbSetupTransfer(usbp, (uint8_t *)extra_report_blank, sizeof(extra_report_blank), NULL); + return TRUE; + break; + default: + return FALSE; + } + } else { + return FALSE; + } + break; +#endif /* EXTRAKEY_ENABLE */ + default: usbSetupTransfer(usbp, NULL, 0, NULL); return TRUE; From cd7f30299a26dd32d19ef8ddd587eb8e1a5d4958 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 07:14:07 +0100 Subject: [PATCH 052/179] Add missing #include to keymap.c. --- tmk_core/common/keymap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index ece69fd5..d227add8 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -22,6 +22,7 @@ along with this program. If not, see . #include "action_macro.h" #include "wait.h" #include "debug.h" +#include "bootloader.h" static action_t keycode_to_action(uint8_t keycode); From d9652cdf992baaa066f75866689ac50d2b37cb9f Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 09:40:06 +0100 Subject: [PATCH 053/179] Make bootmagic.c code portable (_delay_ms -> wait_ms). --- tmk_core/common/bootmagic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index d6684b2d..698693cb 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -1,6 +1,6 @@ #include #include -#include +#include "wait.h" #include "matrix.h" #include "bootloader.h" #include "debug.h" @@ -21,7 +21,7 @@ void bootmagic(void) /* do scans in case of bounce */ print("bootmagic scan: ... "); uint8_t scan = 100; - while (scan--) { matrix_scan(); _delay_ms(10); } + while (scan--) { matrix_scan(); wait_ms(10); } print("done.\n"); /* bootmagic skip */ From cb663eeca6f5f2924974b4c6798a64489a5cdacc Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 09:46:48 +0100 Subject: [PATCH 054/179] Move declaration of keymap_config. Should really not declare variables in .h files - since it's included in different .c files, a proper linker then complains that the same variable is declared more than once (once for each .c file that the offending .h is included in). --- tmk_core/common/bootmagic.c | 1 + tmk_core/common/keymap.c | 3 +++ tmk_core/common/keymap.h | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 698693cb..08241f7d 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -10,6 +10,7 @@ #include "eeconfig.h" #include "bootmagic.h" +keymap_config_t keymap_config; void bootmagic(void) { diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index d227add8..876f5c82 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -24,6 +24,9 @@ along with this program. If not, see . #include "debug.h" #include "bootloader.h" +#ifdef BOOTMAGIC_ENABLE +extern keymap_config_t keymap_config; +#endif static action_t keycode_to_action(uint8_t keycode); diff --git a/tmk_core/common/keymap.h b/tmk_core/common/keymap.h index e1a6f992..659ea357 100644 --- a/tmk_core/common/keymap.h +++ b/tmk_core/common/keymap.h @@ -38,7 +38,6 @@ typedef union { bool nkro:1; }; } keymap_config_t; -keymap_config_t keymap_config; #endif From 2ac5cd730bf1578e9d593f83926a49b9053c4919 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 09:47:27 +0100 Subject: [PATCH 055/179] Add eeprom support for chibios/kinetis. --- tmk_core/common/chibios/eeconfig.c | 551 +++++++++++++++++++++++++++++ tmk_core/tool/chibios/common.mk | 1 - 2 files changed, 551 insertions(+), 1 deletion(-) create mode 100644 tmk_core/common/chibios/eeconfig.c diff --git a/tmk_core/common/chibios/eeconfig.c b/tmk_core/common/chibios/eeconfig.c new file mode 100644 index 00000000..f9e2718a --- /dev/null +++ b/tmk_core/common/chibios/eeconfig.c @@ -0,0 +1,551 @@ +#include "ch.h" +#include "hal.h" + +#include "eeconfig.h" + +/*************************************/ +/* Hardware backend */ +/* */ +/* Code from PJRC/Teensyduino */ +/*************************************/ + +/* Teensyduino Core Library + * http://www.pjrc.com/teensy/ + * Copyright (c) 2013 PJRC.COM, LLC. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * 1. The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 2. If the Software is incorporated into a build system that allows + * selection among a list of target devices, then similar target + * devices manufactured by PJRC.COM must be included in the list of + * target devices and selectable in the same manner. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + +#if defined(K20x) /* chip selection */ +/* Teensy 3.0, 3.1, 3.2; mchck; infinity keyboard */ + +// The EEPROM is really RAM with a hardware-based backup system to +// flash memory. Selecting a smaller size EEPROM allows more wear +// leveling, for higher write endurance. If you edit this file, +// set this to the smallest size your application can use. Also, +// due to Freescale's implementation, writing 16 or 32 bit words +// (aligned to 2 or 4 byte boundaries) has twice the endurance +// compared to writing 8 bit bytes. +// +#define EEPROM_SIZE 32 + +// Writing unaligned 16 or 32 bit data is handled automatically when +// this is defined, but at a cost of extra code size. Without this, +// any unaligned write will cause a hard fault exception! If you're +// absolutely sure all 16 and 32 bit writes will be aligned, you can +// remove the extra unnecessary code. +// +#define HANDLE_UNALIGNED_WRITES + +// Minimum EEPROM Endurance +// ------------------------ +#if (EEPROM_SIZE == 2048) // 35000 writes/byte or 70000 writes/word + #define EEESIZE 0x33 +#elif (EEPROM_SIZE == 1024) // 75000 writes/byte or 150000 writes/word + #define EEESIZE 0x34 +#elif (EEPROM_SIZE == 512) // 155000 writes/byte or 310000 writes/word + #define EEESIZE 0x35 +#elif (EEPROM_SIZE == 256) // 315000 writes/byte or 630000 writes/word + #define EEESIZE 0x36 +#elif (EEPROM_SIZE == 128) // 635000 writes/byte or 1270000 writes/word + #define EEESIZE 0x37 +#elif (EEPROM_SIZE == 64) // 1275000 writes/byte or 2550000 writes/word + #define EEESIZE 0x38 +#elif (EEPROM_SIZE == 32) // 2555000 writes/byte or 5110000 writes/word + #define EEESIZE 0x39 +#endif + +void eeprom_initialize(void) +{ + uint32_t count=0; + uint16_t do_flash_cmd[] = { + 0xf06f, 0x037f, 0x7003, 0x7803, + 0xf013, 0x0f80, 0xd0fb, 0x4770}; + uint8_t status; + + if (FTFL->FCNFG & FTFL_FCNFG_RAMRDY) { + // FlexRAM is configured as traditional RAM + // We need to reconfigure for EEPROM usage + FTFL->FCCOB0 = 0x80; // PGMPART = Program Partition Command + FTFL->FCCOB4 = EEESIZE; // EEPROM Size + FTFL->FCCOB5 = 0x03; // 0K for Dataflash, 32K for EEPROM backup + __disable_irq(); + // do_flash_cmd() must execute from RAM. Luckily the C syntax is simple... + (*((void (*)(volatile uint8_t *))((uint32_t)do_flash_cmd | 1)))(&(FTFL->FSTAT)); + __enable_irq(); + status = FTFL->FSTAT; + if (status & (FTFL_FSTAT_RDCOLERR|FTFL_FSTAT_ACCERR|FTFL_FSTAT_FPVIOL)) { + FTFL->FSTAT = (status & (FTFL_FSTAT_RDCOLERR|FTFL_FSTAT_ACCERR|FTFL_FSTAT_FPVIOL)); + return; // error + } + } + // wait for eeprom to become ready (is this really necessary?) + while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { + if (++count > 20000) break; + } +} + +#define FlexRAM ((uint8_t *)0x14000000) + +uint8_t eeprom_read_byte(const uint8_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return FlexRAM[offset]; +} + +uint16_t eeprom_read_word(const uint16_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE-1) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return *(uint16_t *)(&FlexRAM[offset]); +} + +uint32_t eeprom_read_dword(const uint32_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE-3) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return *(uint32_t *)(&FlexRAM[offset]); +} + +void eeprom_read_block(void *buf, const void *addr, uint32_t len) +{ + uint32_t offset = (uint32_t)addr; + uint8_t *dest = (uint8_t *)buf; + uint32_t end = offset + len; + + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (end > EEPROM_SIZE) end = EEPROM_SIZE; + while (offset < end) { + *dest++ = FlexRAM[offset++]; + } +} + +int eeprom_is_ready(void) +{ + return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; +} + +static void flexram_wait(void) +{ + while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { + // TODO: timeout + } +} + +void eeprom_write_byte(uint8_t *addr, uint8_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } +} + +void eeprom_write_word(uint16_t *addr, uint16_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE-1) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); +#ifdef HANDLE_UNALIGNED_WRITES + if ((offset & 1) == 0) { +#endif + if (*(uint16_t *)(&FlexRAM[offset]) != value) { + *(uint16_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } +#ifdef HANDLE_UNALIGNED_WRITES + } else { + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } + if (FlexRAM[offset + 1] != (value >> 8)) { + FlexRAM[offset + 1] = value >> 8; + flexram_wait(); + } + } +#endif +} + +void eeprom_write_dword(uint32_t *addr, uint32_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE-3) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); +#ifdef HANDLE_UNALIGNED_WRITES + switch (offset & 3) { + case 0: +#endif + if (*(uint32_t *)(&FlexRAM[offset]) != value) { + *(uint32_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } + return; +#ifdef HANDLE_UNALIGNED_WRITES + case 2: + if (*(uint16_t *)(&FlexRAM[offset]) != value) { + *(uint16_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } + if (*(uint16_t *)(&FlexRAM[offset + 2]) != (value >> 16)) { + *(uint16_t *)(&FlexRAM[offset + 2]) = value >> 16; + flexram_wait(); + } + return; + default: + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } + if (*(uint16_t *)(&FlexRAM[offset + 1]) != (value >> 8)) { + *(uint16_t *)(&FlexRAM[offset + 1]) = value >> 8; + flexram_wait(); + } + if (FlexRAM[offset + 3] != (value >> 24)) { + FlexRAM[offset + 3] = value >> 24; + flexram_wait(); + } + } +#endif +} + +void eeprom_write_block(const void *buf, void *addr, uint32_t len) +{ + uint32_t offset = (uint32_t)addr; + const uint8_t *src = (const uint8_t *)buf; + + if (offset >= EEPROM_SIZE) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (len >= EEPROM_SIZE) len = EEPROM_SIZE; + if (offset + len >= EEPROM_SIZE) len = EEPROM_SIZE - offset; + while (len > 0) { + uint32_t lsb = offset & 3; + if (lsb == 0 && len >= 4) { + // write aligned 32 bits + uint32_t val32; + val32 = *src++; + val32 |= (*src++ << 8); + val32 |= (*src++ << 16); + val32 |= (*src++ << 24); + if (*(uint32_t *)(&FlexRAM[offset]) != val32) { + *(uint32_t *)(&FlexRAM[offset]) = val32; + flexram_wait(); + } + offset += 4; + len -= 4; + } else if ((lsb == 0 || lsb == 2) && len >= 2) { + // write aligned 16 bits + uint16_t val16; + val16 = *src++; + val16 |= (*src++ << 8); + if (*(uint16_t *)(&FlexRAM[offset]) != val16) { + *(uint16_t *)(&FlexRAM[offset]) = val16; + flexram_wait(); + } + offset += 2; + len -= 2; + } else { + // write 8 bits + uint8_t val8 = *src++; + if (FlexRAM[offset] != val8) { + FlexRAM[offset] = val8; + flexram_wait(); + } + offset++; + len--; + } + } +} + +/* +void do_flash_cmd(volatile uint8_t *fstat) +{ + *fstat = 0x80; + while ((*fstat & 0x80) == 0) ; // wait +} +00000000 : + 0: f06f 037f mvn.w r3, #127 ; 0x7f + 4: 7003 strb r3, [r0, #0] + 6: 7803 ldrb r3, [r0, #0] + 8: f013 0f80 tst.w r3, #128 ; 0x80 + c: d0fb beq.n 6 + e: 4770 bx lr +*/ + +#elif defined(KL2x) /* chip selection */ +/* Teensy LC (emulated) */ + +#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) + +extern uint32_t __eeprom_workarea_start__; +extern uint32_t __eeprom_workarea_end__; + +#define EEPROM_SIZE 128 + +static uint32_t flashend = 0; + +void eeprom_initialize(void) +{ + const uint16_t *p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); + + do { + if (*p++ == 0xFFFF) { + flashend = (uint32_t)(p - 2); + return; + } + } while (p < (uint16_t *)SYMVAL(__eeprom_workarea_end__)); + flashend = (uint32_t)((uint16_t *)SYMVAL(__eeprom_workarea_end__) - 1); +} + +uint8_t eeprom_read_byte(const uint8_t *addr) +{ + uint32_t offset = (uint32_t)addr; + const uint16_t *p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); + const uint16_t *end = (const uint16_t *)((uint32_t)flashend); + uint16_t val; + uint8_t data=0xFF; + + if (!end) { + eeprom_initialize(); + end = (const uint16_t *)((uint32_t)flashend); + } + if (offset < EEPROM_SIZE) { + while (p <= end) { + val = *p++; + if ((val & 255) == offset) data = val >> 8; + } + } + return data; +} + +static void flash_write(const uint16_t *code, uint32_t addr, uint32_t data) +{ + // with great power comes great responsibility.... + uint32_t stat; + *(uint32_t *)&(FTFA->FCCOB3) = 0x06000000 | (addr & 0x00FFFFFC); + *(uint32_t *)&(FTFA->FCCOB7) = data; + __disable_irq(); + (*((void (*)(volatile uint8_t *))((uint32_t)code | 1)))(&(FTFA->FSTAT)); + __enable_irq(); + stat = FTFA->FSTAT & (FTFA_FSTAT_RDCOLERR|FTFA_FSTAT_ACCERR|FTFA_FSTAT_FPVIOL); + if (stat) { + FTFA->FSTAT = stat; + } + MCM->PLACR |= MCM_PLACR_CFCC; +} + +void eeprom_write_byte(uint8_t *addr, uint8_t data) +{ + uint32_t offset = (uint32_t)addr; + const uint16_t *p, *end = (const uint16_t *)((uint32_t)flashend); + uint32_t i, val, flashaddr; + uint16_t do_flash_cmd[] = { + 0x2380, 0x7003, 0x7803, 0xb25b, 0x2b00, 0xdafb, 0x4770}; + uint8_t buf[EEPROM_SIZE]; + + if (offset >= EEPROM_SIZE) return; + if (!end) { + eeprom_initialize(); + end = (const uint16_t *)((uint32_t)flashend); + } + if (++end < (uint16_t *)SYMVAL(__eeprom_workarea_end__)) { + val = (data << 8) | offset; + flashaddr = (uint32_t)end; + flashend = flashaddr; + if ((flashaddr & 2) == 0) { + val |= 0xFFFF0000; + } else { + val <<= 16; + val |= 0x0000FFFF; + } + flash_write(do_flash_cmd, flashaddr, val); + } else { + for (i=0; i < EEPROM_SIZE; i++) { + buf[i] = 0xFF; + } + for (p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); p < (uint16_t *)SYMVAL(__eeprom_workarea_end__); p++) { + val = *p; + if ((val & 255) < EEPROM_SIZE) { + buf[val & 255] = val >> 8; + } + } + buf[offset] = data; + for (flashaddr=(uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_start__); flashaddr < (uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_end__); flashaddr += 1024) { + *(uint32_t *)&(FTFA->FCCOB3) = 0x09000000 | flashaddr; + __disable_irq(); + (*((void (*)(volatile uint8_t *))((uint32_t)do_flash_cmd | 1)))(&(FTFA->FSTAT)); + __enable_irq(); + val = FTFA->FSTAT & (FTFA_FSTAT_RDCOLERR|FTFA_FSTAT_ACCERR|FTFA_FSTAT_FPVIOL);; + if (val) FTFA->FSTAT = val; + MCM->PLACR |= MCM_PLACR_CFCC; + } + flashaddr=(uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_start__); + for (i=0; i < EEPROM_SIZE; i++) { + if (buf[i] == 0xFF) continue; + if ((flashaddr & 2) == 0) { + val = (buf[i] << 8) | i; + } else { + val = val | (buf[i] << 24) | (i << 16); + flash_write(do_flash_cmd, flashaddr, val); + } + flashaddr += 2; + } + flashend = flashaddr; + if ((flashaddr & 2)) { + val |= 0xFFFF0000; + flash_write(do_flash_cmd, flashaddr, val); + } + } +} + +/* +void do_flash_cmd(volatile uint8_t *fstat) +{ + *fstat = 0x80; + while ((*fstat & 0x80) == 0) ; // wait +} +00000000 : + 0: 2380 movs r3, #128 ; 0x80 + 2: 7003 strb r3, [r0, #0] + 4: 7803 ldrb r3, [r0, #0] + 6: b25b sxtb r3, r3 + 8: 2b00 cmp r3, #0 + a: dafb bge.n 4 + c: 4770 bx lr +*/ + + +uint16_t eeprom_read_word(const uint16_t *addr) +{ + const uint8_t *p = (const uint8_t *)addr; + return eeprom_read_byte(p) | (eeprom_read_byte(p+1) << 8); +} + +uint32_t eeprom_read_dword(const uint32_t *addr) +{ + const uint8_t *p = (const uint8_t *)addr; + return eeprom_read_byte(p) | (eeprom_read_byte(p+1) << 8) + | (eeprom_read_byte(p+2) << 16) | (eeprom_read_byte(p+3) << 24); +} + +void eeprom_read_block(void *buf, const void *addr, uint32_t len) +{ + const uint8_t *p = (const uint8_t *)addr; + uint8_t *dest = (uint8_t *)buf; + while (len--) { + *dest++ = eeprom_read_byte(p++); + } +} + +int eeprom_is_ready(void) +{ + return 1; +} + +void eeprom_write_word(uint16_t *addr, uint16_t value) +{ + uint8_t *p = (uint8_t *)addr; + eeprom_write_byte(p++, value); + eeprom_write_byte(p, value >> 8); +} + +void eeprom_write_dword(uint32_t *addr, uint32_t value) +{ + uint8_t *p = (uint8_t *)addr; + eeprom_write_byte(p++, value); + eeprom_write_byte(p++, value >> 8); + eeprom_write_byte(p++, value >> 16); + eeprom_write_byte(p, value >> 24); +} + +void eeprom_write_block(const void *buf, void *addr, uint32_t len) +{ + uint8_t *p = (uint8_t *)addr; + const uint8_t *src = (const uint8_t *)buf; + while (len--) { + eeprom_write_byte(p++, *src++); + } +} + +#else +#error EEPROM support not implemented for your chip +#endif /* chip selection */ + + +/*****************/ +/* TMK functions */ +/*****************/ + +void eeconfig_init(void) +{ + eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); + eeprom_write_byte(EECONFIG_DEBUG, 0); + eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0); + eeprom_write_byte(EECONFIG_KEYMAP, 0); + eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0); +#ifdef BACKLIGHT_ENABLE + eeprom_write_byte(EECONFIG_BACKLIGHT, 0); +#endif +} + +void eeconfig_enable(void) +{ + eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); +} + +void eeconfig_disable(void) +{ + eeprom_write_word(EECONFIG_MAGIC, 0xFFFF); +} + +bool eeconfig_is_enabled(void) +{ + return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); +} + +uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } +void eeconfig_write_debug(uint8_t val) { eeprom_write_byte(EECONFIG_DEBUG, val); } + +uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } +void eeconfig_write_default_layer(uint8_t val) { eeprom_write_byte(EECONFIG_DEFAULT_LAYER, val); } + +uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } +void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val); } + +#ifdef BACKLIGHT_ENABLE +uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } +void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); } +#endif diff --git a/tmk_core/tool/chibios/common.mk b/tmk_core/tool/chibios/common.mk index f0d39f31..883054a4 100644 --- a/tmk_core/tool/chibios/common.mk +++ b/tmk_core/tool/chibios/common.mk @@ -18,7 +18,6 @@ SRC += $(COMMON_DIR)/host.c \ # Option modules ifdef BOOTMAGIC_ENABLE - $(error Bootmagic Not Supported) SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/chibios/eeconfig.c OPT_DEFS += -DBOOTMAGIC_ENABLE From 9178ea2d73511786182317fe3e7b8ffc02cc3dc4 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 10:20:16 +0100 Subject: [PATCH 056/179] Rename chibios example keyboard. --- .../{chibi_onekey => stm32_onekey}/Makefile | 1 + .../bootloader_defs.h | 0 .../{chibi_onekey => stm32_onekey}/chconf.h | 0 .../{chibi_onekey => stm32_onekey}/config.h | 0 .../{chibi_onekey => stm32_onekey}/halconf.h | 0 .../keymap_plain.c | 0 keyboard/{chibi_onekey => stm32_onekey}/led.c | 0 .../{chibi_onekey => stm32_onekey}/matrix.c | 0 .../{chibi_onekey => stm32_onekey}/mcuconf.h | 0 tmk_core/protocol/chibios/README.md | 22 +++++++++---------- tmk_core/tool/chibios/chibios.mk | 2 +- 11 files changed, 13 insertions(+), 12 deletions(-) rename keyboard/{chibi_onekey => stm32_onekey}/Makefile (97%) rename keyboard/{chibi_onekey => stm32_onekey}/bootloader_defs.h (100%) rename keyboard/{chibi_onekey => stm32_onekey}/chconf.h (100%) rename keyboard/{chibi_onekey => stm32_onekey}/config.h (100%) rename keyboard/{chibi_onekey => stm32_onekey}/halconf.h (100%) rename keyboard/{chibi_onekey => stm32_onekey}/keymap_plain.c (100%) rename keyboard/{chibi_onekey => stm32_onekey}/led.c (100%) rename keyboard/{chibi_onekey => stm32_onekey}/matrix.c (100%) rename keyboard/{chibi_onekey => stm32_onekey}/mcuconf.h (100%) diff --git a/keyboard/chibi_onekey/Makefile b/keyboard/stm32_onekey/Makefile similarity index 97% rename from keyboard/chibi_onekey/Makefile rename to keyboard/stm32_onekey/Makefile index 2c5af44b..d84bfa4b 100644 --- a/keyboard/chibi_onekey/Makefile +++ b/keyboard/stm32_onekey/Makefile @@ -52,6 +52,7 @@ ARMV = 6 # comment out to disable the options. # #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## BOOTMAGIC is not supported on STM32 chips yet. MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug diff --git a/keyboard/chibi_onekey/bootloader_defs.h b/keyboard/stm32_onekey/bootloader_defs.h similarity index 100% rename from keyboard/chibi_onekey/bootloader_defs.h rename to keyboard/stm32_onekey/bootloader_defs.h diff --git a/keyboard/chibi_onekey/chconf.h b/keyboard/stm32_onekey/chconf.h similarity index 100% rename from keyboard/chibi_onekey/chconf.h rename to keyboard/stm32_onekey/chconf.h diff --git a/keyboard/chibi_onekey/config.h b/keyboard/stm32_onekey/config.h similarity index 100% rename from keyboard/chibi_onekey/config.h rename to keyboard/stm32_onekey/config.h diff --git a/keyboard/chibi_onekey/halconf.h b/keyboard/stm32_onekey/halconf.h similarity index 100% rename from keyboard/chibi_onekey/halconf.h rename to keyboard/stm32_onekey/halconf.h diff --git a/keyboard/chibi_onekey/keymap_plain.c b/keyboard/stm32_onekey/keymap_plain.c similarity index 100% rename from keyboard/chibi_onekey/keymap_plain.c rename to keyboard/stm32_onekey/keymap_plain.c diff --git a/keyboard/chibi_onekey/led.c b/keyboard/stm32_onekey/led.c similarity index 100% rename from keyboard/chibi_onekey/led.c rename to keyboard/stm32_onekey/led.c diff --git a/keyboard/chibi_onekey/matrix.c b/keyboard/stm32_onekey/matrix.c similarity index 100% rename from keyboard/chibi_onekey/matrix.c rename to keyboard/stm32_onekey/matrix.c diff --git a/keyboard/chibi_onekey/mcuconf.h b/keyboard/stm32_onekey/mcuconf.h similarity index 100% rename from keyboard/chibi_onekey/mcuconf.h rename to keyboard/stm32_onekey/mcuconf.h diff --git a/tmk_core/protocol/chibios/README.md b/tmk_core/protocol/chibios/README.md index 676a5f4f..9796f8c7 100644 --- a/tmk_core/protocol/chibios/README.md +++ b/tmk_core/protocol/chibios/README.md @@ -2,15 +2,14 @@ ### Notes -- To use, unpack or symlink [ChibiOS] {currently 3.0.2} to `tmk_core/tool/chibios/chibios`. +- To use, unpack or symlink [ChibiOS] {currently 3.0.2} to `tmk_core/tool/chibios/chibios`. For Kinetis support, you'll need a fork which implements the USB driver, e.g. [this one](https://github.com/flabbergast/ChibiOS/tree/kinetis). - For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. - There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task`, or 1.5sec wait for USB init, in `main.c`. There should be no such in `usb_main.c` (the main USB stack). Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. -- Jumping to bootloader works, but it is not entirely pleasant, since it is very much MCU dependent. The code is now geared towards STM32 chips and their built-in bootloaders. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. +- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. - Sleep LED works, but at the moment only on/off, i.e. no breathing. -- The USB stack works pretty completely; however there are bits of other TMK stuff that are not done yet: ### Immediate todo @@ -24,12 +23,20 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ### Missing / not working (TMK vs ChibiOS bits) -- eeprom / bootmagic (will be chip dependent; eeprom needs to be emulated in flash, which means less writes; wear-levelling?) There is a semi-official ST "driver" for eeprom, with wear-levelling, but I think it consumes a lot of RAM (like 2 pages, i.e. 1kB or so). +- eeprom / bootmagic for STM32 (will be chip dependent; eeprom needs to be emulated in flash, which means less writes; wear-levelling?) There is a semi-official ST "driver" for eeprom, with wear-levelling, but I think it consumes a lot of RAM (like 2 pages, i.e. 1kB or so). ### Tried with - ChibiOS 3.0.1, 3.0.2 and ST F072RB DISCOVERY board. - Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. +- ChibiOS with Kinetis patches and Teensy LC and 3.0. + +## ChibiOS-supported MCUs (as of 3.0.2) + +- Pretty much all STM32 chips. +- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), but again, no official USB stack yet. However the `kinetis` branch of [my ChibiOS fork](https://github.com/flabbergast/ChibiOS). With this fork, TMK work normally on all the ARM Teensies. +- There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. +- I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. ## STM32-based keyboard design considerations @@ -38,13 +45,6 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. - For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). However this is not strictly necessary, because instead of direct output of a timer to a pin (better of course), it is easy to define timer callbacks in ChibiOS that turn on/off an arbitrary pin. -## ChibiOS-supported MCUs (as of 3.0.2) - -- Pretty much all STM32 chips. -- There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. -- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.0, mchck, FRDM-KL25Z, FRDM-K20D50M), but again, no official USB stack yet. This is being worked on, see the `kinetis` branch of [my ChibiOS fork](https://github.com/flabbergast/ChibiOS). It supports also Teensy LC, 3.1 and FRDM-KL26Z. -- I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. - [ChibiOS]: http://chibios.org diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index bc8c61b3..d1738c13 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -DPROTOCOL_CHIBIOS + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -DPROTOCOL_CHIBIOS endif # C specific options here (added to USE_OPT). From 2b4066bb93ffda75dde58342a21c28878b6f50e6 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 10:38:47 +0100 Subject: [PATCH 057/179] Move chibios/cortex selection to local Makefiles. --- keyboard/stm32_onekey/Makefile | 3 +++ tmk_core/tool/chibios/chibios.mk | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/keyboard/stm32_onekey/Makefile b/keyboard/stm32_onekey/Makefile index d84bfa4b..3868ee3d 100644 --- a/keyboard/stm32_onekey/Makefile +++ b/keyboard/stm32_onekey/Makefile @@ -35,6 +35,9 @@ MCU_STARTUP = stm32f0xx # it should exist either in /os/hal/boards/ # or /boards BOARD = ST_STM32F072B_DISCOVERY +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m0 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 6 # If you want to be able to jump to bootloader from firmware on STM32 MCUs, diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index d1738c13..0f6af53d 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -162,8 +162,6 @@ INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ # Compiler settings # -MCU = cortex-m0 - #TRGT = arm-elf- TRGT = arm-none-eabi- CC = $(TRGT)gcc From c61210cfff21f88c25ad102dcd3afe58ce251c96 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 12 Oct 2015 10:39:24 +0100 Subject: [PATCH 058/179] Add Teensy LC onekey example. --- keyboard/teensy_lc_onekey/Makefile | 77 ++++ keyboard/teensy_lc_onekey/Makefile.3.0 | 77 ++++ keyboard/teensy_lc_onekey/chconf.h | 499 ++++++++++++++++++++++ keyboard/teensy_lc_onekey/config.h | 74 ++++ keyboard/teensy_lc_onekey/halconf.h | 168 ++++++++ keyboard/teensy_lc_onekey/instructions.md | 62 +++ keyboard/teensy_lc_onekey/keymap_plain.c | 44 ++ keyboard/teensy_lc_onekey/ld/MKL26Z64.ld | 161 +++++++ keyboard/teensy_lc_onekey/led.c | 32 ++ keyboard/teensy_lc_onekey/matrix.c | 163 +++++++ keyboard/teensy_lc_onekey/mcuconf.h | 55 +++ 11 files changed, 1412 insertions(+) create mode 100644 keyboard/teensy_lc_onekey/Makefile create mode 100644 keyboard/teensy_lc_onekey/Makefile.3.0 create mode 100644 keyboard/teensy_lc_onekey/chconf.h create mode 100644 keyboard/teensy_lc_onekey/config.h create mode 100644 keyboard/teensy_lc_onekey/halconf.h create mode 100644 keyboard/teensy_lc_onekey/instructions.md create mode 100644 keyboard/teensy_lc_onekey/keymap_plain.c create mode 100644 keyboard/teensy_lc_onekey/ld/MKL26Z64.ld create mode 100644 keyboard/teensy_lc_onekey/led.c create mode 100644 keyboard/teensy_lc_onekey/matrix.c create mode 100644 keyboard/teensy_lc_onekey/mcuconf.h diff --git a/keyboard/teensy_lc_onekey/Makefile b/keyboard/teensy_lc_onekey/Makefile new file mode 100644 index 00000000..dc489cb7 --- /dev/null +++ b/keyboard/teensy_lc_onekey/Makefile @@ -0,0 +1,77 @@ +# Target file name (without extension). +PROJECT = ch + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +## chip/board settings +# - the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +# - For Teensies, FAMILY = KINETIS and SERIES is either +# KL2x (LC) or K20x (3.0,3.1,3.2). +MCU_FAMILY = KINETIS +MCU_SERIES = KL2x + +# Linker script to use +# - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# - NOTE: a custom ld script is needed for EEPROM on Teensy LC +# - LDSCRIPT = +# - MKL26Z64 for Teensy LC +# - MK20DX128 for Teensy 3.0 +# - MK20DX256 for Teensy 3.1 and 3.2 +MCU_LDSCRIPT = MKL26Z64 + +# Startup code to use +# - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +# - STARTUP = +# - kl2x for Teensy LC +# - k20x5 for Teensy 3.0 +# - k20x7 for Teensy 3.1 and 3.2 +MCU_STARTUP = kl2x + +# Board: it should exist either in /os/hal/boards/ +# or /boards +# - BOARD = +# - PJRC_TEENSY_LC for Teensy LC +# - PJRC_TEENSY_3 for Teensy 3.0 +# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2 +BOARD = PJRC_TEENSY_LC + +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m0 + +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +# I.e. 6 for Teensy LC; 7 for Teensy 3.x +ARMV = 6 + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk diff --git a/keyboard/teensy_lc_onekey/Makefile.3.0 b/keyboard/teensy_lc_onekey/Makefile.3.0 new file mode 100644 index 00000000..a2f98c7e --- /dev/null +++ b/keyboard/teensy_lc_onekey/Makefile.3.0 @@ -0,0 +1,77 @@ +# Target file name (without extension). +PROJECT = ch + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +## chip/board settings +# - the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +# - For Teensies, FAMILY = KINETIS and SERIES is either +# KL2x (LC) or K20x (3.0,3.1,3.2). +MCU_FAMILY = KINETIS +MCU_SERIES = K20x + +# Linker script to use +# - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# - NOTE: a custom ld script is needed for EEPROM on Teensy LC +# - LDSCRIPT = +# - MKL26Z64 for Teensy LC +# - MK20DX128 for Teensy 3.0 +# - MK20DX256 for Teensy 3.1 and 3.2 +MCU_LDSCRIPT = MK20DX128 + +# Startup code to use +# - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +# - STARTUP = +# - kl2x for Teensy LC +# - k20x5 for Teensy 3.0 +# - k20x7 for Teensy 3.1 and 3.2 +MCU_STARTUP = k20x5 + +# Board: it should exist either in /os/hal/boards/ +# or /boards +# - BOARD = +# - PJRC_TEENSY_LC for Teensy LC +# - PJRC_TEENSY_3 for Teensy 3.0 +# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2 +BOARD = PJRC_TEENSY_3 + +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m0 + +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +# I.e. 6 for Teensy LC; 7 for Teensy 3.x +ARMV = 7 + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk diff --git a/keyboard/teensy_lc_onekey/chconf.h b/keyboard/teensy_lc_onekey/chconf.h new file mode 100644 index 00000000..50cb1be4 --- /dev/null +++ b/keyboard/teensy_lc_onekey/chconf.h @@ -0,0 +1,499 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 32 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 1000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 0 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 20 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_QUEUES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE TRUE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP TRUE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS TRUE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK TRUE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS TRUE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS TRUE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_TRACE TRUE + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK TRUE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS TRUE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/keyboard/teensy_lc_onekey/config.h b/keyboard/teensy_lc_onekey/config.h new file mode 100644 index 00000000..8063c57e --- /dev/null +++ b/keyboard/teensy_lc_onekey/config.h @@ -0,0 +1,74 @@ +/* +Copyright 2015 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 + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +/* in python2: list(u"whatever".encode('utf-16-le')) */ +/* at most 32 characters or the ugly hack in usb_main.c borks */ +#define MANUFACTURER "TMK" +#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' +#define PRODUCT "ChibiOS TMK test" +#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' +#define DESCRIPTION "TMK keyboard firmware over ChibiOS" + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* 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/keyboard/teensy_lc_onekey/halconf.h b/keyboard/teensy_lc_onekey/halconf.h new file mode 100644 index 00000000..0d4bc4d0 --- /dev/null +++ b/keyboard/teensy_lc_onekey/halconf.h @@ -0,0 +1,168 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md new file mode 100644 index 00000000..b19b8984 --- /dev/null +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -0,0 +1,62 @@ +# Teensy LC, 3.0, 3.1, 3.2 support + +These ARM Teensies are now supported through [chibios](http://chibios.org). + +You'll need to install an ARM toolchain, for instance from [gcc ARM embedded](https://launchpad.net/gcc-arm-embedded) website, or using your favourite package manager. After installing, you should be able to run `arm-none-eabi-gcc -v` in the command prompt and get sensible output. This toolchain is used instead of `avr-gcc`, which is only for AVR chips. Naturally you'll also need the usual development tools (e.g. `make`), just as in the AVR setting. + +Next, you'll need ChibiOS. The current release (3.0.2) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip). Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). + +This should be it. Running `make` in `keyboard/teensy_lc_onekey` should create a working firmware in `build/`, called `ch.hex`. + +For more notes about the ChibiOS backend in TMK, see `tmk_core/protocol/chibios/README.md`. + +## About this onekey example + +It's set up for Teensy LC. To use 3.x, you'll need to edit the `Makefile` (and comment out one line in `mcuconf.h`). A sample makefile for Teensy 3.0 is provided as `Makefile.3.0`, can be used without renaming with `make -f Makefile.3.0`. + +## Credits + +The USB support for Kinetis MCUs is due to RedoX. His ChibiOS fork is also [on github](https://github.com/RedoXyde/ChibiOS); but it doesn't include Teensy LC definitions. + +## Features that are not implemented yet + +Currently only the more fancy suspend features are not there (i.e. "breathing" LED during suspend, power saving during suspend, sending a wakeup packet). The rest should work fine (reports either way are welcome). + +# Matrix programming notes + +The notes below explain what commands can be used to examine and set the status of Teensy pins. + +## ChibiOS pin manipulation basics + +### Pins + +Each pin sits on a "port", each of which comprises at most 32 individual pins. +So for instance "PTC5" from Kinetis manual/datasheet refers to port C (or GPIOA), pin 5. Most functions dealing with pins take 2 parameters which specify the pin -- the first being the port, the second being the pin number. + +Within ChibiOS, there are definitions which simplify this a bit for the Teensies. `TEENSY_PINn_IOPORT` represents the port of the MCU's pin connected Teensy's PIN `n`, and `TEENSY_PINn` represents its MCU's pin number. + +### Mode + +A MCU pin can be in several modes. The basic command to set a pin mode is + + palSetPadMode(TEENSY_PINn_IOPORT, TEENSY_PINn, PAL_MODE_INPUT_PULLUP); + +The last parameter is the mode. For keyboards, the usual ones that are used are `PAL_MODE_INPUT_PULLUP` (input with a pullup), `PAL_MODE_INPUT_PULLDOWN` (input with a pulldown), `PAL_MODE_INPUT` (input floating, a.k.a. Hi-Z), `PAL_MODE_OUTPUT_PUSHPULL` (output in the Arduino sense -- can be then set HIGH or LOW). + +### Setting + +Pins are set HIGH (after they've been put into `OUTPUT_PUSHPULL` mode) by + + palSetPad(TEENSY_PINn_IOPORT, TEENSY_PINn); + +or set LOW by + + palClearPad(TEENSY_PINn_IOPORT, TEENSY_PINn); + +### Reading + +Reading pin status is done with + + palReadPad(TEENSY_PINn_IOPORT, TEENSY_PINn); + +The function returns either `PAL_HIGH` (actually `1`) or `PAL_LOW` (actually `0`). diff --git a/keyboard/teensy_lc_onekey/keymap_plain.c b/keyboard/teensy_lc_onekey/keymap_plain.c new file mode 100644 index 00000000..a8357489 --- /dev/null +++ b/keyboard/teensy_lc_onekey/keymap_plain.c @@ -0,0 +1,44 @@ +/* +Copyright 2012,2013 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 "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "host.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + +static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + {{KC_BTLD}}, +}; // to test: KC_CAPS, KT_BTLD + +static const uint16_t fn_actions[] = { +}; + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return keymaps[(layer)][(key.row)][(key.col)]; +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = fn_actions[FN_INDEX(keycode)] }; +} diff --git a/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld new file mode 100644 index 00000000..fd9102de --- /dev/null +++ b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld @@ -0,0 +1,161 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. + + This file is part of ChibiOS. + + ChibiOS 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 3 of the License, or + (at your option) any later version. + + ChibiOS 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 . +*/ + +/* + * KL25Z64 memory setup. + */ + +ENTRY(Reset_Handler) + +MEMORY +{ + flash0 : org = 0x00000000, len = 0xc0 + flashcfg : org = 0x00000400, len = 0x10 + flash : org = 0x00000410, len = 62k - 0x410 + eeprom_emu : org = 0x0000F800, len = 2k + ram : org = 0x1FFFF800, len = 8k +} + +__ram_start__ = ORIGIN(ram); +__ram_size__ = LENGTH(ram); +__ram_end__ = __ram_start__ + __ram_size__; + +__eeprom_workarea_start__ = ORIGIN(eeprom_emu); +__eeprom_workarea_size__ = LENGTH(eeprom_emu); +__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; + +SECTIONS +{ + . = 0; + + .isr : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.vectors)) + } > flash0 + + .cfmprotect : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.cfmconfig)) + } > flashcfg + + _text = .; + + constructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE(__init_array_end = .); + } > flash + + destructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__fini_array_start = .); + KEEP(*(.fini_array)) + KEEP(*(SORT(.fini_array.*))) + PROVIDE(__fini_array_end = .); + } > flash + + .text : ALIGN(4) SUBALIGN(4) + { + *(.text) + *(.text.*) + *(.rodata) + *(.rodata.*) + *(.glue_7t) + *(.glue_7) + *(.gcc*) + } > flash + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > flash + + .ARM.exidx : { + PROVIDE(__exidx_start = .); + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + PROVIDE(__exidx_end = .); + } > flash + + .eh_frame_hdr : + { + *(.eh_frame_hdr) + } > flash + + .eh_frame : ONLY_IF_RO + { + *(.eh_frame) + } > flash + + .textalign : ONLY_IF_RO + { + . = ALIGN(8); + } > flash + + _etext = .; + _textdata = _etext; + + .stacks : + { + . = ALIGN(8); + __main_stack_base__ = .; + . += __main_stack_size__; + . = ALIGN(8); + __main_stack_end__ = .; + __process_stack_base__ = .; + __main_thread_stack_base__ = .; + . += __process_stack_size__; + . = ALIGN(8); + __process_stack_end__ = .; + __main_thread_stack_end__ = .; + } > ram + + .data : + { + . = ALIGN(4); + PROVIDE(_data = .); + *(.data) + . = ALIGN(4); + *(.data.*) + . = ALIGN(4); + *(.ramtext) + . = ALIGN(4); + PROVIDE(_edata = .); + } > ram AT > flash + + .bss : + { + . = ALIGN(4); + PROVIDE(_bss_start = .); + *(.bss) + . = ALIGN(4); + *(.bss.*) + . = ALIGN(4); + *(COMMON) + . = ALIGN(4); + PROVIDE(_bss_end = .); + } > ram +} + +PROVIDE(end = .); +_end = .; + +__heap_base__ = _end; +__heap_end__ = __ram_end__; diff --git a/keyboard/teensy_lc_onekey/led.c b/keyboard/teensy_lc_onekey/led.c new file mode 100644 index 00000000..dfa60c10 --- /dev/null +++ b/keyboard/teensy_lc_onekey/led.c @@ -0,0 +1,32 @@ +/* +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 "hal.h" + +#include "led.h" + + +void led_set(uint8_t usb_led) { + if (usb_led & (1< + +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 "ch.h" +#include "hal.h" + +/* + * scan matrix + */ +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "wait.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif +static uint8_t debouncing = DEBOUNCE; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +#define LED_ON() do { palSetPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13) ;} while (0) +#define LED_OFF() do { palClearPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); } while (0) +#define LED_TGL() do { palTogglePad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); } while (0) + +void matrix_init(void) +{ + // initialize row and col + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + //debug + debug_matrix = true; + LED_ON(); + wait_ms(500); + LED_OFF(); +} + +uint8_t matrix_scan(void) +{ + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + select_row(i); + wait_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i] != cols) { + matrix_debouncing[i] = cols; + if (debouncing) { + debug("bounce!: "); debug_hex(debouncing); debug("\n"); + } + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + wait_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + return 1; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1< Date: Wed, 14 Oct 2015 10:13:49 +0100 Subject: [PATCH 059/179] Chibios: use WFI in idle. WIP suspend stuff. --- keyboard/stm32_onekey/chconf.h | 4 ++ keyboard/stm32_onekey/keymap_plain.c | 2 +- keyboard/teensy_lc_onekey/chconf.h | 4 ++ keyboard/teensy_lc_onekey/instructions.md | 2 + keyboard/teensy_lc_onekey/keymap_plain.c | 4 +- tmk_core/common/chibios/sleep_led.c | 4 ++ tmk_core/common/chibios/suspend.c | 65 +++++++++++++++++++++-- tmk_core/protocol/chibios/main.c | 21 +++++++- tmk_core/protocol/chibios/usb_main.c | 8 +-- 9 files changed, 102 insertions(+), 12 deletions(-) diff --git a/keyboard/stm32_onekey/chconf.h b/keyboard/stm32_onekey/chconf.h index da4160b6..be362a95 100644 --- a/keyboard/stm32_onekey/chconf.h +++ b/keyboard/stm32_onekey/chconf.h @@ -103,6 +103,10 @@ */ #define CH_CFG_NO_IDLE_THREAD FALSE +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + /** @} */ /*===========================================================================*/ diff --git a/keyboard/stm32_onekey/keymap_plain.c b/keyboard/stm32_onekey/keymap_plain.c index ea173935..8de1c027 100644 --- a/keyboard/stm32_onekey/keymap_plain.c +++ b/keyboard/stm32_onekey/keymap_plain.c @@ -25,7 +25,7 @@ along with this program. If not, see . #include "keymap.h" static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - {{KC_A}}, + {{KC_CAPS}}, // test with KC_CAPS, KC_A, KC_BTLD }; static const uint16_t fn_actions[] = { diff --git a/keyboard/teensy_lc_onekey/chconf.h b/keyboard/teensy_lc_onekey/chconf.h index 50cb1be4..ee527d47 100644 --- a/keyboard/teensy_lc_onekey/chconf.h +++ b/keyboard/teensy_lc_onekey/chconf.h @@ -103,6 +103,10 @@ */ #define CH_CFG_NO_IDLE_THREAD FALSE +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + /** @} */ /*===========================================================================*/ diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md index b19b8984..9a7aeece 100644 --- a/keyboard/teensy_lc_onekey/instructions.md +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -16,6 +16,8 @@ It's set up for Teensy LC. To use 3.x, you'll need to edit the `Makefile` (and c ## Credits +TMK itself is written by hasu, original sources [here](https://github.com/tmk/tmk_keyboard). + The USB support for Kinetis MCUs is due to RedoX. His ChibiOS fork is also [on github](https://github.com/RedoXyde/ChibiOS); but it doesn't include Teensy LC definitions. ## Features that are not implemented yet diff --git a/keyboard/teensy_lc_onekey/keymap_plain.c b/keyboard/teensy_lc_onekey/keymap_plain.c index a8357489..922fa537 100644 --- a/keyboard/teensy_lc_onekey/keymap_plain.c +++ b/keyboard/teensy_lc_onekey/keymap_plain.c @@ -25,8 +25,8 @@ along with this program. If not, see . #include "keymap.h" static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - {{KC_BTLD}}, -}; // to test: KC_CAPS, KT_BTLD + {{KC_A}}, +}; // to test: KC_CAPS, KT_BTLD, KC_A static const uint16_t fn_actions[] = { }; diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c index b08c9c2a..fad7ac04 100644 --- a/tmk_core/common/chibios/sleep_led.c +++ b/tmk_core/common/chibios/sleep_led.c @@ -4,6 +4,10 @@ #include "sleep_led.h" void sleep_led_init(void) { + // we could go the 'software way' -- just enable *some* timer + // and go with callbacks + // or we could go the 'hardware way' -- and use timer output to + // pins directly } void sleep_led_enable(void) { diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 49ecad43..6ca16034 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -1,8 +1,65 @@ /* TODO */ -#include +#include "ch.h" +#include "hal.h" +#include "matrix.h" +#include "action.h" +#include "action_util.h" +#include "mousekey.h" +#include "host.h" +#include "backlight.h" +#include "suspend.h" -void suspend_power_down(void) {} -bool suspend_wakeup_condition(void) { return true; } -void suspend_wakeup_init(void) {} +void suspend_idle(uint8_t time) { + // TODO: this is not used anywhere - what units is 'time' in? + chThdSleepMilliseconds(time); +} + +void suspend_power_down(void) { + // TODO: figure out what to power down and how + // shouldn't power down TPM/FTM if we want a breathing LED + // also shouldn't power down USB + + // on AVR, this enables the watchdog for 15ms (max), and goes to + // SLEEP_MODE_PWR_DOWN + + chThdSleepMilliseconds(17); +} + +__attribute__ ((weak)) void matrix_power_up(void) {} +__attribute__ ((weak)) void matrix_power_down(void) {} +bool suspend_wakeup_condition(void) +{ + matrix_power_up(); + matrix_scan(); + matrix_power_down(); + for (uint8_t r = 0; r < MATRIX_ROWS; r++) { + if (matrix_get_row(r)) return true; + } + return false; +} + +// run immediately after wakeup +void suspend_wakeup_init(void) +{ + // clear keyboard state + // need to do it manually, because we're running from ISR + // and clear_keyboard() calls print + // so only clear the variables in memory + // the reports will be sent from main.c afterwards + // or if the PC asks for GET_REPORT + clear_mods(); + clear_weak_mods(); + clear_keys(); +#ifdef MOUSEKEY_ENABLE + mousekey_clear(); +#endif /* MOUSEKEY_ENABLE */ +#ifdef EXTRAKEY_ENABLE + host_system_send(0); + host_consumer_send(0); +#endif /* EXTRAKEY_ENABLE */ +#ifdef BACKLIGHT_ENABLE + backlight_init(); +#endif /* BACKLIGHT_ENABLE */ +} diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index b2526d14..c4666ebd 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -26,6 +26,8 @@ #include "host_driver.h" #include "keyboard.h" #include "action.h" +#include "action_util.h" +#include "mousekey.h" #include "led.h" #include "sendchar.h" #include "debug.h" @@ -113,7 +115,24 @@ int main(void) { /* Main loop */ while(true) { - /* TODO: check for suspended event */ + + if(USB_DRIVER.state == USB_SUSPENDED) { + print("[s]"); + while(USB_DRIVER.state == USB_SUSPENDED) { + /* Do this in the suspended state */ + suspend_power_down(); // on AVR this deep sleeps for 15ms + // TODO: remote wakeup + // if(USB_Device_RemoteWakeupEnabled (USB_DRIVER.status & 2) && suspend_wakeup_condition()) { + // USB_Device_SendRemoteWakeup(); + // } + } + /* Woken up */ + // variables has been already cleared by the wakeup hook + send_keyboard_report(); +#ifdef MOUSEKEY_ENABLE + mousekey_send(); +#endif /* MOUSEKEY_ENABLE */ + } keyboard_task(); chThdSleepMilliseconds(5); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 2625c425..872d1c65 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -22,6 +22,7 @@ #include "host.h" #include "debug.h" +#include "suspend.h" #ifdef SLEEP_LED_ENABLE #include "sleep_led.h" #include "led.h" @@ -356,8 +357,8 @@ static const uint8_t hid_configuration_descriptor_data[] = { NUM_INTERFACES, // bNumInterfaces 1, // bConfigurationValue 0, // iConfiguration - 0xA0, // bmAttributes - 50), // bMaxPower (100mA) + 0xA0, // bmAttributes (RESERVED|REMOTEWAKEUP) + 50), // bMaxPower (50mA) /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ USB_DESC_INTERFACE(KBD_INTERFACE, // bInterfaceNumber @@ -793,7 +794,6 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { case USB_EVENT_SUSPEND: //TODO: from ISR! print("[S]"); - //TODO: signal suspend? #ifdef SLEEP_LED_ENABLE sleep_led_enable(); #endif /* SLEEP_LED_ENABLE */ @@ -801,7 +801,7 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { case USB_EVENT_WAKEUP: //TODO: from ISR! print("[W]"); - //TODO: suspend_wakeup_init(); + suspend_wakeup_init(); #ifdef SLEEP_LED_ENABLE sleep_led_disable(); // NOTE: converters may not accept this From b25da7a51df91a73520df5f5120478438d84dad7 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Wed, 14 Oct 2015 10:35:45 +0100 Subject: [PATCH 060/179] Update chibi/teensy instructions. --- keyboard/teensy_lc_onekey/instructions.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md index 9a7aeece..4d8e51df 100644 --- a/keyboard/teensy_lc_onekey/instructions.md +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -4,7 +4,9 @@ These ARM Teensies are now supported through [chibios](http://chibios.org). You'll need to install an ARM toolchain, for instance from [gcc ARM embedded](https://launchpad.net/gcc-arm-embedded) website, or using your favourite package manager. After installing, you should be able to run `arm-none-eabi-gcc -v` in the command prompt and get sensible output. This toolchain is used instead of `avr-gcc`, which is only for AVR chips. Naturally you'll also need the usual development tools (e.g. `make`), just as in the AVR setting. -Next, you'll need ChibiOS. The current release (3.0.2) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip). Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). +You'll need this fork/branch of TMK. If you're reading this from your own hard drive, then you already have it ;) Anyway, you can get a zip from [here](https://https://github.com/flabbergast/tmk_keyboard/archive/chibios.zip) {or clone this repo from github and checkout the `chibios` branch}. + +Next, you'll need ChibiOS. The current release (3.0.2) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip) {or clone that repo from github and checkout the `kinetis` branch}. Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). This should be it. Running `make` in `keyboard/teensy_lc_onekey` should create a working firmware in `build/`, called `ch.hex`. From aa2c56823574b56735b81e5db08bd9c2ec501294 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Wed, 14 Oct 2015 18:04:25 +0100 Subject: [PATCH 061/179] Update chibios/Teensy instructions. --- keyboard/teensy_lc_onekey/instructions.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md index 4d8e51df..ed355e29 100644 --- a/keyboard/teensy_lc_onekey/instructions.md +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -57,6 +57,16 @@ or set LOW by palClearPad(TEENSY_PINn_IOPORT, TEENSY_PINn); +Toggling can be done with + + palTogglePad(TEENSY_PINn_IOPORT, TEENSY_PINn); + +Alternatively, you can use + + palWritePad(TEENSY_PINn_IOPORT, TEENSY_PINn, bit); + +where `bit` is either `PAL_LOW` or `PAL_HIGH` (i.e. `0` or `1`). + ### Reading Reading pin status is done with @@ -64,3 +74,7 @@ Reading pin status is done with palReadPad(TEENSY_PINn_IOPORT, TEENSY_PINn); The function returns either `PAL_HIGH` (actually `1`) or `PAL_LOW` (actually `0`). + +### Further docs + +All the commands that are available for pin manipulation through ChibiOS HAL are documented in [ChibiOS PAL driver docs](http://chibios.sourceforge.net/docs3/hal/group___p_a_l.html). From 2e06ccf70a7f86e4abeaf5cec73886c909a2f7a9 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Wed, 14 Oct 2015 19:55:09 +0100 Subject: [PATCH 062/179] ChibiOS/kinetis: sending remote wakeup. --- tmk_core/protocol/chibios/main.c | 8 ++++---- tmk_core/protocol/chibios/usb_main.c | 17 +++++++++++++++++ tmk_core/protocol/chibios/usb_main.h | 3 +++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index c4666ebd..9607f1a9 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -121,10 +121,10 @@ int main(void) { while(USB_DRIVER.state == USB_SUSPENDED) { /* Do this in the suspended state */ suspend_power_down(); // on AVR this deep sleeps for 15ms - // TODO: remote wakeup - // if(USB_Device_RemoteWakeupEnabled (USB_DRIVER.status & 2) && suspend_wakeup_condition()) { - // USB_Device_SendRemoteWakeup(); - // } + /* Remote wakeup */ + if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { + send_remote_wakeup(&USB_DRIVER); + } } /* Woken up */ // variables has been already cleared by the wakeup hook diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 872d1c65..09de7196 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1024,6 +1024,23 @@ void init_usb_driver(USBDriver *usbp) { #endif } +/* + * Send remote wakeup packet + * Note: should not be called from ISR + */ +void send_remote_wakeup(USBDriver *usbp) { + (void)usbp; +#if defined(K20x) || defined(KL2x) +#if KINETIS_USB_USE_USB0 + USB0->CTL |= USBx_CTL_RESUME; + chThdSleepMilliseconds(15); + USB0->CTL &= ~USBx_CTL_RESUME; +#endif /* KINETIS_USB_USE_USB0 */ +#else /* K20x || KL2x */ +#warning Sending remote wakeup packet not implemented for your platform. +#endif /* K20x || KL2x */ +} + /* --------------------------------------------------------- * Keyboard functions * --------------------------------------------------------- diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 85ea9153..d8f30e95 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -36,6 +36,9 @@ /* Initialize the USB driver and bus */ void init_usb_driver(USBDriver *usbp); +/* Send remote wakeup packet */ +void send_remote_wakeup(USBDriver *usbp); + /* --------------- * Keyboard header * --------------- From 6fe4af82fa21cbeb8e22c9f0630e5a908963cc13 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 15 Oct 2015 11:48:14 +0900 Subject: [PATCH 063/179] Fix port setting of alps64/matrix.c --- keyboard/alps64/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboard/alps64/matrix.c b/keyboard/alps64/matrix.c index aa991e0a..5638d7f6 100644 --- a/keyboard/alps64/matrix.c +++ b/keyboard/alps64/matrix.c @@ -157,7 +157,7 @@ static void unselect_rows(void) DDRD &= ~0b01111111; PORTD &= ~0b01111111; DDRC &= ~0b00000100; - PORTD &= ~0b00000100; + PORTC &= ~0b00000100; } static void select_row(uint8_t row) From 6def1045305aaf9c539b5ebbe04232a4c83662ec Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 15 Oct 2015 09:34:51 +0100 Subject: [PATCH 064/179] ChibiOS/STM32: send remote wakeup. --- tmk_core/protocol/chibios/usb_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 09de7196..382966b9 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1036,7 +1036,11 @@ void send_remote_wakeup(USBDriver *usbp) { chThdSleepMilliseconds(15); USB0->CTL &= ~USBx_CTL_RESUME; #endif /* KINETIS_USB_USE_USB0 */ -#else /* K20x || KL2x */ +#elif defined(STM32F0XX) /* K20x || KL2x */ + STM32_USB->CNTR |= CNTR_RESUME; + chThdSleepMilliseconds(15); + STM32_USB->CNTR &= ~CNTR_RESUME; +#else /* STM32F0XX */ #warning Sending remote wakeup packet not implemented for your platform. #endif /* K20x || KL2x */ } From fd71b3f4eff1825d6527b1c657e88e2e3bd87483 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Fri, 16 Oct 2015 17:44:26 +0900 Subject: [PATCH 065/179] Add infinity_chibios --- keyboard/infinity_chibios/MEMO.txt | 385 +++++++++++++++++ keyboard/infinity_chibios/Makefile | 87 ++++ keyboard/infinity_chibios/chconf.h | 499 ++++++++++++++++++++++ keyboard/infinity_chibios/config.h | 76 ++++ keyboard/infinity_chibios/halconf.h | 334 +++++++++++++++ keyboard/infinity_chibios/keymap_common.c | 30 ++ keyboard/infinity_chibios/keymap_common.h | 80 ++++ keyboard/infinity_chibios/keymap_plain.c | 48 +++ keyboard/infinity_chibios/led.c | 24 ++ keyboard/infinity_chibios/matrix.c | 128 ++++++ keyboard/infinity_chibios/mcuconf.h | 55 +++ 11 files changed, 1746 insertions(+) create mode 100644 keyboard/infinity_chibios/MEMO.txt create mode 100644 keyboard/infinity_chibios/Makefile create mode 100644 keyboard/infinity_chibios/chconf.h create mode 100644 keyboard/infinity_chibios/config.h create mode 100644 keyboard/infinity_chibios/halconf.h create mode 100644 keyboard/infinity_chibios/keymap_common.c create mode 100644 keyboard/infinity_chibios/keymap_common.h create mode 100644 keyboard/infinity_chibios/keymap_plain.c create mode 100644 keyboard/infinity_chibios/led.c create mode 100644 keyboard/infinity_chibios/matrix.c create mode 100644 keyboard/infinity_chibios/mcuconf.h diff --git a/keyboard/infinity_chibios/MEMO.txt b/keyboard/infinity_chibios/MEMO.txt new file mode 100644 index 00000000..e2886aa0 --- /dev/null +++ b/keyboard/infinity_chibios/MEMO.txt @@ -0,0 +1,385 @@ +flabbergast's TMK/ChibiOS port +============================== +2015/10/16 + + +Build +----- +$ git clone -b chibios https://github.com/flabbergast/tmk_keyboard.git + +$ cd tmk_keyboard +$ git submodule add -f -b kinetis https://github.com/flabbergast/ChibiOS.git tmk_core/tool/chibios/chibios +or +$ cd tmk_keyboard/tmk_core/tool/chibios +$ git clone -b kinetis https://github.com/flabbergast/ChibiOS.git tmk_core/tool/chibios/chibios + +$ cd tmk_keyboard/keyboard/infinity_chibios +$ make + + + + +Chibios Configuration +--------------------- +halconf.h: for HAL configuration + placed in project directory + read in chibios/os/hal/hal.mk + included in chibios/os/hal/include/hal.h +mcuconf.h: for MCU configuration + placed in project directory + included in halconf.h + + +Chibios Term +------------ +PAL = Port Abstraction Layer + palWritePad + palReadPad + palSetPad + chibios/os/hal/include/pal.h + +LLD = Low Level Driver + + +Makefile +-------- + # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = KINETIS + MCU_SERIES = KL2x + + # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ + # or /ld/ + MCU_LDSCRIPT = MKL26Z64 + + # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP = kl2x + + # Board: it should exist either in /os/hal/boards/ + # or /boards + BOARD = PJRC_TEENSY_LC + + MCU = cortex-m0 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 6 + + +halconf.h +--------- + + +mcuconf.h +--------- + + +chconf.h +-------- + + +ld script +--------- +--- ../../tmk_core/tool/chibios/chibios/os/common/ports/ARMCMx/compilers/GCC/ld/MKL26Z64.ld 2015-10-15 09:08:58.732904304 +0900 ++++ ld/MKL26Z64.ld 2015-10-15 08:48:06.430215496 +0900 +@@ -27,7 +27,8 @@ + { + flash0 : org = 0x00000000, len = 0xc0 + flashcfg : org = 0x00000400, len = 0x10 +- flash : org = 0x00000410, len = 64k - 0x410 ++ flash : org = 0x00000410, len = 62k - 0x410 ++ eeprom_emu : org = 0x0000F800, len = 2k + ram : org = 0x1FFFF800, len = 8k + } + +@@ -35,6 +36,10 @@ + __ram_size__ = LENGTH(ram); + __ram_end__ = __ram_start__ + __ram_size__; + ++__eeprom_workarea_start__ = ORIGIN(eeprom_emu); ++__eeprom_workarea_size__ = LENGTH(eeprom_emu); ++__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; ++ + SECTIONS + { + . = 0; + + + +Configuration/Startup for Infinity 60% +-------------------------------------- +Configuration: + + +Clock: +Inifinity + FEI(FLL Engaged Internal) mode with core clock:48MHz, bus clock:48MHz, flash clock:24MHz + Clock dividor: + SIM_CLKDIV1[OUTDIV1] = 0 divide-by-1 for core clock + SIM_CLKDIV1[OUTDIV2] = 0 divide-by-1 for bus clock + SIM_CLKDIV1[OUTDIV4] = 1 divide-by-2 for flash clock + Internal reference clock: + MCG_C1[IREFS] = 1 Internal Reference Select for clock source for FLL + MCG_C1[IRCLKEN] = 1 Internal Reference Clock Enable + FLL multipilication: + MCG_C4[DMX32] = 1 + MCG_C4[DRST_DRS] = 01 FLL factor 1464 * 32.768kHz = 48MHz + +chibios/os/hal/ports/KINETIS/K20x/hal_lld.c + k20x_clock_init(): called in __early_init() defined in board.c + disable watchdog and configure clock + + configurable macros: + KINETIS_NO_INIT: whether init or not + KINETIS_MCG_MODE: clock mode + KINETIS_MCG_MODE_FEI + KINETIS_MCG_MODE_PEE + hal/ports/KINETIS/K20x/hal_lld.h + + +chibios/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h + PALConfig pal_default_config + boardInit() + __early_init() + macro definitions for board infos, freq and mcu type + +chibios/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.c + +USB + + +Startup +------- + common/ports/ARMCMx/GCC/crt0_v[67]m.s + Reset_Handler: startup code + common/ports/ARMCMx/GCC/crt1.c + __core_init(): weak + __early_init(): weak + __late_init(): weak + __default_exit(): weak + called from Reset_Handler of crt0 + common/ports/ARMCMx/GCC/vector.c + common/ports/ARMCMx/GCC/ld/*.ld + +chibios/os/common/ports/ARMCMx/compilers/GCC/ +├── crt0_v6m.s +├── crt0_v7m.s +├── crt1.c +├── ld +│   ├── MK20DX128BLDR3.ld +│   ├── MK20DX128BLDR4.ld +│   ├── MK20DX128.ld +│   ├── MK20DX256.ld +│   ├── MKL25Z128.ld +│   ├── MKL26Z128.ld +│   ├── MKL26Z64.ld +│   └── STM32L476xG.ld +├── mk +│   ├── startup_k20x5.mk +│   ├── startup_k20x7.mk +│   ├── startup_k20x.mk +│   ├── startup_kl2x.mk +│   └── startup_stm32l4xx.mk +├── rules.ld +├── rules.mk +└── vectors.c + +chibios/os/hal/ +├── boards +│   ├── FREESCALE_FREEDOM_K20D50M +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── MCHCK_K20 +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── PJRC_TEENSY_3 +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── PJRC_TEENSY_3_1 +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── PJRC_TEENSY_LC +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── readme.txt +│   ├── simulator +│   │   ├── board.c +│   │   ├── board.h +│   │   └── board.mk +│   ├── ST_NUCLEO_F030R8 +│   │   ├── board.c +│   │   ├── board.h +│   │   ├── board.mk +│   │   └── cfg +│   │   └── board.chcfg +├── hal.mk +├── include +│   ├── adc.h +│   ├── can.h +│   ├── dac.h +│   ├── ext.h +│   ├── gpt.h +│   ├── hal_channels.h +│   ├── hal_files.h +│   ├── hal.h +│   ├── hal_ioblock.h +│   ├── hal_mmcsd.h +│   ├── hal_queues.h +│   ├── hal_streams.h +│   ├── i2c.h +│   ├── i2s.h +│   ├── icu.h +│   ├── mac.h +│   ├── mii.h +│   ├── mmc_spi.h +│   ├── pal.h +│   ├── pwm.h +│   ├── rtc.h +│   ├── sdc.h +│   ├── serial.h +│   ├── serial_usb.h +│   ├── spi.h +│   ├── st.h +│   ├── uart.h +│   └── usb.h +├── lib +│   └── streams +│   ├── chprintf.c +│   ├── chprintf.h +│   ├── memstreams.c +│   ├── memstreams.h +│   ├── nullstreams.c +│   └── nullstreams.h +├── osal +│   ├── nil +│   │   ├── osal.c +│   │   ├── osal.h +│   │   └── osal.mk +│   ├── os-less +│   │   └── ARMCMx +│   │   ├── osal.c +│   │   ├── osal.h +│   │   └── osal.mk +│   └── rt +│   ├── osal.c +│   ├── osal.h +│   └── osal.mk +├── ports +│   ├── AVR +│   ├── common +│   │   └── ARMCMx +│   │   ├── mpu.h +│   │   ├── nvic.c +│   │   └── nvic.h +│   ├── KINETIS +│   │   ├── K20x +│   │   │   ├── hal_lld.c +│   │   │   ├── hal_lld.h +│   │   │   ├── kinetis_registry.h +│   │   │   ├── platform.dox +│   │   │   ├── platform.mk +│   │   │   ├── pwm_lld.c +│   │   │   ├── pwm_lld.h +│   │   │   ├── spi_lld.c +│   │   │   └── spi_lld.h +│   │   ├── KL2x +│   │   │   ├── hal_lld.c +│   │   │   ├── hal_lld.h +│   │   │   ├── kinetis_registry.h +│   │   │   ├── platform.mk +│   │   │   ├── pwm_lld.c +│   │   │   └── pwm_lld.h +│   │   ├── LLD +│   │   │   ├── adc_lld.c +│   │   │   ├── adc_lld.h +│   │   │   ├── ext_lld.c +│   │   │   ├── ext_lld.h +│   │   │   ├── gpt_lld.c +│   │   │   ├── gpt_lld.h +│   │   │   ├── i2c_lld.c +│   │   │   ├── i2c_lld.h +│   │   │   ├── pal_lld.c +│   │   │   ├── pal_lld.h +│   │   │   ├── serial_lld.c +│   │   │   ├── serial_lld.h +│   │   │   ├── st_lld.c +│   │   │   ├── st_lld.h +│   │   │   ├── usb_lld.c +│   │   │   └── usb_lld.h +│   │   └── README.md +│   ├── LPC +│   ├── simulator +│   └── STM32 +├── src +│   ├── adc.c +│   ├── can.c +│   ├── dac.c +│   ├── ext.c +│   ├── gpt.c +│   ├── hal.c +│   ├── hal_mmcsd.c +│   ├── hal_queues.c +│   ├── i2c.c +│   ├── i2s.c +│   ├── icu.c +│   ├── mac.c +│   ├── mmc_spi.c +│   ├── pal.c +│   ├── pwm.c +│   ├── rtc.c +│   ├── sdc.c +│   ├── serial.c +│   ├── serial_usb.c +│   ├── spi.c +│   ├── st.c +│   ├── uart.c +│   └── usb.c +└── templates + ├── adc_lld.c + ├── adc_lld.h + ├── can_lld.c + ├── can_lld.h + ├── dac_lld.c + ├── dac_lld.h + ├── ext_lld.c + ├── ext_lld.h + ├── gpt_lld.c + ├── gpt_lld.h + ├── halconf.h + ├── hal_lld.c + ├── hal_lld.h + ├── i2c_lld.c + ├── i2c_lld.h + ├── i2s_lld.c + ├── i2s_lld.h + ├── icu_lld.c + ├── icu_lld.h + ├── mac_lld.c + ├── mac_lld.h + ├── mcuconf.h + ├── osal + │   ├── osal.c + │   ├── osal.h + │   └── osal.mk + ├── pal_lld.c + ├── pal_lld.h + ├── platform.mk + ├── pwm_lld.c + ├── pwm_lld.h + ├── rtc_lld.c + ├── rtc_lld.h + ├── sdc_lld.c + ├── sdc_lld.h + ├── serial_lld.c + ├── serial_lld.h + ├── spi_lld.c + ├── spi_lld.h + ├── st_lld.c + ├── st_lld.h + ├── uart_lld.c + ├── uart_lld.h + ├── usb_lld.c + └── usb_lld.h diff --git a/keyboard/infinity_chibios/Makefile b/keyboard/infinity_chibios/Makefile new file mode 100644 index 00000000..6fca4890 --- /dev/null +++ b/keyboard/infinity_chibios/Makefile @@ -0,0 +1,87 @@ +# Target file name (without extension). +PROJECT = ch + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + keymap_common.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +## chip/board settings +# - the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +# - For Teensies, FAMILY = KINETIS and SERIES is either +# KL2x (LC) or K20x (3.0,3.1,3.2). +MCU_FAMILY = KINETIS +MCU_SERIES = K20x + +# Linker script to use +# - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# - NOTE: a custom ld script is needed for EEPROM on Teensy LC +# - LDSCRIPT = +# - MKL26Z64 for Teensy LC +# - MK20DX128 for Teensy 3.0 +# - MK20DX256 for Teensy 3.1 and 3.2 +#MCU_LDSCRIPT = MK20DX128 +MCU_LDSCRIPT = MK20DX128BLDR4 + +# Startup code to use +# - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +# - STARTUP = +# - kl2x for Teensy LC +# - k20x5 for Teensy 3.0 +# - k20x7 for Teensy 3.1 and 3.2 +MCU_STARTUP = k20x5 + +# Board: it should exist either in /os/hal/boards/ +# or /boards +# - BOARD = +# - PJRC_TEENSY_LC for Teensy LC +# - PJRC_TEENSY_3 for Teensy 3.0 +# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2 +BOARD = MCHCK_K20 + +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m4 + +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +# I.e. 6 for Teensy LC; 7 for Teensy 3.x +ARMV = 7 + +# Vector table for application +# 0x00000000-0x00001000 area is occupied by bootlaoder.*/ +OPT_DEFS = -DCORTEX_VTOR_INIT=0x00001000 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk + +program: $(BUILDDIR)/$(PROJECT).bin + dfu-util -D $(BUILDDIR)/$(PROJECT).bin diff --git a/keyboard/infinity_chibios/chconf.h b/keyboard/infinity_chibios/chconf.h new file mode 100644 index 00000000..b7a340d6 --- /dev/null +++ b/keyboard/infinity_chibios/chconf.h @@ -0,0 +1,499 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 32 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 1000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 0 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 20 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_QUEUES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE TRUE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP TRUE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS TRUE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK FALSE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS FALSE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS FALSE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_TRACE FALSE + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK FALSE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS FALSE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/keyboard/infinity_chibios/config.h b/keyboard/infinity_chibios/config.h new file mode 100644 index 00000000..b4b7fcd3 --- /dev/null +++ b/keyboard/infinity_chibios/config.h @@ -0,0 +1,76 @@ +/* +Copyright 2015 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 + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +/* in python2: list(u"whatever".encode('utf-16-le')) */ +/* at most 32 characters or the ugly hack in usb_main.c borks */ +#define MANUFACTURER "TMK" +#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' +#define PRODUCT "ChibiOS TMK test" +#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' +#define DESCRIPTION "TMK keyboard firmware over ChibiOS" + +/* key matrix size */ +#define MATRIX_ROWS 9 +#define MATRIX_COLS 7 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* Keymap for Infiity prototype */ +#define INFINITY_PROTOTYPE + + +/* + * 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/keyboard/infinity_chibios/halconf.h b/keyboard/infinity_chibios/halconf.h new file mode 100644 index 00000000..2472ba7e --- /dev/null +++ b/keyboard/infinity_chibios/halconf.h @@ -0,0 +1,334 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB TRUE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboard/infinity_chibios/keymap_common.c b/keyboard/infinity_chibios/keymap_common.c new file mode 100644 index 00000000..69b170ce --- /dev/null +++ b/keyboard/infinity_chibios/keymap_common.c @@ -0,0 +1,30 @@ +/* +Copyright 2012,2013 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 "keymap_common.h" + + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return keymaps[(layer)][(key.row)][(key.col)]; +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = fn_actions[FN_INDEX(keycode)] }; +} diff --git a/keyboard/infinity_chibios/keymap_common.h b/keyboard/infinity_chibios/keymap_common.h new file mode 100644 index 00000000..b0f765bf --- /dev/null +++ b/keyboard/infinity_chibios/keymap_common.h @@ -0,0 +1,80 @@ +/* +Copyright 2014 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 KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include +#include +#include "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "host.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + + +extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint16_t fn_actions[]; + + +#ifdef INFINITY_PROTOTYPE + +/* Infinity prototype */ +#define KEYMAP( \ + K00, K10, K20, K30, K40, K50, K60, K70, K80, K01, K11, K21, K31, K41, K86, \ + K51, K61, K71, K81, K02, K12, K22, K32, K42, K52, K62, K72, K82, K03, \ + K13, K23, K33, K43, K53, K63, K73, K83, K04, K14, K24, K34, K44, \ + K54, K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, \ + K06, K16, K26, K36, K46, K56, K66, K76 \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \ + { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \ +} + +#else + +/* Infinity production */ +#define KEYMAP( \ + K00, K10, K20, K30, K40, K50, K60, K70, K80, K01, K11, K21, K31, K41, K51, \ + K61, K71, K81, K02, K12, K22, K32, K42, K52, K62, K72, K82, K03, K13, \ + K23, K33, K43, K53, K63, K73, K83, K04, K14, K24, K34, K44, K54, \ + K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, K06, \ + K16, K26, K36, K46, K56, K66, K76, K86 \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \ + { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \ + { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \ + { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \ +} + +#endif + +#endif diff --git a/keyboard/infinity_chibios/keymap_plain.c b/keyboard/infinity_chibios/keymap_plain.c new file mode 100644 index 00000000..2673d6aa --- /dev/null +++ b/keyboard/infinity_chibios/keymap_plain.c @@ -0,0 +1,48 @@ +#include "keymap_common.h" + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Layer 0: Default Layer + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|BSp| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| + * |-----------------------------------------------------------| + * |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| + * |-----------------------------------------------------------' + * | |Gui|Alt | Space |Alt |Gui| | | + * `-----------------------------------------------------------' + */ + [0] = + KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \ + NO, LGUI,LALT, SPC, RALT,RGUI,NO, NO), + + /* Layer 1: HHKB mode (HHKB Fn) + * ,-----------------------------------------------------------. + * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| + * |-----------------------------------------------------------| + * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | + * |-----------------------------------------------------------| + * | | | | | | | +| -|End|PgD|Dow| | | + * `-----------------------------------------------------------' + * | |Gui|Alt | Space |Alt |Gui| | | + * `-----------------------------------------------------------' + */ + [1] = + KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \ + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), +}; + +const uint16_t fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), +}; + diff --git a/keyboard/infinity_chibios/led.c b/keyboard/infinity_chibios/led.c new file mode 100644 index 00000000..aed66c7c --- /dev/null +++ b/keyboard/infinity_chibios/led.c @@ -0,0 +1,24 @@ +/* +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 "hal.h" + +#include "led.h" + + +void led_set(uint8_t usb_led) { +} diff --git a/keyboard/infinity_chibios/matrix.c b/keyboard/infinity_chibios/matrix.c new file mode 100644 index 00000000..2c68ea83 --- /dev/null +++ b/keyboard/infinity_chibios/matrix.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include "hal.h" +#include "timer.h" +#include "wait.h" +#include "print.h" +#include "matrix.h" + + +/* + * Infinity Pinusage: + * Column pins are input with internal pull-down. Row pins are output and strobe with high. + * Key is high or 1 when it turns on. + * + * col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 } + * row: { PTB0, PTB1, PTB2, PTB3, PTB16, PTB17, PTC4, PTC5, PTD0 } + */ +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +static bool debouncing = false; +static uint16_t debouncing_time = 0; + + +void matrix_init(void) +{ + /* Column(sense) */ + palSetPadMode(GPIOD, 1, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 2, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 3, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 4, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN); + + /* Row(strobe) */ + palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 17, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); + + memset(matrix, 0, MATRIX_ROWS); + memset(matrix_debouncing, 0, MATRIX_ROWS); +} + +uint8_t matrix_scan(void) +{ + for (int row = 0; row < MATRIX_ROWS; row++) { + matrix_row_t data = 0; + + // strobe row + switch (row) { + case 0: palSetPad(GPIOB, 0); break; + case 1: palSetPad(GPIOB, 1); break; + case 2: palSetPad(GPIOB, 2); break; + case 3: palSetPad(GPIOB, 3); break; + case 4: palSetPad(GPIOB, 16); break; + case 5: palSetPad(GPIOB, 17); break; + case 6: palSetPad(GPIOC, 4); break; + case 7: palSetPad(GPIOC, 5); break; + case 8: palSetPad(GPIOD, 0); break; + } + + wait_us(1); // need wait to settle pin state + + // read col data + data = (palReadPort(GPIOD)>>1); + + // un-strobe row + switch (row) { + case 0: palClearPad(GPIOB, 0); break; + case 1: palClearPad(GPIOB, 1); break; + case 2: palClearPad(GPIOB, 2); break; + case 3: palClearPad(GPIOB, 3); break; + case 4: palClearPad(GPIOB, 16); break; + case 5: palClearPad(GPIOB, 17); break; + case 6: palClearPad(GPIOC, 4); break; + case 7: palClearPad(GPIOC, 5); break; + case 8: palClearPad(GPIOD, 0); break; + } + + if (matrix_debouncing[row] != data) { + matrix_debouncing[row] = data; + debouncing = true; + debouncing_time = timer_read(); + } + } + + if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { + for (int row = 0; row < MATRIX_ROWS; row++) { + matrix[row] = matrix_debouncing[row]; + } + debouncing = false; + } + return 1; +} + +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & (1< Date: Sat, 17 Oct 2015 01:59:55 +0900 Subject: [PATCH 066/179] Fix report size of boot protocol. --- tmk_core/protocol/chibios/usb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 382966b9..619b798b 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1130,7 +1130,7 @@ void send_keyboard(report_keyboard_t *report) { } else #endif /* NKRO_ENABLE */ { /* boot protocol */ - usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); osalSysLock(); usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); osalSysUnlock(); From dcac43fa510eb5087a3b80d5654ffaa98fa471d4 Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sat, 17 Oct 2015 02:52:44 +0900 Subject: [PATCH 067/179] Add keymap_hasu.c --- keyboard/infinity_chibios/keymap_common.h | 1 + keyboard/infinity_chibios/keymap_hasu.c | 199 ++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 keyboard/infinity_chibios/keymap_hasu.c diff --git a/keyboard/infinity_chibios/keymap_common.h b/keyboard/infinity_chibios/keymap_common.h index b0f765bf..260822fc 100644 --- a/keyboard/infinity_chibios/keymap_common.h +++ b/keyboard/infinity_chibios/keymap_common.h @@ -22,6 +22,7 @@ along with this program. If not, see . #include "keycode.h" #include "action.h" #include "action_macro.h" +#include "action_util.h" #include "report.h" #include "host.h" #include "print.h" diff --git a/keyboard/infinity_chibios/keymap_hasu.c b/keyboard/infinity_chibios/keymap_hasu.c new file mode 100644 index 00000000..2d0635f0 --- /dev/null +++ b/keyboard/infinity_chibios/keymap_hasu.c @@ -0,0 +1,199 @@ +#include "keymap_common.h" + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Layer 0: Default Layer + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|BSp| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| + * |-----------------------------------------------------------| + * |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| + * |-----------------------------------------------------------' + * | |Gui|Alt | Space |Alt |Gui| | | + * `-----------------------------------------------------------' + */ + [0] = + KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ + LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN6, \ + FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \ + NO, LGUI,LALT, FN4, FN5, RGUI,NO, NO), + + /* Layer 1: HHKB mode (HHKB Fn) + * ,-----------------------------------------------------------. + * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| + * |-----------------------------------------------------------| + * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | + * |-----------------------------------------------------------| + * | | | | | | | +| -|End|PgD|Dow| | | + * `-----------------------------------------------------------' + * | |Gui|Alt | Space |Alt |Gui| | | + * `-----------------------------------------------------------' + */ + [1] = + KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS,BSPC, \ + LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \ + LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \ + TRNS,LGUI,LALT, TRNS, RALT,RGUI,TRNS,TRNS), + + /* Layer 2: Vi mode[Slash] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs| + * |-----------------------------------------------------------| + * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return | + * |-----------------------------------------------------------| + * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | | + * `-----------------------------------------------------------' + * |Gui|Alt | Space |Alt |Gui| + * `-------------------------------------------' + */ + [2] = \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ + LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \ + LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,TRNS, \ + TRNS,LGUI,LALT, SPC, RALT,RGUI,TRNS,TRNS), + + /* Layer 3: Mouse mode(IJKL)[Semicolon] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T| + * |-----------------------------------------------------------| + * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return | + * |-----------------------------------------------------------| + * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | + * `-----------------------------------------------------------' + * |Gui |Alt | Mb1 |Fn |Fn | + * `--------------------------------------------' + * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel + */ + [3] = \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,FN9, FN10,FN8, \ + LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,FN3, NO, ENT, \ + LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \ + TRNS,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,TRNS), + + /* Layer 4: Mouse mode(IJKL)[Space] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T| + * |-----------------------------------------------------------| + * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return | + * |-----------------------------------------------------------| + * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | + * `-----------------------------------------------------------' + * |Gui |Alt | Mb1 |Fn |Fn | + * `--------------------------------------------' + * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel + */ + [4] = \ + KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN8, \ + LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \ + LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \ + TRNS,LGUI,LALT, TRNS, TRNS,TRNS,TRNS,TRNS), + +}; + +/* id for user defined functions */ +enum function_id { + LSHIFT_LPAREN, +}; + +enum macro_id { + HELLO, + VOLUP, + ALT_TAB, +}; + +/* + * Fn action definition + */ +const uint16_t fn_actions[] = { + [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) + [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) + [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash* + [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon* + [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space + [5] = ACTION_LAYER_MOMENTARY(4), // Mousekey layer(IJKL) + [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter + [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift + [8] = ACTION_MACRO(ALT_TAB), // Application switching + [9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT), + [10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT), +}; + +/* + * Macro definition + */ +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) { + case HELLO: + return (record->event.pressed ? + MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) : + MACRO_NONE ); + case VOLUP: + return (record->event.pressed ? + MACRO( D(VOLU), U(VOLU), END ) : + MACRO_NONE ); + case ALT_TAB: + return (record->event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; +} + + + +/* + * user defined action function + */ +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (record->event.pressed) dprint("P"); else dprint("R"); + dprintf("%d", record->tap.count); + if (record->tap.interrupted) dprint("i"); + dprint("\n"); + + switch (id) { + case LSHIFT_LPAREN: + // Shift parentheses example: LShft + tap '(' + // http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses + // http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899 + if (record->event.pressed) { + if (record->tap.count > 0 && !record->tap.interrupted) { + if (record->tap.interrupted) { + dprint("tap interrupted\n"); + register_mods(MOD_BIT(KC_LSHIFT)); + } + } else { + register_mods(MOD_BIT(KC_LSHIFT)); + } + } else { + if (record->tap.count > 0 && !(record->tap.interrupted)) { + add_weak_mods(MOD_BIT(KC_LSHIFT)); + send_keyboard_report(); + register_code(KC_9); + unregister_code(KC_9); + del_weak_mods(MOD_BIT(KC_LSHIFT)); + send_keyboard_report(); + record->tap.count = 0; // ad hoc: cancel tap + } else { + unregister_mods(MOD_BIT(KC_LSHIFT)); + } + } + break; + } +} From 8bcddd24f7320344aba9c9e757be2a7d516f4faa Mon Sep 17 00:00:00 2001 From: Jun Wako Date: Sat, 17 Oct 2015 15:28:21 +0900 Subject: [PATCH 068/179] Fix drop key stroke Keyboard report should be checked if its transfer finishs successfully. Otherwise key stroke can be missing when other key event occurs before the last report transfer is done. Boot protocol 10ms interval probably causes this problem in case it receives key events in a row within the period. NKRO protocol suffers less or nothing due to its interval 1ms. --- tmk_core/protocol/chibios/usb_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 619b798b..0fc2f6e3 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1121,19 +1121,24 @@ void send_keyboard(report_keyboard_t *report) { } osalSysUnlock(); + bool ret; #ifdef NKRO_ENABLE if(keyboard_nkro) { /* NKRO protocol */ usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); - osalSysLock(); - usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); - osalSysUnlock(); + do { + osalSysLock(); + ret = usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); + osalSysUnlock(); + } while (ret); } else #endif /* NKRO_ENABLE */ { /* boot protocol */ usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); - osalSysLock(); - usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); - osalSysUnlock(); + do { + osalSysLock(); + ret = usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); + osalSysUnlock(); + } while (ret); } keyboard_report_sent = *report; } From 7c4a2fab6d78e2f59f477bf75690a12c233b0ea7 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 17 Oct 2015 18:18:47 +0100 Subject: [PATCH 069/179] Chibios/usb_main: rename a variable for clarity. --- tmk_core/protocol/chibios/usb_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 0fc2f6e3..1ce5b4ae 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1121,24 +1121,26 @@ void send_keyboard(report_keyboard_t *report) { } osalSysUnlock(); - bool ret; + bool ep_not_ready; #ifdef NKRO_ENABLE if(keyboard_nkro) { /* NKRO protocol */ usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + /* need to wait until the previous packet has made it through */ do { osalSysLock(); - ret = usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); + ep_not_ready = usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); osalSysUnlock(); - } while (ret); + } while (ep_not_ready); } else #endif /* NKRO_ENABLE */ { /* boot protocol */ usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); + /* need to wait until the previous packet has made it through */ do { osalSysLock(); - ret = usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); + ep_not_ready = usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); osalSysUnlock(); - } while (ret); + } while (ep_not_ready); } keyboard_report_sent = *report; } From 0914c583518b3d80b668d1bc6265c15c92642047 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 17 Oct 2015 18:20:12 +0100 Subject: [PATCH 070/179] Add correct chibios/bootloader_jump for infinity KB. --- tmk_core/common/chibios/bootloader.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index cac52209..fa951128 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -23,10 +23,24 @@ void bootloader_jump(void) { #elif defined(KL2x) || defined(K20x) /* STM32_BOOTLOADER_ADDRESS */ /* Kinetis */ +#if defined(KIIBOHD_BOOTLOADER) +/* Kiibohd Bootloader (MCHCK and Infinity KB) */ +#define SCB_AIRCR (*(volatile uint32_t *)0xE000ED0C) // Application Interrupt and Reset Control +#define VBAT (*(volatile uint8_t *)0x4003E000) // VBAT register file (32 bytes) +const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; +void bootloader_jump(void) { + __builtin_memcpy((void *)&VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); + // request reset + SCB_AIRCR = 0x05FA0004; +} + +#else /* defined(KIIBOHD_BOOTLOADER) */ +/* Default for Kinetis - expecting an ARM Teensy */ void bootloader_jump(void) { chThdSleepMilliseconds(100); __BKPT(0); } +#endif /* defined(KIIBOHD_BOOTLOADER) */ #else /* neither STM32 nor KINETIS */ void bootloader_jump(void) {} From 7524f5c9c334103510aeaecd312f955421e6c86a Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 17 Oct 2015 18:23:13 +0100 Subject: [PATCH 071/179] Infinity_chibios: select correct bootloader_jump. --- keyboard/infinity_chibios/bootloader_defs.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 keyboard/infinity_chibios/bootloader_defs.h diff --git a/keyboard/infinity_chibios/bootloader_defs.h b/keyboard/infinity_chibios/bootloader_defs.h new file mode 100644 index 00000000..c67153be --- /dev/null +++ b/keyboard/infinity_chibios/bootloader_defs.h @@ -0,0 +1 @@ +#define KIIBOHD_BOOTLOADER From 44421f5bf4a15e0e0cfdcc18e9008fc242c5308a Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sun, 18 Oct 2015 10:44:08 +0100 Subject: [PATCH 072/179] ChibiOS: make reset request more CMSISy. --- tmk_core/common/chibios/bootloader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index fa951128..d19aab89 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -25,13 +25,13 @@ void bootloader_jump(void) { #if defined(KIIBOHD_BOOTLOADER) /* Kiibohd Bootloader (MCHCK and Infinity KB) */ -#define SCB_AIRCR (*(volatile uint32_t *)0xE000ED0C) // Application Interrupt and Reset Control +#define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 #define VBAT (*(volatile uint8_t *)0x4003E000) // VBAT register file (32 bytes) const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; void bootloader_jump(void) { __builtin_memcpy((void *)&VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); // request reset - SCB_AIRCR = 0x05FA0004; + SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; } #else /* defined(KIIBOHD_BOOTLOADER) */ From aef7a2973e223bbfc813c97b6244edc403051a55 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sun, 18 Oct 2015 11:37:27 +0100 Subject: [PATCH 073/179] Chibios: Add breathing sleep LED on Kinetis MCUs. --- tmk_core/common/chibios/sleep_led.c | 143 ++++++++++++++++++++++++++-- 1 file changed, 136 insertions(+), 7 deletions(-) diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c index fad7ac04..d9cdeba1 100644 --- a/tmk_core/common/chibios/sleep_led.c +++ b/tmk_core/common/chibios/sleep_led.c @@ -1,23 +1,152 @@ #include "ch.h" +#include "hal.h" #include "led.h" #include "sleep_led.h" +#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ +/* All right, we go the "software" way: LP timer, toggle LED in interrupt. + * Based on hasu's code for AVRs. + */ + +/* Breathing Sleep LED brighness(PWM On period) table + * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle + * + * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63 + * (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i } + */ +static const uint8_t breathing_table[64] = { +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, +15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, +255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, +15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* LP Timer interrupt handler */ +OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { + OSAL_IRQ_PROLOGUE(); + + /* Software PWM + * timer:1111 1111 1111 1111 + * \_____/\/ \_______/____ count(0-255) + * \ \______________ duration of step(4) + * \__________________ index of step table(0-63) + */ + + // this works for cca 65536 irqs/sec + static union { + uint16_t row; + struct { + uint8_t count:8; + uint8_t duration:2; + uint8_t index:6; + } pwm; + } timer = { .row = 0 }; + + timer.row++; + + // LED on + if (timer.pwm.count == 0) { + led_set(1<CSR |= LPTMRx_CSR_TCF; + + OSAL_IRQ_EPILOGUE(); +} + +/* LPTMR clock options */ +#define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ +#define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ +#define LPTMR_CLOCK_ERCLK32K 2 +#define LPTMR_CLOCK_OSCERCLK 3 /* output from OSC */ + +/* Work around inconsistencies in Freescale naming */ +#if !defined(SIM_SCGC5_LPTMR) +#define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER +#endif + +/* Initialise the timer */ void sleep_led_init(void) { - // we could go the 'software way' -- just enable *some* timer - // and go with callbacks - // or we could go the 'hardware way' -- and use timer output to - // pins directly + /* Make sure the clock to the LPTMR is enabled */ + SIM->SCGC5 |= SIM_SCGC5_LPTMR; + /* Reset LPTMR settings */ + LPTMR0->CSR = 0; + /* Set the compare value */ + LPTMR0->CMR = 1; // trigger on counter value (i.e. every time) + /* Set up clock source and prescaler */ + /* Software PWM + * ______ ______ __ + * | ON |___OFF___| ON |___OFF___| .... + * |<-------------->|<-------------->|<- .... + * PWM period PWM period + * + * R interrupts/period[resolution] + * F periods/second[frequency] + * R * F interrupts/second + */ + /* === OPTION 1 === */ + // for 1kHz LPO + // No prescaler => 1024 irqs/sec + // LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_LPO)|LPTMRx_PSR_PBYP; + /* === OPTION 2 === */ + // for nMHz IRC (n=4 on KL25Z, KL26Z and K20x; n=2 or 8 on KL27Z) + MCG->C2 |= MCG_C2_IRCS; // fast (4MHz) internal ref clock + #if defined(KL27Z) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others + MCG->MC |= MCG_MC_LIRC_DIV2_DIV2; + #endif /* KL27Z */ + MCG->C1 |= MCG_C1_IRCLKEN; // enable internal ref clock + // to work in stop mode, also MCG_C1_IREFSTEN + // Divide 4MHz by 2^N (N=5) => 62500 irqs/sec => + // => approx F=61, R=256, duration = 4 + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_MCGIRCLK)|LPTMRx_PSR_PRESCALE(5); + /* === OPTION 3 === */ + // for OSC output (external crystal), usually 8MHz or 16MHz + // OSC0->CR |= OSC_CR_ERCLKEN; // enable ext ref clock + // to work in stop mode, also OSC_CR_EREFSTEN + // Divide by 2^N + // LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_OSCERCLK)|LPTMRx_PSR_PRESCALE(7); + /* === END OPTIONS === */ + /* Interrupt on TCF set (compare flag) */ + nvicEnableVector(LPTMR0_IRQn, 2); // vector, priority + LPTMR0->CSR |= LPTMRx_CSR_TIE; } void sleep_led_enable(void) { - led_set(1<CSR |= LPTMRx_CSR_TEN; } void sleep_led_disable(void) { - led_set(0); + /* Disable the timer */ + LPTMR0->CSR &= ~LPTMRx_CSR_TEN; } void sleep_led_toggle(void) { - // not working yet, state not saved anywhere currently + /* Toggle the timer */ + LPTMR0->CSR ^= LPTMRx_CSR_TEN; } + +#else /* platform selection: not on familiar Kinetis chips */ + +void sleep_led_init(void) { +} + +void sleep_led_enable(void) { + led_set(1< Date: Sun, 18 Oct 2015 11:55:39 +0100 Subject: [PATCH 074/179] ChibiOS: Update infinity bootloader code to match updated ChibiOS. --- tmk_core/common/chibios/bootloader.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index d19aab89..c8888f3c 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -26,10 +26,9 @@ void bootloader_jump(void) { #if defined(KIIBOHD_BOOTLOADER) /* Kiibohd Bootloader (MCHCK and Infinity KB) */ #define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 -#define VBAT (*(volatile uint8_t *)0x4003E000) // VBAT register file (32 bytes) const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; void bootloader_jump(void) { - __builtin_memcpy((void *)&VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); + __builtin_memcpy((void *)VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); // request reset SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; } From c60dd8791808642420eea828b2217ec62fef0429 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sun, 18 Oct 2015 18:54:34 +0100 Subject: [PATCH 075/179] ChibiOS: prettify/document sleep_led code. --- tmk_core/common/chibios/sleep_led.c | 38 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c index d9cdeba1..50cf4eb7 100644 --- a/tmk_core/common/chibios/sleep_led.c +++ b/tmk_core/common/chibios/sleep_led.c @@ -22,7 +22,7 @@ static const uint8_t breathing_table[64] = { 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -/* LP Timer interrupt handler */ +/* Low Power Timer interrupt handler */ OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { OSAL_IRQ_PROLOGUE(); @@ -63,7 +63,7 @@ OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { /* LPTMR clock options */ #define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ #define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ -#define LPTMR_CLOCK_ERCLK32K 2 +#define LPTMR_CLOCK_ERCLK32K 2 /* external 32kHz crystal */ #define LPTMR_CLOCK_OSCERCLK 3 /* output from OSC */ /* Work around inconsistencies in Freescale naming */ @@ -78,7 +78,8 @@ void sleep_led_init(void) { /* Reset LPTMR settings */ LPTMR0->CSR = 0; /* Set the compare value */ - LPTMR0->CMR = 1; // trigger on counter value (i.e. every time) + LPTMR0->CMR = 0; // trigger on counter value (i.e. every time) + /* Set up clock source and prescaler */ /* Software PWM * ______ ______ __ @@ -90,28 +91,39 @@ void sleep_led_init(void) { * F periods/second[frequency] * R * F interrupts/second */ + /* === OPTION 1 === */ - // for 1kHz LPO + #if 0 + // 1kHz LPO // No prescaler => 1024 irqs/sec - // LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_LPO)|LPTMRx_PSR_PBYP; + // Note: this is too slow for a smooth breathe + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_LPO)|LPTMRx_PSR_PBYP; + #endif /* OPTION 1 */ + /* === OPTION 2 === */ - // for nMHz IRC (n=4 on KL25Z, KL26Z and K20x; n=2 or 8 on KL27Z) + #if 1 + // nMHz IRC (n=4 on KL25Z, KL26Z and K20x; n=2 or 8 on KL27Z) MCG->C2 |= MCG_C2_IRCS; // fast (4MHz) internal ref clock - #if defined(KL27Z) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others + #if defined(KL27) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others MCG->MC |= MCG_MC_LIRC_DIV2_DIV2; - #endif /* KL27Z */ + #endif /* KL27 */ MCG->C1 |= MCG_C1_IRCLKEN; // enable internal ref clock // to work in stop mode, also MCG_C1_IREFSTEN - // Divide 4MHz by 2^N (N=5) => 62500 irqs/sec => + // Divide 4MHz by 2^N (N=6) => 62500 irqs/sec => // => approx F=61, R=256, duration = 4 - LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_MCGIRCLK)|LPTMRx_PSR_PRESCALE(5); + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_MCGIRCLK)|LPTMRx_PSR_PRESCALE(6); + #endif /* OPTION 2 */ + /* === OPTION 3 === */ - // for OSC output (external crystal), usually 8MHz or 16MHz - // OSC0->CR |= OSC_CR_ERCLKEN; // enable ext ref clock + #if 0 + // OSC output (external crystal), usually 8MHz or 16MHz + OSC0->CR |= OSC_CR_ERCLKEN; // enable ext ref clock // to work in stop mode, also OSC_CR_EREFSTEN // Divide by 2^N - // LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_OSCERCLK)|LPTMRx_PSR_PRESCALE(7); + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_OSCERCLK)|LPTMRx_PSR_PRESCALE(7); + #endif /* OPTION 3 */ /* === END OPTIONS === */ + /* Interrupt on TCF set (compare flag) */ nvicEnableVector(LPTMR0_IRQn, 2); // vector, priority LPTMR0->CSR |= LPTMRx_CSR_TIE; From fa33719adab1393753312d298b8c365e04e844b9 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 21 Oct 2015 06:59:26 +0900 Subject: [PATCH 076/179] Add doc of HHKB original keycodes --- keyboard/hhkb/doc/HHKB_keycodes.txt | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 keyboard/hhkb/doc/HHKB_keycodes.txt diff --git a/keyboard/hhkb/doc/HHKB_keycodes.txt b/keyboard/hhkb/doc/HHKB_keycodes.txt new file mode 100644 index 00000000..9ec85901 --- /dev/null +++ b/keyboard/hhkb/doc/HHKB_keycodes.txt @@ -0,0 +1,69 @@ +HHKB keycodes +============= +2015/10/03 +Looked into unclear keycodes(usages) of Fn-chording-key on HHKB. +Followings are usages of Keyboard/Keypad Page(0x07) that HHKB spits out when Fn key is down. + +## HHK mode(Off-Off) + Key Usage + ------------------------ + ⌘ / ◇ 0x78 Stop + +## Lite Ext. mode(On-Off) + + +## Mac mode(Off-On) + Key Usage + ------------------------ + Esc 0x66 Power + A 0x81 Volume Down + S 0x80 Volume Up + D 0x7F Mute + F 0x6F F20 + Delete 0x53 Num Lock and Clear + + +## Secret mode(On-On) + Key Usage + ------------------------ + Esc 0x66 Power + Q 0x78 Stop + W 0x7E Find + E 0x74 Execute + R 0x77 Select + T 0x76 Menu + Y 0x75 Help + Z 0x7A Undo + X 0x7B Cut + C 0x7C Copy + V 0x7D Paste + B 0x79 Again + + +## Matrix Key-Mode + + + Mode + ------------------------------- + Key HHK Lite Mac Secret Desc + --------------------------------------------------------------------------------------- + ⌘ / ◇ 0x78 - - - Stop + Esc - - 0x66 0x66 Power + A - - 0x81 - Volume Down + S - - 0x80 - Volume Up + D - - 0x7F - Mute + F - - 0x6F - F20 + Delete 0x2A 0x2A 0x53 0x2A Num Lock and Clear(0x53)/Backspace(0x2A) + Q - - - 0x78 Stop + W - - - 0x7E Find + E - - - 0x74 Execute + R - - - 0x77 Select + T - - - 0x76 Menu + Y - - - 0x75 Help + Z - - - 0x7A Undo + X - - - 0x7B Cut + C - - - 0x7C Copy + V - - - 0x7D Paste + B - - - 0x79 Again + +EOF From e19d574b295199d32a99ebc592cdd0e5c690a2ad Mon Sep 17 00:00:00 2001 From: Ryan Riginding Date: Sat, 7 Nov 2015 17:00:28 +0100 Subject: [PATCH 077/179] add KC_MRWD and KC_MFFD to rn42 on OSX KC_MRWD and KC_MFFD are used instead of KC_MPRV and KC_MNXT --- keyboard/hhkb/rn42/rn42.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/keyboard/hhkb/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c index 756285d7..6fabf99f 100644 --- a/keyboard/hhkb/rn42/rn42.c +++ b/keyboard/hhkb/rn42/rn42.c @@ -184,20 +184,20 @@ static void send_system(uint16_t data) static uint16_t usage2bits(uint16_t usage) { switch (usage) { - case AC_HOME: return 0x01; - case AL_EMAIL: return 0x02; - case AC_SEARCH: return 0x04; + case AC_HOME: return 0x01; + case AL_EMAIL: return 0x02; + case AC_SEARCH: return 0x04; //case AL_KBD_LAYOUT: return 0x08; // Apple virtual keybaord toggle - case AUDIO_VOL_UP: return 0x10; - case AUDIO_VOL_DOWN: return 0x20; - case AUDIO_MUTE: return 0x40; - case TRANSPORT_PLAY_PAUSE: return 0x80; - case TRANSPORT_NEXT_TRACK: return 0x100; - case TRANSPORT_PREV_TRACK: return 0x200; - case TRANSPORT_STOP: return 0x400; - case TRANSPORT_STOP_EJECT: return 0x800; - //case return 0x1000; // Fast forward - //case return 0x2000; // Rewind + case AUDIO_VOL_UP: return 0x10; + case AUDIO_VOL_DOWN: return 0x20; + case AUDIO_MUTE: return 0x40; + case TRANSPORT_PLAY_PAUSE: return 0x80; + case TRANSPORT_NEXT_TRACK: return 0x100; + case TRANSPORT_PREV_TRACK: return 0x200; + case TRANSPORT_STOP: return 0x400; + case TRANSPORT_STOP_EJECT: return 0x800; + case TRANSPORT_FAST_FORWARD: return 0x1000; + case TRANSPORT_REWIND: return 0x2000; //case return 0x4000; // Stop/eject //case return 0x8000; // Internet browser }; From 14a66a181ea6d300aab199cb121027d926fd6ab6 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 8 Nov 2015 13:05:30 +0900 Subject: [PATCH 078/179] alps64: support for keymap editor --- keyboard/alps64/Makefile.keymap_editor | 4 ++ keyboard/alps64/keymap_plain.c | 59 ++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 keyboard/alps64/Makefile.keymap_editor diff --git a/keyboard/alps64/Makefile.keymap_editor b/keyboard/alps64/Makefile.keymap_editor new file mode 100644 index 00000000..d7ad0cc4 --- /dev/null +++ b/keyboard/alps64/Makefile.keymap_editor @@ -0,0 +1,4 @@ +# build firmware for keymap editor +# +KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor +include Makefile diff --git a/keyboard/alps64/keymap_plain.c b/keyboard/alps64/keymap_plain.c index a5489919..fcbec596 100644 --- a/keyboard/alps64/keymap_plain.c +++ b/keyboard/alps64/keymap_plain.c @@ -1,7 +1,23 @@ #include "keymap_common.h" -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: qwerty */ +#ifdef KEYMAP_SECTION_ENABLE +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { +#else +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { +#endif + /* 0: qwerty + * ,-----------------------------------------------------------. + * |` | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| #|Bsp| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * |-----------------------------------------------------------| + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | + * |-----------------------------------------------------------| + * |Shft| \| Z| X| C| V| B| N| M| ,| .| /|Shift |Esc| + * |-----------------------------------------------------------' + * |Ctrl|Gui |Alt | Space |App |Alt |Gui |Ctrl | + * `-----------------------------------------------------------' + */ KEYMAP( \ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ @@ -9,4 +25,41 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,ESC, \ LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,RCTL), }; -const uint16_t PROGMEM fn_actions[] = {}; +#ifdef KEYMAP_SECTION_ENABLE +const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_MOMENTARY(3), + [3] = ACTION_LAYER_MOMENTARY(4), + [4] = ACTION_LAYER_MOMENTARY(5), + [5] = ACTION_LAYER_MOMENTARY(6), + [6] = ACTION_LAYER_MOMENTARY(7), + [7] = ACTION_LAYER_TOGGLE(1), + [8] = ACTION_LAYER_TOGGLE(2), + [9] = ACTION_LAYER_TOGGLE(3), + [10] = ACTION_LAYER_TAP_TOGGLE(1), + [11] = ACTION_LAYER_TAP_TOGGLE(2), + [12] = ACTION_LAYER_TAP_TOGGLE(3), + [13] = ACTION_LAYER_TAP_KEY(1, KC_A), + [14] = ACTION_LAYER_TAP_KEY(2, KC_F), + [15] = ACTION_LAYER_TAP_KEY(3, KC_J), + [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), + [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), + [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), + [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), + [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), + [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), + [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), + [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), + [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), + [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), + [26] = ACTION_MODS_ONESHOT(MOD_LCTL), + [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), + [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), + [29] = ACTION_MODS_ONESHOT(MOD_LSFT), + [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), + [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), +}; +#else +const uint16_t fn_actions[] PROGMEM = {}; +#endif From db2015a6b2d01c765dbd5ef2d13f160ab69965f4 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 9 Nov 2015 11:21:45 +0900 Subject: [PATCH 079/179] hhkb: fix for keymap editor --- keyboard/hhkb/Makefile.keymap_editor | 5 +++++ keyboard/hhkb/Makefile.rn42 | 4 ++-- keyboard/hhkb/Makefile.rn42.keymap_editor | 5 +++++ keyboard/hhkb/config_rn42.h | 2 +- keyboard/hhkb/keymap_hhkb.c | 4 ++-- 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 keyboard/hhkb/Makefile.keymap_editor create mode 100644 keyboard/hhkb/Makefile.rn42.keymap_editor diff --git a/keyboard/hhkb/Makefile.keymap_editor b/keyboard/hhkb/Makefile.keymap_editor new file mode 100644 index 00000000..77a13e68 --- /dev/null +++ b/keyboard/hhkb/Makefile.keymap_editor @@ -0,0 +1,5 @@ +# build firmware for keymap editor +# +KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor +include Makefile + diff --git a/keyboard/hhkb/Makefile.rn42 b/keyboard/hhkb/Makefile.rn42 index cbb2b744..8cb44352 100644 --- a/keyboard/hhkb/Makefile.rn42 +++ b/keyboard/hhkb/Makefile.rn42 @@ -108,12 +108,12 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # Build Options # comment out to disable the options. # -#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration -#NKRO_ENABLE = yes # USB Nkey Rollover +NKRO_ENABLE = yes # USB Nkey Rollover #KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor #HHKB_JP = yes # HHKB JP support diff --git a/keyboard/hhkb/Makefile.rn42.keymap_editor b/keyboard/hhkb/Makefile.rn42.keymap_editor new file mode 100644 index 00000000..6e55f694 --- /dev/null +++ b/keyboard/hhkb/Makefile.rn42.keymap_editor @@ -0,0 +1,5 @@ +# build firmware for keymap editor +# +KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor +include Makefile.rn42 + diff --git a/keyboard/hhkb/config_rn42.h b/keyboard/hhkb/config_rn42.h index 21e73f1c..df75fba5 100644 --- a/keyboard/hhkb/config_rn42.h +++ b/keyboard/hhkb/config_rn42.h @@ -48,7 +48,7 @@ along with this program. If not, see . #define ONESHOT_TIMEOUT 300 /* Boot Magic salt key: Space */ -#define BOOTMAGIC_KEY_SALT KC_FN6 +#define BOOTMAGIC_KEY_SALT KC_SPACE /* power control of key switch board */ #define HHKB_POWER_SAVING diff --git a/keyboard/hhkb/keymap_hhkb.c b/keyboard/hhkb/keymap_hhkb.c index 86ad0f5e..f0552a37 100644 --- a/keyboard/hhkb/keymap_hhkb.c +++ b/keyboard/hhkb/keymap_hhkb.c @@ -85,8 +85,8 @@ const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), [29] = ACTION_MODS_ONESHOT(MOD_LSFT), - [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ESC), - [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSPACE), + [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), + [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), }; #else const uint16_t fn_actions[] PROGMEM = { From df1b665a3cc5fdab60a0f6520a34d64da8f9f764 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Tue, 10 Nov 2015 20:54:01 +0000 Subject: [PATCH 080/179] Infinity_chibios: improve comments. --- keyboard/infinity_chibios/Makefile | 8 +++++--- keyboard/infinity_chibios/config.h | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/keyboard/infinity_chibios/Makefile b/keyboard/infinity_chibios/Makefile index 6fca4890..9999451c 100644 --- a/keyboard/infinity_chibios/Makefile +++ b/keyboard/infinity_chibios/Makefile @@ -25,6 +25,7 @@ CONFIG_H = config.h # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) # - For Teensies, FAMILY = KINETIS and SERIES is either # KL2x (LC) or K20x (3.0,3.1,3.2). +# - For Infinity KB, SERIES = K20x MCU_FAMILY = KINETIS MCU_SERIES = K20x @@ -36,14 +37,14 @@ MCU_SERIES = K20x # - MKL26Z64 for Teensy LC # - MK20DX128 for Teensy 3.0 # - MK20DX256 for Teensy 3.1 and 3.2 -#MCU_LDSCRIPT = MK20DX128 +# - MK20DX128BLDR4 for Infinity with Kiibohd bootloader MCU_LDSCRIPT = MK20DX128BLDR4 # Startup code to use # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ # - STARTUP = # - kl2x for Teensy LC -# - k20x5 for Teensy 3.0 +# - k20x5 for Teensy 3.0 and Infinity KB # - k20x7 for Teensy 3.1 and 3.2 MCU_STARTUP = k20x5 @@ -53,6 +54,7 @@ MCU_STARTUP = k20x5 # - PJRC_TEENSY_LC for Teensy LC # - PJRC_TEENSY_3 for Teensy 3.0 # - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2 +# - MCHCK_K20 for Infinity KB BOARD = MCHCK_K20 # Cortex version @@ -65,9 +67,9 @@ ARMV = 7 # Vector table for application # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ +# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB OPT_DEFS = -DCORTEX_VTOR_INIT=0x00001000 - # Build Options # comment out to disable the options. # diff --git a/keyboard/infinity_chibios/config.h b/keyboard/infinity_chibios/config.h index b4b7fcd3..cb902220 100644 --- a/keyboard/infinity_chibios/config.h +++ b/keyboard/infinity_chibios/config.h @@ -27,9 +27,8 @@ along with this program. If not, see . /* at most 32 characters or the ugly hack in usb_main.c borks */ #define MANUFACTURER "TMK" #define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' -#define PRODUCT "ChibiOS TMK test" -#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' -#define DESCRIPTION "TMK keyboard firmware over ChibiOS" +#define PRODUCT "Infinity keyboard/TMK" +#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00' /* key matrix size */ #define MATRIX_ROWS 9 From 41f5be3b7a145b71fdb14f6a6912d7fec874e515 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 14 Nov 2015 09:17:01 +0000 Subject: [PATCH 081/179] Chibios: Remove the wait in the main loop. --- tmk_core/protocol/chibios/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 9607f1a9..b62cfa9c 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -135,6 +135,5 @@ int main(void) { } keyboard_task(); - chThdSleepMilliseconds(5); } } From 6cd178ced98017ff59a7fe8cd94fd00fa9043023 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 18 Nov 2015 14:07:19 +0900 Subject: [PATCH 082/179] core: Add keycode KC_JPY for JIS --- tmk_core/common/keycode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 44819530..a7d837b3 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -92,6 +92,7 @@ along with this program. If not, see . #define KC_RO KC_INT1 #define KC_KANA KC_INT2 #define KC_JYEN KC_INT3 +#define KC_JPY KC_INT3 #define KC_HENK KC_INT4 #define KC_MHEN KC_INT5 /* Keypad */ From 706b2776464200a5723ac41d58ad7918d72460bb Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 18 Nov 2015 14:17:51 +0900 Subject: [PATCH 083/179] usb_usb: Add keymap of iso and of jis --- converter/usb_usb/keymap_common.h | 161 ++++++++++++++++++++++++++++++ converter/usb_usb/keymap_iso.c | 36 +++++++ converter/usb_usb/keymap_jis.c | 36 +++++++ 3 files changed, 233 insertions(+) create mode 100644 converter/usb_usb/keymap_iso.c create mode 100644 converter/usb_usb/keymap_jis.c diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h index 435d83fd..e1bc9811 100644 --- a/converter/usb_usb/keymap_common.h +++ b/converter/usb_usb/keymap_common.h @@ -32,6 +32,21 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; +/* ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |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, \ @@ -74,4 +89,150 @@ extern const uint16_t fn_actions[]; { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ } +/* ,---------------. ,---------------. ,---------------. + * |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|Ent| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |-----------| | |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0|KP=| .| | |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,K58, K74,K7D, \ + KE0,KE3,KE2,K8B,K91,K2C, K90,K8A,K88,KE6,KE7,K65, KE4, K50,K51,K4F, K62,K67,K63, 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| [| ]| 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, BSLS,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,K58, NO, NO, \ + KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65, KE4, K50,K51,K4F, K62,NO, K63, 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|MHN| Space |HNK|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, BSLS,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,K58, NO, NO, \ + KE0,KE3,KE2,K8B,NO, K2C, NO, K8A,K88,KE6,KE7,K65, KE4, K50,K51,K4F, K62,NO, K63, NO, NO \ +) #endif diff --git a/converter/usb_usb/keymap_iso.c b/converter/usb_usb/keymap_iso.c new file mode 100644 index 00000000..f22a8405 --- /dev/null +++ b/converter/usb_usb/keymap_iso.c @@ -0,0 +1,36 @@ +#include "keymap_common.h" + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* Layer 0: Default Layer + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |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| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [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 + ), +}; + + +/* + * Fn action definition + */ +const uint16_t fn_actions[] PROGMEM = { +}; diff --git a/converter/usb_usb/keymap_jis.c b/converter/usb_usb/keymap_jis.c new file mode 100644 index 00000000..694d9ffb --- /dev/null +++ b/converter/usb_usb/keymap_jis.c @@ -0,0 +1,36 @@ +#include "keymap_common.h" + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* Layer 0: Default Layer + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |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|MHN| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [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,HENK, SPC, MHEN,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + ), +}; + + +/* + * Fn action definition + */ +const uint16_t fn_actions[] PROGMEM = { +}; From e5bad3f3b7187093e581696cafb7280ff517741c Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 18 Nov 2015 14:18:59 +0900 Subject: [PATCH 084/179] core: Fix debug print of usb_hid --- tmk_core/protocol/usb_hid/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp index 1a152ff3..fe002c0d 100644 --- a/tmk_core/protocol/usb_hid/parser.cpp +++ b/tmk_core/protocol/usb_hid/parser.cpp @@ -13,7 +13,7 @@ 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; - dprintf("KBDReport: %02X %02X", report->mods, report->reserved); + dprintf("keyboard input: %02X %02X", report->mods, report->reserved); for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { if (IS_ERROR(report->keys[i])) { is_error = true; From 2f3f17dba2065f92ce4e1ea7cd6351ee7357f968 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 21 Nov 2015 16:05:42 +0900 Subject: [PATCH 085/179] usb_usb: Fix JIS keymap --- converter/usb_usb/keymap_common.h | 2 +- converter/usb_usb/keymap_jis.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h index e1bc9811..8de4dce0 100644 --- a/converter/usb_usb/keymap_common.h +++ b/converter/usb_usb/keymap_common.h @@ -216,7 +216,7 @@ extern const uint16_t fn_actions[]; * |-----------------------------------------------------------| ,---. |---------------| * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| * |-----------------------------------------------------------| ,-----------. |-----------| | - * |Ctl|Gui|Alt|MHN| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | * `-----------------------------------------------------------' `-----------' `---------------' */ #define KEYMAP_JIS( \ diff --git a/converter/usb_usb/keymap_jis.c b/converter/usb_usb/keymap_jis.c index 694d9ffb..d164dcec 100644 --- a/converter/usb_usb/keymap_jis.c +++ b/converter/usb_usb/keymap_jis.c @@ -14,7 +14,7 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { * |-----------------------------------------------------------| ,---. |---------------| * |Shft | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|Ent| * |-----------------------------------------------------------| ,-----------. |-----------| | - * |Ctl|Gui|Alt|MHN| Space |HNK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | + * |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| | * `-----------------------------------------------------------' `-----------' `---------------' */ [0] = \ @@ -24,7 +24,7 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { 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,HENK, SPC, MHEN,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT + LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT ), }; From 81807dd2a61e63fbd6976bfc7235d770964866bc Mon Sep 17 00:00:00 2001 From: Jeff Gran Date: Thu, 26 Nov 2015 00:42:42 -0700 Subject: [PATCH 086/179] enable TAPPING_TOGGLE=1 to work correctly if TAPPING_TOGGLE is 1, then tap a single time should toggle the mods on/off each tap. Previously this was broken, this fixes it. This allows the same key to either hold (momentary mod) or tap (toggle mod, like capslock). --- tmk_core/common/action.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 1f15bd09..339b3ee6 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -131,10 +131,17 @@ void process_action(keyrecord_t *record) case MODS_TAP_TOGGLE: if (event.pressed) { if (tap_count <= TAPPING_TOGGLE) { - register_mods(mods); + if (mods & get_mods()) { + dprint("MODS_TAP_TOGGLE: toggle mods off\n"); + unregister_mods(mods); + } else { + dprint("MODS_TAP_TOGGLE: toggle mods on\n"); + register_mods(mods); + } } } else { if (tap_count < TAPPING_TOGGLE) { + dprint("MODS_TAP_TOGGLE: release : unregister_mods\n"); unregister_mods(mods); } } From 681464c0f7b7752badfaa685c94c88e395f7a176 Mon Sep 17 00:00:00 2001 From: Jeff Gran Date: Thu, 26 Nov 2015 00:57:07 -0700 Subject: [PATCH 087/179] add ACTION_DEFAULT_LAYER_TOGGLE to toggle a default layer on/off --- tmk_core/common/action_code.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index 4fe9c1d5..da93f77b 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -255,6 +255,7 @@ enum layer_pram_tap_op { #define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) /* Default Layer */ #define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4)) +#define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4)) /* Layer Operation */ #define ACTION_LAYER_CLEAR(on) ACTION_LAYER_BIT_AND(0, 0, (on)) #define ACTION_LAYER_MOMENTARY(layer) ACTION_LAYER_ON_OFF(layer) From d0f174911e84be47d0f3b3d98b7d1adeb38b5411 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 27 Nov 2015 07:19:19 +0900 Subject: [PATCH 088/179] core: Fix rules.mk for dfu target --- tmk_core/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 860fc1a9..0ae84d91 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -425,7 +425,6 @@ ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) else dfu-programmer $(MCU) erase endif - dfu-programmer $(MCU) erase dfu-programmer $(MCU) flash $(TARGET).hex dfu-programmer $(MCU) reset From 39c0c27587a76e94996f2f17fef94c8b90c73bf6 Mon Sep 17 00:00:00 2001 From: Aurelien Bondis Date: Mon, 30 Nov 2015 17:36:15 +0000 Subject: [PATCH 089/179] Add generic STM32F103C8T6 example. --- keyboard/stm32_f103_onekey/Makefile | 80 +++ .../boards/GENERIC_STM32_F103/board.c | 49 ++ .../boards/GENERIC_STM32_F103/board.h | 166 ++++++ .../boards/GENERIC_STM32_F103/board.mk | 5 + .../GENERIC_STM32_F103/mini_stm32_mapping.png | Bin 0 -> 162908 bytes keyboard/stm32_f103_onekey/bootloader_defs.h | 10 + keyboard/stm32_f103_onekey/chconf.h | 503 ++++++++++++++++++ keyboard/stm32_f103_onekey/config.h | 74 +++ keyboard/stm32_f103_onekey/flash.sh | 2 + keyboard/stm32_f103_onekey/halconf.h | 334 ++++++++++++ keyboard/stm32_f103_onekey/keymap_plain.c | 44 ++ keyboard/stm32_f103_onekey/ld/STM32F103x8.ld | 53 ++ .../ld/STM32F103x8_stm32duino_bootloader.ld | 53 ++ keyboard/stm32_f103_onekey/led.c | 32 ++ keyboard/stm32_f103_onekey/matrix.c | 163 ++++++ keyboard/stm32_f103_onekey/mcuconf.h | 172 ++++++ 16 files changed, 1740 insertions(+) create mode 100644 keyboard/stm32_f103_onekey/Makefile create mode 100644 keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c create mode 100644 keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h create mode 100644 keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk create mode 100644 keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png create mode 100644 keyboard/stm32_f103_onekey/bootloader_defs.h create mode 100644 keyboard/stm32_f103_onekey/chconf.h create mode 100644 keyboard/stm32_f103_onekey/config.h create mode 100755 keyboard/stm32_f103_onekey/flash.sh create mode 100644 keyboard/stm32_f103_onekey/halconf.h create mode 100644 keyboard/stm32_f103_onekey/keymap_plain.c create mode 100644 keyboard/stm32_f103_onekey/ld/STM32F103x8.ld create mode 100644 keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld create mode 100644 keyboard/stm32_f103_onekey/led.c create mode 100644 keyboard/stm32_f103_onekey/matrix.c create mode 100644 keyboard/stm32_f103_onekey/mcuconf.h diff --git a/keyboard/stm32_f103_onekey/Makefile b/keyboard/stm32_f103_onekey/Makefile new file mode 100644 index 00000000..ea2ee08b --- /dev/null +++ b/keyboard/stm32_f103_onekey/Makefile @@ -0,0 +1,80 @@ +# Target file name (without extension). +PROJECT = ch +TARGET = alps64 + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +# GENERIC STM32F103C8T6 board - stm32duino bootloader +# OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 +# MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader +# BOARD = GENERIC_STM32_F103 + +# GENERIC STM32F103C8T6 board - no bootloader (programmer over serial or SWD) +OPT_DEFS = +MCU_LDSCRIPT = STM32F103x8 +BOARD = GENERIC_STM32_F103 + +# MAPLE MINI +# OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 +# MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader.ld +# BOARD = MAPLEMINI_STM32_F103 + +## chip/board settings +# the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +MCU_FAMILY = STM32 +MCU_SERIES = STM32F1xx +# linker script to use +# it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# startup code to use +# is should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +MCU_STARTUP = stm32f1xx +# it should exist either in /os/hal/boards/ +# or /boards +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m3 +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +ARMV = 7 +# If you want to be able to jump to bootloader from firmware on STM32 MCUs, +# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in +# ./bootloader_defs.h or in ./boards//bootloader_defs.h (if you have +# a custom board definition that you plan to reuse). +# If you're not setting it here, leave it commented out. +# It is chip dependent, the correct number can be looked up here (page 175): +# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf +# This also requires a patch to chibios: +# /tmk_core/tool/chibios/ch-bootloader-jump.patch +#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 + +# Build Options +# comment out to disable the options. +# +#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## BOOTMAGIC is not supported on STM32 chips yet. +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk diff --git a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c new file mode 100644 index 00000000..31319ef5 --- /dev/null +++ b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c @@ -0,0 +1,49 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "hal.h" + +/** + * @brief PAL setup. + * @details Digital I/O ports static configuration as defined in @p board.h. + * This variable is used by the HAL when initializing the PAL driver. + */ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = +{ + {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, + {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, + {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, + {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, + {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + + stm32_clock_init(); +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { +} diff --git a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h new file mode 100644 index 00000000..ef7318ee --- /dev/null +++ b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h @@ -0,0 +1,166 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Setup for a Generic STM32F103 board. + */ + +/* + * Board identifier. + */ +#define BOARD_GENERIC_STM32_F103 +#define BOARD_NAME "Generic STM32F103x board" + +/* + * Board frequencies. + */ +#define STM32_LSECLK 32768 +#define STM32_HSECLK 8000000 + +/* + * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. + */ +#define STM32F103xB + +/* + * IO pins assignments + */ + +/* on-board */ + +#define GPIOC_LED 13 +#define GPIOD_OSC_IN 0 +#define GPIOD_OSC_OUT 1 + +/* In case your board has a "USB enable" hardware + controlled by a pin, define it here. (It could be just + a 1.5k resistor connected to D+ line.) +*/ +/* +#define GPIOB_USB_DISC 10 +*/ + +/* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * + * The digits have the following meaning: + * 0 - Analog input. + * 1 - Push Pull output 10MHz. + * 2 - Push Pull output 2MHz. + * 3 - Push Pull output 50MHz. + * 4 - Digital input. + * 5 - Open Drain output 10MHz. + * 6 - Open Drain output 2MHz. + * 7 - Open Drain output 50MHz. + * 8 - Digital input with PullUp or PullDown resistor depending on ODR. + * 9 - Alternate Push Pull output 10MHz. + * A - Alternate Push Pull output 2MHz. + * B - Alternate Push Pull output 50MHz. + * C - Reserved. + * D - Alternate Open Drain output 10MHz. + * E - Alternate Open Drain output 2MHz. + * F - Alternate Open Drain output 50MHz. + * Please refer to the STM32 Reference Manual for details. + */ + +/* + * Port A setup. + * Everything input with pull-up except: + * PA2 - Alternate output (USART2 TX). + * PA3 - Normal input (USART2 RX). + * PA9 - Alternate output (USART1 TX). + * PA10 - Normal input (USART1 RX). + */ +#define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ +#define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ +#define VAL_GPIOAODR 0xFFFFFFFF + +/* + * Port B setup. + * Everything input with pull-up except: + * PB10 - Push Pull output (USB switch). + */ +#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ +#define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */ +#define VAL_GPIOBODR 0xFFFFFFFF + +/* + * Port C setup. + * Everything input with pull-up except: + * PC13 - Push Pull output (LED). + */ +#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ +#define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */ +#define VAL_GPIOCODR 0xFFFFFFFF + +/* + * Port D setup. + * Everything input with pull-up except: + * PD0 - Normal input (XTAL). + * PD1 - Normal input (XTAL). + */ +#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ +#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ +#define VAL_GPIODODR 0xFFFFFFFF + +/* + * Port E setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ +#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ +#define VAL_GPIOEODR 0xFFFFFFFF + +/* + * USB bus activation macro, required by the USB driver. + */ +/* The point is that most of the generic STM32F103* boards + have a 1.5k resistor connected on one end to the D+ line + and on the other end to some pin. Or even a slightly more + complicated "USB enable" circuit, controlled by a pin. + That should go here. + + However on some boards (e.g. one that I have), there's no + such hardware. In which case it's better to not do anything. +*/ +/* +#define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) +*/ +#define usb_lld_connect_bus(usbp) + +/* + * USB bus de-activation macro, required by the USB driver. + */ +/* +#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) +*/ +#define usb_lld_disconnect_bus(usbp) + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ diff --git a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk new file mode 100644 index 00000000..a87d78b6 --- /dev/null +++ b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = ./boards/GENERIC_STM32_F103/board.c + +# Required include directories +BOARDINC = ./boards/GENERIC_STM32_F103 diff --git a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png new file mode 100644 index 0000000000000000000000000000000000000000..c44a7d9ebcbf5f50ce5ad9a191bcf50cae2b2522 GIT binary patch literal 162908 zcmeFYWl$Vn^frhDNFYc;LeK$1aCdhI5Zv8e2X_q#gy6y5Ew~OgxVr=$++i39?y!^O z_wHN&-P-T_;jNmP>h7A`=iVdFdCs}rVM+>8nCOJ)2nYz6GSU(%2nfhB2na}|&ynC) z=volqCkW3hMdd{i5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ua`n3w`$A2=G7T=9SSI37-tqM3Ot_Hnzb4OPm8c7MJ`^L{Z4_mel+bYZd9#^1Ql zcC-NhYP_P@#rU{pv8iAMcp*NtH?nx|mu>-z9y9B70gDKi+L1w/tmk_core/tool/chibios/ch-bootloader-jump.patch + */ + +// STM32F103* does NOT have an USB bootloader in ROM (only serial), +// so setting anything here does not make much sense +// #define STM32_BOOTLOADER_ADDRESS 0x1FFFC800 diff --git a/keyboard/stm32_f103_onekey/chconf.h b/keyboard/stm32_f103_onekey/chconf.h new file mode 100644 index 00000000..689d4b39 --- /dev/null +++ b/keyboard/stm32_f103_onekey/chconf.h @@ -0,0 +1,503 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 16 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 10000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 0 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_QUEUES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE FALSE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP FALSE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS FALSE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK FALSE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS FALSE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS FALSE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_TRACE FALSE + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK FALSE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS FALSE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/keyboard/stm32_f103_onekey/config.h b/keyboard/stm32_f103_onekey/config.h new file mode 100644 index 00000000..8063c57e --- /dev/null +++ b/keyboard/stm32_f103_onekey/config.h @@ -0,0 +1,74 @@ +/* +Copyright 2015 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 + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +/* in python2: list(u"whatever".encode('utf-16-le')) */ +/* at most 32 characters or the ugly hack in usb_main.c borks */ +#define MANUFACTURER "TMK" +#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' +#define PRODUCT "ChibiOS TMK test" +#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' +#define DESCRIPTION "TMK keyboard firmware over ChibiOS" + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* 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/keyboard/stm32_f103_onekey/flash.sh b/keyboard/stm32_f103_onekey/flash.sh new file mode 100755 index 00000000..15501dfa --- /dev/null +++ b/keyboard/stm32_f103_onekey/flash.sh @@ -0,0 +1,2 @@ +#!/bin/bash +Arduino_STM32_usb_hid/tools/linux/maple_upload ttyACM0 2 1EAF:0003 build/ch.bin diff --git a/keyboard/stm32_f103_onekey/halconf.h b/keyboard/stm32_f103_onekey/halconf.h new file mode 100644 index 00000000..d3415c55 --- /dev/null +++ b/keyboard/stm32_f103_onekey/halconf.h @@ -0,0 +1,334 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboard/stm32_f103_onekey/keymap_plain.c b/keyboard/stm32_f103_onekey/keymap_plain.c new file mode 100644 index 00000000..8de1c027 --- /dev/null +++ b/keyboard/stm32_f103_onekey/keymap_plain.c @@ -0,0 +1,44 @@ +/* +Copyright 2012,2013 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 "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "host.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + +static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + {{KC_CAPS}}, // test with KC_CAPS, KC_A, KC_BTLD +}; + +static const uint16_t fn_actions[] = { +}; + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return keymaps[(layer)][(key.row)][(key.col)]; +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = fn_actions[FN_INDEX(keycode)] }; +} diff --git a/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld b/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld new file mode 100644 index 00000000..54105375 --- /dev/null +++ b/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld @@ -0,0 +1,53 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. + + This file is part of ChibiOS. + + ChibiOS 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 3 of the License, or + (at your option) any later version. + + ChibiOS 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 . +*/ + +/* + * ST32F103xB memory setup. + */ +MEMORY +{ + flash : org = 0x08000000, len = 64k + ram0 : org = 0x20000000, len = 20k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +INCLUDE rules.ld diff --git a/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld new file mode 100644 index 00000000..425616af --- /dev/null +++ b/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld @@ -0,0 +1,53 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. + + This file is part of ChibiOS. + + ChibiOS 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 3 of the License, or + (at your option) any later version. + + ChibiOS 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 . +*/ + +/* + * ST32F103xB memory setup. + */ +MEMORY +{ + flash : org = 0x08002000, len = 64k - 0x2000 + ram0 : org = 0x20000C00, len = 20k - 0xC00 + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +INCLUDE rules.ld diff --git a/keyboard/stm32_f103_onekey/led.c b/keyboard/stm32_f103_onekey/led.c new file mode 100644 index 00000000..ddacfd8c --- /dev/null +++ b/keyboard/stm32_f103_onekey/led.c @@ -0,0 +1,32 @@ +/* +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 "hal.h" +#include "led.h" + + +void led_set(uint8_t usb_led) +{ + if (usb_led & (1< + +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 "ch.h" +#include "hal.h" + +/* + * scan matrix + */ +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "wait.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif +static uint8_t debouncing = DEBOUNCE; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +#define LED_ON() do { palClearPad(GPIOC, GPIOC_LED) ;} while (0) +#define LED_OFF() do { palSetPad(GPIOC, GPIOC_LED); } while (0) +#define LED_TGL() do { palTogglePad(GPIOC, GPIOC_LED); } while (0) + +void matrix_init(void) +{ + // initialize row and col + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + //debug + debug_matrix = true; + LED_ON(); + wait_ms(500); + LED_OFF(); +} + +uint8_t matrix_scan(void) +{ + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + select_row(i); + wait_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i] != cols) { + matrix_debouncing[i] = cols; + if (debouncing) { + debug("bounce!: "); debug_hex(debouncing); debug("\n"); + } + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + wait_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + return 1; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1< Date: Thu, 3 Dec 2015 08:49:55 +0000 Subject: [PATCH 090/179] Add maple mini code. --- keyboard/stm32_f103_onekey/Makefile | 15 ++- keyboard/stm32_f103_onekey/chconf.h | 8 +- keyboard/stm32_f103_onekey/led.c | 16 ++- keyboard/stm32_f103_onekey/matrix.c | 14 +++ keyboard/stm32_f103_onekey/mcuconf.h | 145 +++++++++++++++++---------- tmk_core/protocol/chibios/usb_main.c | 4 +- 6 files changed, 133 insertions(+), 69 deletions(-) diff --git a/keyboard/stm32_f103_onekey/Makefile b/keyboard/stm32_f103_onekey/Makefile index ea2ee08b..89e58144 100644 --- a/keyboard/stm32_f103_onekey/Makefile +++ b/keyboard/stm32_f103_onekey/Makefile @@ -1,6 +1,5 @@ # Target file name (without extension). PROJECT = ch -TARGET = alps64 # Directory common source files exist TMK_DIR = ../../tmk_core @@ -26,14 +25,14 @@ CONFIG_H = config.h # BOARD = GENERIC_STM32_F103 # GENERIC STM32F103C8T6 board - no bootloader (programmer over serial or SWD) -OPT_DEFS = -MCU_LDSCRIPT = STM32F103x8 -BOARD = GENERIC_STM32_F103 +# OPT_DEFS = +# MCU_LDSCRIPT = STM32F103x8 +# BOARD = GENERIC_STM32_F103 # MAPLE MINI -# OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 -# MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader.ld -# BOARD = MAPLEMINI_STM32_F103 +OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 +MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader +BOARD = MAPLEMINI_STM32_F103 ## chip/board settings # the next two should match the directories in @@ -71,7 +70,7 @@ ARMV = 7 ## BOOTMAGIC is not supported on STM32 chips yet. MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug +# CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover diff --git a/keyboard/stm32_f103_onekey/chconf.h b/keyboard/stm32_f103_onekey/chconf.h index 689d4b39..acce6a1f 100644 --- a/keyboard/stm32_f103_onekey/chconf.h +++ b/keyboard/stm32_f103_onekey/chconf.h @@ -46,7 +46,7 @@ * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ -#define CH_CFG_ST_FREQUENCY 10000 +#define CH_CFG_ST_FREQUENCY 2000 /** * @brief Time delta constant for the tick-less mode. @@ -124,7 +124,7 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ -#define CH_CFG_OPTIMIZE_SPEED FALSE +#define CH_CFG_OPTIMIZE_SPEED TRUE /** @} */ @@ -281,7 +281,7 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MEMCORE FALSE +#define CH_CFG_USE_MEMCORE TRUE /** * @brief Heap Allocator APIs. @@ -293,7 +293,7 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ -#define CH_CFG_USE_HEAP FALSE +#define CH_CFG_USE_HEAP TRUE /** * @brief Memory Pools Allocator APIs. diff --git a/keyboard/stm32_f103_onekey/led.c b/keyboard/stm32_f103_onekey/led.c index ddacfd8c..3c86963c 100644 --- a/keyboard/stm32_f103_onekey/led.c +++ b/keyboard/stm32_f103_onekey/led.c @@ -22,11 +22,25 @@ along with this program. If not, see . void led_set(uint8_t usb_led) { if (usb_led & (1<CTL &= ~USBx_CTL_RESUME; #endif /* KINETIS_USB_USE_USB0 */ -#elif defined(STM32F0XX) /* K20x || KL2x */ +#elif defined(STM32F0XX) || defined(STM32F1XX) /* K20x || KL2x */ STM32_USB->CNTR |= CNTR_RESUME; chThdSleepMilliseconds(15); STM32_USB->CNTR &= ~CNTR_RESUME; -#else /* STM32F0XX */ +#else /* STM32F0XX || STM32F1XX */ #warning Sending remote wakeup packet not implemented for your platform. #endif /* K20x || KL2x */ } From b110884a6d55a7d126e59a43e6481ca51c52e5e8 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 3 Dec 2015 09:05:09 +0000 Subject: [PATCH 091/179] Workaround for compiler warnings when console disabled. --- tmk_core/common/command.c | 10 ++++++---- tmk_core/common/nodebug.h | 2 ++ tmk_core/common/print.h | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 4ef0b077..69209700 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -350,10 +350,11 @@ static bool command_common(uint8_t code) case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; - if (keyboard_nkro) + if (keyboard_nkro) { print("NKRO: on\n"); - else + } else { print("NKRO: off\n"); + } break; #endif case KC_ESC: @@ -607,10 +608,11 @@ static bool mousekey_console(uint8_t code) print("?"); return false; } - if (mousekey_param) + if (mousekey_param) { xprintf("M%d> ", mousekey_param); - else + } else { print("M>" ); + } return true; } #endif diff --git a/tmk_core/common/nodebug.h b/tmk_core/common/nodebug.h index 93309ada..6ef9f91a 100644 --- a/tmk_core/common/nodebug.h +++ b/tmk_core/common/nodebug.h @@ -18,7 +18,9 @@ along with this program. If not, see . #ifndef NODEBUG_H #define NODEBUG_H 1 +#if !defined(NO_DEBUG) #define NO_DEBUG +#endif #include "debug.h" #undef NO_DEBUG diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index 1e1b9b40..5f491aba 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h @@ -99,9 +99,9 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #else /* NO_PRINT */ -#define xprintf -#define print -#define println +#define xprintf(s,...) +#define print(s) +#define println(s) #define print_set_sendchar(func) #define print_dec(data) #define print_decs(data) @@ -127,6 +127,7 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #define print_val_bin_reverse8(v) #define print_val_bin_reverse16(v) #define print_val_bin_reverse32(v) +#define init_printf(s,ss) #endif /* NO_PRINT */ From 7aab3bb21a3a62ce85a1f4b042508a335d6ed028 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 3 Dec 2015 09:24:49 +0000 Subject: [PATCH 092/179] STM32F103x fixes. --- keyboard/stm32_f103_onekey/Makefile | 12 ++++++------ .../boards/GENERIC_STM32_F103/board.h | 4 ++-- keyboard/stm32_f103_onekey/led.c | 7 ++----- keyboard/stm32_f103_onekey/matrix.c | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/keyboard/stm32_f103_onekey/Makefile b/keyboard/stm32_f103_onekey/Makefile index 89e58144..79ca4238 100644 --- a/keyboard/stm32_f103_onekey/Makefile +++ b/keyboard/stm32_f103_onekey/Makefile @@ -20,9 +20,9 @@ endif CONFIG_H = config.h # GENERIC STM32F103C8T6 board - stm32duino bootloader -# OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 -# MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader -# BOARD = GENERIC_STM32_F103 +OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 +MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader +BOARD = GENERIC_STM32_F103 # GENERIC STM32F103C8T6 board - no bootloader (programmer over serial or SWD) # OPT_DEFS = @@ -30,9 +30,9 @@ CONFIG_H = config.h # BOARD = GENERIC_STM32_F103 # MAPLE MINI -OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 -MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader -BOARD = MAPLEMINI_STM32_F103 +# OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 +# MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader +# BOARD = MAPLEMINI_STM32_F103 ## chip/board settings # the next two should match the directories in diff --git a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h index ef7318ee..7253e778 100644 --- a/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h +++ b/keyboard/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h @@ -143,7 +143,7 @@ /* #define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) */ -#define usb_lld_connect_bus(usbp) +#define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); /* * USB bus de-activation macro, required by the USB driver. @@ -151,7 +151,7 @@ /* #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) */ -#define usb_lld_disconnect_bus(usbp) +#define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12); #if !defined(_FROM_ASM_) #ifdef __cplusplus diff --git a/keyboard/stm32_f103_onekey/led.c b/keyboard/stm32_f103_onekey/led.c index 3c86963c..f5c55f7d 100644 --- a/keyboard/stm32_f103_onekey/led.c +++ b/keyboard/stm32_f103_onekey/led.c @@ -24,23 +24,20 @@ void led_set(uint8_t usb_led) if (usb_led & (1< Date: Thu, 3 Dec 2015 09:26:22 +0000 Subject: [PATCH 093/179] Add maple mini pinout pic. --- .../boards/maple_mini_mapping.png | Bin 0 -> 237977 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 keyboard/stm32_f103_onekey/boards/maple_mini_mapping.png diff --git a/keyboard/stm32_f103_onekey/boards/maple_mini_mapping.png b/keyboard/stm32_f103_onekey/boards/maple_mini_mapping.png new file mode 100644 index 0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AP16HAivGV1dJi&&OcDFaD%WiHBXZY9syDm+r~v;^ft(*A5D` zFzc1Q^8&gU^VKKJEBZbPB__x-H7hmbWn;WF71kBaup>1gTI6@ zHD0px^V=C-fWg`nwi(XtO)onA0@KcgN|!%K_BEf}a9Vt3glySfXv27sZJ|VVpPyXr zUM`n5Dv;5kM25WFjgXg(jbU|OWPS9wAca>IU&gU7WOku6$xlM1cKh?fGes$Zb-HI zitE0`FYpEg%2%8!1U+*AR;5{@2bXwNAN~DXI3h~w^X!VuHGjR3jvJs`g%Hd2tYHan zc=8W8A81Vbbt&lCuqzpkH~dRuzi`BD%wYwEX6Q_u-Xz8T2!VVrzK9_U%)bOmVW z#k)tk9a^A_1sgDMp**(e2OCHoir@r2jeXsty>|MZyX@hIJ|HFra9yEB4}vw((qE3dMipJ>Tp00Fn% zlLj_L7MOt^t6~O^9{P6)0M-3l&f>%=0cp8Z9*qq&Y$0sKZDH@AfNk>DcR?S%CSH3W z20Xn38|i7lv6w^_5Pn$ruHDi$3Zj=xmJ zUa!IyOw9(^Fi0765NVP`qlcX^`;?Mf` zrua7&eOTo!3D|H$4Qo}P{<44V@b{nikMxe3%s?j}0qg(Yc}afE5%LJ;a|5U>`j59v znybAh{@U`tNVxYG20gaBzw6B`Gx78o`r)8^Cu z#_904yu3%G;+@H7>tpUjpbP@QGD>4EWsv>49z~*PGxmCpJxb6sQmlWhH;t;Jgg(!@ zA-V{0K~>n7g2RIhZ@U=8KimUb^fGJBX%qO1VjoqPwzD&L9yS1keKEE`T`z om5rSL`T76G0>4s=QbqyWLqQ-#IaOJ>v~l2n0QIh>;s5{u literal 0 HcmV?d00001 From 060c8c55f951c0dc6f07fc202046c8a4877dae58 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 5 Dec 2015 10:15:06 +0900 Subject: [PATCH 094/179] adb_usb: Update README and Makefiles --- converter/adb_usb/Makefile | 8 +- converter/adb_usb/Makefile.pjrc | 73 --------------- converter/adb_usb/Makefile.rev1 | 143 ++++++++++++++++++++++++++++++ converter/adb_usb/Makefile.teensy | 143 ++++++++++++++++++++++++++++++ converter/adb_usb/README.md | 35 ++++++-- 5 files changed, 317 insertions(+), 85 deletions(-) delete mode 100644 converter/adb_usb/Makefile.pjrc create mode 100644 converter/adb_usb/Makefile.rev1 create mode 100644 converter/adb_usb/Makefile.teensy diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile index 2369ee70..7b385749 100644 --- a/converter/adb_usb/Makefile +++ b/converter/adb_usb/Makefile @@ -63,8 +63,10 @@ CONFIG_H = config.h # MCU name -#MCU = at90usb1287 -MCU = atmega32u4 +# atmega32u4 Teensy2.0 +# atemga32u4 TMK Converter rev.1 +# atemga32u2 TMK Converter rev.2 +MCU = atmega32u2 # Processor frequency. # This will define a symbol, F_CPU, in all source code files equal to the @@ -106,7 +108,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # Boot Section Size in *bytes* # Teensy halfKay 512 # Teensy++ halfKay 1024 -# Atmel DFU loader 4096 +# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2 # LUFA bootloader 4096 # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 diff --git a/converter/adb_usb/Makefile.pjrc b/converter/adb_usb/Makefile.pjrc deleted file mode 100644 index c320c09d..00000000 --- a/converter/adb_usb/Makefile.pjrc +++ /dev/null @@ -1,73 +0,0 @@ -# Target file name (without extension). -TARGET = adb_usb_pjrc - -# Directory common source filess exist -TMK_DIR = ../../tmk_core - -# Directory keyboard dependent files exist -TARGET_DIR = . - -# keyboard dependent files -SRC = keymap_common.c \ - matrix.c \ - led.c \ - adb.c - -ifdef KEYMAP - SRC := keymap_$(KEYMAP).c $(SRC) -else - SRC := keymap_ansi.c $(SRC) -endif - -CONFIG_H = config.h - - -# MCU name, you MUST set this to match the board you are using -# type "make clean" after changing this, so all files will be rebuilt -#MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 -#MCU = at90usb646 # Teensy++ 1.0 -#MCU = at90usb1286 # Teensy++ 2.0 - - -# Processor frequency. -# Normally the first thing your program should do is set the clock prescaler, -# so your program will run at the correct speed. You should also set this -# variable to same clock speed. The _delay_ms() macro uses this, and many -# examples use this variable to calculate timings. Do not add a "UL" here. -F_CPU = 16000000 - - -# 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 - - -# Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+5000) -EXTRAKEY_ENABLE = yes # Audio control and System control(+600) -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -#NKRO_ENABLE = yes # USB Nkey Rollover(+500) -ADB_MOUSE_ENABLE = yes - -# ADB Mice need acceleration for todays much bigger screens. -OPT_DEFS += -DADB_MOUSE_MAXACC=8 - - -# Search Path -VPATH += $(TARGET_DIR) -VPATH += $(TMK_DIR) - -include $(TMK_DIR)/protocol/pjrc.mk -include $(TMK_DIR)/protocol.mk -include $(TMK_DIR)/common.mk -include $(TMK_DIR)/rules.mk diff --git a/converter/adb_usb/Makefile.rev1 b/converter/adb_usb/Makefile.rev1 new file mode 100644 index 00000000..1cd539b6 --- /dev/null +++ b/converter/adb_usb/Makefile.rev1 @@ -0,0 +1,143 @@ +#---------------------------------------------------------------------------- +# 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 = adb_usb_lufa + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = keymap_common.c \ + matrix.c \ + led.c \ + adb.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_ansi.c $(SRC) +endif + +CONFIG_H = config.h + + +# MCU name +# atmega32u4 Teensy2.0 +# atemga32u4 TMK Converter rev.1 +# atemga32u2 TMK Converter rev.2 +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 = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +#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 +ADB_MOUSE_ENABLE = yes + +# ADB Mice need acceleration for todays much bigger screens. +OPT_DEFS += -DADB_MOUSE_MAXACC=8 + + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/converter/adb_usb/Makefile.teensy b/converter/adb_usb/Makefile.teensy new file mode 100644 index 00000000..d97f0eb3 --- /dev/null +++ b/converter/adb_usb/Makefile.teensy @@ -0,0 +1,143 @@ +#---------------------------------------------------------------------------- +# 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 = adb_usb_lufa + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = keymap_common.c \ + matrix.c \ + led.c \ + adb.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_ansi.c $(SRC) +endif + +CONFIG_H = config.h + + +# MCU name +# atmega32u4 Teensy2.0 +# atemga32u4 TMK Converter rev.1 +# atemga32u2 TMK Converter rev.2 +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 = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + + +# Build Options +# comment out to disable the options. +# +#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 +ADB_MOUSE_ENABLE = yes + +# ADB Mice need acceleration for todays much bigger screens. +OPT_DEFS += -DADB_MOUSE_MAXACC=8 + + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md index 46082ff6..aa06c8db 100644 --- a/converter/adb_usb/README.md +++ b/converter/adb_usb/README.md @@ -1,8 +1,7 @@ ADB to USB keyboard converter ============================= This firmware converts ADB keyboard protocol to USB. -You can use PJRC Teensy for this converter, though, other USB AVR(ATMega32U4, AT90USB64/128 or etc) should work. -But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U2. +You can use TMK Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) for this. But binary size is probably more than 10KB and it won't fit into 8K flash. Discuss: http://geekhack.org/showwiki.php?title=Island:14290 @@ -54,22 +53,34 @@ Define following macros for ADB connection in config.h if you use other than por ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT -Build ------ -See doc/build.md. In short, +Build firmware and Program microcontroller +------------------------------------------ +See [doc/build.md](../../tmk_core/doc/build.md). - $ make clean - $ make +To build firmware: + + $ make -f Makefile clean + $ make -f Makefile You can select keymap(ansi is default) like this: - $ make KEYMAP=[ansi|iso|hasu] + $ make -f Makefile KEYMAP=[ansi|iso|hasu] + +To program TMK Converter: + + $ make -f Makefile dfu + +To program Teensy2.0: + + $ make -f Makefile.teensy teensy + +Use **Makefile.rev1** for TMK Converter rev.1 and **Makefile.teensy** for Teensy2.0 instead of **Makefile**. For TMK Converter rev.2 just use **Makefile**. Keymap ------ You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c. -How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see doc/keymap.md for more detail. +How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see [doc/keymap.md](../../tmk_core/doc/keymap.md) for more detail. Magic command @@ -85,6 +96,12 @@ https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-sup Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch. +Mouse support +------------- +ADB mouse support was added by @mek-apelsin on Apr,2015. It supports only one button as of now. +https://github.com/tmk/tmk_keyboard/pull/207 + + Notes ----- Not-extended ADB keyboards have no discrimination between right modifier and left one, From 792327caac705e88de1f6b8cf43fb4b2fa2f7d40 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 5 Dec 2015 13:29:20 +0900 Subject: [PATCH 095/179] core: Update doc/build.md and remove other_projects.md --- tmk_core/doc/build.md | 11 +++--- tmk_core/doc/other_projects.md | 62 ---------------------------------- 2 files changed, 5 insertions(+), 68 deletions(-) delete mode 100644 tmk_core/doc/other_projects.md diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md index 20702e94..beff191b 100644 --- a/tmk_core/doc/build.md +++ b/tmk_core/doc/build.md @@ -6,9 +6,9 @@ Download and Install -------------------- ### 1. Install Tools -1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager. +1. **Toolchain** On Windows install [Atmel AVR Toolchain][atmelgcc] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack] or your favorite package manager. On Linux you can install AVR GCC with your favorite package manager. -2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog]. +2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows. 3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver. @@ -53,7 +53,7 @@ Now you have **hex** file to program on current directory. This **hex** is only How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual. ### 2. Program with DFU bootloader -Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. +Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`. If you have a proper program command in `Makefile` just type this. @@ -68,7 +68,7 @@ Or to program with `dfu-programmer` run: $ make -f Makefile. dfu #### FLIP GUI tutorial -1. On menu bar click Device -> Select, then. `ATmega32u4`. +1. On menu bar click Device -> Select, then choose your chip name. 2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog. At this point you'll see grey-outed widgets on the app get colored and ready. @@ -99,10 +99,9 @@ You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or $ make -f Makefile. program +[atmelgcc]: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx [cygwin]: https://www.cygwin.com/ [mingw]: http://www.mingw.org/ -[mhv]: https://infernoembedded.com/products/avr-tools -[winavr]: http://winavr.sourceforge.net/ [crosspack]: http://www.obdev.at/products/crosspack/index.html [flip]: http://www.atmel.com/tools/FLIP.aspx [dfu-prog]: http://dfu-programmer.sourceforge.net/ diff --git a/tmk_core/doc/other_projects.md b/tmk_core/doc/other_projects.md deleted file mode 100644 index bf980b0a..00000000 --- a/tmk_core/doc/other_projects.md +++ /dev/null @@ -1,62 +0,0 @@ -Other Keyboard Firmware Projects -================================ -## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR] -- -- - -## kbupgrade[USB][V-USB][AVR] -- -- - -## c64key[USB][V-USB][AVR] -- - -## rump[USB][V-USB][AVR] -- -- - -## dulcimer[USB][V-USB][AVR] -- - -## humblehacker-keyboard[USB][LUFA][AVR][Ergo] -- -- -- - -## ps2avr[PS/2][AVR] -- - -## ErgoDox[Ergo][Split][USB][AVR] -- -- -- - -## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR] -- -- - -## bpiphany's AVR-Keyboard[PJRC][AVR][USB] -- -- -- - -## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino] -- -- - -## USB-USB converter threads[converter][USB-USB] -- -- - -## kbdbabel.org[converter][vintage][protocol][8051] -Great resource of vintage keyboard protocol information and code - -- - -## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex] -A lots of vintage keyboard protocol supports - -- - -## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo] -- From 24c30681c42762aba3df96432078129e127bfd13 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 5 Dec 2015 13:52:12 +0900 Subject: [PATCH 096/179] Remove doc/ --- README.md | 10 +- doc/COPYING.GPLv2 | 339 --------------------- doc/COPYING.GPLv3 | 674 ------------------------------------------ doc/FUSE.txt | 40 --- doc/POWER.txt | 62 ---- doc/USB_NKRO.txt | 160 ---------- doc/build.md | 185 ------------ doc/keycode.txt | 261 ---------------- doc/keymap.md | 593 ------------------------------------- doc/other_projects.md | 62 ---- 10 files changed, 5 insertions(+), 2381 deletions(-) delete mode 100644 doc/COPYING.GPLv2 delete mode 100644 doc/COPYING.GPLv3 delete mode 100644 doc/FUSE.txt delete mode 100644 doc/POWER.txt delete mode 100644 doc/USB_NKRO.txt delete mode 100644 doc/build.md delete mode 100644 doc/keycode.txt delete mode 100644 doc/keymap.md delete mode 100644 doc/other_projects.md diff --git a/README.md b/README.md index 4f850619..4a6d80fb 100644 --- a/README.md +++ b/README.md @@ -114,13 +114,13 @@ Third party libraries like LUFA, PJRC and V-USB have their own license respectiv Build Firmware and Program Controller ------------------------------------- -See [doc/build.md](doc/build.md). +See [tmk_core/doc/build.md](tmk_core/doc/build.md). Change your keymap ------------------ -See [doc/keymap.md](doc/keymap.md). +See [tmk_core/doc/keymap.md](tmk_core/doc/keymap.md). @@ -226,10 +226,10 @@ You can use xprintf() to display debug info on `hid_listen`, see `tmk_core/commo Files and Directories ------------------- ### Top -* tmk_core/ - core library * keyboard/ - keyboard projects * converter/ - protocol converter projects -* doc/ - documents +* tmk_core/ - core library +* tmk_core/doc/ - documents @@ -241,4 +241,4 @@ Coding Style Other Keyboard Firmware Projects ------------------ -You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](doc/other_projects.md). +You can learn a lot about keyboard firmware from these. See [Other Projects](https://github.com/tmk/tmk_keyboard/wiki/Other-Protjects) other than TMK. diff --git a/doc/COPYING.GPLv2 b/doc/COPYING.GPLv2 deleted file mode 100644 index d159169d..00000000 --- a/doc/COPYING.GPLv2 +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/doc/COPYING.GPLv3 b/doc/COPYING.GPLv3 deleted file mode 100644 index 94a9ed02..00000000 --- a/doc/COPYING.GPLv3 +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 3 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 . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/doc/FUSE.txt b/doc/FUSE.txt deleted file mode 100644 index 40055e5a..00000000 --- a/doc/FUSE.txt +++ /dev/null @@ -1,40 +0,0 @@ -ATMega168P Fuse/Lock Bits -========================= -This configuration is from usbasploader's Makefile. - - HFUSE 0xD6 - LFUSE 0xDF - EFUSE 0x00 - LOCK 0x3F(intact) - -#--------------------------------------------------------------------- -# ATMega168P -#--------------------------------------------------------------------- -# Fuse extended byte: -# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800) -# \+/ -# +------- BOOTSZ (00 = 2k bytes) -# Fuse high byte: -# 0xd6 = 1 1 0 1 0 1 1 0 -# ^ ^ ^ ^ ^ \-+-/ -# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) -# | | | | + --------- EESAVE (preserve EEPROM over chip erase) -# | | | +-------------- WDTON (if 0: watchdog always on) -# | | +---------------- SPIEN (allow serial programming) -# | +------------------ DWEN (debug wire enable) -# +-------------------- RSTDISBL (reset pin is enabled) -# Fuse low byte: -# 0xdf = 1 1 0 1 1 1 1 1 -# ^ ^ \ / \--+--/ -# | | | +------- CKSEL 3..0 (external >8M crystal) -# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) -# | +------------------ CKOUT (if 0: Clock output enabled) -# +-------------------- CKDIV8 (if 0: divide by 8) - - -# Lock Bits -# 0x3f = - - 1 1 1 1 1 1 -# \ / \-/ \-/ -# | | +----- LB 2..1 (No memory lock features enabled) -# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section) -# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section) diff --git a/doc/POWER.txt b/doc/POWER.txt deleted file mode 100644 index 0abbbe48..00000000 --- a/doc/POWER.txt +++ /dev/null @@ -1,62 +0,0 @@ -Time to Sleep -============= -USB suspend no activity on USB line for 3ms -No Interaction no user interaction - matrix has no change - matrix has no switch on - - -AVR Power Management -==================== - -V-USB suspend - USB suspend - http://vusb.wikidot.com/examples - -MCUSR MCU Status Register - WDRF Watchdog Reset Flag - BORF - EXTRF - PORF Power-on Reset Flag - -SMCR Sleep Mode Control Register - SE Sleep Enable - SM2:0 - #define set_sleep_mode(mode) \ - #define SLEEP_MODE_IDLE (0) - #define SLEEP_MODE_ADC _BV(SM0) - #define SLEEP_MODE_PWR_DOWN _BV(SM1) - #define SLEEP_MODE_PWR_SAVE (_BV(SM0) | _BV(SM1)) - #define SLEEP_MODE_STANDBY (_BV(SM1) | _BV(SM2)) - #define SLEEP_MODE_EXT_STANDBY (_BV(SM0) | _BV(SM1) | _BV(SM2)) - - -ACSR Analog Comparator Control and Status Register - To disable Analog Comparator - ACSR = 0x80; - or - ACSR &= ~_BV(ACIE); - ACSR |= _BV(ACD); - - ACD: Analog Comparator Disable - When this bit is written logic one, the power to the Analog Comparator is - switched off. This bit can be set at any time to turn off the Analog - Comparator. This will reduce power consumption in Active and Idle mode. - When changing the ACD bit, the Analog Comparator Interrupt must be disabled - by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when - the bit is changed. - -DIDR1 Digital Input Disable Register 1 - AIN1D - AIN0D - When this bit is written logic one, the digital input buffer on the AIN1/0 pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer. - - -PRR Power Reduction Register - PRTWI - PRTIM2 - PRTIM0 - PRTIM1 - PRSPI - PRUSART0 - PRADC diff --git a/doc/USB_NKRO.txt b/doc/USB_NKRO.txt deleted file mode 100644 index d9f1d122..00000000 --- a/doc/USB_NKRO.txt +++ /dev/null @@ -1,160 +0,0 @@ -USB NKRO MEMO -============= -2010/12/09 - - -References ----------- -USB - boot mode, NKRO, compatibility, etc... - http://geekhack.org/showthread.php?t=13162 -NKey Rollover - Overview, Testing Methodology, and Results - http://geekhack.org/showwiki.php?title=NKey+Rollover+-+Overview+Testing+Methodology+and+Results -dfj's NKRO(2010/06) - http://geekhack.org/showpost.php?p=191195&postcount=251 - http://geekhack.org/showthread.php?p=204389#post204389 - - -Terminology ---------- -NKRO -ghost -matrix -mechanical with diodes -membrane - - -OS Support Status ------------------ -USB NKRO is possible *without* a custom driver. -At least following OS's supports. - Windows7 64bit - WindowsXP - Windows2000 SP4 - Ubuntu10.4(Linux 2.6) - MacOSX(To be tested) - - -Custom Driver for USB NKRO --------------------------- -NOT NEEDED -at least when using following report formats on Windows, Linux or MacOSX. - - -USB NKRO methods ----------------- -1. Virtual keyboards - Keyboard can increase its KRO by using virtual keyboards with Standard or Extended report. - If the keyboard has 2 virtual keyboard with Standard report(6KRO), it gets 12KRO. - Using this method means the keyboard is a composite device. - -2. Extended report - It needs large report size for this method to achieve NKRO. - If a keyboard has 101keys, it needs 103byte report. It seems to be inefficient. - -3. Bitmap report - If the keyboard has less than 128keys, 16byte report will be enough for NKRO. - The 16byte report seems to be reasonable cost to get NKRO. - - -Report Format -------------- -Other report formats than followings are possible, though these format are typical one. - -1. Standard 8bytes - modifiers(bitmap) 1byte - reserved 1byte(not used) - keys(array) 1byte*6 -Standard report can send 6keys plus 8modifiers simultaneously. -Standard report is used by most keyboards in the marketplace. -Standard report is identical to boot protocol report. -Standard report is hard to suffer from compatibility problems. - -2. Extended standard 16,32,64bytes - modifiers(bitmap) 1byte - reserved 1byte(not used) - keys(array) 1byte*(14,32,62) -Extended report can send N-keys by using N+2bytes. -Extended report is expected to be compatible with boot protocol. - -3. Bitmap 16,32,64bytes - keys(bitmap) (16,32)bytes -Bitmap report can send at most 128keys by 16bytes and 256keys by 32bytes. -Bitmap report can achieve USB NKRO efficiently in terms of report size. -Bitmap report needs a deliberation for boot protocol implementation. -Bitmap report descriptor sample: - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - // bitmap of modifiers - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - // LED output report - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), - // bitmap of keys - 0x95, (REPORT_BYTES-1)*8, // Report Count (), - 0x75, 0x01, // Report Size (1), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum(1), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, (REPORT_BYTES-1)*8-1, // Usage Maximum (), - 0x81, 0x02, // Input (Data, Variable, Absolute), - 0xc0 // End Collection -where REPORT_BYTES is a report size in bytes. - - -Considerations --------------- -Compatibility - boot protocol - minor/old system - Some BIOS doesn't send SET_PROTOCOL request, a keyboard can't switch to boot protocol mode. - This may cause a problem on a keyboard which uses other report than Standard. -Reactivity - USB polling time - OS/Driver processing time - - -Windows Problem ---------------- -1. Windows accepts only 6keys in case of Standard report. - It should be able to send 6keys plus 8modifiers. -2. Windows accepts only 10keys in case of 16bytes Extended report. - It should be able to send 14keys plus 8modifiers. -3. Windows accepts only 18keys in case of 32bytes Extended report. - It should be able to send 30keys plus 8modifiers. -If keys are pressed in excess of the number, wrong keys are registered on Windows. - -This problem will be reportedly fixed soon.(2010/12/05) - http://forums.anandtech.com/showpost.php?p=30873364&postcount=17 - - -Tools for testing NKRO ----------------------- -Browser App: -http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx -http://random.xem.us/rollover.html - -Windows: -AquaKeyTest.exe http://geekhack.org/showthread.php?t=6643 - -Linux: -xkeycaps -xev -showkeys - -EOF diff --git a/doc/build.md b/doc/build.md deleted file mode 100644 index beff191b..00000000 --- a/doc/build.md +++ /dev/null @@ -1,185 +0,0 @@ -Build Firmware and Program Controller -===================================== - - -Download and Install --------------------- -### 1. Install Tools - -1. **Toolchain** On Windows install [Atmel AVR Toolchain][atmelgcc] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack] or your favorite package manager. On Linux you can install AVR GCC with your favorite package manager. - -2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows. - -3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver. - -If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader]. - - -### 2. Download source -You can find firmware source at github: - -- - -If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from: - -- - - -Build firmware --------------- -### 1. Open terminal -Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up. - -### 2. Change directory -Move to project directory in the firmware source. - - cd tmk_keyboard/{'keyboard' or 'converter'}/ - -### 3. Make -Build firmware using GNU `make` command. You'll see `_.hex` file in that directory unless something unexpected occurs in build process. - - - make -f Makefile. clean - make -f Makefile. - - - - -Program Controller ------------------- -Now you have **hex** file to program on current directory. This **hex** is only needed to program your controller, other files are used for development and you may leave and forget them. - -### 1. Start bootloader -How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual. - -### 2. Program with DFU bootloader -Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. - -To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`. -If you have a proper program command in `Makefile` just type this. - -`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. -To use command line tool run this command. Note that you need to set PATH variable properly. - - $ make -f Makefile. flip - -Or to program with `dfu-programmer` run: - - $ make -f Makefile. dfu - -#### FLIP GUI tutorial -1. On menu bar click Device -> Select, then choose your chip name. -2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog. -At this point you'll see grey-outed widgets on the app get colored and ready. - -3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog. -4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected. -5. Re-plug USB cord or click 'Start Application' button to restart your controller. -Done. - -See also these instructions if you need. - -- -- - - -### 3. Program with Teensy Loader -If you have PJRC Teensy see instruction of `Teensy Loader`. - -- - -Or use this command if you have command line version of Teensy Loader installed. - - $ make -f Makefile. teensy - - -### 4. Program with Other programmer -You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. - - $ make -f Makefile. program - - -[atmelgcc]: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx -[cygwin]: https://www.cygwin.com/ -[mingw]: http://www.mingw.org/ -[crosspack]: http://www.obdev.at/products/crosspack/index.html -[flip]: http://www.atmel.com/tools/FLIP.aspx -[dfu-prog]: http://dfu-programmer.sourceforge.net/ -[teensy-loader]:http://www.pjrc.com/teensy/loader.html - - - -Makefile Options ----------------- -### 1. MCU and Frequency. - - MCU = atmega32u4 # Teensy 2.0 - #MCU = at90usb1286 # Teensy++ 2.0 - F_CPU = 16000000 - -Set your MCU and its clock in Hz. - - # Boot Section Size in *bytes* - # Teensy halfKay 512 - # Atmel DFU loader 4096 - # LUFA bootloader 4096 - OPT_DEFS += -DBOOTLOADER_SIZE=4096 - -If you are using PJRC Teensy use `512` for `BOOTLOADER_SIZE`, otherwise use `4096` unless you are sure. - -### 2. Features -Optional. Note that ***comment out*** with `#` to disable them. - - 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 # Enable keyboard backlight functionality - -### 3. Programmer -Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`. - - # avrdude with AVRISPmkII - PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex - - # avrdude with USBaspLoader - PROGRAM_CMD = avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex - - # avrdude with arduino - PROGRAM_CMD = avrdude -p $(MCU) -c arduino -P COM1 -b 57600 -U flash:w:$(TARGET).hex - - - -Config.h Options ----------------- -### 1. Magic command key combination - - #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) - -### 2. Mechanical Locking Support for CapsLock - - /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */ - #define CAPSLOCK_LOCKING_ENABLE - /* Locking CapsLock re-synchronize hack */ - #define CAPSLOCK_LOCKING_RESYNC_ENABLE - -### 3. Disable Debug and Print - - /* disable debug print */ - #define NO_DEBUG - - /* disable print */ - #define NO_PRINT - -### 4. Disable Action Features - - #define NO_ACTION_LAYER - #define NO_ACTION_TAPPING - #define NO_ACTION_ONESHOT - #define NO_ACTION_MACRO - #define NO_ACTION_FUNCTION - -***TBD*** diff --git a/doc/keycode.txt b/doc/keycode.txt deleted file mode 100644 index 44d7e27c..00000000 --- a/doc/keycode.txt +++ /dev/null @@ -1,261 +0,0 @@ -Keycode Symbol Table -==================== -Keycodes are defined in `common/keycode.h`. -Range of 00-A4 and E0-E7 are identical with HID Usage: - -Virtual keycodes are defined out of above range to support special actions. - - -Keycode Symbol Short name Description --------------------------------------------------------------------------------- -KC_NO 00 Reserved (no event indicated) -KC_ROLL_OVER 01 Keyboard ErrorRollOver -KC_POST_FAIL 02 Keyboard POSTFail -KC_UNDEFINED 03 Keyboard ErrorUndefined -KC_A 04 Keyboard a and A -KC_B 05 Keyboard b and B -KC_C 06 Keyboard c and C -KC_D 07 Keyboard d and D -KC_E 08 Keyboard e and E -KC_F 09 Keyboard f and F -KC_G 0A Keyboard g and G -KC_H 0B Keyboard h and H -KC_I 0C Keyboard i and I -KC_J 0D Keyboard j and J -KC_K 0E Keyboard k and K -KC_L 0F Keyboard l and L -KC_M 10 Keyboard m and M -KC_N 11 Keyboard n and N -KC_O 12 Keyboard o and O -KC_P 13 Keyboard p and P -KC_Q 14 Keyboard q and Q -KC_R 15 Keyboard r and R -KC_S 16 Keyboard s and S -KC_T 17 Keyboard t and T -KC_U 18 Keyboard u and U -KC_V 19 Keyboard v and V -KC_W 1A Keyboard w and W -KC_X 1B Keyboard x and X -KC_Y 1C Keyboard y and Y -KC_Z 1D Keyboard z and Z -KC_1 1E Keyboard 1 and ! -KC_2 1F Keyboard 2 and @ -KC_3 20 Keyboard 3 and # -KC_4 21 Keyboard 4 and $ -KC_5 22 Keyboard 5 and % -KC_6 23 Keyboard 6 and ^ -KC_7 24 Keyboard 7 and & -KC_8 25 Keyboard 8 and * -KC_9 26 Keyboard 9 and ( -KC_0 27 Keyboard 0 and ) -KC_ENTER KC_ENT 28 Keyboard Return (ENTER) -KC_ESCAPE KC_ESC 29 Keyboard ESCAPE -KC_BSPACE KC_BSPC 2A Keyboard DELETE (Backspace) -KC_TAB 2B Keyboard Tab -KC_SPACE KC_SPC 2C Keyboard Spacebar -KC_MINUS KC_MINS 2D Keyboard - and (underscore) -KC_EQUAL KC_EQL 2E Keyboard = and + -KC_LBRACKET KC_LBRC 2F Keyboard [ and { -KC_RBRACKET KC_RBRC 30 Keyboard ] and } -KC_BSLASH KC_BSLS 31 Keyboard \ and | -KC_NONUS_HASH KC_NUHS 32 Keyboard Non-US # and ~ -KC_SCOLON KC_SCLN 33 Keyboard ; and : -KC_QUOTE KC_QUOT 34 Keyboard ‘ and “ -KC_GRAVE KC_GRV 35 Keyboard Grave Accent and Tilde -KC_COMMA KC_COMM 36 Keyboard, and < -KC_DOT 37 Keyboard . and > -KC_SLASH KC_SLSH 38 Keyboard / and ? -KC_CAPSLOCK KC_CAPS 39 Keyboard Caps Lock -KC_F1 3A Keyboard F1 -KC_F2 3B Keyboard F2 -KC_F3 3C Keyboard F3 -KC_F4 3D Keyboard F4 -KC_F5 3E Keyboard F5 -KC_F6 3F Keyboard F6 -KC_F7 40 Keyboard F7 -KC_F8 41 Keyboard F8 -KC_F9 42 Keyboard F9 -KC_F10 43 Keyboard F10 -KC_F11 44 Keyboard F11 -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_INS 49 Keyboard Insert1 -KC_HOME 4A Keyboard Home1 -KC_PGUP 4B Keyboard PageUp1 -KC_DELETE KC_DELETE 4C Keyboard Delete Forward -KC_END 4D Keyboard End1 -KC_PGDOWN KC_PGDN 4E Keyboard PageDown1 -KC_RIGHT KC_RGHT 4F Keyboard RightArrow1 -KC_LEFT 50 Keyboard LeftArrow1 -KC_DOWN 51 Keyboard DownArrow1 -KC_UP 52 Keyboard UpArrow1 -KC_NUMLOCK KC_NLCK 53 Keypad Num Lock and Clear11 -KC_KP_SLASH KC_PSLS 54 Keypad /1 -KC_KP_ASTERISK KC_PAST 55 Keypad * -KC_KP_MINUS KC_PMNS 56 Keypad - -KC_KP_PLUS KC_PPLS 57 Keypad + -KC_KP_ENTER KC_PENT 58 Keypad ENTER5 -KC_KP_1 KC_P1 59 Keypad 1 and End -KC_KP_2 KC_P2 5A Keypad 2 and Down Arrow -KC_KP_3 KC_P3 5B Keypad 3 and PageDn -KC_KP_4 KC_P4 5C Keypad 4 and Left Arrow -KC_KP_5 KC_P5 5D Keypad 5 -KC_KP_6 KC_P6 5E Keypad 6 and Right Arrow -KC_KP_7 KC_P7 5F Keypad 7 and Home -KC_KP_8 KC_P8 60 Keypad 8 and Up Arrow -KC_KP_9 KC_P9 61 Keypad 9 and PageUp -KC_KP_0 KC_P0 62 Keypad 0 and Insert -KC_KP_DOT KC_PDOT 63 Keypad . and Delete -KC_NONUS_BSLASH KC_NUBS 64 Keyboard Non-US \ and | -KC_APPLICATION KC_APP 65 Keyboard Application10 -KC_POWER 66 Keyboard Power9 -KC_KP_EQUAL KC_PEQL 67 Keypad = -KC_F13 68 Keyboard F13 -KC_F14 69 Keyboard F14 -KC_F15 6A Keyboard F15 -KC_F16 6B Keyboard F16 -KC_F17 6C Keyboard F17 -KC_F18 6D Keyboard F18 -KC_F19 6E Keyboard F19 -KC_F20 6F Keyboard F20 -KC_F21 70 Keyboard F21 -KC_F22 71 Keyboard F22 -KC_F23 72 Keyboard F23 -KC_F24 73 Keyboard F24 -KC_EXECUTE 74 Keyboard Execute -KC_HELP 75 Keyboard Help -KC_MENU 76 Keyboard Menu -KC_SELECT 77 Keyboard Select -KC_STOP 78 Keyboard Stop -KC_AGAIN 79 Keyboard Again -KC_UNDO 7A Keyboard Undo -KC_CUT 7B Keyboard Cut -KC_COPY 7C Keyboard Copy -KC_PASTE 7D Keyboard Paste -KC_FIND 7E Keyboard Find -KC__MUTE 7F Keyboard Mute -KC__VOLUP 80 Keyboard Volume Up -KC__VOLDOWN 81 Keyboard Volume Down -KC_LOCKING_CAPS 82 Keyboard Locking Caps Lock12 -KC_LOCKING_NUM 83 Keyboard Locking Num Lock12 -KC_LOCKING_SCROLL 84 Keyboard Locking Scroll Lock12 -KC_KP_COMMA KC_PCMM 85 Keypad Comma27 -KC_KP_EQUAL_AS400 86 Keypad Equal Sign29 -KC_INT1 KC_RO 87 Keyboard International115,28 -KC_INT2 KC_KANA 88 Keyboard International216 -KC_INT3 KC_JYEN 89 Keyboard International317 -KC_INT4 KC_HENK 8A Keyboard International418 -KC_INT5 KC_MHEN 8B Keyboard International519 -KC_INT6 8C Keyboard International620 -KC_INT7 8D Keyboard International721 -KC_INT8 8E Keyboard International822 -KC_INT9 8F Keyboard International922 -KC_LANG1 90 Keyboard LANG125 -KC_LANG2 91 Keyboard LANG226 -KC_LANG3 92 Keyboard LANG330 -KC_LANG4 93 Keyboard LANG431 -KC_LANG5 94 Keyboard LANG532 -KC_LANG6 95 Keyboard LANG68 -KC_LANG7 96 Keyboard LANG78 -KC_LANG8 97 Keyboard LANG88 -KC_LANG9 98 Keyboard LANG98 -KC_ALT_ERASE 99 Keyboard Alternate Erase7 -KC_SYSREQ 9A Keyboard SysReq/Attention1 -KC_CANCEL 9B Keyboard Cancel -KC_CLEAR 9C Keyboard Clear -KC_PRIOR 9D Keyboard Prior -KC_RETURN 9E Keyboard Return -KC_SEPARATOR 9F Keyboard Separator -KC_OUT A0 Keyboard Out -KC_OPER A1 Keyboard Oper -KC_CLEAR_AGAIN A2 Keyboard Clear/Again -KC_CRSEL A3 Keyboard CrSel/Props -KC_EXSEL A4 Keyboard ExSel -/* Modifiers */ -KC_LCTRL KC_LCTL E0 Keyboard LeftControl -KC_LSHIFT KC_LSFT E1 Keyboard LeftShift -KC_LALT E2 Keyboard LeftAlt -KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key) -KC_RCTRL KC_RCTL E4 Keyboard RightControl -KC_RSHIFT KC_RSFT E5 Keyboard RightShift -KC_RALT E6 Keyboard RightAlt -KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key) - -/* - * Virtual keycodes - */ -/* System Control */ -KC_SYSTEM_POWER KC_PWR System Power Down -KC_SYSTEM_SLEEP KC_SLEP System Sleep -KC_SYSTEM_WAKE KC_WAKE System Wake -/* Consumer Page */ -KC_AUDIO_MUTE KC_MUTE -KC_AUDIO_VOL_UP KC_VOLU -KC_AUDIO_VOL_DOWN KC_VOLD -KC_MEDIA_NEXT_TRACK KC_MNXT -KC_MEDIA_PREV_TRACK KC_MPRV -KC_MEDIA_STOP KC_MSTP -KC_MEDIA_PLAY_PAUSE KC_MPLY -KC_MEDIA_SELECT KC_MSEL -KC_MAIL KC_MAIL -KC_CALCULATOR KC_CALC -KC_MY_COMPUTER KC_MYCM -KC_WWW_SEARCH KC_WSCH -KC_WWW_HOME KC_WHOM -KC_WWW_BACK KC_WBAK -KC_WWW_FORWARD KC_WFWD -KC_WWW_STOP KC_WSTP -KC_WWW_REFRESH KC_WREF -KC_WWW_FAVORITES KC_WFAV -/* Mousekey */ -KC_MS_UP KC_MS_U Mouse Cursor Up -KC_MS_DOWN KC_MS_D Mouse Cursor Down -KC_MS_LEFT KC_MS_L Mouse Cursor Left -KC_MS_RIGHT KC_MS_R Mouse Cursor Right -KC_MS_BTN1 KC_BTN1 Mouse Button 1 -KC_MS_BTN2 KC_BTN2 Mouse Button 2 -KC_MS_BTN3 KC_BTN3 Mouse Button 3 -KC_MS_BTN4 KC_BTN4 Mouse Button 4 -KC_MS_BTN5 KC_BTN5 Mouse Button 5 -KC_MS_WH_UP KC_WH_U Mouse Wheel Up -KC_MS_WH_DOWN KC_WH_D Mouse Wheel Down -KC_MS_WH_LEFT KC_WH_L Mouse Wheel Left -KC_MS_WH_RIGHT KC_WH_R Mouse Wheel Right -KC_MS_ACCEL0 KC_ACL0 Mouse Acceleration 0 -KC_MS_ACCEL1 KC_ACL1 Mouse Acceleration 1 -KC_MS_ACCEL2 KC_ACL2 Mouse Acceleration 2 -/* Fn key */ -KC_FN0 -KC_FN1 -KC_FN2 -KC_FN3 -KC_FN4 -KC_FN5 -KC_FN6 -KC_FN7 -KC_FN8 -KC_FN9 -KC_FN10 -KC_FN11 -KC_FN12 -KC_FN13 -KC_FN14 -KC_FN15 -KC_FN16 -KC_FN17 -KC_FN18 -KC_FN19 -KC_FN20 -KC_FN21 -KC_FN22 -KC_FN23 -KC_FN24 -KC_FN25 -KC_FN26 -KC_FN27 -KC_FN28 -KC_FN29 -KC_FN30 -KC_FN31 diff --git a/doc/keymap.md b/doc/keymap.md deleted file mode 100644 index d4a129b2..00000000 --- a/doc/keymap.md +++ /dev/null @@ -1,593 +0,0 @@ -Keymap framework - how to define your keymap -============================================ -***NOTE: This is not final version, may be inconsistent with source code and changed occasionally for a while.*** - -## 0. Keymap and layers -**Keymap** is comprised of multiple layers of key layout, you can define **32 layers** at most. -**Layer** is an array of **keycodes** to define **actions** for each physical keys. -respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence. - - Keymap: 32 Layers Layer: Keycode matrix - ----------------- --------------------- - stack of layers array_of_keycode[row][column] - ____________ precedence _______________________ - / / | high / ESC / F1 / F2 / F3 .... - 31 /___________// | /-----/-----/-----/----- - 30 /___________// | / TAB / Q / W / E .... - 29 /___________/ | /-----/-----/-----/----- - : _:_:_:_:_:__ | : /LCtrl/ A / S / D .... - : / : : : : : / | : / : : : : - 2 /___________// | 2 `-------------------------- - 1 /___________// | 1 `-------------------------- - 0 /___________/ V low 0 `-------------------------- - - - -### 0.1 Keymap status -Keymap has its state in two parameters: -**`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit. - -Keymap layer '0' is usually `default_layer` and which is the only valid layer and other layers is initially off after boot up firmware, though, you can configured them in `config.h`. -To change `default_layer` will be useful when you switch key layout completely, say you want Colmak instead of Qwerty. - - Initial state of Keymap Change base layout - ----------------------- ------------------ - - 31 31 - 30 30 - 29 29 - : : - : : ____________ - 2 ____________ 2 / / - 1 / / ,->1 /___________/ - ,->0 /___________/ | 0 - | | - `--- default_layer = 0 `--- default_layer = 1 - layer_state = 0x00000001 layer_state = 0x00000002 - -On the other hand, you shall change `layer_state` to overlay base layer with some layers for feature such as navigation keys, function key(F1-F12), media keys or special actions. - - Overlay feature layer - --------------------- bit|status - ____________ ---+------ - 31 / / 31 | 0 - 30 /___________// -----> 30 | 1 - 29 /___________/ -----> 29 | 1 - : : | : - : ____________ : | : - 2 / / 2 | 0 - ,->1 /___________/ -----> 1 | 1 - | 0 0 | 0 - | + - `--- default_layer = 1 | - layer_state = 0x60000002 <-' - - - -### 0.2 Layer Precedence and Transparency -Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred. - -You can place `KC_TRNS` on overlay layer changes just part of layout to fall back on lower or base layer. -Key with `KC_TRANS` doesn't has its own keycode and refers to lower valid layers for keycode, instead. -See example below. - - -### 0.3 Keymap Example -Keymap is **`keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array. - -This is a keymap example for [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. -This example has three layers, 'Qwerty' as base layer, 'Cursor' and 'Mousekey'. -In this example, - - `Fn0` is a **momentary layer switching** key, you can use keys on Cursor layer while holding the key. - - `Fn1` is a momentary layer switching key with tapping feature, you can get semicolon **';'** with taping the key and switch layers while holding the key. The word **'tap'** or **'tapping'** mean to press and release a key quickly. - - `Fn2` is a **toggle layer switch** key, you can stay switched layer after releasing the key unlike momentary switching. - -You can find other keymap definitions in file `keymap.c` located on project directories. - - static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: Qwerty - * ,-----------------------------------------------------------. - * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| - * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| - * |-----------------------------------------------------------| - * |Contro| A| S| D| F| G| H| J| K| L|Fn1| '|Enter | - * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| - * `-----------------------------------------------------------' - * |Gui|Alt |Space |Alt |Fn2| - * `-------------------------------------------' - */ - KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ - LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,ENT, \ - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \ - LGUI,LALT, SPC, RALT,FN2), - /* 1: Cursor(HHKB mode) - * ,-----------------------------------------------------------. - * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| - * |-----------------------------------------------------------| - * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| - * |-----------------------------------------------------------| - * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | - * |-----------------------------------------------------------| - * |Shift | | | | | | +| -|End|PgD|Dow|Shift | | - * `-----------------------------------------------------------' - * |Gui |Alt |Space |Alt |Gui| - * `--------------------------------------------' - */ - KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ - CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,BSPC, \ - LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \ - LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \ - LGUI,LALT, SPC, RALT,RGUI), - /* 2: Mousekey - * ,-----------------------------------------------------------. - * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| - * |-----------------------------------------------------------| - * |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs| - * |-----------------------------------------------------------| - * |Contro| | | | | |McL|McD|McU|McR| | |Return | - * |-----------------------------------------------------------| - * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | - * `-----------------------------------------------------------' - * |Gui |Alt |Mb1 |Alt | | - * `--------------------------------------------' - * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel - */ - KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ - TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,BSPC, \ - LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \ - LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,TRNS, \ - LGUI,LALT, BTN1, RALT,TRNS), - }; - - static const uint16_t PROGMEM fn_actions[] = { - ACTION_LAYER_MOMENTARY(1), // FN0 - ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1 - ACTION_LAYER_TOGGLE(2), // FN2 - }; - - - - -## 1. Keycode -See [`common/keycode.h`](../common/keycode.h) or keycode table below for the detail. Keycode is internal **8bit code** to indicate action performed on key in keymap. Keycode has `KC_` prefixed symbol respectively. Most of keycodes like `KC_A` have simple action registers key to host on press and unregister on release, while some of other keycodes has some special actions like `Fn` keys, Media control keys, System control keys and Mousekeys. - - ***In `KEYMAP()` macro you should omit prefix part `KC_` of keycode to keep keymap compact.*** For example, just use `A` instead you place `KC_A` in `KEYMAP()`. Some keycodes has 4-letter **short name** in addition to descriptive name, you'll prefer short one in `KEYMAP()`. - -### 1.0 Other key -- `KC_NO` for no action -- `KC_TRNS` for layer transparency (See above) - -### 1.1 Normal key -- `KC_A` to `KC_Z`, `KC_1` to `KC_0` for alpha numeric key -- `KC_MINS`, `KC_EQL`, `KC_GRV`, `KC_RBRC`, `KC_LBRC`, `KC_COMM`, `KC_DOT`, `KC_BSLS`, `KC_SLSH`, `KC_SCLN`, `KC_QUOT` -- `KC_ESC`, `KC_TAB`, `KC_SPC`, `KC_BSPC`, `KC_ENT`, `KC_DEL`, `KC_INS` -- `KC_UP`, `KC_DOWN`, `KC_RGHT`, `KC_LEFT`, `KC_PGUP`, `KC_PGDN`, `KC_HOME`, `KC_END` -- `KC_CAPS`, `KC_NLCK`, `KC_SLCK`, `KC_PSCR`, `KC_PAUS`, `KC_APP`, `KC_F1` to `KC_F24` -- `KC_P1` to `KC_P0`, `KC_PDOT`, `KC_PCMM`, `KC_PSLS`, `KC_PAST`, `KC_PMNS`, `KC_PPLS`, `KC_PEQL`, `KC_PENT` for keypad. - -### 1.2 Modifier -There are 8 modifiers which has discrimination between left and right. - -- `KC_LCTL` and `KC_RCTL` for Control -- `KC_LSFT` and `KC_RSFT` for Shift -- `KC_LALT` and `KC_RALT` for Alt -- `KC_LGUI` and `KC_RGUI` for Windows key or Command key in Mac - -### 1.3 Mousekey -- `KC_MS_U`, `KC_MS_D`, `KC_MS_L`, `KC_MS_R` for mouse cursor -- `KC_WH_U`, `KC_WH_D`, `KC_WH_L`, `KC_WH_R` for mouse wheel -- `KC_BTN1`, `KC_BTN2`, `KC_BTN3`, `KC_BTN4`, `KC_BTN5` for mouse buttons - -### 1.4 System & Media key -- `KC_PWR`, `KC_SLEP`, `KC_WAKE` for Power, Sleep, Wake -- `KC_MUTE`, `KC_VOLU`, `KC_VOLD` for audio volume control -- `KC_MNXT`, `KC_MPRV`, `KC_MSTP`, `KC_MPLY`, `KC_MSEL` for media control -- `KC_MAIL`, `KC_CALC`, `KC_MYCM` for application launch -- `KC_WSCH`, `KC_WHOM`, `KC_WBAK`, `KC_WFWD`, `KC_WSTP`, `KC_WREF`, `KC_WFAV` for web browser operation - -### 1.5 Fn key -`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***32 `Fn` keys can be defined at most.*** - -### 1.6 Keycode Table - See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes. - - In regard to implementation side most of keycodes are identical with [HID usage][HID_usage](pdf) sent to host for real and some virtual keycodes are defined to support special actions. -[HID_usage]: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf - - - -## 2. Action -See [`common/action_code.h`](../common/action_code.h). Action is a **16bit code** and defines function to perform on events of a key like press, release, holding and tapping. - -Most of keys just register 8bit scancode to host, but to support other complex features needs 16bit extended action codes internally. However, using 16bit action codes in keymap results in double size in memory compared to using just keycodes. To avoid this waste 8bit keycodes are used in `KEYMAP()` instead of action codes. - -***You can just use keycodes of `Normal key`, `Modifier`, `Mousekey` and `System & Media key` in keymap*** to indicate corresponding actions instead of using action codes. While ***to use other special actions you should use keycode of `Fn` key defined in `fn_actions[]`.*** - - -### 2.1 Key Action -This is a simple action that registers scancodes(HID usage in fact) to host on press event of key and unregister on release. - -#### Parameters -+ **mods**: { ` MOD_LCTL`, ` MOD_LSFT`, ` MOD_LALT`, ` MOD_LGUI`, - ` MOD_RCTL`, ` MOD_RSFT`, ` MOD_RALT`, ` MOD_RGUI` } -+ **key**: keycode - - -#### 2.1.1 Normal key and Modifier -***This action usually won't be used expressly in keymap*** because you can just use keycodes in `KEYMAP()` instead. - -You can define these actions on *'A'* key and *'left shift'* modifier with: - - ACTION_KEY(KC_A) - ACTION_KEY(KC_LSFT) - -#### 2.1.2 Modified key -This action is comprised of strokes of modifiers and a key. `Macro` action is needed if you want more complex key strokes. - -Say you want to assign a key to `Shift + 1` to get character *'!'* or `Alt + Tab` to switch application windows. - - ACTION_MODS_KEY(MOD_LSFT, KC_1) - ACTION_MODS_KEY(MOD_LALT, KC_TAB) - -Or `Alt,Shift + Tab` can be defined. `ACTION_MODS_KEY(mods, key)` requires **4-bit modifier state** and a **keycode** as arguments. See `keycode.h` for `MOD_BIT()` macro. - - ACTION_MODS_KEY(MOD_LALT | MOD_LSFT, KC_TAB) - -#### 2.1.3 Multiple Modifiers -Registers multiple modifiers with pressing a key. To specify multiple modifiers use `|`. - - ACTION_MODS(MOD_ALT | MOD_LSFT) - -#### 2.1.3 Modifier with Tap key([Dual role][dual_role]) -Works as a modifier key while holding, but registers a key on tap(press and release quickly). - - - ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT) - - - -### 2.2 Layer Action -These actions operate layers of keymap. - -#### Parameters -You can specify a **target layer** of action and **when the action is executed**. Some actions take a **bit value** for bitwise operation. - - -+ **layer**: `0`-`31` -+ **on**: { `ON_PRESS` | `ON_RELEASE` | `ON_BOTH` } -+ **bits**: 4-bit value and 1-bit mask bit - - -#### 2.2.1 Default Layer -Default Layer is a layer which always is valid and referred to when actions is not defined on other overlay layers. - -This sets Default Layer to given parameter `layer` and activate it. - - ACTION_DEFAULT_LAYER_SET(layer) - - -#### 2.2.2 Momentary -Turns on `layer` momentarily while holding, in other words it activates when key is pressed and deactivate when released. - - ACTION_LAYER_MOMENTARY(layer) - - -#### 2.2.3 Toggle Switch -Turns on `layer` with first type(press and release) and turns off with next. - - ACTION_LAYER_TOGGLE(layer) - - -#### 2.2.4 Momentary Switch with tap key -Turns on `layer` momentary while holding, but registers key on tap(press and release quickly). - - ACTION_LAYER_TAP_KEY(layer, key) - - -#### 2.2.5 Momentary Switch with tap toggle -Turns on `layer` momentary while holding and toggles it with serial taps. - - ACTION_LAYER_TAP_TOGGLE(layer) - - -#### 2.2.6 Invert state of layer -Inverts current state of `layer`. If the layer is on it becomes off with this action. - - ACTION_LAYER_INVERT(layer, on) - - -#### 2.2.7 Turn On layer -Turns on layer state. - - ACTION_LAYER_ON(layer, on) - -Turns on layer state on press and turns off on release. - - ACTION_LAYER_ON_OFF(layer) - - -#### 2.2.8 Turn Off layer -Turns off layer state. - - ACTION_LAYER_OFF(layer, on) - -Turns off layer state on press and activates on release. - - ACTION_LAYER_OFF_ON(layer) - - -#### 2.2.9 Set layer -Turn on layer only. -`layer_state = (1< ((bits< diff --git a/doc/other_projects.md b/doc/other_projects.md deleted file mode 100644 index bf980b0a..00000000 --- a/doc/other_projects.md +++ /dev/null @@ -1,62 +0,0 @@ -Other Keyboard Firmware Projects -================================ -## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR] -- -- - -## kbupgrade[USB][V-USB][AVR] -- -- - -## c64key[USB][V-USB][AVR] -- - -## rump[USB][V-USB][AVR] -- -- - -## dulcimer[USB][V-USB][AVR] -- - -## humblehacker-keyboard[USB][LUFA][AVR][Ergo] -- -- -- - -## ps2avr[PS/2][AVR] -- - -## ErgoDox[Ergo][Split][USB][AVR] -- -- -- - -## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR] -- -- - -## bpiphany's AVR-Keyboard[PJRC][AVR][USB] -- -- -- - -## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino] -- -- - -## USB-USB converter threads[converter][USB-USB] -- -- - -## kbdbabel.org[converter][vintage][protocol][8051] -Great resource of vintage keyboard protocol information and code - -- - -## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex] -A lots of vintage keyboard protocol supports - -- - -## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo] -- From d60a9b90488a8fee8e1d827b386c1641e5395c2e Mon Sep 17 00:00:00 2001 From: Jeff Gran Date: Thu, 26 Nov 2015 00:42:42 -0700 Subject: [PATCH 097/179] enable TAPPING_TOGGLE=1 to work correctly if TAPPING_TOGGLE is 1, then tap a single time should toggle the mods on/off each tap. Previously this was broken, this fixes it. This allows the same key to either hold (momentary mod) or tap (toggle mod, like capslock). --- tmk_core/common/action.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 1f15bd09..339b3ee6 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -131,10 +131,17 @@ void process_action(keyrecord_t *record) case MODS_TAP_TOGGLE: if (event.pressed) { if (tap_count <= TAPPING_TOGGLE) { - register_mods(mods); + if (mods & get_mods()) { + dprint("MODS_TAP_TOGGLE: toggle mods off\n"); + unregister_mods(mods); + } else { + dprint("MODS_TAP_TOGGLE: toggle mods on\n"); + register_mods(mods); + } } } else { if (tap_count < TAPPING_TOGGLE) { + dprint("MODS_TAP_TOGGLE: release : unregister_mods\n"); unregister_mods(mods); } } From 3dd8fb46276ccee869df82080a815160e2eea98c Mon Sep 17 00:00:00 2001 From: "Howard P. Logsdon" Date: Tue, 8 Dec 2015 16:46:08 -0700 Subject: [PATCH 098/179] Remove an errant comma trailing the KC_ERAS macro alias --- tmk_core/common/keycode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index a7d837b3..9fec2904 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -85,7 +85,7 @@ along with this program. If not, see . #define KC_LCAP KC_LOCKING_CAPS #define KC_LNUM KC_LOCKING_NUM #define KC_LSCR KC_LOCKING_SCROLL -#define KC_ERAS KC_ALT_ERASE, +#define KC_ERAS KC_ALT_ERASE #define KC_CLR KC_CLEAR /* Japanese specific */ #define KC_ZKHK KC_GRAVE From a75834ee98e94cea329aea224a4daaed1a4bf681 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Fri, 18 Dec 2015 20:50:59 +0000 Subject: [PATCH 099/179] Do timeout when writing to CONSOLE EP queue. Fixes TMK bug #266. --- tmk_core/protocol/chibios/usb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 85548fbb..ee2788e5 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1323,10 +1323,13 @@ int8_t sendchar(uint8_t c) { return 0; } osalSysUnlock(); - /* should get suspended and wait if the queue is full - * but it's not blocking even if noone is listening, - * because the USB packets are sent anyway */ - return(chOQPut(&console_queue, c)); + /* Timeout after 5us if the queue is full. + * Increase this timeout if too much stuff is getting + * dropped (i.e. the buffer is getting full too fast + * for USB/HIDRAW to dequeue). Another possibility + * for fixing this kind of thing is to increase + * CONSOLE_QUEUE_CAPACITY. */ + return(chOQPutTimeout(&console_queue, c, US2ST(5))); } #else /* CONSOLE_ENABLE */ From dbbd4e8f8d6bf04af4b778d2c8fd14d5417780c6 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 21 Dec 2015 08:45:26 +0000 Subject: [PATCH 100/179] Chibios: updates for 3.0.4 git. --- keyboard/infinity_chibios/halconf.h | 7 ++ keyboard/stm32_f103_onekey/halconf.h | 7 ++ keyboard/stm32_onekey/halconf.h | 7 ++ keyboard/teensy_lc_onekey/halconf.h | 7 ++ keyboard/teensy_lc_onekey/ld/MKL26Z64.ld | 145 ++++------------------- 5 files changed, 50 insertions(+), 123 deletions(-) diff --git a/keyboard/infinity_chibios/halconf.h b/keyboard/infinity_chibios/halconf.h index 2472ba7e..61a9ac0a 100644 --- a/keyboard/infinity_chibios/halconf.h +++ b/keyboard/infinity_chibios/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB TRUE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ diff --git a/keyboard/stm32_f103_onekey/halconf.h b/keyboard/stm32_f103_onekey/halconf.h index d3415c55..e75c1c36 100644 --- a/keyboard/stm32_f103_onekey/halconf.h +++ b/keyboard/stm32_f103_onekey/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB TRUE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ diff --git a/keyboard/stm32_onekey/halconf.h b/keyboard/stm32_onekey/halconf.h index d3415c55..e75c1c36 100644 --- a/keyboard/stm32_onekey/halconf.h +++ b/keyboard/stm32_onekey/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB TRUE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ diff --git a/keyboard/teensy_lc_onekey/halconf.h b/keyboard/teensy_lc_onekey/halconf.h index 0d4bc4d0..86839166 100644 --- a/keyboard/teensy_lc_onekey/halconf.h +++ b/keyboard/teensy_lc_onekey/halconf.h @@ -163,6 +163,13 @@ #define HAL_USE_USB TRUE #endif +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + #endif /* _HALCONF_H_ */ /** @} */ diff --git a/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld index fd9102de..9e9e9250 100644 --- a/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld +++ b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld @@ -18,144 +18,43 @@ */ /* - * KL25Z64 memory setup. + * KL26Z64 memory setup. */ - -ENTRY(Reset_Handler) - MEMORY { flash0 : org = 0x00000000, len = 0xc0 flashcfg : org = 0x00000400, len = 0x10 flash : org = 0x00000410, len = 62k - 0x410 eeprom_emu : org = 0x0000F800, len = 2k - ram : org = 0x1FFFF800, len = 8k + ram0 : org = 0x1FFFF800, len = 8k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 } -__ram_start__ = ORIGIN(ram); -__ram_size__ = LENGTH(ram); -__ram_end__ = __ram_start__ + __ram_size__; - __eeprom_workarea_start__ = ORIGIN(eeprom_emu); __eeprom_workarea_size__ = LENGTH(eeprom_emu); __eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; -SECTIONS -{ - . = 0; +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); - .isr : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.vectors)) - } > flash0 +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flashcfg +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); - _text = .; +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); - constructors : ALIGN(4) SUBALIGN(4) - { - PROVIDE(__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE(__init_array_end = .); - } > flash +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); - destructors : ALIGN(4) SUBALIGN(4) - { - PROVIDE(__fini_array_start = .); - KEEP(*(.fini_array)) - KEEP(*(SORT(.fini_array.*))) - PROVIDE(__fini_array_end = .); - } > flash - - .text : ALIGN(4) SUBALIGN(4) - { - *(.text) - *(.text.*) - *(.rodata) - *(.rodata.*) - *(.glue_7t) - *(.glue_7) - *(.gcc*) - } > flash - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > flash - - .ARM.exidx : { - PROVIDE(__exidx_start = .); - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - PROVIDE(__exidx_end = .); - } > flash - - .eh_frame_hdr : - { - *(.eh_frame_hdr) - } > flash - - .eh_frame : ONLY_IF_RO - { - *(.eh_frame) - } > flash - - .textalign : ONLY_IF_RO - { - . = ALIGN(8); - } > flash - - _etext = .; - _textdata = _etext; - - .stacks : - { - . = ALIGN(8); - __main_stack_base__ = .; - . += __main_stack_size__; - . = ALIGN(8); - __main_stack_end__ = .; - __process_stack_base__ = .; - __main_thread_stack_base__ = .; - . += __process_stack_size__; - . = ALIGN(8); - __process_stack_end__ = .; - __main_thread_stack_end__ = .; - } > ram - - .data : - { - . = ALIGN(4); - PROVIDE(_data = .); - *(.data) - . = ALIGN(4); - *(.data.*) - . = ALIGN(4); - *(.ramtext) - . = ALIGN(4); - PROVIDE(_edata = .); - } > ram AT > flash - - .bss : - { - . = ALIGN(4); - PROVIDE(_bss_start = .); - *(.bss) - . = ALIGN(4); - *(.bss.*) - . = ALIGN(4); - *(COMMON) - . = ALIGN(4); - PROVIDE(_bss_end = .); - } > ram -} - -PROVIDE(end = .); -_end = .; - -__heap_base__ = _end; -__heap_end__ = __ram_end__; +INCLUDE ld/rules_kinetis.ld From a47c3c733320c2c11fc1f7be6215f9a40787cdf1 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 21 Dec 2015 17:04:23 +0000 Subject: [PATCH 101/179] Chibios: rename example stm32_onekey -> stm32_f072_onekey. --- keyboard/{stm32_onekey => stm32_f072_onekey}/Makefile | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/bootloader_defs.h | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/chconf.h | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/config.h | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/halconf.h | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/keymap_plain.c | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/led.c | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/matrix.c | 0 keyboard/{stm32_onekey => stm32_f072_onekey}/mcuconf.h | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename keyboard/{stm32_onekey => stm32_f072_onekey}/Makefile (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/bootloader_defs.h (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/chconf.h (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/config.h (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/halconf.h (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/keymap_plain.c (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/led.c (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/matrix.c (100%) rename keyboard/{stm32_onekey => stm32_f072_onekey}/mcuconf.h (100%) diff --git a/keyboard/stm32_onekey/Makefile b/keyboard/stm32_f072_onekey/Makefile similarity index 100% rename from keyboard/stm32_onekey/Makefile rename to keyboard/stm32_f072_onekey/Makefile diff --git a/keyboard/stm32_onekey/bootloader_defs.h b/keyboard/stm32_f072_onekey/bootloader_defs.h similarity index 100% rename from keyboard/stm32_onekey/bootloader_defs.h rename to keyboard/stm32_f072_onekey/bootloader_defs.h diff --git a/keyboard/stm32_onekey/chconf.h b/keyboard/stm32_f072_onekey/chconf.h similarity index 100% rename from keyboard/stm32_onekey/chconf.h rename to keyboard/stm32_f072_onekey/chconf.h diff --git a/keyboard/stm32_onekey/config.h b/keyboard/stm32_f072_onekey/config.h similarity index 100% rename from keyboard/stm32_onekey/config.h rename to keyboard/stm32_f072_onekey/config.h diff --git a/keyboard/stm32_onekey/halconf.h b/keyboard/stm32_f072_onekey/halconf.h similarity index 100% rename from keyboard/stm32_onekey/halconf.h rename to keyboard/stm32_f072_onekey/halconf.h diff --git a/keyboard/stm32_onekey/keymap_plain.c b/keyboard/stm32_f072_onekey/keymap_plain.c similarity index 100% rename from keyboard/stm32_onekey/keymap_plain.c rename to keyboard/stm32_f072_onekey/keymap_plain.c diff --git a/keyboard/stm32_onekey/led.c b/keyboard/stm32_f072_onekey/led.c similarity index 100% rename from keyboard/stm32_onekey/led.c rename to keyboard/stm32_f072_onekey/led.c diff --git a/keyboard/stm32_onekey/matrix.c b/keyboard/stm32_f072_onekey/matrix.c similarity index 100% rename from keyboard/stm32_onekey/matrix.c rename to keyboard/stm32_f072_onekey/matrix.c diff --git a/keyboard/stm32_onekey/mcuconf.h b/keyboard/stm32_f072_onekey/mcuconf.h similarity index 100% rename from keyboard/stm32_onekey/mcuconf.h rename to keyboard/stm32_f072_onekey/mcuconf.h From b2a3a2653789908e0d5b4770f8ab89d6e8e1d050 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 21 Dec 2015 17:04:46 +0000 Subject: [PATCH 102/179] Chibios: add makefiles for Teensy 3.x examples. --- keyboard/teensy_lc_onekey/Makefile.3.0 | 2 +- keyboard/teensy_lc_onekey/Makefile.3.2 | 77 ++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 keyboard/teensy_lc_onekey/Makefile.3.2 diff --git a/keyboard/teensy_lc_onekey/Makefile.3.0 b/keyboard/teensy_lc_onekey/Makefile.3.0 index a2f98c7e..dbf12c36 100644 --- a/keyboard/teensy_lc_onekey/Makefile.3.0 +++ b/keyboard/teensy_lc_onekey/Makefile.3.0 @@ -55,7 +55,7 @@ BOARD = PJRC_TEENSY_3 # Cortex version # Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 +MCU = cortex-m4 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 # I.e. 6 for Teensy LC; 7 for Teensy 3.x diff --git a/keyboard/teensy_lc_onekey/Makefile.3.2 b/keyboard/teensy_lc_onekey/Makefile.3.2 new file mode 100644 index 00000000..41bfa41a --- /dev/null +++ b/keyboard/teensy_lc_onekey/Makefile.3.2 @@ -0,0 +1,77 @@ +# Target file name (without extension). +PROJECT = ch + +# Directory common source files exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + +## chip/board settings +# - the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +# - For Teensies, FAMILY = KINETIS and SERIES is either +# KL2x (LC) or K20x (3.0,3.1,3.2). +MCU_FAMILY = KINETIS +MCU_SERIES = K20x + +# Linker script to use +# - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# - NOTE: a custom ld script is needed for EEPROM on Teensy LC +# - LDSCRIPT = +# - MKL26Z64 for Teensy LC +# - MK20DX128 for Teensy 3.0 +# - MK20DX256 for Teensy 3.1 and 3.2 +MCU_LDSCRIPT = MK20DX256 + +# Startup code to use +# - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +# - STARTUP = +# - kl2x for Teensy LC +# - k20x5 for Teensy 3.0 +# - k20x7 for Teensy 3.1 and 3.2 +MCU_STARTUP = k20x7 + +# Board: it should exist either in /os/hal/boards/ +# or /boards +# - BOARD = +# - PJRC_TEENSY_LC for Teensy LC +# - PJRC_TEENSY_3 for Teensy 3.0 +# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2 +BOARD = PJRC_TEENSY_3_1 + +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m4 + +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +# I.e. 6 for Teensy LC; 7 for Teensy 3.x +ARMV = 7 + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover + +include $(TMK_DIR)/tool/chibios/common.mk +include $(TMK_DIR)/tool/chibios/chibios.mk From 0998a9930dbdfe54add0245630fc6ff5297e5fa9 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 26 Dec 2015 19:54:33 +0100 Subject: [PATCH 103/179] Chibios: update Teensy 3.x instructions. --- keyboard/teensy_lc_onekey/instructions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md index ed355e29..b8beb108 100644 --- a/keyboard/teensy_lc_onekey/instructions.md +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -4,9 +4,9 @@ These ARM Teensies are now supported through [chibios](http://chibios.org). You'll need to install an ARM toolchain, for instance from [gcc ARM embedded](https://launchpad.net/gcc-arm-embedded) website, or using your favourite package manager. After installing, you should be able to run `arm-none-eabi-gcc -v` in the command prompt and get sensible output. This toolchain is used instead of `avr-gcc`, which is only for AVR chips. Naturally you'll also need the usual development tools (e.g. `make`), just as in the AVR setting. -You'll need this fork/branch of TMK. If you're reading this from your own hard drive, then you already have it ;) Anyway, you can get a zip from [here](https://https://github.com/flabbergast/tmk_keyboard/archive/chibios.zip) {or clone this repo from github and checkout the `chibios` branch}. +You'll need this fork/branch of TMK. If you're reading this from your own hard drive, then you already have it ;) Anyway, you can get a zip from [here](https://github.com/flabbergast/tmk_keyboard/archive/chibios.zip) {or clone this repo from github and checkout the `chibios` branch}. -Next, you'll need ChibiOS. The current release (3.0.2) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip) {or clone that repo from github and checkout the `kinetis` branch}. Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). +Next, you'll need ChibiOS. The current release (3.0.4) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip) {or clone that repo from github and checkout the `kinetis` branch}. Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). This should be it. Running `make` in `keyboard/teensy_lc_onekey` should create a working firmware in `build/`, called `ch.hex`. @@ -14,7 +14,7 @@ For more notes about the ChibiOS backend in TMK, see `tmk_core/protocol/chibios/ ## About this onekey example -It's set up for Teensy LC. To use 3.x, you'll need to edit the `Makefile` (and comment out one line in `mcuconf.h`). A sample makefile for Teensy 3.0 is provided as `Makefile.3.0`, can be used without renaming with `make -f Makefile.3.0`. +It's set up for Teensy LC. To use 3.x, you'll need to edit the `Makefile` (and comment out one line in `mcuconf.h`). A sample makefile for Teensy 3.0 is provided as `Makefile.3.0`, can be used without renaming with `make -f Makefile.3.0`. Similarly for Teensy 3.2, there's `Makefile.3.2`. ## Credits @@ -24,7 +24,7 @@ The USB support for Kinetis MCUs is due to RedoX. His ChibiOS fork is also [on g ## Features that are not implemented yet -Currently only the more fancy suspend features are not there (i.e. "breathing" LED during suspend, power saving during suspend, sending a wakeup packet). The rest should work fine (reports either way are welcome). +Currently only the more fancy suspend features are not there (power saving during suspend). The rest should work fine (reports either way are welcome). # Matrix programming notes From 1d6c6609e0f41f760a9eecaab1e19c76f99f9c52 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sun, 27 Dec 2015 19:32:27 +0100 Subject: [PATCH 104/179] Chibios: Tsy LC is cortex-m0plus. --- keyboard/teensy_lc_onekey/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboard/teensy_lc_onekey/Makefile b/keyboard/teensy_lc_onekey/Makefile index dc489cb7..e4424dda 100644 --- a/keyboard/teensy_lc_onekey/Makefile +++ b/keyboard/teensy_lc_onekey/Makefile @@ -54,8 +54,8 @@ MCU_STARTUP = kl2x BOARD = PJRC_TEENSY_LC # Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 +# Teensy LC is cortex-m0plus; Teensy 3.x are cortex-m4 +MCU = cortex-m0plus # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 # I.e. 6 for Teensy LC; 7 for Teensy 3.x From 58867094c489e09c79fb0d906f280e3f9db7cc5d Mon Sep 17 00:00:00 2001 From: flabbergast Date: Wed, 30 Dec 2015 10:46:08 +0100 Subject: [PATCH 105/179] Chibios: add 'core/protocol' to the makefiles' search path. --- tmk_core/tool/chibios/chibios.mk | 2 +- tmk_core/tool/chibios/common.mk | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index 0f6af53d..a67e067a 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -152,7 +152,7 @@ INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \ $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \ - $(TARGET_DIR) + $(TMK_DIR)/protocol $(TARGET_DIR) # # Project, sources and paths diff --git a/tmk_core/tool/chibios/common.mk b/tmk_core/tool/chibios/common.mk index 883054a4..7e3cccc9 100644 --- a/tmk_core/tool/chibios/common.mk +++ b/tmk_core/tool/chibios/common.mk @@ -83,6 +83,3 @@ OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') ifdef BOOTLOADER_ADDRESS OPT_DEFS += -DBOOTLOADER_ADDRESS=$(BOOTLOADER_ADDRESS) endif - -# Search Path -VPATH += $(TMK_DIR)/common From 66b6df0068b8a9ad9cd522ae2a32bc8d52aa35c9 Mon Sep 17 00:00:00 2001 From: obones Date: Thu, 7 Jan 2016 14:40:53 +0100 Subject: [PATCH 106/179] host_driver is only used if KEYBOARD_LOCK_ENABLE is defined --- tmk_core/common/command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index d59bb01b..465aa21c 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -178,7 +178,9 @@ static void print_eeconfig(void) static bool command_common(uint8_t code) { +#ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; +#endif switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: From 310a39dd7617e27d53e8e7c0a0d0fbd0faff58e6 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 8 Jan 2016 10:25:24 +0900 Subject: [PATCH 107/179] adb_usb: Change keycode PEQL to EQL(Fix #238) Windows doesn't support PEQL(Keypad =) --- converter/adb_usb/keymap_ansi.c | 2 +- converter/adb_usb/keymap_iso.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/converter/adb_usb/keymap_ansi.c b/converter/adb_usb/keymap_ansi.c index 4ea601be..aa993192 100644 --- a/converter/adb_usb/keymap_ansi.c +++ b/converter/adb_usb/keymap_ansi.c @@ -4,7 +4,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KEYMAP_EXT_ANSI( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, LCAP,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, diff --git a/converter/adb_usb/keymap_iso.c b/converter/adb_usb/keymap_iso.c index a1b1a5eb..1ccb17e2 100644 --- a/converter/adb_usb/keymap_iso.c +++ b/converter/adb_usb/keymap_iso.c @@ -4,7 +4,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KEYMAP_EXT_ISO( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS, LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, From c219570e54caed947882c26266a6b85ab9a3a493 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 8 Jan 2016 10:39:23 +0900 Subject: [PATCH 108/179] adb_usb: Add LED flash on startup --- converter/adb_usb/matrix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index 6220ee6e..dad71758 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -86,6 +86,12 @@ void matrix_init(void) //debug_keyboard = true; //debug_mouse = true; print("debug enabled.\n"); + + // LED flash + DDRD |= (1<<6); PORTD |= (1<<6); + _delay_ms(500); + DDRD |= (1<<6); PORTD &= ~(1<<6); + return; } From 7d621aca7bcf34374e30ddfe79f0f16cf5caa26e Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 8 Jan 2016 12:48:35 +0900 Subject: [PATCH 109/179] m0110_usb: Add LED flash on startup --- converter/m0110_usb/matrix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/converter/m0110_usb/matrix.c b/converter/m0110_usb/matrix.c index 2189c0b5..9dcdc0d6 100644 --- a/converter/m0110_usb/matrix.c +++ b/converter/m0110_usb/matrix.c @@ -64,6 +64,12 @@ void matrix_init(void) // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00; matrix = _matrix0; + + // LED flash + DDRD |= (1<<6); PORTD |= (1<<6); + _delay_ms(500); + DDRD |= (1<<6); PORTD &= ~(1<<6); + return; } From 467602749dda5bcf8e2651b7407c07779fb5646c Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 12 Jan 2016 02:21:56 +0900 Subject: [PATCH 110/179] Fix fn_actions for keymap editor --- converter/m0110_usb/keymap_default.c | 2 +- keyboard/alps64/keymap_plain.c | 6 +++--- keyboard/hhkb/keymap_hhkb.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/converter/m0110_usb/keymap_default.c b/converter/m0110_usb/keymap_default.c index ff7478d1..0f9b8d27 100644 --- a/converter/m0110_usb/keymap_default.c +++ b/converter/m0110_usb/keymap_default.c @@ -133,5 +133,5 @@ const uint16_t fn_actions[] PROGMEM = { [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), [29] = ACTION_MODS_ONESHOT(MOD_LSFT), [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), - [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH), + [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), }; diff --git a/keyboard/alps64/keymap_plain.c b/keyboard/alps64/keymap_plain.c index fcbec596..d6ff119f 100644 --- a/keyboard/alps64/keymap_plain.c +++ b/keyboard/alps64/keymap_plain.c @@ -40,9 +40,9 @@ const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { [10] = ACTION_LAYER_TAP_TOGGLE(1), [11] = ACTION_LAYER_TAP_TOGGLE(2), [12] = ACTION_LAYER_TAP_TOGGLE(3), - [13] = ACTION_LAYER_TAP_KEY(1, KC_A), - [14] = ACTION_LAYER_TAP_KEY(2, KC_F), - [15] = ACTION_LAYER_TAP_KEY(3, KC_J), + [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), + [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), + [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), diff --git a/keyboard/hhkb/keymap_hhkb.c b/keyboard/hhkb/keymap_hhkb.c index f0552a37..7807f436 100644 --- a/keyboard/hhkb/keymap_hhkb.c +++ b/keyboard/hhkb/keymap_hhkb.c @@ -68,9 +68,9 @@ const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { [10] = ACTION_LAYER_TAP_TOGGLE(1), [11] = ACTION_LAYER_TAP_TOGGLE(2), [12] = ACTION_LAYER_TAP_TOGGLE(3), - [13] = ACTION_LAYER_TAP_KEY(1, KC_A), - [14] = ACTION_LAYER_TAP_KEY(2, KC_F), - [15] = ACTION_LAYER_TAP_KEY(3, KC_J), + [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), + [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), + [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), From c5d98f5c6f8c5c38b66ec386dbf204a0dea73f33 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 12 Jan 2016 11:31:07 +0900 Subject: [PATCH 111/179] hhkb: Add note about RN42 --- keyboard/hhkb/rn42/MEMO.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/keyboard/hhkb/rn42/MEMO.txt b/keyboard/hhkb/rn42/MEMO.txt index 0363c2f4..a86c49c4 100644 --- a/keyboard/hhkb/rn42/MEMO.txt +++ b/keyboard/hhkb/rn42/MEMO.txt @@ -2,6 +2,13 @@ Memo of deveopment ================== just memo, NOT WORTH READING +2015/11/24 +JP Bluetooth: + RN-42 cannot send Japanese keys like; henkan, mu-henkan and kana, JPY and RO. + It seems HID usage more than 0x65 cannot be send with the module. + http://shiki.esrille.com/2014/07/bluetoothnisse.html + + Bug: - Factory Reset PIO4 doesn't work - the reason is unclear - 12/08 NOT LOOK INTO ANY MORE From 6382a9b5f4ab67522a0f373559db6c877dd4ca80 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 12 Jan 2016 13:03:22 +0900 Subject: [PATCH 112/179] usb_usb: Fix for keymap editor --- converter/usb_usb/Makefile.keymap_editor | 5 + converter/usb_usb/keymap.c | 103 ++++++++------- converter/usb_usb/keymap_common.h | 161 ++++++++++------------- converter/usb_usb/keymap_editor.c | 88 +++++++++++++ converter/usb_usb/keymap_spacefn.c | 64 ++++----- tmk_core/common/keycode.h | 8 ++ 6 files changed, 258 insertions(+), 171 deletions(-) create mode 100644 converter/usb_usb/Makefile.keymap_editor create mode 100644 converter/usb_usb/keymap_editor.c diff --git a/converter/usb_usb/Makefile.keymap_editor b/converter/usb_usb/Makefile.keymap_editor new file mode 100644 index 00000000..08293d5d --- /dev/null +++ b/converter/usb_usb/Makefile.keymap_editor @@ -0,0 +1,5 @@ +# build firmware for keymap editor +# +KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor +KEYMAP = editor +include Makefile diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c index 5397de51..f1211147 100644 --- a/converter/usb_usb/keymap.c +++ b/converter/usb_usb/keymap.c @@ -18,33 +18,37 @@ along with this program. If not, see . #include "keymap_common.h" -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { /* 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| - * `---' `---------------' `---------------' `---------------' `-----------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| | - * |-----------------------------------------------------------| `-----------' |-----------| +| - * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| | - * |-----------------------------------------------------------| ,---. |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | - * |-----------------------------------------------------------| ,-----------. |-----------|Ent| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| | - * `-----------------------------------------------------------' `-----------' `---------------' + * ,---------------. ,---------------. ,---------------. + * |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( - 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, - 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 + 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 ), - /* 1: Colemak http://colemak.com +#if 0 + /* Colemak http://colemak.com * ,-----------------------------------------------------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| * |-----------------------------------------------------------| @@ -57,16 +61,17 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |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, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, - BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + 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 ), - /* 2: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard + /* Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard * ,-----------------------------------------------------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| * |-----------------------------------------------------------| @@ -79,16 +84,17 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |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, LBRC,RBRC,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9, - CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, P4, P5, P6, PPLS, - LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + 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 ), - /* 3: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ + /* 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| * |-----------------------------------------------------------| @@ -101,15 +107,16 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |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, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, - BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + 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 ), +#endif }; -const uint16_t PROGMEM fn_actions[] = { -}; +const uint16_t fn_actions[] PROGMEM = {}; diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h index 8de4dce0..0240d4de 100644 --- a/converter/usb_usb/keymap_common.h +++ b/converter/usb_usb/keymap_common.h @@ -32,63 +32,6 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; -/* ,---. ,---------------. ,---------------. ,---------------. ,-----------. - * |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 \ -) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, /* 00-07 */ \ - { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, /* 08-0F */ \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, /* 10-17 */ \ - { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, /* 18-1F */ \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, /* 20-27 */ \ - { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \ - { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, /* 30-37 */ \ - { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, /* 38-3F */ \ - { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, /* 40-47 */ \ - { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, /* 48-4F */ \ - { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, /* 50-57 */ \ - { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, /* 58-5F */ \ - { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_NO, KC_##K65, KC_NO, KC_NO }, /* 60-67 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 68-6F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 70-77 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 78-7F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 80-87 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 90-97 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A0-A7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B0-B7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C0-C7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D0-D7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \ - { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, /* E0-E7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F0-F7 */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ -} - /* ,---------------. ,---------------. ,---------------. * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. @@ -101,9 +44,9 @@ extern const uint16_t fn_actions[]; * |-----------------------------------------------------------| `-----------' |---------------| |-------| * |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|Ent| |Exe|Pst| - * |-----------------------------------------------------------| ,-----------. |-----------| | |-------| - * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0|KP=| .| | |Fnd|Cut| + * |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| * `-----------------------------------------------------------' `-----------' `---------------' `-------' * * @@ -130,13 +73,13 @@ extern const uint16_t fn_actions[]; * 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,K58, K74,K7D, \ - KE0,KE3,KE2,K8B,K91,K2C, K90,K8A,K88,KE6,KE7,K65, KE4, K50,K51,K4F, K62,K67,K63, K7E,K7B \ + 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 */ \ @@ -172,6 +115,38 @@ extern const uint16_t fn_actions[]; { 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| * `---' `---------------' `---------------' `---------------' `-----------' @@ -188,20 +163,20 @@ extern const uint16_t fn_actions[]; * `-----------------------------------------------------------' `-----------' `---------------' */ #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 \ + 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, BSLS,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,K58, NO, NO, \ - KE0,KE3,KE2,NO, NO, K2C, NO, NO, NO, KE6,KE7,K65, KE4, K50,K51,K4F, K62,NO, K63, NO, NO \ + 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 \ ) /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -220,19 +195,19 @@ extern const uint16_t fn_actions[]; * `-----------------------------------------------------------' `-----------' `---------------' */ #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 \ + 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, BSLS,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,K58, NO, NO, \ - KE0,KE3,KE2,K8B,NO, K2C, NO, K8A,K88,KE6,KE7,K65, KE4, K50,K51,K4F, K62,NO, K63, NO, NO \ + 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 diff --git a/converter/usb_usb/keymap_editor.c b/converter/usb_usb/keymap_editor.c new file mode 100644 index 00000000..5e008901 --- /dev/null +++ b/converter/usb_usb/keymap_editor.c @@ -0,0 +1,88 @@ +/* +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 "keymap_common.h" + + +#ifndef KEYMAP_SECTION_ENABLE + #error "KEYMAP_SECTION_ENABLE is not defined." +#endif + +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { + /* 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 + ), +}; + +const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_MOMENTARY(3), + [3] = ACTION_LAYER_MOMENTARY(4), + [4] = ACTION_LAYER_MOMENTARY(5), + [5] = ACTION_LAYER_MOMENTARY(6), + [6] = ACTION_LAYER_MOMENTARY(7), + [7] = ACTION_LAYER_TOGGLE(1), + [8] = ACTION_LAYER_TOGGLE(2), + [9] = ACTION_LAYER_TOGGLE(3), + [10] = ACTION_LAYER_TAP_TOGGLE(1), + [11] = ACTION_LAYER_TAP_TOGGLE(2), + [12] = ACTION_LAYER_TAP_TOGGLE(3), + [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), + [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), + [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), + [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), + [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), + [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), + [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), + [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), + [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), + [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), + [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), + [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), + [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), + [26] = ACTION_MODS_ONESHOT(MOD_LCTL), + [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), + [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), + [29] = ACTION_MODS_ONESHOT(MOD_LSFT), + [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), + [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), +}; diff --git a/converter/usb_usb/keymap_spacefn.c b/converter/usb_usb/keymap_spacefn.c index bffd2bc6..69f8693e 100644 --- a/converter/usb_usb/keymap_spacefn.c +++ b/converter/usb_usb/keymap_spacefn.c @@ -6,36 +6,39 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: default - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| - * `---' `---------------' `---------------' `---------------' `-----------' `-----------' - * ,-----------------------------------------------------------. ,-----------. ,---------------. - * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -| - * |-----------------------------------------------------------| |-----------| |---------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| | - * |-----------------------------------------------------------| `-----------' |-----------| +| - * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| | - * |-----------------------------------------------------------| ,---. |---------------| - * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | - * |-----------------------------------------------------------| ,-----------. |-----------|Ent| - * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| | - * `-----------------------------------------------------------' `-----------' `---------------' + /* 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| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' */ - KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + 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 | * |-----------------------------------------------------------| - * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | + * |Caps | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | * |-----------------------------------------------------------| * | | | | | | |PgU|Lef|Dow|Rig| | | | * |-----------------------------------------------------------| @@ -44,13 +47,14 @@ 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,BRK, - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, - TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS, - TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3, - TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT + 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 ), }; diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 9fec2904..f3402712 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -95,6 +95,9 @@ along with this program. If not, see . #define KC_JPY 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 @@ -114,6 +117,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 From 2a55b1d80532af1edfb02eabc33a746dc82f4312 Mon Sep 17 00:00:00 2001 From: Shayne Holmes Date: Tue, 12 Jan 2016 10:19:58 -0800 Subject: [PATCH 113/179] Fix typo in bootmagic debug message --- tmk_core/common/bootmagic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index b002a585..d6684b2d 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -19,7 +19,7 @@ void bootmagic(void) } /* do scans in case of bounce */ - print("boogmagic scan: ... "); + print("bootmagic scan: ... "); uint8_t scan = 100; while (scan--) { matrix_scan(); _delay_ms(10); } print("done.\n"); From c74eee6327c5995456ba004d70b9663cf485d9f8 Mon Sep 17 00:00:00 2001 From: duanhongyi Date: Thu, 14 Jan 2016 15:27:26 +0800 Subject: [PATCH 114/179] remove SERIAL_SOFT_DEBUG macro SERIAL_SOFT_DEBUG can be defined in the `config.h` --- tmk_core/protocol/serial_soft.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tmk_core/protocol/serial_soft.c b/tmk_core/protocol/serial_soft.c index 44822b7e..569205bf 100644 --- a/tmk_core/protocol/serial_soft.c +++ b/tmk_core/protocol/serial_soft.c @@ -68,7 +68,6 @@ POSSIBILITY OF SUCH DAMAGE. #endif /* debug for signal timing, see debug pin with oscilloscope */ -#define SERIAL_SOFT_DEBUG #ifdef SERIAL_SOFT_DEBUG #define SERIAL_SOFT_DEBUG_INIT() (DDRD |= 1<<7) #define SERIAL_SOFT_DEBUG_TGL() (PORTD ^= 1<<7) @@ -176,7 +175,7 @@ void serial_send(uint8_t data) ISR(SERIAL_SOFT_RXD_VECT) { SERIAL_SOFT_DEBUG_TGL(); - SERIAL_SOFT_RXD_INT_ENTER() + SERIAL_SOFT_RXD_INT_ENTER(); uint8_t data = 0; From 5611f94fb11096ecf13c463642d1e8c480d7fc2e Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 12:18:58 +0900 Subject: [PATCH 115/179] usb_usb: Change matrix size 32x8 to 16x16 --- converter/usb_usb/config.h | 4 +- converter/usb_usb/keymap_common.h | 64 +++++++++++++++---------------- converter/usb_usb/keymap_editor.c | 2 +- converter/usb_usb/matrix.c | 26 ++++++------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/converter/usb_usb/config.h b/converter/usb_usb/config.h index c9924567..87da4a45 100644 --- a/converter/usb_usb/config.h +++ b/converter/usb_usb/config.h @@ -30,8 +30,8 @@ along with this program. If not, see . /* matrix size */ -#define MATRIX_ROWS 32 -#define MATRIX_COLS 8 +#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))) diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h index 0240d4de..ee1c7c4d 100644 --- a/converter/usb_usb/keymap_common.h +++ b/converter/usb_usb/keymap_common.h @@ -81,38 +81,38 @@ extern const uint16_t fn_actions[]; 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, 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 */ \ } /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. diff --git a/converter/usb_usb/keymap_editor.c b/converter/usb_usb/keymap_editor.c index 5e008901..bd63ea23 100644 --- a/converter/usb_usb/keymap_editor.c +++ b/converter/usb_usb/keymap_editor.c @@ -1,5 +1,5 @@ /* -Copyright 2012 Jun Wako +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 diff --git a/converter/usb_usb/matrix.c b/converter/usb_usb/matrix.c index 83d5ab6c..184933ac 100644 --- a/converter/usb_usb/matrix.c +++ b/converter/usb_usb/matrix.c @@ -31,20 +31,20 @@ along with this program. If not, see . * * 7 6 5 4 3 2 1 0 * +---------------+ - * | ROW | COL | + * | ROW | COL | * +---------------+ * - * Matrix space(32 * 8): - * 01234567 - * 0 +--------+ - * : | | - * : | | - * 31 +--------+ + * Matrix space(16 * 16): + * r\c0123456789ABCDEF + * 0 +----------------+ + * : | | + * : | | + * 16 +----------------+ */ -#define ROW_MASK 0xF8 -#define COL_MASK 0x07 -#define CODE(row, col) (((row) << 3) | (col)) -#define ROW(code) (((code) & ROW_MASK) >> 3) +#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)) @@ -89,8 +89,8 @@ bool matrix_is_on(uint8_t row, uint8_t col) { return false; } -uint8_t matrix_get_row(uint8_t row) { - uint8_t row_bits = 0; +matrix_row_t matrix_get_row(uint8_t row) { + uint16_t row_bits = 0; if (IS_MOD(CODE(row, 0)) && usb_hid_keyboard_report.mods) { row_bits |= usb_hid_keyboard_report.mods; From 0851cf926f63aeacc055ceaf72917f95068b49c0 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 14:12:57 +0900 Subject: [PATCH 116/179] core: Fix doc/build.md --- tmk_core/doc/build.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md index beff191b..ffcd0fbc 100644 --- a/tmk_core/doc/build.md +++ b/tmk_core/doc/build.md @@ -10,7 +10,7 @@ Download and Install 2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows. -3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver. +3. **Driver** On Windows when you start DFU bootloader on the chip first time you will see **Found New Hardware Wizard** to install driver. If you install device driver properly you will find chip name like **ATmega32U4** under **LibUSB-Win32 Devices** tree on **Device Manager**. If not you shall need to update its driver on **Device Manager**. You will find the driver in `FLIP` install directory like: `C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\`. In case of `dfu-programmer` install driver distributed with it. If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader]. @@ -20,7 +20,7 @@ You can find firmware source at github: - -If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from: +If you are familiar with `git` tools you are recommended to use it but you can also download zip archive from: - @@ -28,7 +28,7 @@ If you are familiar with `Git` tools you are recommended to use it but you can a Build firmware -------------- ### 1. Open terminal -Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up. +Open terminal window to get access to commands. Use Cygwin(or MingGW) shell terminal in Windows or `Terminal.app` on Mac OSX. ### 2. Change directory Move to project directory in the firmware source. @@ -68,33 +68,31 @@ Or to program with `dfu-programmer` run: $ make -f Makefile. dfu #### FLIP GUI tutorial -1. On menu bar click Device -> Select, then choose your chip name. -2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog. -At this point you'll see grey-outed widgets on the app get colored and ready. +1. On menu bar click **Device** -> **Select**, then choose your chip name. (In most case **ATmega32U2** or **ATmega32U4**) +2. On menu bar click **Settings** -> **Communication** -> **USB**, then click **Open** button on **USB Port Connection** dialog. At this point you'll have to plug into USB and start bootloader. -3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog. -4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected. -5. Re-plug USB cord or click 'Start Application' button to restart your controller. +3. On menu bar click **File** -> **Load HEX File**, then select your firmware hex file on File Selector dialog. +4. On **Operations Flow** panel click **Run** button to load the firmware binary to the chip. Note that you should keep **Erase**, **Blank Check**, **Program** and **Verify** check boxes selected. +5. Re-plug USB cord or click **Start Application** button to restart your controller. Done. -See also these instructions if you need. +See also these instructions if needed. - - -### 3. Program with Teensy Loader -If you have PJRC Teensy see instruction of `Teensy Loader`. +##### Troubleshoot +* **FLIP: AtLibUsbDfu.dll not found** +Remove current driver and re-install one FLIP provides from DeviceManager of WIndows. See -- -Or use this command if you have command line version of Teensy Loader installed. +### 3. Program with Other programmer +If you are using PJRC Teensy consult with instruction of [Teensy Loader][teensy-loader]. Or run this target with `make` after you install command line version of it. $ make -f Makefile. teensy - -### 4. Program with Other programmer -You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. +You may want to use other programmer like [`avrdude`][avrdude]. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. See below. $ make -f Makefile. program @@ -106,6 +104,7 @@ You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or [flip]: http://www.atmel.com/tools/FLIP.aspx [dfu-prog]: http://dfu-programmer.sourceforge.net/ [teensy-loader]:http://www.pjrc.com/teensy/loader.html +[avrdude]: http://savannah.nongnu.org/projects/avrdude/ @@ -121,6 +120,7 @@ Set your MCU and its clock in Hz. # Boot Section Size in *bytes* # Teensy halfKay 512 + # Teensy++ halfKay 2048 # Atmel DFU loader 4096 # LUFA bootloader 4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096 @@ -140,7 +140,7 @@ Optional. Note that ***comment out*** with `#` to disable them. #BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality ### 3. Programmer -Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`. +Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. # avrdude with AVRISPmkII PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex From 6baca549b946033128a786ed4150de7644340d1f Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 14:30:47 +0900 Subject: [PATCH 117/179] core: Add dfu-programmer example to doc/build.md --- tmk_core/doc/build.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md index ffcd0fbc..0585d62d 100644 --- a/tmk_core/doc/build.md +++ b/tmk_core/doc/build.md @@ -53,22 +53,28 @@ Now you have **hex** file to program on current directory. This **hex** is only How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual. ### 2. Program with DFU bootloader -Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. +Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. `FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. Open source alternative `dfu-programmer` also supports AVR chips, it is command line tool and runs on Linux, Mac OSX and even Windows. -To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`. -If you have a proper program command in `Makefile` just type this. -`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. -To use command line tool run this command. Note that you need to set PATH variable properly. +To program with command of `FLIP` run this. Note that you need to set PATH variable properly. $ make -f Makefile. flip -Or to program with `dfu-programmer` run: +With `dfu-programmer` run this. $ make -f Makefile. dfu +Or you can execute the command directly as the following. + + $ dfu-programmer erase --force + $ dfu-programmer flash + $ dfu-programmer reset + +`` part will be `atmega32u4` or `atmega32u2` in most cases. See manual of the command for the detail. + + #### FLIP GUI tutorial -1. On menu bar click **Device** -> **Select**, then choose your chip name. (In most case **ATmega32U2** or **ATmega32U4**) +1. On menu bar click **Device** -> **Select**, then choose your chip name. (In most cases **ATmega32U2** or **ATmega32U4**) 2. On menu bar click **Settings** -> **Communication** -> **USB**, then click **Open** button on **USB Port Connection** dialog. At this point you'll have to plug into USB and start bootloader. 3. On menu bar click **File** -> **Load HEX File**, then select your firmware hex file on File Selector dialog. From 5a196b64448dd0b8fe84e5960b7ed4111383b8eb Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 23 Oct 2015 20:38:50 +0200 Subject: [PATCH 118/179] Add support for storing, restoring and clearing modifiers in macros --- tmk_core/common/action_macro.c | 13 +++++++++++++ tmk_core/common/action_macro.h | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c index ffaf125c..34e22e57 100644 --- a/tmk_core/common/action_macro.c +++ b/tmk_core/common/action_macro.c @@ -34,6 +34,8 @@ void action_macro_play(const macro_t *macro_p) macro_t macro = END; uint8_t interval = 0; + uint8_t mod_storage; + if (!macro_p) return; while (true) { switch (MACRO_READ()) { @@ -66,6 +68,17 @@ void action_macro_play(const macro_t *macro_p) interval = MACRO_READ(); dprintf("INTERVAL(%u)\n", interval); break; + case MOD_STORE: + mod_storage = get_mods(); + break; + case MOD_RESTORE: + set_mods(mod_storage); + send_keyboard_report(); + break; + case MOD_CLEAR: + clear_mods(); + send_keyboard_report(); + break; case 0x04 ... 0x73: dprintf("DOWN(%02X)\n", macro); register_code(macro); diff --git a/tmk_core/common/action_macro.h b/tmk_core/common/action_macro.h index aedc32ec..4cf2216d 100644 --- a/tmk_core/common/action_macro.h +++ b/tmk_core/common/action_macro.h @@ -64,6 +64,9 @@ enum macro_command_id{ /* 0x74 - 0x83 */ WAIT = 0x74, INTERVAL, + MOD_STORE, + MOD_RESTORE, + MOD_CLEAR, /* 0x84 - 0xf3 (reserved for keycode up) */ @@ -82,6 +85,9 @@ enum macro_command_id{ #define TYPE(key) DOWN(key), UP(key) #define WAIT(ms) WAIT, (ms) #define INTERVAL(ms) INTERVAL, (ms) +#define STORE() MOD_STORE +#define RESTORE() MOD_RESTORE +#define CLEAR() MOD_CLEAR /* key down */ #define D(key) DOWN(KC_##key) @@ -93,6 +99,12 @@ enum macro_command_id{ #define W(ms) WAIT(ms) /* interval */ #define I(ms) INTERVAL(ms) +/* store modifier(s) */ +#define SM() STORE() +/* restore modifier(s) */ +#define RM() RESTORE() +/* clear modifier(s) */ +#define CM() CLEAR() /* for backward comaptibility */ #define MD(key) DOWN(KC_##key) From 8ccbbde881a7bd176ee64db3b11a6336d3b17a84 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 16:00:56 +0900 Subject: [PATCH 119/179] core: Add macro commands SM(), RM() and CM() --- tmk_core/doc/keymap.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index d4a129b2..566936c6 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -368,17 +368,37 @@ Default Layer also has bitwise operations, they are executed when key is release MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) #### 2.3.1 Macro Commands +- **MACRO()** +- **MACRO_NONE** + - **I()** change interval of stroke. - **D()** press key - **U()** release key - **T()** type key(press and release) - **W()** wait +- **SM()** store modifier state +- **RM()** restore modifier state +- **CM()** clear modifier state - **END** end mark #### 2.3.2 Examples +***TBD*** + + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) + { + switch (id) { + case HELLO: + return (record->event.pressed ? + MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) : + MACRO_NONE ); + case ALT_TAB: + return (record->event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; + } -***TODO: sample implementation*** -See `keyboard/hhkb/keymap.c` for sample. From 325a99acd9c81f60519b6e594b2bf5d1e478ac56 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 16:24:06 +0900 Subject: [PATCH 120/179] core: Fix variable init and header include --- tmk_core/common/keymap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index d4892380..f6a15172 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -22,6 +22,7 @@ along with this program. If not, see . #include "action_macro.h" #include "wait.h" #include "debug.h" +#include "bootloader.h" static action_t keycode_to_action(uint8_t keycode); @@ -123,7 +124,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) /* translates keycode to action */ static action_t keycode_to_action(uint8_t keycode) { - action_t action; + action_t action = {}; switch (keycode) { case KC_A ... KC_EXSEL: case KC_LCTRL ... KC_RGUI: From 7694eb62ac108a049e037cfb6d2eac956fc08931 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 16:26:01 +0900 Subject: [PATCH 121/179] core: Fix variable initialize --- tmk_core/common/action_macro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c index 34e22e57..b2891bf4 100644 --- a/tmk_core/common/action_macro.c +++ b/tmk_core/common/action_macro.c @@ -34,7 +34,7 @@ void action_macro_play(const macro_t *macro_p) macro_t macro = END; uint8_t interval = 0; - uint8_t mod_storage; + uint8_t mod_storage = 0; if (!macro_p) return; while (true) { From 5ef7d89406da5e3eda1196805dcc842787fa01cb Mon Sep 17 00:00:00 2001 From: flabbergast Date: Fri, 15 Jan 2016 21:41:51 +0000 Subject: [PATCH 122/179] Chibios: Update to new USB API. --- tmk_core/protocol/chibios/usb_main.c | 131 +++++++++++++++------------ 1 file changed, 73 insertions(+), 58 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index ee2788e5..9097d4e8 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -52,11 +52,12 @@ uint8_t extra_report_blank[3] = {0}; #endif /* EXTRAKEY_ENABLE */ #ifdef CONSOLE_ENABLE -/* The emission queue */ -output_queue_t console_queue; -static uint8_t console_queue_buffer[CONSOLE_QUEUE_BUFFER_SIZE]; +/* The emission buffers queue */ +output_buffers_queue_t console_buf_queue; +static uint8_t console_queue_buffer[BQ_BUFFER_SIZE(CONSOLE_QUEUE_CAPACITY, CONSOLE_EPSIZE)]; + static virtual_timer_t console_flush_timer; -void console_queue_onotify(io_queue_t *qp); +void console_queue_onotify(io_buffers_queue_t *bqp); static void console_flush_cb(void *arg); #endif /* CONSOLE_ENABLE */ @@ -1019,7 +1020,7 @@ void init_usb_driver(USBDriver *usbp) { chVTObjectInit(&keyboard_idle_timer); #ifdef CONSOLE_ENABLE - oqObjectInit(&console_queue, console_queue_buffer, sizeof(console_queue_buffer), console_queue_onotify, (void *)usbp); + obqObjectInit(&console_buf_queue, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp); chVTObjectInit(&console_flush_timer); #endif } @@ -1093,10 +1094,7 @@ static void keyboard_idle_timer_cb(void *arg) { if(keyboard_idle) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ - osalSysUnlockFromISR(); - usbPrepareTransmit(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); - osalSysLockFromISR(); - usbStartTransmitI(usbp, KBD_ENDPOINT); + usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); /* rearm the timer */ chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); } @@ -1121,26 +1119,28 @@ void send_keyboard(report_keyboard_t *report) { } osalSysUnlock(); - bool ep_not_ready; #ifdef NKRO_ENABLE if(keyboard_nkro) { /* NKRO protocol */ - usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); /* need to wait until the previous packet has made it through */ - do { - osalSysLock(); - ep_not_ready = usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); - osalSysUnlock(); - } while (ep_not_ready); + /* can rewrite this using the synchronous API, then would wait + * until *after* the packet has been transmitted. I think + * this is more efficient */ + /* busy wait, should be short and not very common */ + osalSysLock(); + while(usbGetTransmitStatusI(&USB_DRIVER, NKRO_ENDPOINT)) + ; + usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + osalSysUnlock(); } else #endif /* NKRO_ENABLE */ { /* boot protocol */ - usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); /* need to wait until the previous packet has made it through */ - do { - osalSysLock(); - ep_not_ready = usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); - osalSysUnlock(); - } while (ep_not_ready); + /* busy wait, should be short and not very common */ + osalSysLock(); + while(usbGetTransmitStatusI(&USB_DRIVER, KBD_ENDPOINT)) + ; + usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); + osalSysUnlock(); } keyboard_report_sent = *report; } @@ -1171,9 +1171,8 @@ void send_mouse(report_mouse_t *report) { * is this really needed? */ - usbPrepareTransmit(&USB_DRIVER, MOUSE_ENDPOINT, (uint8_t *)report, sizeof(report_mouse_t)); osalSysLock(); - usbStartTransmitI(&USB_DRIVER, MOUSE_ENDPOINT); + usbStartTransmitI(&USB_DRIVER, MOUSE_ENDPOINT, (uint8_t *)report, sizeof(report_mouse_t)); osalSysUnlock(); } @@ -1209,10 +1208,7 @@ static void send_extra_report(uint8_t report_id, uint16_t data) { .usage = data }; - osalSysUnlock(); - usbPrepareTransmit(&USB_DRIVER, EXTRA_ENDPOINT, (uint8_t *)&report, sizeof(report_extra_t)); - osalSysLock(); - usbStartTransmitI(&USB_DRIVER, EXTRA_ENDPOINT); + usbStartTransmitI(&USB_DRIVER, EXTRA_ENDPOINT, (uint8_t *)&report, sizeof(report_extra_t)); osalSysUnlock(); } @@ -1240,20 +1236,32 @@ void send_consumer(uint16_t data) { #ifdef CONSOLE_ENABLE -/* debug IN callback hander */ +/* console IN callback hander */ void console_in_cb(USBDriver *usbp, usbep_t ep) { - (void)ep; + (void)ep; /* should have ep == CONSOLE_ENDPOINT, so use that to save time/space */ + uint8_t *buf; + size_t n; + osalSysLockFromISR(); /* rearm the timer */ chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); - /* Check if there is data to send left in the output queue */ - if(chOQGetFullI(&console_queue) >= CONSOLE_EPSIZE) { - osalSysUnlockFromISR(); - usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_EPSIZE); - osalSysLockFromISR(); - usbStartTransmitI(usbp, CONSOLE_ENDPOINT); + /* Freeing the buffer just transmitted, if it was not a zero size packet.*/ + if (usbp->epc[CONSOLE_ENDPOINT]->in_state->txsize > 0U) { + obqReleaseEmptyBufferI(&console_buf_queue); + } + + /* Checking if there is a buffer ready for transmission.*/ + buf = obqGetFullBufferI(&console_buf_queue, &n); + + if (buf != NULL) { + /* The endpoint cannot be busy, we are in the context of the callback, + so it is safe to transmit without a check.*/ + /* Should have n == CONSOLE_EPSIZE; check it? */ + usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); + } else { + /* Nothing to transmit.*/ } osalSysUnlockFromISR(); @@ -1261,18 +1269,22 @@ void console_in_cb(USBDriver *usbp, usbep_t ep) { /* Callback when data is inserted into the output queue * Called from a locked state */ -void console_queue_onotify(io_queue_t *qp) { - USBDriver *usbp = qGetLink(qp); +void console_queue_onotify(io_buffers_queue_t *bqp) { + size_t n; + USBDriver *usbp = bqGetLinkX(bqp); if(usbGetDriverStateI(usbp) != USB_ACTIVE) return; - if(!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT) - && (chOQGetFullI(&console_queue) >= CONSOLE_EPSIZE)) { - osalSysUnlock(); - usbPrepareQueuedTransmit(usbp, CONSOLE_ENDPOINT, &console_queue, CONSOLE_EPSIZE); - osalSysLock(); - usbStartTransmitI(usbp, CONSOLE_ENDPOINT); + /* Checking if there is already a transaction ongoing on the endpoint.*/ + if (!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { + /* Trying to get a full buffer.*/ + uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); + if (buf != NULL) { + /* Buffer found, starting a new transaction.*/ + /* Should have n == CONSOLE_EPSIZE; check this? */ + usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); + } } } @@ -1280,8 +1292,6 @@ void console_queue_onotify(io_queue_t *qp) { * callback (called from ISR, unlocked state) */ static void console_flush_cb(void *arg) { USBDriver *usbp = (USBDriver *)arg; - size_t i, n; - uint8_t buf[CONSOLE_EPSIZE]; /* TODO: a solution without extra buffer? */ osalSysLockFromISR(); /* check that the states of things are as they're supposed to */ @@ -1292,23 +1302,28 @@ static void console_flush_cb(void *arg) { return; } - /* don't do anything if the queue is empty or has enough stuff in it */ - if(((n = oqGetFullI(&console_queue)) == 0) || (n >= CONSOLE_EPSIZE)) { + /* If there is already a transaction ongoing then another one cannot be + started.*/ + if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { /* rearm the timer */ chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); osalSysUnlockFromISR(); return; } - /* there's stuff hanging in the queue - so dequeue and send */ - for(i = 0; i < n; i++) - buf[i] = (uint8_t)oqGetI(&console_queue); - for(i = n; i < CONSOLE_EPSIZE; i++) - buf[i] = 0; - osalSysUnlockFromISR(); - usbPrepareTransmit(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); - osalSysLockFromISR(); - (void)usbStartTransmitI(usbp, CONSOLE_ENDPOINT); + /* Checking if there only a buffer partially filled, if so then it is + enforced in the queue and transmitted.*/ + if(obqTryFlushI(&console_buf_queue)) { + size_t n,i; + uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); + + osalDbgAssert(buf != NULL, "queue is empty"); + + /* zero the rest of the buffer (buf should point to allocated space) */ + for(i=n; i Date: Sat, 16 Jan 2016 10:05:32 +0900 Subject: [PATCH 123/179] core: Add note about sudo and git --- tmk_core/doc/build.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md index 0585d62d..57a36ac4 100644 --- a/tmk_core/doc/build.md +++ b/tmk_core/doc/build.md @@ -20,7 +20,7 @@ You can find firmware source at github: - -If you are familiar with `git` tools you are recommended to use it but you can also download zip archive from: +If you are familiar with [`git`][git] tools you are recommended to use it but you can also download zip archive from: - @@ -70,7 +70,7 @@ Or you can execute the command directly as the following. $ dfu-programmer flash $ dfu-programmer reset -`` part will be `atmega32u4` or `atmega32u2` in most cases. See manual of the command for the detail. +`` part will be `atmega32u4` or `atmega32u2` in most cases. See manual of the command for the detail. On Linux and Mac OSX you will need proper permission to program a controller and you can use `sudo` command for this purpose probably. On Linux you also can configure `udev` rules to set permission. #### FLIP GUI tutorial @@ -111,6 +111,7 @@ You may want to use other programmer like [`avrdude`][avrdude]. In that case you [dfu-prog]: http://dfu-programmer.sourceforge.net/ [teensy-loader]:http://www.pjrc.com/teensy/loader.html [avrdude]: http://savannah.nongnu.org/projects/avrdude/ +[git]: https://git-scm.com/ From 42d5d64306e3d55d47f0e55d57b075ef1c0f1f52 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Fri, 22 Jan 2016 10:21:51 +0900 Subject: [PATCH 124/179] core: Speed up compilation --- tmk_core/common.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 3b53c0a0..e165a78b 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -81,7 +81,8 @@ ifdef KEYMAP_SECTION_ENABLE endif # Version string -OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +VERSION := $(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +OPT_DEFS += -DVERSION=$(VERSION) # Search Path From 72c52d30c894b85e64861704e162ee3873661c7d Mon Sep 17 00:00:00 2001 From: flabbergast Date: Fri, 22 Jan 2016 22:19:02 +0000 Subject: [PATCH 125/179] Chibios: add more guards for transmitting (fix a deadlock bug). --- keyboard/infinity_chibios/halconf.h | 12 ++++++++++++ keyboard/stm32_f072_onekey/halconf.h | 12 ++++++++++++ keyboard/stm32_f103_onekey/halconf.h | 12 ++++++++++++ keyboard/teensy_lc_onekey/halconf.h | 12 ++++++++++++ tmk_core/protocol/chibios/usb_main.c | 22 +++++++++++++++++----- 5 files changed, 65 insertions(+), 5 deletions(-) diff --git a/keyboard/infinity_chibios/halconf.h b/keyboard/infinity_chibios/halconf.h index 61a9ac0a..53538de1 100644 --- a/keyboard/infinity_chibios/halconf.h +++ b/keyboard/infinity_chibios/halconf.h @@ -336,6 +336,18 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + #endif /* _HALCONF_H_ */ /** @} */ diff --git a/keyboard/stm32_f072_onekey/halconf.h b/keyboard/stm32_f072_onekey/halconf.h index e75c1c36..1a450d63 100644 --- a/keyboard/stm32_f072_onekey/halconf.h +++ b/keyboard/stm32_f072_onekey/halconf.h @@ -336,6 +336,18 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + #endif /* _HALCONF_H_ */ /** @} */ diff --git a/keyboard/stm32_f103_onekey/halconf.h b/keyboard/stm32_f103_onekey/halconf.h index e75c1c36..1a450d63 100644 --- a/keyboard/stm32_f103_onekey/halconf.h +++ b/keyboard/stm32_f103_onekey/halconf.h @@ -336,6 +336,18 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + #endif /* _HALCONF_H_ */ /** @} */ diff --git a/keyboard/teensy_lc_onekey/halconf.h b/keyboard/teensy_lc_onekey/halconf.h index 86839166..b1d2cd55 100644 --- a/keyboard/teensy_lc_onekey/halconf.h +++ b/keyboard/teensy_lc_onekey/halconf.h @@ -170,6 +170,18 @@ #define HAL_USE_WDG FALSE #endif +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + #endif /* _HALCONF_H_ */ /** @} */ diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 9097d4e8..d248b447 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1094,7 +1094,9 @@ static void keyboard_idle_timer_cb(void *arg) { if(keyboard_idle) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ - usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent)); + if(!usbGetTransmitStatusI(usbp, KBD_ENDPOINT)) { + usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, KBD_EPSIZE); + } /* rearm the timer */ chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); } @@ -1127,8 +1129,13 @@ void send_keyboard(report_keyboard_t *report) { * this is more efficient */ /* busy wait, should be short and not very common */ osalSysLock(); - while(usbGetTransmitStatusI(&USB_DRIVER, NKRO_ENDPOINT)) - ; + if(usbGetTransmitStatusI(&USB_DRIVER, NKRO_ENDPOINT)) { + /* Need to either suspend, or loop and call unlock/lock during + * every iteration - otherwise the system will remain locked, + * no interrupts served, so USB not going through as well. + * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ + osalThreadSuspendS(&(&USB_DRIVER)->epc[NKRO_ENDPOINT]->in_state->thread); + } usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); osalSysUnlock(); } else @@ -1137,8 +1144,13 @@ void send_keyboard(report_keyboard_t *report) { /* need to wait until the previous packet has made it through */ /* busy wait, should be short and not very common */ osalSysLock(); - while(usbGetTransmitStatusI(&USB_DRIVER, KBD_ENDPOINT)) - ; + if(usbGetTransmitStatusI(&USB_DRIVER, KBD_ENDPOINT)) { + /* Need to either suspend, or loop and call unlock/lock during + * every iteration - otherwise the system will remain locked, + * no interrupts served, so USB not going through as well. + * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ + osalThreadSuspendS(&(&USB_DRIVER)->epc[KBD_ENDPOINT]->in_state->thread); + } usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); osalSysUnlock(); } From 5c89d73755e1b42420f6b52e659f9489bc833ce9 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 27 Jan 2016 08:14:44 +0900 Subject: [PATCH 126/179] core: Remove unused warning. Fix tmk_keyboard/#293 --- tmk_core/common/action_tapping.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 826c2330..a74eb106 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -30,7 +30,6 @@ static bool process_tapping(keyrecord_t *record); static bool waiting_buffer_enq(keyrecord_t record); static void waiting_buffer_clear(void); static bool waiting_buffer_typed(keyevent_t event); -static bool waiting_buffer_has_anykey_pressed(void); static void waiting_buffer_scan_tap(void); static void debug_tapping_key(void); static void debug_waiting_buffer(void); @@ -324,14 +323,6 @@ bool waiting_buffer_typed(keyevent_t event) return false; } -bool waiting_buffer_has_anykey_pressed(void) -{ - for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { - if (waiting_buffer[i].event.pressed) return true; - } - return false; -} - /* scan buffer for tapping */ void waiting_buffer_scan_tap(void) { From 3730666b9788ce93a93185ef8ca76a5f5b770abd Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 2 Feb 2016 13:51:47 +0900 Subject: [PATCH 127/179] ibm4704_usb: Add Makefiles for TMK Converter --- converter/ibm4704_usb/Makefile | 4 ++-- converter/ibm4704_usb/Makefile.tmk_rev1 | 5 +++++ converter/ibm4704_usb/Makefile.tmk_rev2 | 6 ++++++ converter/ibm4704_usb/README.md | 19 ++++++++++++++++--- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 converter/ibm4704_usb/Makefile.tmk_rev1 create mode 100644 converter/ibm4704_usb/Makefile.tmk_rev2 diff --git a/converter/ibm4704_usb/Makefile b/converter/ibm4704_usb/Makefile index b5c97d2d..79f17ec0 100644 --- a/converter/ibm4704_usb/Makefile +++ b/converter/ibm4704_usb/Makefile @@ -23,8 +23,8 @@ CONFIG_H = config.h # MCU name -#MCU = at90usb1287 -MCU = atmega32u4 +# TMK Converter rev.2 +MCU ?= atmega32u2 # Processor frequency. # This will define a symbol, F_CPU, in all source code files equal to the diff --git a/converter/ibm4704_usb/Makefile.tmk_rev1 b/converter/ibm4704_usb/Makefile.tmk_rev1 new file mode 100644 index 00000000..338b7da5 --- /dev/null +++ b/converter/ibm4704_usb/Makefile.tmk_rev1 @@ -0,0 +1,5 @@ +# TMK Converter rev.1 +# which looks like this: +# https://github.com/tmk/keyboard_converter#pcb-rev1 +MCU = atmega32u4 +include Makefile diff --git a/converter/ibm4704_usb/Makefile.tmk_rev2 b/converter/ibm4704_usb/Makefile.tmk_rev2 new file mode 100644 index 00000000..56c2c2c6 --- /dev/null +++ b/converter/ibm4704_usb/Makefile.tmk_rev2 @@ -0,0 +1,6 @@ +# TMK Converter rev.2 +# which looks like this: +# https://github.com/tmk/keyboard_converter#pcb-rev2 +MCU = atmega32u2 +include Makefile + diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md index 68db4bd0..49c65cdf 100644 --- a/converter/ibm4704_usb/README.md +++ b/converter/ibm4704_usb/README.md @@ -47,22 +47,35 @@ Keyboard Plug from front: Connection ---------- -In case of using ATMega32U4(Teensy2.0): +In case of using ATMega32U4/U2 1. Supply power with VCC and GND. 2. Connect CLOCK to PD1 and DATA to PD0. You can change pin with config.h. 3. Optionally you may need pull-up register. 1KOhm probably work. +TMK Converter can supports IBM 4704. +https://github.com/tmk/keyboard_converter + Build Firmware -------------- Just run `make`: - $ make + $ make -f + +For TMK Converter rev.1 use `Makefile.tmk_rev1` as makefile: + + $ make -f Makefile.tmk_rev1 + +For TMK Converter rev.2 use `Makefile.tmk_rev2` as makefile: + + $ make -f Makefile.tmk_rev2 To select keymap: - $ make KEYMAP=[plain|...] + $ make -f KEYMAP=[plain|...] + +To indentify your TMK Converter revision see [this](https://github.com/tmk/keyboard_converter#pcb-revisions). Keymap From 99732d5acd64aa805fd9a5bf5d831377cbe3f6c7 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 2 Feb 2016 14:27:19 +0900 Subject: [PATCH 128/179] ibm4704_usb: Fix README.md --- converter/ibm4704_usb/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md index 49c65cdf..45b1f683 100644 --- a/converter/ibm4704_usb/README.md +++ b/converter/ibm4704_usb/README.md @@ -7,9 +7,9 @@ Keyboard initialization process takes a few seconds at start up. During that you Update ------ -2015/09/07 Added keymap for Alps 102-key. Thanks, tai @ geekhack! -2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack! -2015/05/19 Fixed a protocol handling bug. +- 2015/09/07 Added keymap for Alps 102-key. Thanks, tai @ geekhack! +- 2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack! +- 2015/05/19 Fixed a protocol handling bug. From 5b8e4ca2c4c8c46a67d2fdaa2eba925faca91739 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 10 Feb 2016 08:11:45 +0900 Subject: [PATCH 129/179] Change README for chibios --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4a6d80fb..f03c9165 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ Source code is available here: Updates ------- +#### 2016/02/10 +core: flabbergast's Chibios protocol was merged from (@72b1668). See [tmk_core/protocol/chibios/README.md](tmk_core/protocol/chibios/README.md). Chibios protocol supports Cortex-M such as STM32 and Kinetis. + #### 2015/04/22 Core library was separated to other branch `core`. From 28203e909e83b1ac6becb45a3eadae23b190df32 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 11 Feb 2016 12:21:21 +0900 Subject: [PATCH 130/179] Squashed 'tmk_core/' changes from 57d27a8..08ce4c3 08ce4c3 Add update for chibios in README 30cac1d Merge remote-tracking branch 'flabbergast-tmk_keyboard/chibios' f218a38 core: Remove unused warning. Fix tmk_keyboard/#293 3e68807 Chibios: add more guards for transmitting (fix a deadlock bug). cecc807 core: Speed up compilation d01d959 Merge remote-tracking branch 'upstream/master' into chibios 8ff12ae Merge pull request #230 from jerryen/master 3afb83d core: Add note about sudo and git 2525d5d Chibios: Update to new USB API. 2fc5cd6 Merge branch 'master' into chibios 6f5511a core: Fix variable initialize 02a15fa core: Fix variable init and header include 1833ca1 Merge pull request #292 from obones/command_warning bc9dc6f Merge pull request #294 from shayneholmes/fix-debug-message c1b891b Merge pull request #295 from doopai/master 1da837c core: Add macro commands SM(), RM() and CM() d9d5a93 Add support for storing, restoring and clearing modifiers in macros 4f371c0 core: Add dfu-programmer example to doc/build.md ba3792e core: Fix doc/build.md 4b99fed remove SERIAL_SOFT_DEBUG macro 984accb Fix typo in bootmagic debug message 67a7ea1 usb_usb: Fix for keymap editor 2fc9ae4 host_driver is only used if KEYBOARD_LOCK_ENABLE is defined a35cdea Chibios: add 'core/protocol' to the makefiles' search path. 5ed2fd6 Merge remote-tracking branch 'upstream/master' into chibios bbc4851 Do timeout when writing to CONSOLE EP queue. 2450559 Remove an errant comma trailing the KC_ERAS macro alias 8465747 Merge pull request #270 from jeffgran/single-tap-toggle a37339a Merge pull request #271 from jeffgran/default-layer-toggle 8e732f7 core: Update doc/build.md and remove other_projects.md e47dc15 Workaround for compiler warnings when console disabled. 4184c52 Add maple mini code. b555238 core: Fix rules.mk for dfu target 26dacf4 add ACTION_DEFAULT_LAYER_TOGGLE to toggle a default layer on/off 83607d9 enable TAPPING_TOGGLE=1 to work correctly bef3089 Merge branch 'master' into chibios f7a55fd core: Fix debug print of usb_hid 1402f7d core: Add keycode KC_JPY for JIS 8e3a460 Chibios: Remove the wait in the main loop. 7d41746 ChibiOS: prettify/document sleep_led code. 235cdee ChibiOS: Update infinity bootloader code to match updated ChibiOS. 807bf1e Chibios: Add breathing sleep LED on Kinetis MCUs. ba3bf7c ChibiOS: make reset request more CMSISy. bf2ffd4 Add correct chibios/bootloader_jump for infinity KB. f5e03fd Chibios/usb_main: rename a variable for clarity. 63a330c Fix drop key stroke d8f5b06 Fix report size of boot protocol. 38abb50 ChibiOS/STM32: send remote wakeup. 6725650 ChibiOS/kinetis: sending remote wakeup. 69f6e54 Chibios: use WFI in idle. WIP suspend stuff. 02f044b Move chibios/cortex selection to local Makefiles. fa59dfa Rename chibios example keyboard. 5c060de Add eeprom support for chibios/kinetis. efd0044 Move declaration of keymap_config. 7196b24 Make bootmagic.c code portable (_delay_ms -> wait_ms). 37b15b2 Add missing #include to keymap.c. 31316e3 Merge branch 'master' into chibios 166f312 Fix chibios/usb_main GET_REPORT handing. 57ac6c2 Add ARM Teensies bootloader code. 1758086 Move STM32 bootloader address config to separate .h file. 03bb026 Rename some Makefile defines. 76ba6ac NKRO fixes. 06498f8 Update chibios README. db0a4f5 Add basic sleep_led for chibios. c3f930e Move AVR specific sleep_led.c into avr. 4069494 Fix bootloader-jump compiling. 9117f7b Small updates. 269cb85 Implement jump-to-bootloader. 7e81b34 Move chibios to tool. 923a892 Make usb_main more USB_DRIVER #define independent. aa054f0 Add ChibiOS support (USB stack + support files). 1e3e282 Modularity and gcc warnings fixes. 2f60ce0 Add KEYBOARD_LOCK_ENABLE to makefile git-subtree-dir: tmk_core git-subtree-split: 08ce4c3021d2ecd446c5b9a137aded65423d241e --- README.md | 16 +- common.mk | 11 +- common/action.c | 9 +- common/action_code.h | 1 + common/action_macro.c | 13 + common/action_macro.h | 12 + common/action_tapping.c | 11 +- common/{ => avr}/sleep_led.c | 0 common/bootmagic.c | 7 +- common/chibios/bootloader.c | 46 + common/chibios/eeconfig.c | 551 ++++++++++ common/chibios/printf.c | 240 +++++ common/chibios/printf.h | 111 ++ common/chibios/sleep_led.c | 164 +++ common/chibios/suspend.c | 65 ++ common/chibios/timer.c | 27 + common/command.c | 28 +- common/keycode.h | 11 +- common/keymap.c | 12 +- common/keymap.h | 1 - common/nodebug.h | 2 + common/print.c | 8 +- common/print.h | 17 +- common/progmem.h | 4 +- common/report.h | 5 + common/wait.h | 8 +- doc/build.md | 64 +- doc/keymap.md | 24 +- doc/other_projects.md | 62 -- protocol/chibios/README.md | 50 + protocol/chibios/main.c | 139 +++ protocol/chibios/usb_main.c | 1372 +++++++++++++++++++++++++ protocol/chibios/usb_main.h | 143 +++ protocol/serial_soft.c | 3 +- protocol/usb_hid/parser.cpp | 2 +- rules.mk | 1 - tool/chibios/.gitignore | 1 + tool/chibios/ch-bootloader-jump.patch | 116 +++ tool/chibios/chibios.mk | 231 +++++ tool/chibios/common.mk | 85 ++ tool/mbed/common.mk | 2 +- 41 files changed, 3534 insertions(+), 141 deletions(-) rename common/{ => avr}/sleep_led.c (100%) create mode 100644 common/chibios/bootloader.c create mode 100644 common/chibios/eeconfig.c create mode 100644 common/chibios/printf.c create mode 100644 common/chibios/printf.h create mode 100644 common/chibios/sleep_led.c create mode 100644 common/chibios/suspend.c create mode 100644 common/chibios/timer.c delete mode 100644 doc/other_projects.md create mode 100644 protocol/chibios/README.md create mode 100644 protocol/chibios/main.c create mode 100644 protocol/chibios/usb_main.c create mode 100644 protocol/chibios/usb_main.h create mode 100644 tool/chibios/.gitignore create mode 100644 tool/chibios/ch-bootloader-jump.patch create mode 100644 tool/chibios/chibios.mk create mode 100644 tool/chibios/common.mk diff --git a/README.md b/README.md index 6b6714a6..f460d0ed 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,16 @@ This is a keyboard firmware library with some useful features for Atmel AVR and Source code is available here: +Updates +------- +#### 2016/02/10 +flabbergast's Chibios protocol was merged from . See [protocol/chibios/README.md](protocol/chibios/README.md). Chibios protocol supports Cortex-M such as STM32 and Kinetis. + +#### 2015/04/22 +separated with TMK Keyboard Firmware Collection + + + Features -------- These features can be used in your keyboard. @@ -27,12 +37,6 @@ These features can be used in your keyboard. -Updates -------- -2015/04/22 separated with TMK Keyboard Firmware Collection - - - TMK Keyboard Firmware Collection -------------------------------- Complete firmwares for various keyboards and protocol converters. diff --git a/common.mk b/common.mk index cb030b33..ebaafd1d 100644 --- a/common.mk +++ b/common.mk @@ -1,4 +1,4 @@ -COMMON_DIR = common +COMMON_DIR = $(TMK_DIR)/common SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ $(COMMON_DIR)/action.c \ @@ -53,8 +53,12 @@ ifdef USB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE endif +ifdef KEYBOARD_LOCK_ENABLE + OPT_DEFS += -DKEYBOARD_LOCK_ENABLE +endif + ifdef SLEEP_LED_ENABLE - SRC += $(COMMON_DIR)/sleep_led.c + SRC += $(COMMON_DIR)/avr/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif @@ -77,7 +81,8 @@ ifdef KEYMAP_SECTION_ENABLE endif # Version string -OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +VERSION := $(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +OPT_DEFS += -DVERSION=$(VERSION) # Search Path diff --git a/common/action.c b/common/action.c index 1f15bd09..339b3ee6 100644 --- a/common/action.c +++ b/common/action.c @@ -131,10 +131,17 @@ void process_action(keyrecord_t *record) case MODS_TAP_TOGGLE: if (event.pressed) { if (tap_count <= TAPPING_TOGGLE) { - register_mods(mods); + if (mods & get_mods()) { + dprint("MODS_TAP_TOGGLE: toggle mods off\n"); + unregister_mods(mods); + } else { + dprint("MODS_TAP_TOGGLE: toggle mods on\n"); + register_mods(mods); + } } } else { if (tap_count < TAPPING_TOGGLE) { + dprint("MODS_TAP_TOGGLE: release : unregister_mods\n"); unregister_mods(mods); } } diff --git a/common/action_code.h b/common/action_code.h index 4fe9c1d5..da93f77b 100644 --- a/common/action_code.h +++ b/common/action_code.h @@ -255,6 +255,7 @@ enum layer_pram_tap_op { #define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) /* Default Layer */ #define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4)) +#define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4)) /* Layer Operation */ #define ACTION_LAYER_CLEAR(on) ACTION_LAYER_BIT_AND(0, 0, (on)) #define ACTION_LAYER_MOMENTARY(layer) ACTION_LAYER_ON_OFF(layer) diff --git a/common/action_macro.c b/common/action_macro.c index ffaf125c..b2891bf4 100644 --- a/common/action_macro.c +++ b/common/action_macro.c @@ -34,6 +34,8 @@ void action_macro_play(const macro_t *macro_p) macro_t macro = END; uint8_t interval = 0; + uint8_t mod_storage = 0; + if (!macro_p) return; while (true) { switch (MACRO_READ()) { @@ -66,6 +68,17 @@ void action_macro_play(const macro_t *macro_p) interval = MACRO_READ(); dprintf("INTERVAL(%u)\n", interval); break; + case MOD_STORE: + mod_storage = get_mods(); + break; + case MOD_RESTORE: + set_mods(mod_storage); + send_keyboard_report(); + break; + case MOD_CLEAR: + clear_mods(); + send_keyboard_report(); + break; case 0x04 ... 0x73: dprintf("DOWN(%02X)\n", macro); register_code(macro); diff --git a/common/action_macro.h b/common/action_macro.h index aedc32ec..4cf2216d 100644 --- a/common/action_macro.h +++ b/common/action_macro.h @@ -64,6 +64,9 @@ enum macro_command_id{ /* 0x74 - 0x83 */ WAIT = 0x74, INTERVAL, + MOD_STORE, + MOD_RESTORE, + MOD_CLEAR, /* 0x84 - 0xf3 (reserved for keycode up) */ @@ -82,6 +85,9 @@ enum macro_command_id{ #define TYPE(key) DOWN(key), UP(key) #define WAIT(ms) WAIT, (ms) #define INTERVAL(ms) INTERVAL, (ms) +#define STORE() MOD_STORE +#define RESTORE() MOD_RESTORE +#define CLEAR() MOD_CLEAR /* key down */ #define D(key) DOWN(KC_##key) @@ -93,6 +99,12 @@ enum macro_command_id{ #define W(ms) WAIT(ms) /* interval */ #define I(ms) INTERVAL(ms) +/* store modifier(s) */ +#define SM() STORE() +/* restore modifier(s) */ +#define RM() RESTORE() +/* clear modifier(s) */ +#define CM() CLEAR() /* for backward comaptibility */ #define MD(key) DOWN(KC_##key) diff --git a/common/action_tapping.c b/common/action_tapping.c index 826c2330..a3a5a7d0 100644 --- a/common/action_tapping.c +++ b/common/action_tapping.c @@ -30,7 +30,6 @@ static bool process_tapping(keyrecord_t *record); static bool waiting_buffer_enq(keyrecord_t record); static void waiting_buffer_clear(void); static bool waiting_buffer_typed(keyevent_t event); -static bool waiting_buffer_has_anykey_pressed(void); static void waiting_buffer_scan_tap(void); static void debug_tapping_key(void); static void debug_waiting_buffer(void); @@ -257,7 +256,7 @@ bool process_tapping(keyrecord_t *keyp) return true; } } else { - if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n"); + if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; process_action(keyp); return true; } @@ -324,14 +323,6 @@ bool waiting_buffer_typed(keyevent_t event) return false; } -bool waiting_buffer_has_anykey_pressed(void) -{ - for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { - if (waiting_buffer[i].event.pressed) return true; - } - return false; -} - /* scan buffer for tapping */ void waiting_buffer_scan_tap(void) { diff --git a/common/sleep_led.c b/common/avr/sleep_led.c similarity index 100% rename from common/sleep_led.c rename to common/avr/sleep_led.c diff --git a/common/bootmagic.c b/common/bootmagic.c index b002a585..08241f7d 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c @@ -1,6 +1,6 @@ #include #include -#include +#include "wait.h" #include "matrix.h" #include "bootloader.h" #include "debug.h" @@ -10,6 +10,7 @@ #include "eeconfig.h" #include "bootmagic.h" +keymap_config_t keymap_config; void bootmagic(void) { @@ -19,9 +20,9 @@ void bootmagic(void) } /* do scans in case of bounce */ - print("boogmagic scan: ... "); + print("bootmagic scan: ... "); uint8_t scan = 100; - while (scan--) { matrix_scan(); _delay_ms(10); } + while (scan--) { matrix_scan(); wait_ms(10); } print("done.\n"); /* bootmagic skip */ diff --git a/common/chibios/bootloader.c b/common/chibios/bootloader.c new file mode 100644 index 00000000..c8888f3c --- /dev/null +++ b/common/chibios/bootloader.c @@ -0,0 +1,46 @@ +#include "bootloader.h" + +#include "ch.h" +#include "hal.h" + +#ifdef STM32_BOOTLOADER_ADDRESS +/* STM32 */ + +#if defined(STM32F0XX) +/* This code should be checked whether it runs correctly on platforms */ +#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) +extern uint32_t __ram0_end__; + +void bootloader_jump(void) { + *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader + NVIC_SystemReset(); +} + +#else /* defined(STM32F0XX) */ +#error Check that the bootloader code works on your platform and add it to bootloader.c! +#endif /* defined(STM32F0XX) */ + +#elif defined(KL2x) || defined(K20x) /* STM32_BOOTLOADER_ADDRESS */ +/* Kinetis */ + +#if defined(KIIBOHD_BOOTLOADER) +/* Kiibohd Bootloader (MCHCK and Infinity KB) */ +#define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 +const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; +void bootloader_jump(void) { + __builtin_memcpy((void *)VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); + // request reset + SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; +} + +#else /* defined(KIIBOHD_BOOTLOADER) */ +/* Default for Kinetis - expecting an ARM Teensy */ +void bootloader_jump(void) { + chThdSleepMilliseconds(100); + __BKPT(0); +} +#endif /* defined(KIIBOHD_BOOTLOADER) */ + +#else /* neither STM32 nor KINETIS */ +void bootloader_jump(void) {} +#endif \ No newline at end of file diff --git a/common/chibios/eeconfig.c b/common/chibios/eeconfig.c new file mode 100644 index 00000000..f9e2718a --- /dev/null +++ b/common/chibios/eeconfig.c @@ -0,0 +1,551 @@ +#include "ch.h" +#include "hal.h" + +#include "eeconfig.h" + +/*************************************/ +/* Hardware backend */ +/* */ +/* Code from PJRC/Teensyduino */ +/*************************************/ + +/* Teensyduino Core Library + * http://www.pjrc.com/teensy/ + * Copyright (c) 2013 PJRC.COM, LLC. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * 1. The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 2. If the Software is incorporated into a build system that allows + * selection among a list of target devices, then similar target + * devices manufactured by PJRC.COM must be included in the list of + * target devices and selectable in the same manner. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + +#if defined(K20x) /* chip selection */ +/* Teensy 3.0, 3.1, 3.2; mchck; infinity keyboard */ + +// The EEPROM is really RAM with a hardware-based backup system to +// flash memory. Selecting a smaller size EEPROM allows more wear +// leveling, for higher write endurance. If you edit this file, +// set this to the smallest size your application can use. Also, +// due to Freescale's implementation, writing 16 or 32 bit words +// (aligned to 2 or 4 byte boundaries) has twice the endurance +// compared to writing 8 bit bytes. +// +#define EEPROM_SIZE 32 + +// Writing unaligned 16 or 32 bit data is handled automatically when +// this is defined, but at a cost of extra code size. Without this, +// any unaligned write will cause a hard fault exception! If you're +// absolutely sure all 16 and 32 bit writes will be aligned, you can +// remove the extra unnecessary code. +// +#define HANDLE_UNALIGNED_WRITES + +// Minimum EEPROM Endurance +// ------------------------ +#if (EEPROM_SIZE == 2048) // 35000 writes/byte or 70000 writes/word + #define EEESIZE 0x33 +#elif (EEPROM_SIZE == 1024) // 75000 writes/byte or 150000 writes/word + #define EEESIZE 0x34 +#elif (EEPROM_SIZE == 512) // 155000 writes/byte or 310000 writes/word + #define EEESIZE 0x35 +#elif (EEPROM_SIZE == 256) // 315000 writes/byte or 630000 writes/word + #define EEESIZE 0x36 +#elif (EEPROM_SIZE == 128) // 635000 writes/byte or 1270000 writes/word + #define EEESIZE 0x37 +#elif (EEPROM_SIZE == 64) // 1275000 writes/byte or 2550000 writes/word + #define EEESIZE 0x38 +#elif (EEPROM_SIZE == 32) // 2555000 writes/byte or 5110000 writes/word + #define EEESIZE 0x39 +#endif + +void eeprom_initialize(void) +{ + uint32_t count=0; + uint16_t do_flash_cmd[] = { + 0xf06f, 0x037f, 0x7003, 0x7803, + 0xf013, 0x0f80, 0xd0fb, 0x4770}; + uint8_t status; + + if (FTFL->FCNFG & FTFL_FCNFG_RAMRDY) { + // FlexRAM is configured as traditional RAM + // We need to reconfigure for EEPROM usage + FTFL->FCCOB0 = 0x80; // PGMPART = Program Partition Command + FTFL->FCCOB4 = EEESIZE; // EEPROM Size + FTFL->FCCOB5 = 0x03; // 0K for Dataflash, 32K for EEPROM backup + __disable_irq(); + // do_flash_cmd() must execute from RAM. Luckily the C syntax is simple... + (*((void (*)(volatile uint8_t *))((uint32_t)do_flash_cmd | 1)))(&(FTFL->FSTAT)); + __enable_irq(); + status = FTFL->FSTAT; + if (status & (FTFL_FSTAT_RDCOLERR|FTFL_FSTAT_ACCERR|FTFL_FSTAT_FPVIOL)) { + FTFL->FSTAT = (status & (FTFL_FSTAT_RDCOLERR|FTFL_FSTAT_ACCERR|FTFL_FSTAT_FPVIOL)); + return; // error + } + } + // wait for eeprom to become ready (is this really necessary?) + while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { + if (++count > 20000) break; + } +} + +#define FlexRAM ((uint8_t *)0x14000000) + +uint8_t eeprom_read_byte(const uint8_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return FlexRAM[offset]; +} + +uint16_t eeprom_read_word(const uint16_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE-1) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return *(uint16_t *)(&FlexRAM[offset]); +} + +uint32_t eeprom_read_dword(const uint32_t *addr) +{ + uint32_t offset = (uint32_t)addr; + if (offset >= EEPROM_SIZE-3) return 0; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + return *(uint32_t *)(&FlexRAM[offset]); +} + +void eeprom_read_block(void *buf, const void *addr, uint32_t len) +{ + uint32_t offset = (uint32_t)addr; + uint8_t *dest = (uint8_t *)buf; + uint32_t end = offset + len; + + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (end > EEPROM_SIZE) end = EEPROM_SIZE; + while (offset < end) { + *dest++ = FlexRAM[offset++]; + } +} + +int eeprom_is_ready(void) +{ + return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; +} + +static void flexram_wait(void) +{ + while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { + // TODO: timeout + } +} + +void eeprom_write_byte(uint8_t *addr, uint8_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } +} + +void eeprom_write_word(uint16_t *addr, uint16_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE-1) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); +#ifdef HANDLE_UNALIGNED_WRITES + if ((offset & 1) == 0) { +#endif + if (*(uint16_t *)(&FlexRAM[offset]) != value) { + *(uint16_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } +#ifdef HANDLE_UNALIGNED_WRITES + } else { + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } + if (FlexRAM[offset + 1] != (value >> 8)) { + FlexRAM[offset + 1] = value >> 8; + flexram_wait(); + } + } +#endif +} + +void eeprom_write_dword(uint32_t *addr, uint32_t value) +{ + uint32_t offset = (uint32_t)addr; + + if (offset >= EEPROM_SIZE-3) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); +#ifdef HANDLE_UNALIGNED_WRITES + switch (offset & 3) { + case 0: +#endif + if (*(uint32_t *)(&FlexRAM[offset]) != value) { + *(uint32_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } + return; +#ifdef HANDLE_UNALIGNED_WRITES + case 2: + if (*(uint16_t *)(&FlexRAM[offset]) != value) { + *(uint16_t *)(&FlexRAM[offset]) = value; + flexram_wait(); + } + if (*(uint16_t *)(&FlexRAM[offset + 2]) != (value >> 16)) { + *(uint16_t *)(&FlexRAM[offset + 2]) = value >> 16; + flexram_wait(); + } + return; + default: + if (FlexRAM[offset] != value) { + FlexRAM[offset] = value; + flexram_wait(); + } + if (*(uint16_t *)(&FlexRAM[offset + 1]) != (value >> 8)) { + *(uint16_t *)(&FlexRAM[offset + 1]) = value >> 8; + flexram_wait(); + } + if (FlexRAM[offset + 3] != (value >> 24)) { + FlexRAM[offset + 3] = value >> 24; + flexram_wait(); + } + } +#endif +} + +void eeprom_write_block(const void *buf, void *addr, uint32_t len) +{ + uint32_t offset = (uint32_t)addr; + const uint8_t *src = (const uint8_t *)buf; + + if (offset >= EEPROM_SIZE) return; + if (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) eeprom_initialize(); + if (len >= EEPROM_SIZE) len = EEPROM_SIZE; + if (offset + len >= EEPROM_SIZE) len = EEPROM_SIZE - offset; + while (len > 0) { + uint32_t lsb = offset & 3; + if (lsb == 0 && len >= 4) { + // write aligned 32 bits + uint32_t val32; + val32 = *src++; + val32 |= (*src++ << 8); + val32 |= (*src++ << 16); + val32 |= (*src++ << 24); + if (*(uint32_t *)(&FlexRAM[offset]) != val32) { + *(uint32_t *)(&FlexRAM[offset]) = val32; + flexram_wait(); + } + offset += 4; + len -= 4; + } else if ((lsb == 0 || lsb == 2) && len >= 2) { + // write aligned 16 bits + uint16_t val16; + val16 = *src++; + val16 |= (*src++ << 8); + if (*(uint16_t *)(&FlexRAM[offset]) != val16) { + *(uint16_t *)(&FlexRAM[offset]) = val16; + flexram_wait(); + } + offset += 2; + len -= 2; + } else { + // write 8 bits + uint8_t val8 = *src++; + if (FlexRAM[offset] != val8) { + FlexRAM[offset] = val8; + flexram_wait(); + } + offset++; + len--; + } + } +} + +/* +void do_flash_cmd(volatile uint8_t *fstat) +{ + *fstat = 0x80; + while ((*fstat & 0x80) == 0) ; // wait +} +00000000 : + 0: f06f 037f mvn.w r3, #127 ; 0x7f + 4: 7003 strb r3, [r0, #0] + 6: 7803 ldrb r3, [r0, #0] + 8: f013 0f80 tst.w r3, #128 ; 0x80 + c: d0fb beq.n 6 + e: 4770 bx lr +*/ + +#elif defined(KL2x) /* chip selection */ +/* Teensy LC (emulated) */ + +#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) + +extern uint32_t __eeprom_workarea_start__; +extern uint32_t __eeprom_workarea_end__; + +#define EEPROM_SIZE 128 + +static uint32_t flashend = 0; + +void eeprom_initialize(void) +{ + const uint16_t *p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); + + do { + if (*p++ == 0xFFFF) { + flashend = (uint32_t)(p - 2); + return; + } + } while (p < (uint16_t *)SYMVAL(__eeprom_workarea_end__)); + flashend = (uint32_t)((uint16_t *)SYMVAL(__eeprom_workarea_end__) - 1); +} + +uint8_t eeprom_read_byte(const uint8_t *addr) +{ + uint32_t offset = (uint32_t)addr; + const uint16_t *p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); + const uint16_t *end = (const uint16_t *)((uint32_t)flashend); + uint16_t val; + uint8_t data=0xFF; + + if (!end) { + eeprom_initialize(); + end = (const uint16_t *)((uint32_t)flashend); + } + if (offset < EEPROM_SIZE) { + while (p <= end) { + val = *p++; + if ((val & 255) == offset) data = val >> 8; + } + } + return data; +} + +static void flash_write(const uint16_t *code, uint32_t addr, uint32_t data) +{ + // with great power comes great responsibility.... + uint32_t stat; + *(uint32_t *)&(FTFA->FCCOB3) = 0x06000000 | (addr & 0x00FFFFFC); + *(uint32_t *)&(FTFA->FCCOB7) = data; + __disable_irq(); + (*((void (*)(volatile uint8_t *))((uint32_t)code | 1)))(&(FTFA->FSTAT)); + __enable_irq(); + stat = FTFA->FSTAT & (FTFA_FSTAT_RDCOLERR|FTFA_FSTAT_ACCERR|FTFA_FSTAT_FPVIOL); + if (stat) { + FTFA->FSTAT = stat; + } + MCM->PLACR |= MCM_PLACR_CFCC; +} + +void eeprom_write_byte(uint8_t *addr, uint8_t data) +{ + uint32_t offset = (uint32_t)addr; + const uint16_t *p, *end = (const uint16_t *)((uint32_t)flashend); + uint32_t i, val, flashaddr; + uint16_t do_flash_cmd[] = { + 0x2380, 0x7003, 0x7803, 0xb25b, 0x2b00, 0xdafb, 0x4770}; + uint8_t buf[EEPROM_SIZE]; + + if (offset >= EEPROM_SIZE) return; + if (!end) { + eeprom_initialize(); + end = (const uint16_t *)((uint32_t)flashend); + } + if (++end < (uint16_t *)SYMVAL(__eeprom_workarea_end__)) { + val = (data << 8) | offset; + flashaddr = (uint32_t)end; + flashend = flashaddr; + if ((flashaddr & 2) == 0) { + val |= 0xFFFF0000; + } else { + val <<= 16; + val |= 0x0000FFFF; + } + flash_write(do_flash_cmd, flashaddr, val); + } else { + for (i=0; i < EEPROM_SIZE; i++) { + buf[i] = 0xFF; + } + for (p = (uint16_t *)SYMVAL(__eeprom_workarea_start__); p < (uint16_t *)SYMVAL(__eeprom_workarea_end__); p++) { + val = *p; + if ((val & 255) < EEPROM_SIZE) { + buf[val & 255] = val >> 8; + } + } + buf[offset] = data; + for (flashaddr=(uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_start__); flashaddr < (uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_end__); flashaddr += 1024) { + *(uint32_t *)&(FTFA->FCCOB3) = 0x09000000 | flashaddr; + __disable_irq(); + (*((void (*)(volatile uint8_t *))((uint32_t)do_flash_cmd | 1)))(&(FTFA->FSTAT)); + __enable_irq(); + val = FTFA->FSTAT & (FTFA_FSTAT_RDCOLERR|FTFA_FSTAT_ACCERR|FTFA_FSTAT_FPVIOL);; + if (val) FTFA->FSTAT = val; + MCM->PLACR |= MCM_PLACR_CFCC; + } + flashaddr=(uint32_t)(uint16_t *)SYMVAL(__eeprom_workarea_start__); + for (i=0; i < EEPROM_SIZE; i++) { + if (buf[i] == 0xFF) continue; + if ((flashaddr & 2) == 0) { + val = (buf[i] << 8) | i; + } else { + val = val | (buf[i] << 24) | (i << 16); + flash_write(do_flash_cmd, flashaddr, val); + } + flashaddr += 2; + } + flashend = flashaddr; + if ((flashaddr & 2)) { + val |= 0xFFFF0000; + flash_write(do_flash_cmd, flashaddr, val); + } + } +} + +/* +void do_flash_cmd(volatile uint8_t *fstat) +{ + *fstat = 0x80; + while ((*fstat & 0x80) == 0) ; // wait +} +00000000 : + 0: 2380 movs r3, #128 ; 0x80 + 2: 7003 strb r3, [r0, #0] + 4: 7803 ldrb r3, [r0, #0] + 6: b25b sxtb r3, r3 + 8: 2b00 cmp r3, #0 + a: dafb bge.n 4 + c: 4770 bx lr +*/ + + +uint16_t eeprom_read_word(const uint16_t *addr) +{ + const uint8_t *p = (const uint8_t *)addr; + return eeprom_read_byte(p) | (eeprom_read_byte(p+1) << 8); +} + +uint32_t eeprom_read_dword(const uint32_t *addr) +{ + const uint8_t *p = (const uint8_t *)addr; + return eeprom_read_byte(p) | (eeprom_read_byte(p+1) << 8) + | (eeprom_read_byte(p+2) << 16) | (eeprom_read_byte(p+3) << 24); +} + +void eeprom_read_block(void *buf, const void *addr, uint32_t len) +{ + const uint8_t *p = (const uint8_t *)addr; + uint8_t *dest = (uint8_t *)buf; + while (len--) { + *dest++ = eeprom_read_byte(p++); + } +} + +int eeprom_is_ready(void) +{ + return 1; +} + +void eeprom_write_word(uint16_t *addr, uint16_t value) +{ + uint8_t *p = (uint8_t *)addr; + eeprom_write_byte(p++, value); + eeprom_write_byte(p, value >> 8); +} + +void eeprom_write_dword(uint32_t *addr, uint32_t value) +{ + uint8_t *p = (uint8_t *)addr; + eeprom_write_byte(p++, value); + eeprom_write_byte(p++, value >> 8); + eeprom_write_byte(p++, value >> 16); + eeprom_write_byte(p, value >> 24); +} + +void eeprom_write_block(const void *buf, void *addr, uint32_t len) +{ + uint8_t *p = (uint8_t *)addr; + const uint8_t *src = (const uint8_t *)buf; + while (len--) { + eeprom_write_byte(p++, *src++); + } +} + +#else +#error EEPROM support not implemented for your chip +#endif /* chip selection */ + + +/*****************/ +/* TMK functions */ +/*****************/ + +void eeconfig_init(void) +{ + eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); + eeprom_write_byte(EECONFIG_DEBUG, 0); + eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0); + eeprom_write_byte(EECONFIG_KEYMAP, 0); + eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0); +#ifdef BACKLIGHT_ENABLE + eeprom_write_byte(EECONFIG_BACKLIGHT, 0); +#endif +} + +void eeconfig_enable(void) +{ + eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); +} + +void eeconfig_disable(void) +{ + eeprom_write_word(EECONFIG_MAGIC, 0xFFFF); +} + +bool eeconfig_is_enabled(void) +{ + return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); +} + +uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } +void eeconfig_write_debug(uint8_t val) { eeprom_write_byte(EECONFIG_DEBUG, val); } + +uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } +void eeconfig_write_default_layer(uint8_t val) { eeprom_write_byte(EECONFIG_DEFAULT_LAYER, val); } + +uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } +void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val); } + +#ifdef BACKLIGHT_ENABLE +uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } +void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); } +#endif diff --git a/common/chibios/printf.c b/common/chibios/printf.c new file mode 100644 index 00000000..72e3d4f8 --- /dev/null +++ b/common/chibios/printf.c @@ -0,0 +1,240 @@ +/* + * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php + * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php + */ + +/* +File: printf.c + +Copyright (C) 2004 Kustaa Nyholm + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "printf.h" + +typedef void (*putcf) (void*,char); +static putcf stdout_putf; +static void* stdout_putp; + +// this adds cca 400 bytes +#define PRINTF_LONG_SUPPORT + +#ifdef PRINTF_LONG_SUPPORT + +static void uli2a(unsigned long int num, unsigned int base, int uc,char * bf) + { + int n=0; + unsigned int d=1; + while (num/d >= base) + d*=base; + while (d!=0) { + int dgt = num / d; + num%=d; + d/=base; + if (n || dgt>0|| d==0) { + *bf++ = dgt+(dgt<10 ? '0' : (uc ? 'A' : 'a')-10); + ++n; + } + } + *bf=0; + } + +static void li2a (long num, char * bf) + { + if (num<0) { + num=-num; + *bf++ = '-'; + } + uli2a(num,10,0,bf); + } + +#endif + +static void ui2a(unsigned int num, unsigned int base, int uc,char * bf) + { + int n=0; + unsigned int d=1; + while (num/d >= base) + d*=base; + while (d!=0) { + int dgt = num / d; + num%= d; + d/=base; + if (n || dgt>0 || d==0) { + *bf++ = dgt+(dgt<10 ? '0' : (uc ? 'A' : 'a')-10); + ++n; + } + } + *bf=0; + } + +static void i2a (int num, char * bf) + { + if (num<0) { + num=-num; + *bf++ = '-'; + } + ui2a(num,10,0,bf); + } + +static int a2d(char ch) + { + if (ch>='0' && ch<='9') + return ch-'0'; + else if (ch>='a' && ch<='f') + return ch-'a'+10; + else if (ch>='A' && ch<='F') + return ch-'A'+10; + else return -1; + } + +static char a2i(char ch, char** src,int base,int* nump) + { + char* p= *src; + int num=0; + int digit; + while ((digit=a2d(ch))>=0) { + if (digit>base) break; + num=num*base+digit; + ch=*p++; + } + *src=p; + *nump=num; + return ch; + } + +static void putchw(void* putp,putcf putf,int n, char z, char* bf) + { + char fc=z? '0' : ' '; + char ch; + char* p=bf; + while (*p++ && n > 0) + n--; + while (n-- > 0) + putf(putp,fc); + while ((ch= *bf++)) + putf(putp,ch); + } + +void tfp_format(void* putp,putcf putf,char *fmt, va_list va) + { + char bf[12]; + + char ch; + + + while ((ch=*(fmt++))) { + if (ch!='%') + putf(putp,ch); + else { + char lz=0; +#ifdef PRINTF_LONG_SUPPORT + char lng=0; +#endif + int w=0; + ch=*(fmt++); + if (ch=='0') { + ch=*(fmt++); + lz=1; + } + if (ch>='0' && ch<='9') { + ch=a2i(ch,&fmt,10,&w); + } +#ifdef PRINTF_LONG_SUPPORT + if (ch=='l') { + ch=*(fmt++); + lng=1; + } +#endif + switch (ch) { + case 0: + goto abort; + case 'u' : { +#ifdef PRINTF_LONG_SUPPORT + if (lng) + uli2a(va_arg(va, unsigned long int),10,0,bf); + else +#endif + ui2a(va_arg(va, unsigned int),10,0,bf); + putchw(putp,putf,w,lz,bf); + break; + } + case 'd' : { +#ifdef PRINTF_LONG_SUPPORT + if (lng) + li2a(va_arg(va, unsigned long int),bf); + else +#endif + i2a(va_arg(va, int),bf); + putchw(putp,putf,w,lz,bf); + break; + } + case 'x': case 'X' : +#ifdef PRINTF_LONG_SUPPORT + if (lng) + uli2a(va_arg(va, unsigned long int),16,(ch=='X'),bf); + else +#endif + ui2a(va_arg(va, unsigned int),16,(ch=='X'),bf); + putchw(putp,putf,w,lz,bf); + break; + case 'c' : + putf(putp,(char)(va_arg(va, int))); + break; + case 's' : + putchw(putp,putf,w,0,va_arg(va, char*)); + break; + case '%' : + putf(putp,ch); + default: + break; + } + } + } + abort:; + } + + +void init_printf(void* putp,void (*putf) (void*,char)) + { + stdout_putf=putf; + stdout_putp=putp; + } + +void tfp_printf(char *fmt, ...) + { + va_list va; + va_start(va,fmt); + tfp_format(stdout_putp,stdout_putf,fmt,va); + va_end(va); + } + +static void putcp(void* p,char c) + { + *(*((char**)p))++ = c; + } + + + +void tfp_sprintf(char* s,char *fmt, ...) + { + va_list va; + va_start(va,fmt); + tfp_format(&s,putcp,fmt,va); + putcp(&s,0); + va_end(va); + } diff --git a/common/chibios/printf.h b/common/chibios/printf.h new file mode 100644 index 00000000..678a100c --- /dev/null +++ b/common/chibios/printf.h @@ -0,0 +1,111 @@ +/* + * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php + * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php + */ + +/* +File: printf.h + +Copyright (C) 2004 Kustaa Nyholm + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +This library is realy just two files: 'printf.h' and 'printf.c'. + +They provide a simple and small (+200 loc) printf functionality to +be used in embedded systems. + +I've found them so usefull in debugging that I do not bother with a +debugger at all. + +They are distributed in source form, so to use them, just compile them +into your project. + +Two printf variants are provided: printf and sprintf. + +The formats supported by this implementation are: 'd' 'u' 'c' 's' 'x' 'X'. + +Zero padding and field width are also supported. + +If the library is compiled with 'PRINTF_SUPPORT_LONG' defined then the +long specifier is also +supported. Note that this will pull in some long math routines (pun intended!) +and thus make your executable noticably longer. + +The memory foot print of course depends on the target cpu, compiler and +compiler options, but a rough guestimate (based on a H8S target) is about +1.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space. +Not too bad. Your milage may vary. By hacking the source code you can +get rid of some hunred bytes, I'm sure, but personally I feel the balance of +functionality and flexibility versus code size is close to optimal for +many embedded systems. + +To use the printf you need to supply your own character output function, +something like : + + void putc ( void* p, char c) + { + while (!SERIAL_PORT_EMPTY) ; + SERIAL_PORT_TX_REGISTER = c; + } + +Before you can call printf you need to initialize it to use your +character output function with something like: + + init_printf(NULL,putc); + +Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', +the NULL (or any pointer) you pass into the 'init_printf' will eventually be +passed to your 'putc' routine. This allows you to pass some storage space (or +anything realy) to the character output function, if necessary. +This is not often needed but it was implemented like that because it made +implementing the sprintf function so neat (look at the source code). + +The code is re-entrant, except for the 'init_printf' function, so it +is safe to call it from interupts too, although this may result in mixed output. +If you rely on re-entrancy, take care that your 'putc' function is re-entrant! + +The printf and sprintf functions are actually macros that translate to +'tfp_printf' and 'tfp_sprintf'. This makes it possible +to use them along with 'stdio.h' printf's in a single source file. +You just need to undef the names before you include the 'stdio.h'. +Note that these are not function like macros, so if you have variables +or struct members with these names, things will explode in your face. +Without variadic macros this is the best we can do to wrap these +fucnction. If it is a problem just give up the macros and use the +functions directly or rename them. + +For further details see source code. + +regs Kusti, 23.10.2004 +*/ + + +#ifndef __TFP_PRINTF__ +#define __TFP_PRINTF__ + +#include + +void init_printf(void* putp,void (*putf) (void*,char)); + +void tfp_printf(char *fmt, ...); +void tfp_sprintf(char* s,char *fmt, ...); + +void tfp_format(void* putp,void (*putf) (void*,char),char *fmt, va_list va); + +#define printf tfp_printf +#define sprintf tfp_sprintf + +#endif diff --git a/common/chibios/sleep_led.c b/common/chibios/sleep_led.c new file mode 100644 index 00000000..50cf4eb7 --- /dev/null +++ b/common/chibios/sleep_led.c @@ -0,0 +1,164 @@ +#include "ch.h" +#include "hal.h" + +#include "led.h" +#include "sleep_led.h" + +#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ +/* All right, we go the "software" way: LP timer, toggle LED in interrupt. + * Based on hasu's code for AVRs. + */ + +/* Breathing Sleep LED brighness(PWM On period) table + * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle + * + * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63 + * (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i } + */ +static const uint8_t breathing_table[64] = { +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, +15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, +255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, +15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Low Power Timer interrupt handler */ +OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { + OSAL_IRQ_PROLOGUE(); + + /* Software PWM + * timer:1111 1111 1111 1111 + * \_____/\/ \_______/____ count(0-255) + * \ \______________ duration of step(4) + * \__________________ index of step table(0-63) + */ + + // this works for cca 65536 irqs/sec + static union { + uint16_t row; + struct { + uint8_t count:8; + uint8_t duration:2; + uint8_t index:6; + } pwm; + } timer = { .row = 0 }; + + timer.row++; + + // LED on + if (timer.pwm.count == 0) { + led_set(1<CSR |= LPTMRx_CSR_TCF; + + OSAL_IRQ_EPILOGUE(); +} + +/* LPTMR clock options */ +#define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ +#define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ +#define LPTMR_CLOCK_ERCLK32K 2 /* external 32kHz crystal */ +#define LPTMR_CLOCK_OSCERCLK 3 /* output from OSC */ + +/* Work around inconsistencies in Freescale naming */ +#if !defined(SIM_SCGC5_LPTMR) +#define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER +#endif + +/* Initialise the timer */ +void sleep_led_init(void) { + /* Make sure the clock to the LPTMR is enabled */ + SIM->SCGC5 |= SIM_SCGC5_LPTMR; + /* Reset LPTMR settings */ + LPTMR0->CSR = 0; + /* Set the compare value */ + LPTMR0->CMR = 0; // trigger on counter value (i.e. every time) + + /* Set up clock source and prescaler */ + /* Software PWM + * ______ ______ __ + * | ON |___OFF___| ON |___OFF___| .... + * |<-------------->|<-------------->|<- .... + * PWM period PWM period + * + * R interrupts/period[resolution] + * F periods/second[frequency] + * R * F interrupts/second + */ + + /* === OPTION 1 === */ + #if 0 + // 1kHz LPO + // No prescaler => 1024 irqs/sec + // Note: this is too slow for a smooth breathe + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_LPO)|LPTMRx_PSR_PBYP; + #endif /* OPTION 1 */ + + /* === OPTION 2 === */ + #if 1 + // nMHz IRC (n=4 on KL25Z, KL26Z and K20x; n=2 or 8 on KL27Z) + MCG->C2 |= MCG_C2_IRCS; // fast (4MHz) internal ref clock + #if defined(KL27) // divide the 8MHz IRC by 2, to have the same MCGIRCLK speed as others + MCG->MC |= MCG_MC_LIRC_DIV2_DIV2; + #endif /* KL27 */ + MCG->C1 |= MCG_C1_IRCLKEN; // enable internal ref clock + // to work in stop mode, also MCG_C1_IREFSTEN + // Divide 4MHz by 2^N (N=6) => 62500 irqs/sec => + // => approx F=61, R=256, duration = 4 + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_MCGIRCLK)|LPTMRx_PSR_PRESCALE(6); + #endif /* OPTION 2 */ + + /* === OPTION 3 === */ + #if 0 + // OSC output (external crystal), usually 8MHz or 16MHz + OSC0->CR |= OSC_CR_ERCLKEN; // enable ext ref clock + // to work in stop mode, also OSC_CR_EREFSTEN + // Divide by 2^N + LPTMR0->PSR = LPTMRx_PSR_PCS(LPTMR_CLOCK_OSCERCLK)|LPTMRx_PSR_PRESCALE(7); + #endif /* OPTION 3 */ + /* === END OPTIONS === */ + + /* Interrupt on TCF set (compare flag) */ + nvicEnableVector(LPTMR0_IRQn, 2); // vector, priority + LPTMR0->CSR |= LPTMRx_CSR_TIE; +} + +void sleep_led_enable(void) { + /* Enable the timer */ + LPTMR0->CSR |= LPTMRx_CSR_TEN; +} + +void sleep_led_disable(void) { + /* Disable the timer */ + LPTMR0->CSR &= ~LPTMRx_CSR_TEN; +} + +void sleep_led_toggle(void) { + /* Toggle the timer */ + LPTMR0->CSR ^= LPTMRx_CSR_TEN; +} + +#else /* platform selection: not on familiar Kinetis chips */ + +void sleep_led_init(void) { +} + +void sleep_led_enable(void) { + led_set(1<. */ #include #include -#include +#include "wait.h" #include "keycode.h" #include "host.h" #include "keymap.h" @@ -97,12 +97,14 @@ bool command_proc(uint8_t code) bool command_extra(uint8_t code) __attribute__ ((weak)); bool command_extra(uint8_t code) { + (void)code; return false; } bool command_console_extra(uint8_t code) __attribute__ ((weak)); bool command_console_extra(uint8_t code) { + (void)code; return false; } @@ -178,7 +180,9 @@ static void print_eeconfig(void) static bool command_common(uint8_t code) { +#ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; +#endif switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: @@ -223,7 +227,7 @@ static bool command_common(uint8_t code) case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); - _delay_ms(1000); + wait_ms(1000); bootloader_jump(); // not return break; case KC_D: @@ -283,6 +287,9 @@ static bool command_common(uint8_t code) #ifdef PROTOCOL_VUSB " VUSB" #endif +#ifdef PROTOCOL_CHIBIOS + " CHIBIOS" +#endif #ifdef BOOTMAGIC_ENABLE " BOOTMAGIC" #endif @@ -307,8 +314,13 @@ static bool command_common(uint8_t code) " " STR(BOOTLOADER_SIZE) "\n"); print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) +#if defined(__AVR__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); +#elif defined(__arm__) + // TODO + ); +#endif break; case KC_S: print("\n\t- Status -\n"); @@ -318,7 +330,7 @@ static bool command_common(uint8_t code) #ifdef NKRO_ENABLE print_val_hex8(keyboard_nkro); #endif - print_val_hex32(timer_count); + print_val_hex32(timer_read32()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); @@ -338,10 +350,11 @@ static bool command_common(uint8_t code) case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; - if (keyboard_nkro) + if (keyboard_nkro) { print("NKRO: on\n"); - else + } else { print("NKRO: off\n"); + } break; #endif case KC_ESC: @@ -595,10 +608,11 @@ static bool mousekey_console(uint8_t code) print("?"); return false; } - if (mousekey_param) + if (mousekey_param) { xprintf("M%d> ", mousekey_param); - else + } else { print("M>" ); + } return true; } #endif diff --git a/common/keycode.h b/common/keycode.h index 44819530..f3402712 100644 --- a/common/keycode.h +++ b/common/keycode.h @@ -85,15 +85,19 @@ along with this program. If not, see . #define KC_LCAP KC_LOCKING_CAPS #define KC_LNUM KC_LOCKING_NUM #define KC_LSCR KC_LOCKING_SCROLL -#define KC_ERAS KC_ALT_ERASE, +#define KC_ERAS KC_ALT_ERASE #define KC_CLR KC_CLEAR /* Japanese specific */ #define KC_ZKHK KC_GRAVE #define KC_RO KC_INT1 #define KC_KANA KC_INT2 #define KC_JYEN KC_INT3 +#define KC_JPY 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 +117,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/common/keymap.c b/common/keymap.c index d4892380..134e01c2 100644 --- a/common/keymap.c +++ b/common/keymap.c @@ -22,7 +22,11 @@ along with this program. If not, see . #include "action_macro.h" #include "wait.h" #include "debug.h" +#include "bootloader.h" +#ifdef BOOTMAGIC_ENABLE +extern keymap_config_t keymap_config; +#endif static action_t keycode_to_action(uint8_t keycode); @@ -109,6 +113,9 @@ action_t action_for_key(uint8_t layer, keypos_t key) __attribute__ ((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; return MACRO_NONE; } @@ -116,6 +123,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) __attribute__ ((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; } @@ -123,7 +133,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) /* translates keycode to action */ static action_t keycode_to_action(uint8_t keycode) { - action_t action; + action_t action = {}; switch (keycode) { case KC_A ... KC_EXSEL: case KC_LCTRL ... KC_RGUI: diff --git a/common/keymap.h b/common/keymap.h index e1a6f992..659ea357 100644 --- a/common/keymap.h +++ b/common/keymap.h @@ -38,7 +38,6 @@ typedef union { bool nkro:1; }; } keymap_config_t; -keymap_config_t keymap_config; #endif diff --git a/common/nodebug.h b/common/nodebug.h index 93309ada..6ef9f91a 100644 --- a/common/nodebug.h +++ b/common/nodebug.h @@ -18,7 +18,9 @@ along with this program. If not, see . #ifndef NODEBUG_H #define NODEBUG_H 1 +#if !defined(NO_DEBUG) #define NO_DEBUG +#endif #include "debug.h" #undef NO_DEBUG diff --git a/common/print.c b/common/print.c index ca94e1e5..00489557 100644 --- a/common/print.c +++ b/common/print.c @@ -38,11 +38,15 @@ void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) xdev_out(sendchar_func); } -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ + +// don't need anything extra + +#elif defined(__arm__) /* __AVR__ */ // TODO //void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { } -#endif +#endif /* __AVR__ */ #endif diff --git a/common/print.h b/common/print.h index c0e9e143..5f491aba 100644 --- a/common/print.h +++ b/common/print.h @@ -47,7 +47,15 @@ extern "C" /* function pointer of sendchar to be used by print utility */ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ + +#include "chibios/printf.h" + +#define print(s) printf(s) +#define println(s) printf(s "\r\n") +#define xprintf printf + +#elif defined(__arm__) /* __AVR__ */ #include "mbed/xprintf.h" @@ -91,9 +99,9 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #else /* NO_PRINT */ -#define xprintf -#define print -#define println +#define xprintf(s,...) +#define print(s) +#define println(s) #define print_set_sendchar(func) #define print_dec(data) #define print_decs(data) @@ -119,6 +127,7 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #define print_val_bin_reverse8(v) #define print_val_bin_reverse16(v) #define print_val_bin_reverse32(v) +#define init_printf(s,ss) #endif /* NO_PRINT */ diff --git a/common/progmem.h b/common/progmem.h index 199b1bed..5b276562 100644 --- a/common/progmem.h +++ b/common/progmem.h @@ -5,8 +5,8 @@ # include #elif defined(__arm__) # define PROGMEM -# define pgm_read_byte(p) *(p) -# define pgm_read_word(p) *(p) +# define pgm_read_byte(p) *((unsigned char*)p) +# define pgm_read_word(p) *((uint16_t*)p) #endif #endif diff --git a/common/report.h b/common/report.h index f6c0a315..0c799eca 100644 --- a/common/report.h +++ b/common/report.h @@ -84,6 +84,11 @@ along with this program. If not, see . # define KEYBOARD_REPORT_SIZE NKRO_EPSIZE # define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) # define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) +#elif defined(PROTOCOL_CHIBIOS) && defined(NKRO_ENABLE) +# include "protocol/chibios/usb_main.h" +# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE +# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) +# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) #else # define KEYBOARD_REPORT_SIZE 8 diff --git a/common/wait.h b/common/wait.h index 40d00b0c..82727be0 100644 --- a/common/wait.h +++ b/common/wait.h @@ -9,9 +9,13 @@ extern "C" { # include # define wait_ms(ms) _delay_ms(ms) # define wait_us(us) _delay_us(us) -#elif defined(__arm__) +#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ +# include "ch.h" +# define wait_ms(ms) chThdSleepMilliseconds(ms) +# define wait_us(us) chThdSleepMicroseconds(us) +#elif defined(__arm__) /* __AVR__ */ # include "wait_api.h" -#endif +#endif /* __AVR__ */ #ifdef __cplusplus } diff --git a/doc/build.md b/doc/build.md index 20702e94..57a36ac4 100644 --- a/doc/build.md +++ b/doc/build.md @@ -6,11 +6,11 @@ Download and Install -------------------- ### 1. Install Tools -1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager. +1. **Toolchain** On Windows install [Atmel AVR Toolchain][atmelgcc] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack] or your favorite package manager. On Linux you can install AVR GCC with your favorite package manager. -2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog]. +2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows. -3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver. +3. **Driver** On Windows when you start DFU bootloader on the chip first time you will see **Found New Hardware Wizard** to install driver. If you install device driver properly you will find chip name like **ATmega32U4** under **LibUSB-Win32 Devices** tree on **Device Manager**. If not you shall need to update its driver on **Device Manager**. You will find the driver in `FLIP` install directory like: `C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\`. In case of `dfu-programmer` install driver distributed with it. If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader]. @@ -20,7 +20,7 @@ You can find firmware source at github: - -If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from: +If you are familiar with [`git`][git] tools you are recommended to use it but you can also download zip archive from: - @@ -28,7 +28,7 @@ If you are familiar with `Git` tools you are recommended to use it but you can a Build firmware -------------- ### 1. Open terminal -Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up. +Open terminal window to get access to commands. Use Cygwin(or MingGW) shell terminal in Windows or `Terminal.app` on Mac OSX. ### 2. Change directory Move to project directory in the firmware source. @@ -53,60 +53,65 @@ Now you have **hex** file to program on current directory. This **hex** is only How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual. ### 2. Program with DFU bootloader -Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows. +Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. `FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. Open source alternative `dfu-programmer` also supports AVR chips, it is command line tool and runs on Linux, Mac OSX and even Windows. -To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`. -If you have a proper program command in `Makefile` just type this. -`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. -To use command line tool run this command. Note that you need to set PATH variable properly. +To program with command of `FLIP` run this. Note that you need to set PATH variable properly. $ make -f Makefile. flip -Or to program with `dfu-programmer` run: +With `dfu-programmer` run this. $ make -f Makefile. dfu -#### FLIP GUI tutorial -1. On menu bar click Device -> Select, then. `ATmega32u4`. -2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog. -At this point you'll see grey-outed widgets on the app get colored and ready. +Or you can execute the command directly as the following. -3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog. -4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected. -5. Re-plug USB cord or click 'Start Application' button to restart your controller. + $ dfu-programmer erase --force + $ dfu-programmer flash + $ dfu-programmer reset + +`` part will be `atmega32u4` or `atmega32u2` in most cases. See manual of the command for the detail. On Linux and Mac OSX you will need proper permission to program a controller and you can use `sudo` command for this purpose probably. On Linux you also can configure `udev` rules to set permission. + + +#### FLIP GUI tutorial +1. On menu bar click **Device** -> **Select**, then choose your chip name. (In most cases **ATmega32U2** or **ATmega32U4**) +2. On menu bar click **Settings** -> **Communication** -> **USB**, then click **Open** button on **USB Port Connection** dialog. At this point you'll have to plug into USB and start bootloader. + +3. On menu bar click **File** -> **Load HEX File**, then select your firmware hex file on File Selector dialog. +4. On **Operations Flow** panel click **Run** button to load the firmware binary to the chip. Note that you should keep **Erase**, **Blank Check**, **Program** and **Verify** check boxes selected. +5. Re-plug USB cord or click **Start Application** button to restart your controller. Done. -See also these instructions if you need. +See also these instructions if needed. - - -### 3. Program with Teensy Loader -If you have PJRC Teensy see instruction of `Teensy Loader`. +##### Troubleshoot +* **FLIP: AtLibUsbDfu.dll not found** +Remove current driver and re-install one FLIP provides from DeviceManager of WIndows. See -- -Or use this command if you have command line version of Teensy Loader installed. +### 3. Program with Other programmer +If you are using PJRC Teensy consult with instruction of [Teensy Loader][teensy-loader]. Or run this target with `make` after you install command line version of it. $ make -f Makefile. teensy - -### 4. Program with Other programmer -You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. +You may want to use other programmer like [`avrdude`][avrdude]. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. See below. $ make -f Makefile. program +[atmelgcc]: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx [cygwin]: https://www.cygwin.com/ [mingw]: http://www.mingw.org/ -[mhv]: https://infernoembedded.com/products/avr-tools -[winavr]: http://winavr.sourceforge.net/ [crosspack]: http://www.obdev.at/products/crosspack/index.html [flip]: http://www.atmel.com/tools/FLIP.aspx [dfu-prog]: http://dfu-programmer.sourceforge.net/ [teensy-loader]:http://www.pjrc.com/teensy/loader.html +[avrdude]: http://savannah.nongnu.org/projects/avrdude/ +[git]: https://git-scm.com/ @@ -122,6 +127,7 @@ Set your MCU and its clock in Hz. # Boot Section Size in *bytes* # Teensy halfKay 512 + # Teensy++ halfKay 2048 # Atmel DFU loader 4096 # LUFA bootloader 4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096 @@ -141,7 +147,7 @@ Optional. Note that ***comment out*** with `#` to disable them. #BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality ### 3. Programmer -Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`. +Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. # avrdude with AVRISPmkII PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex diff --git a/doc/keymap.md b/doc/keymap.md index d4a129b2..566936c6 100644 --- a/doc/keymap.md +++ b/doc/keymap.md @@ -368,17 +368,37 @@ Default Layer also has bitwise operations, they are executed when key is release MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) #### 2.3.1 Macro Commands +- **MACRO()** +- **MACRO_NONE** + - **I()** change interval of stroke. - **D()** press key - **U()** release key - **T()** type key(press and release) - **W()** wait +- **SM()** store modifier state +- **RM()** restore modifier state +- **CM()** clear modifier state - **END** end mark #### 2.3.2 Examples +***TBD*** + + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) + { + switch (id) { + case HELLO: + return (record->event.pressed ? + MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) : + MACRO_NONE ); + case ALT_TAB: + return (record->event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; + } -***TODO: sample implementation*** -See `keyboard/hhkb/keymap.c` for sample. diff --git a/doc/other_projects.md b/doc/other_projects.md deleted file mode 100644 index bf980b0a..00000000 --- a/doc/other_projects.md +++ /dev/null @@ -1,62 +0,0 @@ -Other Keyboard Firmware Projects -================================ -## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR] -- -- - -## kbupgrade[USB][V-USB][AVR] -- -- - -## c64key[USB][V-USB][AVR] -- - -## rump[USB][V-USB][AVR] -- -- - -## dulcimer[USB][V-USB][AVR] -- - -## humblehacker-keyboard[USB][LUFA][AVR][Ergo] -- -- -- - -## ps2avr[PS/2][AVR] -- - -## ErgoDox[Ergo][Split][USB][AVR] -- -- -- - -## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR] -- -- - -## bpiphany's AVR-Keyboard[PJRC][AVR][USB] -- -- -- - -## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino] -- -- - -## USB-USB converter threads[converter][USB-USB] -- -- - -## kbdbabel.org[converter][vintage][protocol][8051] -Great resource of vintage keyboard protocol information and code - -- - -## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex] -A lots of vintage keyboard protocol supports - -- - -## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo] -- diff --git a/protocol/chibios/README.md b/protocol/chibios/README.md new file mode 100644 index 00000000..9796f8c7 --- /dev/null +++ b/protocol/chibios/README.md @@ -0,0 +1,50 @@ +## TMK running on top of ChibiOS + +### Notes + +- To use, unpack or symlink [ChibiOS] {currently 3.0.2} to `tmk_core/tool/chibios/chibios`. For Kinetis support, you'll need a fork which implements the USB driver, e.g. [this one](https://github.com/flabbergast/ChibiOS/tree/kinetis). +- For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. +Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. +- USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. +- There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task`, or 1.5sec wait for USB init, in `main.c`. There should be no such in `usb_main.c` (the main USB stack). Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). +- It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. +- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. +- Sleep LED works, but at the moment only on/off, i.e. no breathing. + +### Immediate todo + +- host-wakeup packet sending during suspend +- power saving for suspend? +- PWM for sleep led + +### Not tested, but possibly working + +- backlight + +### Missing / not working (TMK vs ChibiOS bits) + +- eeprom / bootmagic for STM32 (will be chip dependent; eeprom needs to be emulated in flash, which means less writes; wear-levelling?) There is a semi-official ST "driver" for eeprom, with wear-levelling, but I think it consumes a lot of RAM (like 2 pages, i.e. 1kB or so). + +### Tried with + +- ChibiOS 3.0.1, 3.0.2 and ST F072RB DISCOVERY board. +- Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. +- ChibiOS with Kinetis patches and Teensy LC and 3.0. + +## ChibiOS-supported MCUs (as of 3.0.2) + +- Pretty much all STM32 chips. +- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), but again, no official USB stack yet. However the `kinetis` branch of [my ChibiOS fork](https://github.com/flabbergast/ChibiOS). With this fork, TMK work normally on all the ARM Teensies. +- There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. +- I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. + +## STM32-based keyboard design considerations + +- STM32F0x2 chips can do crystal-less USB, but they still need a 3.3V voltage regulator. +- The BOOT0 pin should be tied to GND. +- For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. +- For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). However this is not strictly necessary, because instead of direct output of a timer to a pin (better of course), it is easy to define timer callbacks in ChibiOS that turn on/off an arbitrary pin. + + + +[ChibiOS]: http://chibios.org diff --git a/protocol/chibios/main.c b/protocol/chibios/main.c new file mode 100644 index 00000000..b62cfa9c --- /dev/null +++ b/protocol/chibios/main.c @@ -0,0 +1,139 @@ +/* + * (c) 2015 flabberast + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + +#include "ch.h" +#include "hal.h" + +#include "usb_main.h" + +/* TMK includes */ +#include "report.h" +#include "host.h" +#include "host_driver.h" +#include "keyboard.h" +#include "action.h" +#include "action_util.h" +#include "mousekey.h" +#include "led.h" +#include "sendchar.h" +#include "debug.h" +#ifdef SLEEP_LED_ENABLE +#include "sleep_led.h" +#endif +#include "suspend.h" + + +/* ------------------------- + * TMK host driver defs + * ------------------------- + */ + +/* declarations */ +uint8_t keyboard_leds(void); +void send_keyboard(report_keyboard_t *report); +void send_mouse(report_mouse_t *report); +void send_system(uint16_t data); +void send_consumer(uint16_t data); + +/* host struct */ +host_driver_t chibios_driver = { + keyboard_leds, + send_keyboard, + send_mouse, + send_system, + send_consumer +}; + + +/* TESTING + * Amber LED blinker thread, times are in milliseconds. + */ +/* set this variable to non-zero anywhere to blink once */ +// uint8_t blinkLed = 0; +// static THD_WORKING_AREA(waBlinkerThread, 128); +// static THD_FUNCTION(blinkerThread, arg) { +// (void)arg; +// chRegSetThreadName("blinkOrange"); +// while(true) { +// if(blinkLed) { +// blinkLed = 0; +// palSetPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); +// chThdSleepMilliseconds(100); +// palClearPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); +// } +// chThdSleepMilliseconds(100); +// } +// } + + + +/* Main thread + */ +int main(void) { + /* ChibiOS/RT init */ + halInit(); + chSysInit(); + + // TESTING + // chThdCreateStatic(waBlinkerThread, sizeof(waBlinkerThread), NORMALPRIO, blinkerThread, NULL); + + /* Init USB */ + init_usb_driver(&USB_DRIVER); + + /* init printf */ + init_printf(NULL,sendchar_pf); + + /* Wait until the USB is active */ + while(USB_DRIVER.state != USB_ACTIVE) + chThdSleepMilliseconds(50); + + print("USB configured.\n"); + + /* init TMK modules */ + keyboard_init(); + host_set_driver(&chibios_driver); + +#ifdef SLEEP_LED_ENABLE + sleep_led_init(); +#endif + + print("Keyboard start.\n"); + + /* Main loop */ + while(true) { + + if(USB_DRIVER.state == USB_SUSPENDED) { + print("[s]"); + while(USB_DRIVER.state == USB_SUSPENDED) { + /* Do this in the suspended state */ + suspend_power_down(); // on AVR this deep sleeps for 15ms + /* Remote wakeup */ + if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { + send_remote_wakeup(&USB_DRIVER); + } + } + /* Woken up */ + // variables has been already cleared by the wakeup hook + send_keyboard_report(); +#ifdef MOUSEKEY_ENABLE + mousekey_send(); +#endif /* MOUSEKEY_ENABLE */ + } + + keyboard_task(); + } +} diff --git a/protocol/chibios/usb_main.c b/protocol/chibios/usb_main.c new file mode 100644 index 00000000..d248b447 --- /dev/null +++ b/protocol/chibios/usb_main.c @@ -0,0 +1,1372 @@ +/* + * (c) 2015 flabberast + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + +#include "ch.h" +#include "hal.h" + +#include "usb_main.h" + +#include "host.h" +#include "debug.h" +#include "suspend.h" +#ifdef SLEEP_LED_ENABLE +#include "sleep_led.h" +#include "led.h" +#endif + +/* --------------------------------------------------------- + * Global interface variables and declarations + * --------------------------------------------------------- + */ + +uint8_t keyboard_idle = 0; +uint8_t keyboard_protocol = 1; +uint16_t keyboard_led_stats = 0; +volatile uint16_t keyboard_idle_count = 0; +static virtual_timer_t keyboard_idle_timer; +static void keyboard_idle_timer_cb(void *arg); +#ifdef NKRO_ENABLE +extern bool keyboard_nkro; +#endif /* NKRO_ENABLE */ + +report_keyboard_t keyboard_report_sent = {{0}}; +#ifdef MOUSE_ENABLE +report_mouse_t mouse_report_blank = {0}; +#endif /* MOUSE_ENABLE */ +#ifdef EXTRAKEY_ENABLE +uint8_t extra_report_blank[3] = {0}; +#endif /* EXTRAKEY_ENABLE */ + +#ifdef CONSOLE_ENABLE +/* The emission buffers queue */ +output_buffers_queue_t console_buf_queue; +static uint8_t console_queue_buffer[BQ_BUFFER_SIZE(CONSOLE_QUEUE_CAPACITY, CONSOLE_EPSIZE)]; + +static virtual_timer_t console_flush_timer; +void console_queue_onotify(io_buffers_queue_t *bqp); +static void console_flush_cb(void *arg); +#endif /* CONSOLE_ENABLE */ + +/* --------------------------------------------------------- + * Descriptors and USB driver objects + * --------------------------------------------------------- + */ + +/* HID specific constants */ +#define USB_DESCRIPTOR_HID 0x21 +#define USB_DESCRIPTOR_HID_REPORT 0x22 +#define HID_GET_REPORT 0x01 +#define HID_GET_IDLE 0x02 +#define HID_GET_PROTOCOL 0x03 +#define HID_SET_REPORT 0x09 +#define HID_SET_IDLE 0x0A +#define HID_SET_PROTOCOL 0x0B + +/* USB Device Descriptor */ +static const uint8_t usb_device_descriptor_data[] = { + USB_DESC_DEVICE(0x0200, // bcdUSB (1.1) + 0, // bDeviceClass (defined in later in interface) + 0, // bDeviceSubClass + 0, // bDeviceProtocol + 64, // bMaxPacketSize (64 bytes) (the driver didn't work with 32) + VENDOR_ID, // idVendor + PRODUCT_ID, // idProduct + DEVICE_VER, // bcdDevice + 1, // iManufacturer + 2, // iProduct + 3, // iSerialNumber + 1) // bNumConfigurations +}; + +/* Device Descriptor wrapper */ +static const USBDescriptor usb_device_descriptor = { + sizeof usb_device_descriptor_data, + usb_device_descriptor_data +}; + +/* + * HID Report Descriptor + * + * See "Device Class Definition for Human Interface Devices (HID)" + * (http://www.usb.org/developers/hidpage/HID1_11.pdf) for the + * detailed descrition of all the fields + */ + +/* Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60 */ +static const uint8_t keyboard_hid_report_desc_data[] = { + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x06, // Usage (Keyboard), + 0xA1, 0x01, // Collection (Application), + 0x75, 0x01, // Report Size (1), + 0x95, 0x08, // Report Count (8), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0xE0, // Usage Minimum (224), + 0x29, 0xE7, // Usage Maximum (231), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte + 0x95, 0x01, // Report Count (1), + 0x75, 0x08, // Report Size (8), + 0x81, 0x03, // Input (Constant), ;Reserved byte + 0x95, 0x05, // Report Count (5), + 0x75, 0x01, // Report Size (1), + 0x05, 0x08, // Usage Page (LEDs), + 0x19, 0x01, // Usage Minimum (1), + 0x29, 0x05, // Usage Maximum (5), + 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report + 0x95, 0x01, // Report Count (1), + 0x75, 0x03, // Report Size (3), + 0x91, 0x03, // Output (Constant), ;LED report padding + 0x95, KBD_REPORT_KEYS, // Report Count (), + 0x75, 0x08, // Report Size (8), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0xFF, // Logical Maximum(255), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0x00, // Usage Minimum (0), + 0x29, 0xFF, // Usage Maximum (255), + 0x81, 0x00, // Input (Data, Array), + 0xc0 // End Collection +}; +/* wrapper */ +static const USBDescriptor keyboard_hid_report_descriptor = { + sizeof keyboard_hid_report_desc_data, + keyboard_hid_report_desc_data +}; + +#ifdef NKRO_ENABLE +static const uint8_t nkro_hid_report_desc_data[] = { + 0x05, 0x01, // Usage Page (Generic Desktop), + 0x09, 0x06, // Usage (Keyboard), + 0xA1, 0x01, // Collection (Application), + // bitmap of modifiers + 0x75, 0x01, // Report Size (1), + 0x95, 0x08, // Report Count (8), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0xE0, // Usage Minimum (224), + 0x29, 0xE7, // Usage Maximum (231), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum (1), + 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte + // LED output report + 0x95, 0x05, // Report Count (5), + 0x75, 0x01, // Report Size (1), + 0x05, 0x08, // Usage Page (LEDs), + 0x19, 0x01, // Usage Minimum (1), + 0x29, 0x05, // Usage Maximum (5), + 0x91, 0x02, // Output (Data, Variable, Absolute), + 0x95, 0x01, // Report Count (1), + 0x75, 0x03, // Report Size (3), + 0x91, 0x03, // Output (Constant), + // bitmap of keys + 0x95, NKRO_REPORT_KEYS * 8, // Report Count (), + 0x75, 0x01, // Report Size (1), + 0x15, 0x00, // Logical Minimum (0), + 0x25, 0x01, // Logical Maximum(1), + 0x05, 0x07, // Usage Page (Key Codes), + 0x19, 0x00, // Usage Minimum (0), + 0x29, NKRO_REPORT_KEYS * 8 - 1, // Usage Maximum (), + 0x81, 0x02, // Input (Data, Variable, Absolute), + 0xc0 // End Collection +}; +/* wrapper */ +static const USBDescriptor nkro_hid_report_descriptor = { + sizeof nkro_hid_report_desc_data, + nkro_hid_report_desc_data +}; +#endif /* NKRO_ENABLE */ + +#ifdef MOUSE_ENABLE +/* Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension + * http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 + * http://www.keil.com/forum/15671/ + * http://www.microsoft.com/whdc/device/input/wheel.mspx */ +static const uint8_t mouse_hid_report_desc_data[] = { + /* mouse */ + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x02, // USAGE (Mouse) + 0xa1, 0x01, // COLLECTION (Application) + //0x85, REPORT_ID_MOUSE, // REPORT_ID (1) + 0x09, 0x01, // USAGE (Pointer) + 0xa1, 0x00, // COLLECTION (Physical) + // ---------------------------- Buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x05, // USAGE_MAXIMUM (Button 5) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x05, // REPORT_COUNT (5) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x03, // REPORT_SIZE (3) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + // ---------------------------- X,Y position + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Vertical wheel + 0x09, 0x38, // USAGE (Wheel) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x35, 0x00, // PHYSICAL_MINIMUM (0) - reset physical + 0x45, 0x00, // PHYSICAL_MAXIMUM (0) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Horizontal wheel + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x0a, 0x38, 0x02, // USAGE (AC Pan) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION +}; +/* wrapper */ +static const USBDescriptor mouse_hid_report_descriptor = { + sizeof mouse_hid_report_desc_data, + mouse_hid_report_desc_data +}; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +static const uint8_t console_hid_report_desc_data[] = { + 0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined) + 0x09, 0x74, // Usage 0x74 + 0xA1, 0x53, // Collection 0x53 + 0x75, 0x08, // report size = 8 bits + 0x15, 0x00, // logical minimum = 0 + 0x26, 0xFF, 0x00, // logical maximum = 255 + 0x95, CONSOLE_EPSIZE, // report count + 0x09, 0x75, // usage + 0x81, 0x02, // Input (array) + 0xC0 // end collection +}; +/* wrapper */ +static const USBDescriptor console_hid_report_descriptor = { + sizeof console_hid_report_desc_data, + console_hid_report_desc_data +}; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +/* audio controls & system controls + * http://www.microsoft.com/whdc/archive/w2kbd.mspx */ +static const uint8_t extra_hid_report_desc_data[] = { + /* system control */ + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x80, // USAGE (System Control) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) + 0x15, 0x01, // LOGICAL_MINIMUM (0x1) + 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) + 0x19, 0x01, // USAGE_MINIMUM (0x1) + 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x00, // INPUT (Data,Array,Abs) + 0xc0, // END_COLLECTION + /* consumer */ + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x09, 0x01, // USAGE (Consumer Control) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, REPORT_ID_CONSUMER, // REPORT_ID (3) + 0x15, 0x01, // LOGICAL_MINIMUM (0x1) + 0x26, 0x9c, 0x02, // LOGICAL_MAXIMUM (0x29c) + 0x19, 0x01, // USAGE_MINIMUM (0x1) + 0x2a, 0x9c, 0x02, // USAGE_MAXIMUM (0x29c) + 0x75, 0x10, // REPORT_SIZE (16) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x00, // INPUT (Data,Array,Abs) + 0xc0, // END_COLLECTION +}; +/* wrapper */ +static const USBDescriptor extra_hid_report_descriptor = { + sizeof extra_hid_report_desc_data, + extra_hid_report_desc_data +}; +#endif /* EXTRAKEY_ENABLE */ + + +/* + * Configuration Descriptor tree for a HID device + * + * The HID Specifications version 1.11 require the following order: + * - Configuration Descriptor + * - Interface Descriptor + * - HID Descriptor + * - Endpoints Descriptors + */ +#define KBD_HID_DESC_NUM 0 +#define KBD_HID_DESC_OFFSET (9 + (9 + 9 + 7) * KBD_HID_DESC_NUM + 9) + +#ifdef MOUSE_ENABLE +# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1) +# define MOUSE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * MOUSE_HID_DESC_NUM + 9) +#else /* MOUSE_ENABLE */ +# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0) +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +#define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) +#define CONSOLE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * CONSOLE_HID_DESC_NUM + 9) +#else /* CONSOLE_ENABLE */ +# define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 0) +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 1) +# define EXTRA_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) +#else /* EXTRAKEY_ENABLE */ +# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 0) +#endif /* EXTRAKEY_ENABLE */ + +#ifdef NKRO_ENABLE +# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1) +# define NKRO_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) +#else /* NKRO_ENABLE */ +# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 0) +#endif /* NKRO_ENABLE */ + +#define NUM_INTERFACES (NKRO_HID_DESC_NUM + 1) +#define CONFIG1_DESC_SIZE (9 + (9 + 9 + 7) * NUM_INTERFACES) + +static const uint8_t hid_configuration_descriptor_data[] = { + /* Configuration Descriptor (9 bytes) USB spec 9.6.3, page 264-266, Table 9-10 */ + USB_DESC_CONFIGURATION(CONFIG1_DESC_SIZE, // wTotalLength + NUM_INTERFACES, // bNumInterfaces + 1, // bConfigurationValue + 0, // iConfiguration + 0xA0, // bmAttributes (RESERVED|REMOTEWAKEUP) + 50), // bMaxPower (50mA) + + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(KBD_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x01, // bInterfaceSubClass: Boot + 0x01, // bInterfaceProtocol: Keyboard + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(keyboard_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(KBD_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + KBD_EPSIZE,// wMaxPacketSize + 10), // bInterval + + #ifdef MOUSE_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(MOUSE_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass (0x03 = HID) + // ThinkPad T23 BIOS doesn't work with boot mouse. + 0x00, // bInterfaceSubClass (0x01 = Boot) + 0x00, // bInterfaceProtocol (0x02 = Mouse) + /* + 0x01, // bInterfaceSubClass (0x01 = Boot) + 0x02, // bInterfaceProtocol (0x02 = Mouse) + */ + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(mouse_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(MOUSE_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + MOUSE_EPSIZE, // wMaxPacketSize + 1), // bInterval + #endif /* MOUSE_ENABLE */ + + #ifdef CONSOLE_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(CONSOLE_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(console_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(CONSOLE_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + CONSOLE_EPSIZE, // wMaxPacketSize + 1), // bInterval + #endif /* CONSOLE_ENABLE */ + + #ifdef EXTRAKEY_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(EXTRA_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(extra_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(EXTRA_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + EXTRA_EPSIZE, // wMaxPacketSize + 10), // bInterval + #endif /* EXTRAKEY_ENABLE */ + + #ifdef NKRO_ENABLE + /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ + USB_DESC_INTERFACE(NKRO_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass: HID + 0x00, // bInterfaceSubClass: None + 0x00, // bInterfaceProtocol: None + 0), // iInterface + + /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ + USB_DESC_BYTE(9), // bLength + USB_DESC_BYTE(0x21), // bDescriptorType (HID class) + USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 + USB_DESC_BYTE(0), // bCountryCode + USB_DESC_BYTE(1), // bNumDescriptors + USB_DESC_BYTE(0x22), // bDescriptorType (report desc) + USB_DESC_WORD(sizeof(nkro_hid_report_desc_data)), // wDescriptorLength + + /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ + USB_DESC_ENDPOINT(NKRO_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (Interrupt) + NKRO_EPSIZE, // wMaxPacketSize + 1), // bInterval + #endif /* NKRO_ENABLE */ +}; + +/* Configuration Descriptor wrapper */ +static const USBDescriptor hid_configuration_descriptor = { + sizeof hid_configuration_descriptor_data, + hid_configuration_descriptor_data +}; + +/* wrappers */ +#define HID_DESCRIPTOR_SIZE 9 +static const USBDescriptor keyboard_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[KBD_HID_DESC_OFFSET] +}; +#ifdef MOUSE_ENABLE +static const USBDescriptor mouse_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[MOUSE_HID_DESC_OFFSET] +}; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE +static const USBDescriptor console_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[CONSOLE_HID_DESC_OFFSET] +}; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE +static const USBDescriptor extra_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[EXTRA_HID_DESC_OFFSET] +}; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE +static const USBDescriptor nkro_hid_descriptor = { + HID_DESCRIPTOR_SIZE, + &hid_configuration_descriptor_data[NKRO_HID_DESC_OFFSET] +}; +#endif /* NKRO_ENABLE */ + + +/* U.S. English language identifier */ +static const uint8_t usb_string_langid[] = { + USB_DESC_BYTE(4), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USB_DESC_WORD(0x0409) // wLANGID (U.S. English) +}; + +/* ugly ugly hack */ +#define PP_NARG(...) \ + PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) +#define PP_NARG_(...) \ + PP_ARG_N(__VA_ARGS__) +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63,N,...) N +#define PP_RSEQ_N() \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9,8,7,6,5,4,3,2,1,0 + +/* Vendor string = manufacturer */ +static const uint8_t usb_string_vendor[] = { + USB_DESC_BYTE(PP_NARG(USBSTR_MANUFACTURER)+2), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USBSTR_MANUFACTURER +}; + +/* Device Description string = product */ +static const uint8_t usb_string_description[] = { + USB_DESC_BYTE(PP_NARG(USBSTR_PRODUCT)+2), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + USBSTR_PRODUCT +}; + +/* Serial Number string (will be filled by the function init_usb_serial_string) */ +static uint8_t usb_string_serial[] = { + USB_DESC_BYTE(22), // bLength + USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType + '0', 0, 'x', 0, 'D', 0, 'E', 0, 'A', 0, 'D', 0, 'B', 0, 'E', 0, 'E', 0, 'F', 0 +}; + +/* Strings wrappers array */ +static const USBDescriptor usb_strings[] = { + { sizeof usb_string_langid, usb_string_langid } + , + { sizeof usb_string_vendor, usb_string_vendor } + , + { sizeof usb_string_description, usb_string_description } + , + { sizeof usb_string_serial, usb_string_serial } +}; + +/* + * Handles the GET_DESCRIPTOR callback + * + * Returns the proper descriptor + */ +static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang) { + (void)usbp; + (void)lang; + switch(dtype) { + /* Generic descriptors */ + case USB_DESCRIPTOR_DEVICE: /* Device Descriptor */ + return &usb_device_descriptor; + + case USB_DESCRIPTOR_CONFIGURATION: /* Configuration Descriptor */ + return &hid_configuration_descriptor; + + case USB_DESCRIPTOR_STRING: /* Strings */ + if(dindex < 4) + return &usb_strings[dindex]; + break; + + /* HID specific descriptors */ + case USB_DESCRIPTOR_HID: /* HID Descriptors */ + switch(lang) { /* yea, poor label, it's actually wIndex from the setup packet */ + case KBD_INTERFACE: + return &keyboard_hid_descriptor; + +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + return &mouse_hid_descriptor; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + return &console_hid_descriptor; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + return &extra_hid_descriptor; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: + return &nkro_hid_descriptor; +#endif /* NKRO_ENABLE */ + } + + case USB_DESCRIPTOR_HID_REPORT: /* HID Report Descriptor */ + switch(lang) { + case KBD_INTERFACE: + return &keyboard_hid_report_descriptor; + +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + return &mouse_hid_report_descriptor; +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + return &console_hid_report_descriptor; +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + return &extra_hid_report_descriptor; +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: + return &nkro_hid_report_descriptor; +#endif /* NKRO_ENABLE */ + } + } + return NULL; +} + +/* keyboard endpoint state structure */ +static USBInEndpointState kbd_ep_state; +/* keyboard endpoint initialization structure (IN) */ +static const USBEndpointConfig kbd_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + kbd_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + KBD_EPSIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &kbd_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; + +#ifdef MOUSE_ENABLE +/* mouse endpoint state structure */ +static USBInEndpointState mouse_ep_state; + +/* mouse endpoint initialization structure (IN) */ +static const USBEndpointConfig mouse_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + mouse_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + MOUSE_EPSIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &mouse_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE +/* console endpoint state structure */ +static USBInEndpointState console_ep_state; + +/* console endpoint initialization structure (IN) */ +static const USBEndpointConfig console_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + console_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + CONSOLE_EPSIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &console_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE +/* extrakey endpoint state structure */ +static USBInEndpointState extra_ep_state; + +/* extrakey endpoint initialization structure (IN) */ +static const USBEndpointConfig extra_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + extra_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + EXTRA_EPSIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &extra_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* EXTRAKEY_ENABLE */ + +#ifdef NKRO_ENABLE +/* nkro endpoint state structure */ +static USBInEndpointState nkro_ep_state; + +/* nkro endpoint initialization structure (IN) */ +static const USBEndpointConfig nkro_ep_config = { + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ + NULL, /* SETUP packet notification callback */ + nkro_in_cb, /* IN notification callback */ + NULL, /* OUT notification callback */ + NKRO_EPSIZE, /* IN maximum packet size */ + 0, /* OUT maximum packet size */ + &nkro_ep_state, /* IN Endpoint state */ + NULL, /* OUT endpoint state */ + 2, /* IN multiplier */ + NULL /* SETUP buffer (not a SETUP endpoint) */ +}; +#endif /* NKRO_ENABLE */ + +/* --------------------------------------------------------- + * USB driver functions + * --------------------------------------------------------- + */ + +/* Handles the USB driver global events + * TODO: maybe disable some things when connection is lost? */ +static void usb_event_cb(USBDriver *usbp, usbevent_t event) { + switch(event) { + case USB_EVENT_RESET: + //TODO: from ISR! print("[R]"); + return; + + case USB_EVENT_ADDRESS: + return; + + case USB_EVENT_CONFIGURED: + osalSysLockFromISR(); + /* Enable the endpoints specified into the configuration. */ + usbInitEndpointI(usbp, KBD_ENDPOINT, &kbd_ep_config); +#ifdef MOUSE_ENABLE + usbInitEndpointI(usbp, MOUSE_ENDPOINT, &mouse_ep_config); +#endif /* MOUSE_ENABLE */ +#ifdef CONSOLE_ENABLE + usbInitEndpointI(usbp, CONSOLE_ENDPOINT, &console_ep_config); + /* don't need to start the flush timer, it starts from console_in_cb automatically */ +#endif /* CONSOLE_ENABLE */ +#ifdef EXTRAKEY_ENABLE + usbInitEndpointI(usbp, EXTRA_ENDPOINT, &extra_ep_config); +#endif /* EXTRAKEY_ENABLE */ +#ifdef NKRO_ENABLE + usbInitEndpointI(usbp, NKRO_ENDPOINT, &nkro_ep_config); +#endif /* NKRO_ENABLE */ + osalSysUnlockFromISR(); + return; + + case USB_EVENT_SUSPEND: + //TODO: from ISR! print("[S]"); +#ifdef SLEEP_LED_ENABLE + sleep_led_enable(); +#endif /* SLEEP_LED_ENABLE */ + return; + + case USB_EVENT_WAKEUP: + //TODO: from ISR! print("[W]"); + suspend_wakeup_init(); +#ifdef SLEEP_LED_ENABLE + sleep_led_disable(); + // NOTE: converters may not accept this + led_set(host_keyboard_leds()); +#endif /* SLEEP_LED_ENABLE */ + return; + + case USB_EVENT_STALLED: + return; + } +} + +/* Function used locally in os/hal/src/usb.c for getting descriptors + * need it here for HID descriptor */ +static uint16_t get_hword(uint8_t *p) { + uint16_t hw; + + hw = (uint16_t)*p++; + hw |= (uint16_t)*p << 8U; + return hw; +} + +/* + * Appendix G: HID Request Support Requirements + * + * The following table enumerates the requests that need to be supported by various types of HID class devices. + * Device type GetReport SetReport GetIdle SetIdle GetProtocol SetProtocol + * ------------------------------------------------------------------------------------------ + * Boot Mouse Required Optional Optional Optional Required Required + * Non-Boot Mouse Required Optional Optional Optional Optional Optional + * Boot Keyboard Required Optional Required Required Required Required + * Non-Boot Keybrd Required Optional Required Required Optional Optional + * Other Device Required Optional Optional Optional Optional Optional + */ + +/* Callback for SETUP request on the endpoint 0 (control) */ +static bool usb_request_hook_cb(USBDriver *usbp) { + const USBDescriptor *dp; + + /* usbp->setup fields: + * 0: bmRequestType (bitmask) + * 1: bRequest + * 2,3: (LSB,MSB) wValue + * 4,5: (LSB,MSB) wIndex + * 6,7: (LSB,MSB) wLength (number of bytes to transfer if there is a data phase) */ + + /* Handle HID class specific requests */ + if(((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) && + ((usbp->setup[0] & USB_RTYPE_RECIPIENT_MASK) == USB_RTYPE_RECIPIENT_INTERFACE)) { + switch(usbp->setup[0] & USB_RTYPE_DIR_MASK) { + case USB_RTYPE_DIR_DEV2HOST: + switch(usbp->setup[1]) { /* bRequest */ + case HID_GET_REPORT: + switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0?) */ + case KBD_INTERFACE: +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: +#endif /* NKRO_ENABLE */ + usbSetupTransfer(usbp, (uint8_t *)&keyboard_report_sent, sizeof(keyboard_report_sent), NULL); + return TRUE; + break; + +#ifdef MOUSE_ENABLE + case MOUSE_INTERFACE: + usbSetupTransfer(usbp, (uint8_t *)&mouse_report_blank, sizeof(mouse_report_blank), NULL); + return TRUE; + break; +#endif /* MOUSE_ENABLE */ + +#ifdef CONSOLE_ENABLE + case CONSOLE_INTERFACE: + usbSetupTransfer(usbp, console_queue_buffer, CONSOLE_EPSIZE, NULL); + return TRUE; + break; +#endif /* CONSOLE_ENABLE */ + +#ifdef EXTRAKEY_ENABLE + case EXTRA_INTERFACE: + if(usbp->setup[3] == 1) { /* MSB(wValue) [Report Type] == 1 [Input Report] */ + switch(usbp->setup[2]) { /* LSB(wValue) [Report ID] */ + case REPORT_ID_SYSTEM: + extra_report_blank[0] = REPORT_ID_SYSTEM; + usbSetupTransfer(usbp, (uint8_t *)extra_report_blank, sizeof(extra_report_blank), NULL); + return TRUE; + break; + case REPORT_ID_CONSUMER: + extra_report_blank[0] = REPORT_ID_CONSUMER; + usbSetupTransfer(usbp, (uint8_t *)extra_report_blank, sizeof(extra_report_blank), NULL); + return TRUE; + break; + default: + return FALSE; + } + } else { + return FALSE; + } + break; +#endif /* EXTRAKEY_ENABLE */ + + default: + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + } + break; + + case HID_GET_PROTOCOL: + if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + usbSetupTransfer(usbp, &keyboard_protocol, 1, NULL); + return TRUE; + } + break; + + case HID_GET_IDLE: + usbSetupTransfer(usbp, &keyboard_idle, 1, NULL); + return TRUE; + break; + } + break; + + case USB_RTYPE_DIR_HOST2DEV: + switch(usbp->setup[1]) { /* bRequest */ + case HID_SET_REPORT: + switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0 and wLength==1?) */ + case KBD_INTERFACE: +#ifdef NKRO_ENABLE + case NKRO_INTERFACE: +#endif /* NKRO_ENABLE */ + /* keyboard_led_stats = + * keyboard_led_stats needs be word (or dword), otherwise we get an exception on F0 */ + usbSetupTransfer(usbp, (uint8_t *)&keyboard_led_stats, 1, NULL); + return TRUE; + break; + } + break; + + case HID_SET_PROTOCOL: + if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */ +#ifdef NKRO_ENABLE + keyboard_nkro = !!keyboard_protocol; + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + /* arm the idle timer if boot protocol & idle */ + osalSysLockFromISR(); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); + osalSysUnlockFromISR(); + } + } + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + + case HID_SET_IDLE: + keyboard_idle = usbp->setup[3]; /* MSB(wValue) */ + /* arm the timer */ +#ifdef NKRO_ENABLE + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + osalSysLockFromISR(); + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); + osalSysUnlockFromISR(); + } + usbSetupTransfer(usbp, NULL, 0, NULL); + return TRUE; + break; + } + break; + } + } + + /* Handle the Get_Descriptor Request for HID class (not handled by the default hook) */ + if((usbp->setup[0] == 0x81) && (usbp->setup[1] == USB_REQ_GET_DESCRIPTOR)) { + dp = usbp->config->get_descriptor_cb(usbp, usbp->setup[3], usbp->setup[2], get_hword(&usbp->setup[4])); + if(dp == NULL) + return FALSE; + usbSetupTransfer(usbp, (uint8_t *)dp->ud_string, dp->ud_size, NULL); + return TRUE; + } + + return FALSE; +} + +/* Start-of-frame callback */ +static void usb_sof_cb(USBDriver *usbp) { + kbd_sof_cb(usbp); +} + + +/* USB driver configuration */ +static const USBConfig usbcfg = { + usb_event_cb, /* USB events callback */ + usb_get_descriptor_cb, /* Device GET_DESCRIPTOR request callback */ + usb_request_hook_cb, /* Requests hook callback */ + usb_sof_cb /* Start Of Frame callback */ +}; + +/* + * Initialize the USB driver + */ +void init_usb_driver(USBDriver *usbp) { + /* + * Activates the USB driver and then the USB bus pull-up on D+. + * Note, a delay is inserted in order to not have to disconnect the cable + * after a reset. + */ + usbDisconnectBus(usbp); + chThdSleepMilliseconds(1500); + usbStart(usbp, &usbcfg); + usbConnectBus(usbp); + + chVTObjectInit(&keyboard_idle_timer); +#ifdef CONSOLE_ENABLE + obqObjectInit(&console_buf_queue, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp); + chVTObjectInit(&console_flush_timer); +#endif +} + +/* + * Send remote wakeup packet + * Note: should not be called from ISR + */ +void send_remote_wakeup(USBDriver *usbp) { + (void)usbp; +#if defined(K20x) || defined(KL2x) +#if KINETIS_USB_USE_USB0 + USB0->CTL |= USBx_CTL_RESUME; + chThdSleepMilliseconds(15); + USB0->CTL &= ~USBx_CTL_RESUME; +#endif /* KINETIS_USB_USE_USB0 */ +#elif defined(STM32F0XX) || defined(STM32F1XX) /* K20x || KL2x */ + STM32_USB->CNTR |= CNTR_RESUME; + chThdSleepMilliseconds(15); + STM32_USB->CNTR &= ~CNTR_RESUME; +#else /* STM32F0XX || STM32F1XX */ +#warning Sending remote wakeup packet not implemented for your platform. +#endif /* K20x || KL2x */ +} + +/* --------------------------------------------------------- + * Keyboard functions + * --------------------------------------------------------- + */ + +/* keyboard IN callback hander (a kbd report has made it IN) */ +void kbd_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} + +#ifdef NKRO_ENABLE +/* nkro IN callback hander (a nkro report has made it IN) */ +void nkro_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} +#endif /* NKRO_ENABLE */ + +/* start-of-frame handler + * TODO: i guess it would be better to re-implement using timers, + * so that this is not going to have to be checked every 1ms */ +void kbd_sof_cb(USBDriver *usbp) { + (void)usbp; +} + +/* Idle requests timer code + * callback (called from ISR, unlocked state) */ +static void keyboard_idle_timer_cb(void *arg) { + USBDriver *usbp = (USBDriver *)arg; + + osalSysLockFromISR(); + + /* check that the states of things are as they're supposed to */ + if(usbGetDriverStateI(usbp) != USB_ACTIVE) { + /* do not rearm the timer, should be enabled on IDLE request */ + osalSysUnlockFromISR(); + return; + } + +#ifdef NKRO_ENABLE + if(!keyboard_nkro && keyboard_idle) { +#else /* NKRO_ENABLE */ + if(keyboard_idle) { +#endif /* NKRO_ENABLE */ + /* TODO: are we sure we want the KBD_ENDPOINT? */ + if(!usbGetTransmitStatusI(usbp, KBD_ENDPOINT)) { + usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, KBD_EPSIZE); + } + /* rearm the timer */ + chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); + } + + /* do not rearm the timer if the condition above fails + * it should be enabled again on either IDLE or SET_PROTOCOL requests */ + osalSysUnlockFromISR(); +} + +/* LED status */ +uint8_t keyboard_leds(void) { + return (uint8_t)(keyboard_led_stats & 0xFF); +} + +/* prepare and start sending a report IN + * not callable from ISR or locked state */ +void send_keyboard(report_keyboard_t *report) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + osalSysUnlock(); + +#ifdef NKRO_ENABLE + if(keyboard_nkro) { /* NKRO protocol */ + /* need to wait until the previous packet has made it through */ + /* can rewrite this using the synchronous API, then would wait + * until *after* the packet has been transmitted. I think + * this is more efficient */ + /* busy wait, should be short and not very common */ + osalSysLock(); + if(usbGetTransmitStatusI(&USB_DRIVER, NKRO_ENDPOINT)) { + /* Need to either suspend, or loop and call unlock/lock during + * every iteration - otherwise the system will remain locked, + * no interrupts served, so USB not going through as well. + * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ + osalThreadSuspendS(&(&USB_DRIVER)->epc[NKRO_ENDPOINT]->in_state->thread); + } + usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + osalSysUnlock(); + } else +#endif /* NKRO_ENABLE */ + { /* boot protocol */ + /* need to wait until the previous packet has made it through */ + /* busy wait, should be short and not very common */ + osalSysLock(); + if(usbGetTransmitStatusI(&USB_DRIVER, KBD_ENDPOINT)) { + /* Need to either suspend, or loop and call unlock/lock during + * every iteration - otherwise the system will remain locked, + * no interrupts served, so USB not going through as well. + * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ + osalThreadSuspendS(&(&USB_DRIVER)->epc[KBD_ENDPOINT]->in_state->thread); + } + usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); + osalSysUnlock(); + } + keyboard_report_sent = *report; +} + +/* --------------------------------------------------------- + * Mouse functions + * --------------------------------------------------------- + */ + +#ifdef MOUSE_ENABLE + +/* mouse IN callback hander (a mouse report has made it IN) */ +void mouse_in_cb(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; +} + +void send_mouse(report_mouse_t *report) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + osalSysUnlock(); + + /* TODO: LUFA manually waits for the endpoint to become ready + * for about 10ms for mouse, kbd, system; 1ms for nkro + * is this really needed? + */ + + osalSysLock(); + usbStartTransmitI(&USB_DRIVER, MOUSE_ENDPOINT, (uint8_t *)report, sizeof(report_mouse_t)); + osalSysUnlock(); +} + +#else /* MOUSE_ENABLE */ +void send_mouse(report_mouse_t *report) { + (void)report; +} +#endif /* MOUSE_ENABLE */ + +/* --------------------------------------------------------- + * Extrakey functions + * --------------------------------------------------------- + */ + +#ifdef EXTRAKEY_ENABLE + +/* extrakey IN callback hander */ +void extra_in_cb(USBDriver *usbp, usbep_t ep) { + /* STUB */ + (void)usbp; + (void)ep; +} + +static void send_extra_report(uint8_t report_id, uint16_t data) { + osalSysLock(); + if(usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + + report_extra_t report = { + .report_id = report_id, + .usage = data + }; + + usbStartTransmitI(&USB_DRIVER, EXTRA_ENDPOINT, (uint8_t *)&report, sizeof(report_extra_t)); + osalSysUnlock(); +} + +void send_system(uint16_t data) { + send_extra_report(REPORT_ID_SYSTEM, data); +} + +void send_consumer(uint16_t data) { + send_extra_report(REPORT_ID_CONSUMER, data); +} + +#else /* EXTRAKEY_ENABLE */ +void send_system(uint16_t data) { + (void)data; +} +void send_consumer(uint16_t data) { + (void)data; +} +#endif /* EXTRAKEY_ENABLE */ + +/* --------------------------------------------------------- + * Console functions + * --------------------------------------------------------- + */ + +#ifdef CONSOLE_ENABLE + +/* console IN callback hander */ +void console_in_cb(USBDriver *usbp, usbep_t ep) { + (void)ep; /* should have ep == CONSOLE_ENDPOINT, so use that to save time/space */ + uint8_t *buf; + size_t n; + + osalSysLockFromISR(); + + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); + + /* Freeing the buffer just transmitted, if it was not a zero size packet.*/ + if (usbp->epc[CONSOLE_ENDPOINT]->in_state->txsize > 0U) { + obqReleaseEmptyBufferI(&console_buf_queue); + } + + /* Checking if there is a buffer ready for transmission.*/ + buf = obqGetFullBufferI(&console_buf_queue, &n); + + if (buf != NULL) { + /* The endpoint cannot be busy, we are in the context of the callback, + so it is safe to transmit without a check.*/ + /* Should have n == CONSOLE_EPSIZE; check it? */ + usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); + } else { + /* Nothing to transmit.*/ + } + + osalSysUnlockFromISR(); +} + +/* Callback when data is inserted into the output queue + * Called from a locked state */ +void console_queue_onotify(io_buffers_queue_t *bqp) { + size_t n; + USBDriver *usbp = bqGetLinkX(bqp); + + if(usbGetDriverStateI(usbp) != USB_ACTIVE) + return; + + /* Checking if there is already a transaction ongoing on the endpoint.*/ + if (!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { + /* Trying to get a full buffer.*/ + uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); + if (buf != NULL) { + /* Buffer found, starting a new transaction.*/ + /* Should have n == CONSOLE_EPSIZE; check this? */ + usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); + } + } +} + +/* Flush timer code + * callback (called from ISR, unlocked state) */ +static void console_flush_cb(void *arg) { + USBDriver *usbp = (USBDriver *)arg; + osalSysLockFromISR(); + + /* check that the states of things are as they're supposed to */ + if(usbGetDriverStateI(usbp) != USB_ACTIVE) { + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); + osalSysUnlockFromISR(); + return; + } + + /* If there is already a transaction ongoing then another one cannot be + started.*/ + if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { + /* rearm the timer */ + chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); + osalSysUnlockFromISR(); + return; + } + + /* Checking if there only a buffer partially filled, if so then it is + enforced in the queue and transmitted.*/ + if(obqTryFlushI(&console_buf_queue)) { + size_t n,i; + uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); + + osalDbgAssert(buf != NULL, "queue is empty"); + + /* zero the rest of the buffer (buf should point to allocated space) */ + for(i=n; i + * + * Based on the following work: + * - Guillaume Duc's raw hid example (MIT License) + * https://github.com/guiduc/usb-hid-chibios-example + * - PJRC Teensy examples (MIT License) + * https://www.pjrc.com/teensy/usb_keyboard.html + * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD) + * https://github.com/tmk/tmk_keyboard/ + * - ChibiOS demo code (Apache 2.0 License) + * http://www.chibios.org + * + * Since some GPL'd code is used, this work is licensed under + * GPL v2 or later. + */ + + +#ifndef _USB_MAIN_H_ +#define _USB_MAIN_H_ + +// TESTING +// extern uint8_t blinkLed; + +#include "ch.h" +#include "hal.h" + +/* ------------------------- + * General USB driver header + * ------------------------- + */ + +/* The USB driver to use */ +#define USB_DRIVER USBD1 + +/* Initialize the USB driver and bus */ +void init_usb_driver(USBDriver *usbp); + +/* Send remote wakeup packet */ +void send_remote_wakeup(USBDriver *usbp); + +/* --------------- + * Keyboard header + * --------------- + */ + +/* main keyboard (6kro) */ +#define KBD_INTERFACE 0 +#define KBD_ENDPOINT 1 +#define KBD_EPSIZE 8 +#define KBD_REPORT_KEYS (KBD_EPSIZE - 2) + +/* secondary keyboard */ +#ifdef NKRO_ENABLE +#define NKRO_INTERFACE 4 +#define NKRO_ENDPOINT 5 +#define NKRO_EPSIZE 16 +#define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1) +#endif + +/* this defines report_keyboard_t and computes REPORT_SIZE defines */ +// #include "report.h" + +/* extern report_keyboard_t keyboard_report_sent; */ + +/* keyboard IN request callback handler */ +void kbd_in_cb(USBDriver *usbp, usbep_t ep); + +/* start-of-frame handler */ +void kbd_sof_cb(USBDriver *usbp); + +#ifdef NKRO_ENABLE +/* nkro IN callback hander */ +void nkro_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* NKRO_ENABLE */ + +/* ------------ + * Mouse header + * ------------ + */ + +#ifdef MOUSE_ENABLE + +#define MOUSE_INTERFACE 1 +#define MOUSE_ENDPOINT 2 +#define MOUSE_EPSIZE 8 + +/* mouse IN request callback handler */ +void mouse_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* MOUSE_ENABLE */ + +/* --------------- + * Extrakey header + * --------------- + */ + +#ifdef EXTRAKEY_ENABLE + +#define EXTRA_INTERFACE 3 +#define EXTRA_ENDPOINT 4 +#define EXTRA_EPSIZE 8 + +/* extrakey IN request callback handler */ +void extra_in_cb(USBDriver *usbp, usbep_t ep); + +/* extra report structure */ +typedef struct { + uint8_t report_id; + uint16_t usage; +} __attribute__ ((packed)) report_extra_t; +#endif /* EXTRAKEY_ENABLE */ + +/* -------------- + * Console header + * -------------- + */ + +#ifdef CONSOLE_ENABLE + +#define CONSOLE_INTERFACE 2 +#define CONSOLE_ENDPOINT 3 +#define CONSOLE_EPSIZE 16 + +/* Number of IN reports that can be stored inside the output queue */ +#define CONSOLE_QUEUE_CAPACITY 2 +#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_EPSIZE) + +/* Console flush time */ +#define CONSOLE_FLUSH_MS 50 + +/* Putchar over the USB console */ +int8_t sendchar(uint8_t c); + +/* Flush output (send everything immediately) */ +void console_flush_output(void); + +/* console IN request callback handler */ +void console_in_cb(USBDriver *usbp, usbep_t ep); +#endif /* CONSOLE_ENABLE */ + +void sendchar_pf(void *p, char c); + +#endif /* _USB_MAIN_H_ */ diff --git a/protocol/serial_soft.c b/protocol/serial_soft.c index 44822b7e..569205bf 100644 --- a/protocol/serial_soft.c +++ b/protocol/serial_soft.c @@ -68,7 +68,6 @@ POSSIBILITY OF SUCH DAMAGE. #endif /* debug for signal timing, see debug pin with oscilloscope */ -#define SERIAL_SOFT_DEBUG #ifdef SERIAL_SOFT_DEBUG #define SERIAL_SOFT_DEBUG_INIT() (DDRD |= 1<<7) #define SERIAL_SOFT_DEBUG_TGL() (PORTD ^= 1<<7) @@ -176,7 +175,7 @@ void serial_send(uint8_t data) ISR(SERIAL_SOFT_RXD_VECT) { SERIAL_SOFT_DEBUG_TGL(); - SERIAL_SOFT_RXD_INT_ENTER() + SERIAL_SOFT_RXD_INT_ENTER(); uint8_t data = 0; diff --git a/protocol/usb_hid/parser.cpp b/protocol/usb_hid/parser.cpp index 1a152ff3..fe002c0d 100644 --- a/protocol/usb_hid/parser.cpp +++ b/protocol/usb_hid/parser.cpp @@ -13,7 +13,7 @@ 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; - dprintf("KBDReport: %02X %02X", report->mods, report->reserved); + dprintf("keyboard input: %02X %02X", report->mods, report->reserved); for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { if (IS_ERROR(report->keys[i])) { is_error = true; diff --git a/rules.mk b/rules.mk index 860fc1a9..0ae84d91 100644 --- a/rules.mk +++ b/rules.mk @@ -425,7 +425,6 @@ ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) else dfu-programmer $(MCU) erase endif - dfu-programmer $(MCU) erase dfu-programmer $(MCU) flash $(TARGET).hex dfu-programmer $(MCU) reset diff --git a/tool/chibios/.gitignore b/tool/chibios/.gitignore new file mode 100644 index 00000000..3118dbef --- /dev/null +++ b/tool/chibios/.gitignore @@ -0,0 +1 @@ +chibios diff --git a/tool/chibios/ch-bootloader-jump.patch b/tool/chibios/ch-bootloader-jump.patch new file mode 100644 index 00000000..d8865762 --- /dev/null +++ b/tool/chibios/ch-bootloader-jump.patch @@ -0,0 +1,116 @@ +diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s +index 51a79bb..42d07bd 100644 +--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s ++++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s +@@ -105,6 +105,13 @@ + #define CRT0_CALL_DESTRUCTORS TRUE + #endif + ++/** ++ * @brief Magic number for jumping to bootloader. ++ */ ++#if !defined(MAGIC_BOOTLOADER_NUMBER) || defined(__DOXYGEN__) ++#define MAGIC_BOOTLOADER_NUMBER 0xDEADBEEF ++#endif ++ + /*===========================================================================*/ + /* Code section. */ + /*===========================================================================*/ +@@ -124,6 +131,17 @@ + .thumb_func + .global Reset_Handler + Reset_Handler: ++ ++#ifdef STM32_BOOTLOADER_ADDRESS ++ /* jump to bootloader code */ ++ ldr r0, =__ram0_end__-4 ++ ldr r1, =MAGIC_BOOTLOADER_NUMBER ++ ldr r2, [r0, #0] ++ str r0, [r0, #0] /* erase stored magic */ ++ cmp r2, r1 ++ beq Bootloader_Jump ++#endif /* STM32_BOOTLOADER_ADDRESS */ ++ + /* Interrupts are globally masked initially.*/ + cpsid i + +@@ -242,6 +260,21 @@ endfiniloop: + ldr r1, =__default_exit + bx r1 + ++#ifdef STM32_BOOTLOADER_ADDRESS ++/* ++ * Jump-to-bootloader function. ++ */ ++ ++ .align 2 ++ .thumb_func ++Bootloader_Jump: ++ ldr r0, =STM32_BOOTLOADER_ADDRESS ++ ldr r1, [r0, #0] ++ mov sp, r1 ++ ldr r0, [r0, #4] ++ bx r0 ++#endif /* STM32_BOOTLOADER_ADDRESS */ ++ + #endif + + /** @} */ +diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s +index 4812a29..dca9f88 100644 +--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s ++++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s +@@ -140,6 +140,13 @@ + #define CRT0_CPACR_INIT 0x00F00000 + #endif + ++/** ++ * @brief Magic number for jumping to bootloader. ++ */ ++#if !defined(MAGIC_BOOTLOADER_NUMBER) || defined(__DOXYGEN__) ++#define MAGIC_BOOTLOADER_NUMBER 0xDEADBEEF ++#endif ++ + /*===========================================================================*/ + /* Code section. */ + /*===========================================================================*/ +@@ -164,6 +171,17 @@ + .thumb_func + .global Reset_Handler + Reset_Handler: ++ ++#ifdef STM32_BOOTLOADER_ADDRESS ++ /* jump to bootloader code */ ++ ldr r0, =__ram0_end__-4 ++ ldr r1, =MAGIC_BOOTLOADER_NUMBER ++ ldr r2, [r0, #0] ++ str r0, [r0, #0] /* erase stored magic */ ++ cmp r2, r1 ++ beq Bootloader_Jump ++#endif /* STM32_BOOTLOADER_ADDRESS */ ++ + /* Interrupts are globally masked initially.*/ + cpsid i + +@@ -305,6 +323,21 @@ endfiniloop: + /* Branching to the defined exit handler.*/ + b __default_exit + ++#ifdef STM32_BOOTLOADER_ADDRESS ++/* ++ * Jump-to-bootloader function. ++ */ ++ ++ .align 2 ++ .thumb_func ++Bootloader_Jump: ++ ldr r0, =STM32_BOOTLOADER_ADDRESS ++ ldr r1, [r0, #0] ++ mov sp, r1 ++ ldr r0, [r0, #4] ++ bx r0 ++#endif /* STM32_BOOTLOADER_ADDRESS */ ++ + #endif /* !defined(__DOXYGEN__) */ + + /** @} */ diff --git a/tool/chibios/chibios.mk b/tool/chibios/chibios.mk new file mode 100644 index 00000000..a67e067a --- /dev/null +++ b/tool/chibios/chibios.mk @@ -0,0 +1,231 @@ +############################################################################## +# Build global options +# NOTE: Can be overridden externally. +# + +# Compiler options here. +ifeq ($(USE_OPT),) + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -DPROTOCOL_CHIBIOS +endif + +# C specific options here (added to USE_OPT). +ifeq ($(USE_COPT),) + USE_COPT = +endif + +# include specific config.h? +ifdef CONFIG_H + USE_COPT += -include $(CONFIG_H) +endif + +# C++ specific options here (added to USE_OPT). +ifeq ($(USE_CPPOPT),) + USE_CPPOPT = -fno-rtti +endif + +# Enable this if you want the linker to remove unused code and data +ifeq ($(USE_LINK_GC),) + USE_LINK_GC = yes +endif + +# Linker extra options here. +ifeq ($(USE_LDOPT),) + USE_LDOPT = +endif + +# Enable this if you want link time optimizations (LTO) +ifeq ($(USE_LTO),) + USE_LTO = yes +endif + +# If enabled, this option allows to compile the application in THUMB mode. +ifeq ($(USE_THUMB),) + USE_THUMB = yes +endif + +# Enable this if you want to see the full log while compiling. +ifeq ($(USE_VERBOSE_COMPILE),) + USE_VERBOSE_COMPILE = no +endif + +# If enabled, this option makes the build process faster by not compiling +# modules not used in the current configuration. +ifeq ($(USE_SMART_BUILD),) + USE_SMART_BUILD = yes +endif + +# +# Build global options +############################################################################## + +############################################################################## +# Architecture or project specific options +# + +# Stack size to be allocated to the Cortex-M process stack. This stack is +# the stack used by the main() thread. +ifeq ($(USE_PROCESS_STACKSIZE),) + USE_PROCESS_STACKSIZE = 0x200 +endif + +# Stack size to the allocated to the Cortex-M main/exceptions stack. This +# stack is used for processing interrupts and exceptions. +ifeq ($(USE_EXCEPTIONS_STACKSIZE),) + USE_EXCEPTIONS_STACKSIZE = 0x400 +endif + +# +# Architecture or project specific options +############################################################################## + +############################################################################## +# Project, sources and paths +# + +# Imported source files and paths +CHIBIOS = $(TMK_DIR)/tool/chibios/chibios +# Startup files. +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk +# HAL-OSAL files (optional). +include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk +ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD))","") + include $(TARGET_DIR)/boards/$(BOARD)/board.mk +else + include $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk +endif +include $(CHIBIOS)/os/hal/osal/rt/osal.mk +# RTOS files (optional). +include $(CHIBIOS)/os/rt/rt.mk +include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk +# Other files (optional). + +# Define linker script file here +ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld)","") +LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld +else +LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld +endif + +# C sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CSRC = $(STARTUPSRC) \ + $(KERNSRC) \ + $(PORTSRC) \ + $(OSALSRC) \ + $(HALSRC) \ + $(PLATFORMSRC) \ + $(BOARDSRC) \ + $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ + $(TMK_DIR)/protocol/chibios/usb_main.c \ + $(TMK_DIR)/protocol/chibios/main.c \ + $(SRC) + +# C++ sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CPPSRC = + +# C sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACSRC = + +# C++ sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACPPSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCPPSRC = + +# List ASM source files here +ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) + +INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ + $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \ + $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \ + $(TMK_DIR)/protocol $(TARGET_DIR) + +# +# Project, sources and paths +############################################################################## + +############################################################################## +# Compiler settings +# + +#TRGT = arm-elf- +TRGT = arm-none-eabi- +CC = $(TRGT)gcc +CPPC = $(TRGT)g++ +# Enable loading with g++ only if you need C++ runtime support. +# NOTE: You can use C++ even without C++ support if you are careful. C++ +# runtime support makes code size explode. +LD = $(TRGT)gcc +#LD = $(TRGT)g++ +CP = $(TRGT)objcopy +AS = $(TRGT)gcc -x assembler-with-cpp +AR = $(TRGT)ar +OD = $(TRGT)objdump +SZ = $(TRGT)size +HEX = $(CP) -O ihex +BIN = $(CP) -O binary + +# ARM-specific options here +AOPT = + +# THUMB-specific options here +TOPT = -mthumb -DTHUMB + +# Define C warning options here +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-missing-field-initializers + +# Define C++ warning options here +CPPWARN = -Wall -Wextra -Wundef + +# +# Compiler settings +############################################################################## + +############################################################################## +# Start of user section +# + +# List all user C define here, like -D_DEBUG=1 +## Select which interfaces to include here! +UDEFS = $(OPT_DEFS) + +# Define ASM defines here +UADEFS = $(OPT_DEFS) +# bootloader definitions may be used in the startup .s file +ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","") + UADEFS += -include $(TARGET_DIR)/bootloader_defs.h + UDEFS += -include $(TARGET_DIR)/bootloader_defs.h +else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","") + UADEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h + UDEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h +endif + +# List all user directories here +UINCDIR = + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# +# End of user defines +############################################################################## + +RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +include $(RULESPATH)/rules.mk diff --git a/tool/chibios/common.mk b/tool/chibios/common.mk new file mode 100644 index 00000000..7e3cccc9 --- /dev/null +++ b/tool/chibios/common.mk @@ -0,0 +1,85 @@ +COMMON_DIR = $(TMK_DIR)/common +SRC += $(COMMON_DIR)/host.c \ + $(COMMON_DIR)/keyboard.c \ + $(COMMON_DIR)/action.c \ + $(COMMON_DIR)/action_tapping.c \ + $(COMMON_DIR)/action_macro.c \ + $(COMMON_DIR)/action_layer.c \ + $(COMMON_DIR)/action_util.c \ + $(COMMON_DIR)/keymap.c \ + $(COMMON_DIR)/print.c \ + $(COMMON_DIR)/debug.c \ + $(COMMON_DIR)/util.c \ + $(COMMON_DIR)/chibios/suspend.c \ + $(COMMON_DIR)/chibios/printf.c \ + $(COMMON_DIR)/chibios/timer.c \ + $(COMMON_DIR)/chibios/bootloader.c + + +# Option modules +ifdef BOOTMAGIC_ENABLE + SRC += $(COMMON_DIR)/bootmagic.c + SRC += $(COMMON_DIR)/chibios/eeconfig.c + OPT_DEFS += -DBOOTMAGIC_ENABLE +endif + +ifdef MOUSEKEY_ENABLE + SRC += $(COMMON_DIR)/mousekey.c + OPT_DEFS += -DMOUSEKEY_ENABLE + OPT_DEFS += -DMOUSE_ENABLE +endif + +ifdef EXTRAKEY_ENABLE + OPT_DEFS += -DEXTRAKEY_ENABLE +endif + +ifdef CONSOLE_ENABLE + OPT_DEFS += -DCONSOLE_ENABLE +else + OPT_DEFS += -DNO_PRINT + OPT_DEFS += -DNO_DEBUG +endif + +ifdef COMMAND_ENABLE + SRC += $(COMMON_DIR)/command.c + OPT_DEFS += -DCOMMAND_ENABLE +endif + +ifdef NKRO_ENABLE + OPT_DEFS += -DNKRO_ENABLE +endif + +ifdef USB_6KRO_ENABLE + OPT_DEFS += -DUSB_6KRO_ENABLE +endif + +ifdef SLEEP_LED_ENABLE + SRC += $(COMMON_DIR)/chibios/sleep_led.c + OPT_DEFS += -DSLEEP_LED_ENABLE + OPT_DEFS += -DNO_SUSPEND_POWER_DOWN +endif + +ifdef BACKLIGHT_ENABLE + SRC += $(COMMON_DIR)/backlight.c + OPT_DEFS += -DBACKLIGHT_ENABLE +endif + +ifdef KEYMAP_SECTION_ENABLE + OPT_DEFS += -DKEYMAP_SECTION_ENABLE + + ifeq ($(strip $(MCU)),atmega32u2) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x + else ifeq ($(strip $(MCU)),atmega32u4) + EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x + else + EXTRALDFLAGS = $(error no ldscript for keymap section) + endif +endif + +# Version string +OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) + +# Bootloader address +ifdef BOOTLOADER_ADDRESS + OPT_DEFS += -DBOOTLOADER_ADDRESS=$(BOOTLOADER_ADDRESS) +endif diff --git a/tool/mbed/common.mk b/tool/mbed/common.mk index 77bf7c3e..a0aa8717 100644 --- a/tool/mbed/common.mk +++ b/tool/mbed/common.mk @@ -63,7 +63,7 @@ endif ifdef SLEEP_LED_ENABLE $(error Not Supported) - SRC += common/sleep_led.c + SRC += common/mbed/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif From fdf808ee24fe8cdfbad7d3f6db905489549564bb Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 11 Feb 2016 21:12:19 +0000 Subject: [PATCH 131/179] Chibios: Fix a HardFault bug (wait after start). --- tmk_core/protocol/chibios/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index b62cfa9c..d588e4de 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -101,6 +101,13 @@ int main(void) { while(USB_DRIVER.state != USB_ACTIVE) chThdSleepMilliseconds(50); + /* Do need to wait here! + * Otherwise the next print might start a transfer on console EP + * before the USB is completely ready, which sometimes causes + * HardFaults. + */ + chThdSleepMilliseconds(50); + print("USB configured.\n"); /* init TMK modules */ From fa52d8ba7468a8bbb5754a5be1df249af7ecfece Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 11 Feb 2016 21:14:28 +0000 Subject: [PATCH 132/179] Chibios: cleanup usb_main code. --- tmk_core/protocol/chibios/usb_main.c | 8 ++++---- tmk_core/protocol/chibios/usb_main.h | 6 +----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index d248b447..e2c9d9bf 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -33,9 +33,9 @@ * --------------------------------------------------------- */ -uint8_t keyboard_idle = 0; -uint8_t keyboard_protocol = 1; -uint16_t keyboard_led_stats = 0; +uint8_t keyboard_idle __attribute__((aligned(2))) = 0; +uint8_t keyboard_protocol __attribute__((aligned(2))) = 1; +uint16_t keyboard_led_stats __attribute__((aligned(2))) = 0; volatile uint16_t keyboard_idle_count = 0; static virtual_timer_t keyboard_idle_timer; static void keyboard_idle_timer_cb(void *arg); @@ -1350,7 +1350,7 @@ int8_t sendchar(uint8_t c) { return 0; } osalSysUnlock(); - /* Timeout after 5us if the queue is full. + /* Timeout after 100us if the queue is full. * Increase this timeout if too much stuff is getting * dropped (i.e. the buffer is getting full too fast * for USB/HIDRAW to dequeue). Another possibility diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index d8f30e95..30d8fcae 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -58,9 +58,6 @@ void send_remote_wakeup(USBDriver *usbp); #define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1) #endif -/* this defines report_keyboard_t and computes REPORT_SIZE defines */ -// #include "report.h" - /* extern report_keyboard_t keyboard_report_sent; */ /* keyboard IN request callback handler */ @@ -122,8 +119,7 @@ typedef struct { #define CONSOLE_EPSIZE 16 /* Number of IN reports that can be stored inside the output queue */ -#define CONSOLE_QUEUE_CAPACITY 2 -#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_EPSIZE) +#define CONSOLE_QUEUE_CAPACITY 4 /* Console flush time */ #define CONSOLE_FLUSH_MS 50 From 5a0132f1c1c9a14fd2941f0a5e29bbf5e31da20c Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 12 Feb 2016 14:38:49 +0900 Subject: [PATCH 133/179] Squashed 'tmk_core/' changes from 08ce4c3..97c7ed4 97c7ed4 Fix COMMON_DIR in common.mk. git-subtree-dir: tmk_core git-subtree-split: 97c7ed4de60ec73de7b5af7c0d66041c523d037a --- common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.mk b/common.mk index ebaafd1d..4c943f04 100644 --- a/common.mk +++ b/common.mk @@ -1,4 +1,4 @@ -COMMON_DIR = $(TMK_DIR)/common +COMMON_DIR = common SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ $(COMMON_DIR)/action.c \ From 803b65ea43b6b27d5c43af1705a7cbc87c87946b Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sat, 13 Feb 2016 10:01:16 +0000 Subject: [PATCH 134/179] Chibios: Revert common.mk change (fix AVR linking problem). --- tmk_core/common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index ebaafd1d..4c943f04 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -1,4 +1,4 @@ -COMMON_DIR = $(TMK_DIR)/common +COMMON_DIR = common SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ $(COMMON_DIR)/action.c \ From 657d9f23fe47fb88cf221adb23095082f191ba6a Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 17 Feb 2016 08:18:03 +0900 Subject: [PATCH 135/179] Squashed 'tmk_core/' changes from 97c7ed4..ee8c5ba ee8c5ba Remove warnings when NO_DEBUG is defined a71e6e0 Remove warnings when NO_PRINT is defined git-subtree-dir: tmk_core git-subtree-split: ee8c5baecc9acf37976de36f56551fc9e6b92968 --- common/action_tapping.c | 2 +- common/debug.h | 44 +++++++++++++++---------------- common/print.h | 58 ++++++++++++++++++++--------------------- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/common/action_tapping.c b/common/action_tapping.c index a3a5a7d0..a74eb106 100644 --- a/common/action_tapping.c +++ b/common/action_tapping.c @@ -256,7 +256,7 @@ bool process_tapping(keyrecord_t *keyp) return true; } } else { - if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; + if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n"); process_action(keyp); return true; } diff --git a/common/debug.h b/common/debug.h index 3cbe2092..a8fd28db 100644 --- a/common/debug.h +++ b/common/debug.h @@ -89,28 +89,28 @@ extern debug_config_t debug_config; #else /* NO_DEBUG */ -#define dprint(s) -#define dprintln(s) -#define dprintf(fmt, ...) -#define dmsg(s) -#define debug(s) -#define debugln(s) -#define debug_msg(s) -#define debug_dec(data) -#define debug_decs(data) -#define debug_hex4(data) -#define debug_hex8(data) -#define debug_hex16(data) -#define debug_hex32(data) -#define debug_bin8(data) -#define debug_bin16(data) -#define debug_bin32(data) -#define debug_bin_reverse8(data) -#define debug_bin_reverse16(data) -#define debug_bin_reverse32(data) -#define debug_hex(data) -#define debug_bin(data) -#define debug_bin_reverse(data) +#define dprint(s) ((void)0) +#define dprintln(s) ((void)0) +#define dprintf(fmt, ...) ((void)0) +#define dmsg(s) ((void)0) +#define debug(s) ((void)0) +#define debugln(s) ((void)0) +#define debug_msg(s) ((void)0) +#define debug_dec(data) ((void)0) +#define debug_decs(data) ((void)0) +#define debug_hex4(data) ((void)0) +#define debug_hex8(data) ((void)0) +#define debug_hex16(data) ((void)0) +#define debug_hex32(data) ((void)0) +#define debug_bin8(data) ((void)0) +#define debug_bin16(data) ((void)0) +#define debug_bin32(data) ((void)0) +#define debug_bin_reverse8(data) ((void)0) +#define debug_bin_reverse16(data) ((void)0) +#define debug_bin_reverse32(data) ((void)0) +#define debug_hex(data) ((void)0) +#define debug_bin(data) ((void)0) +#define debug_bin_reverse(data) ((void)0) #endif /* NO_DEBUG */ diff --git a/common/print.h b/common/print.h index 5f491aba..9eec9191 100644 --- a/common/print.h +++ b/common/print.h @@ -99,35 +99,35 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #else /* NO_PRINT */ -#define xprintf(s,...) -#define print(s) -#define println(s) -#define print_set_sendchar(func) -#define print_dec(data) -#define print_decs(data) -#define print_hex4(data) -#define print_hex8(data) -#define print_hex16(data) -#define print_hex32(data) -#define print_bin4(data) -#define print_bin8(data) -#define print_bin16(data) -#define print_bin32(data) -#define print_bin_reverse8(data) -#define print_bin_reverse16(data) -#define print_bin_reverse32(data) -#define print_val_dec(v) -#define print_val_decs(v) -#define print_val_hex8(v) -#define print_val_hex16(v) -#define print_val_hex32(v) -#define print_val_bin8(v) -#define print_val_bin16(v) -#define print_val_bin32(v) -#define print_val_bin_reverse8(v) -#define print_val_bin_reverse16(v) -#define print_val_bin_reverse32(v) -#define init_printf(s,ss) +#define xprintf(s,...) ((void)0) +#define print(s) ((void)0) +#define println(s) ((void)0) +#define print_set_sendchar(func) ((void)0) +#define print_dec(data) ((void)0) +#define print_decs(data) ((void)0) +#define print_hex4(data) ((void)0) +#define print_hex8(data) ((void)0) +#define print_hex16(data) ((void)0) +#define print_hex32(data) ((void)0) +#define print_bin4(data) ((void)0) +#define print_bin8(data) ((void)0) +#define print_bin16(data) ((void)0) +#define print_bin32(data) ((void)0) +#define print_bin_reverse8(data) ((void)0) +#define print_bin_reverse16(data) ((void)0) +#define print_bin_reverse32(data) ((void)0) +#define print_val_dec(v) ((void)0) +#define print_val_decs(v) ((void)0) +#define print_val_hex8(v) ((void)0) +#define print_val_hex16(v) ((void)0) +#define print_val_hex32(v) ((void)0) +#define print_val_bin8(v) ((void)0) +#define print_val_bin16(v) ((void)0) +#define print_val_bin32(v) ((void)0) +#define print_val_bin_reverse8(v) ((void)0) +#define print_val_bin_reverse16(v) ((void)0) +#define print_val_bin_reverse32(v) ((void)0) +#define init_printf(s,ss) ((void)0) #endif /* NO_PRINT */ From 5a9953b46cee3b94e0db768288513193c8256802 Mon Sep 17 00:00:00 2001 From: obones Date: Wed, 10 Feb 2016 11:18:50 +0100 Subject: [PATCH 136/179] Removed duplicate debug message code and surrounded it with IFDEF as needed --- tmk_core/protocol/ps2_mouse.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index c3e8b3c1..7d23cbed 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c @@ -85,23 +85,19 @@ void ps2_mouse_task(void) if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); return; } - xprintf("%ud ", timer_read()); - print("ps2_mouse raw: ["); - phex(mouse_report.buttons); print("|"); - print_hex8((uint8_t)mouse_report.x); print(" "); - print_hex8((uint8_t)mouse_report.y); print("]\n"); + +#ifdef PS2_MOUSE_DEBUG + xprintf("%ud ", timer_read()); + print("ps2_mouse raw: ["); + phex(mouse_report.buttons); print("|"); + print_hex8((uint8_t)mouse_report.x); print(" "); + print_hex8((uint8_t)mouse_report.y); print("]\n"); +#endif /* if mouse moves or buttons state changes */ if (mouse_report.x || mouse_report.y || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { -#ifdef PS2_MOUSE_DEBUG - print("ps2_mouse raw: ["); - phex(mouse_report.buttons); print("|"); - print_hex8((uint8_t)mouse_report.x); print(" "); - print_hex8((uint8_t)mouse_report.y); print("]\n"); -#endif - buttons_prev = mouse_report.buttons; // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value. From 6360eb308c4b81d5effde77e9b0f357dd9673696 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 17 Feb 2016 08:23:47 +0900 Subject: [PATCH 137/179] core: Fix ps2_mouse.c debug print --- tmk_core/protocol/ps2_mouse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index 7d23cbed..b0f77a83 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c @@ -85,19 +85,19 @@ void ps2_mouse_task(void) if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); return; } - -#ifdef PS2_MOUSE_DEBUG - xprintf("%ud ", timer_read()); - print("ps2_mouse raw: ["); - phex(mouse_report.buttons); print("|"); - print_hex8((uint8_t)mouse_report.x); print(" "); - print_hex8((uint8_t)mouse_report.y); print("]\n"); -#endif /* if mouse moves or buttons state changes */ if (mouse_report.x || mouse_report.y || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { +#ifdef PS2_MOUSE_DEBUG + xprintf("%ud ", timer_read()); + print("ps2_mouse raw: ["); + phex(mouse_report.buttons); print("|"); + print_hex8((uint8_t)mouse_report.x); print(" "); + print_hex8((uint8_t)mouse_report.y); print("]\n"); +#endif + buttons_prev = mouse_report.buttons; // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value. From 1d9c939f388f9ceef8cd673155a4b2086cb5ad08 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 17 Feb 2016 12:36:16 +0900 Subject: [PATCH 138/179] core: Fix chibios user compile options Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS. --- tmk_core/tool/chibios/chibios.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tmk_core/tool/chibios/chibios.mk b/tmk_core/tool/chibios/chibios.mk index a67e067a..77689fc3 100644 --- a/tmk_core/tool/chibios/chibios.mk +++ b/tmk_core/tool/chibios/chibios.mk @@ -201,10 +201,10 @@ CPPWARN = -Wall -Wextra -Wundef # List all user C define here, like -D_DEBUG=1 ## Select which interfaces to include here! -UDEFS = $(OPT_DEFS) +UDEFS += $(OPT_DEFS) # Define ASM defines here -UADEFS = $(OPT_DEFS) +UADEFS += $(OPT_DEFS) # bootloader definitions may be used in the startup .s file ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","") UADEFS += -include $(TARGET_DIR)/bootloader_defs.h @@ -215,13 +215,13 @@ else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","") endif # List all user directories here -UINCDIR = +#UINCDIR = # List the user directory to look for the libraries here -ULIBDIR = +#ULIBDIR = # List all user libraries here -ULIBS = +#ULIBS = # # End of user defines From 449b31c18baaa4d051612dd5d3e6e379fc736016 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 19 Feb 2016 14:40:33 +0900 Subject: [PATCH 139/179] mbed build workaround for #212 --- converter/ps2_usb/Makefile.mbed | 7 ++----- keyboard/infinity/Makefile | 7 ++----- keyboard/mbed_onekey/Makefile | 10 ++++------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/converter/ps2_usb/Makefile.mbed b/converter/ps2_usb/Makefile.mbed index a7ea5bcf..bbd9bd45 100644 --- a/converter/ps2_usb/Makefile.mbed +++ b/converter/ps2_usb/Makefile.mbed @@ -3,10 +3,7 @@ PROJECT = ps2_usb TMK_DIR = ../../tmk_core MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk -#VPATH += $(MBED_DIR):$(TMK_DIR) -vpath %.s .:$(MBED_DIR):$(TMK_DIR) -vpath %.c .:$(MBED_DIR):$(TMK_DIR) -vpath %.cpp .:$(MBED_DIR):$(TMK_DIR) +VPATH += $(TMK_DIR):$(MBED_DIR) OBJDIR = ./build @@ -39,8 +36,8 @@ LIBRARIES = MOUSEKEY_ENABLE = yes +include $(TMK_DIR)/tool/mbed/common.mk #include $(TMK_DIR)/tool/mbed/mk20d50m.mk include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk include $(TMK_DIR)/tool/mbed/mbed.mk -include $(TMK_DIR)/tool/mbed/common.mk include $(TMK_DIR)/tool/mbed/gcc.mk diff --git a/keyboard/infinity/Makefile b/keyboard/infinity/Makefile index e740b6ad..052134c3 100644 --- a/keyboard/infinity/Makefile +++ b/keyboard/infinity/Makefile @@ -3,10 +3,7 @@ PROJECT = infinity TMK_DIR = ../../tmk_core MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk -#VPATH += $(MBED_DIR):$(TMK_DIR) -vpath %.s .:$(MBED_DIR):$(TMK_DIR) -vpath %.c .:$(MBED_DIR):$(TMK_DIR) -vpath %.cpp .:$(MBED_DIR):$(TMK_DIR) +VPATH += $(TMK_DIR):$(MBED_DIR) OBJDIR = ./build @@ -33,9 +30,9 @@ INCLUDE_PATHS = -I. #MOUSEKEY_ENABLE = yes +include $(TMK_DIR)/tool/mbed/common.mk include mbed-infinity.mk include $(TMK_DIR)/tool/mbed/mbed.mk -include $(TMK_DIR)/tool/mbed/common.mk include $(TMK_DIR)/tool/mbed/gcc.mk program: $(OBJDIR)/$(PROJECT).bin diff --git a/keyboard/mbed_onekey/Makefile b/keyboard/mbed_onekey/Makefile index b9c88fdd..c755806f 100644 --- a/keyboard/mbed_onekey/Makefile +++ b/keyboard/mbed_onekey/Makefile @@ -1,12 +1,9 @@ PROJECT = mbed_onekey TMK_DIR = ../../tmk_core -MBED_DIR = $(TMK_DIR)/mbed-sdk +MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk -#VPATH += $(MBED_DIR):$(TMK_DIR) -vpath %.s .:$(MBED_DIR):$(TMK_DIR) -vpath %.c .:$(MBED_DIR):$(TMK_DIR) -vpath %.cpp .:$(MBED_DIR):$(TMK_DIR) +VPATH += $(TMK_DIR):$(MBED_DIR) OBJDIR = ./build @@ -28,6 +25,7 @@ LIBRARIES = #MOUSEKEY_ENABLE = yes -include $(TMK_DIR)/tool/mbed/mbed.mk include $(TMK_DIR)/tool/mbed/common.mk +include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk +include $(TMK_DIR)/tool/mbed/mbed.mk include $(TMK_DIR)/tool/mbed/gcc.mk From 75ca495c010621699866a042e6a85061280177a7 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 20 Feb 2016 07:14:43 +0900 Subject: [PATCH 140/179] ibm4704_usb: Fix scan code range for Alps 102-key --- converter/ibm4704_usb/ibm4704.txt | 10 +++++++--- converter/ibm4704_usb/matrix.c | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/converter/ibm4704_usb/ibm4704.txt b/converter/ibm4704_usb/ibm4704.txt index e2d42f08..73c8a3b9 100644 --- a/converter/ibm4704_usb/ibm4704.txt +++ b/converter/ibm4704_usb/ibm4704.txt @@ -152,12 +152,16 @@ Keyobard sends these bytes to host. FD Command out of bound 00d8h Key out of bound 7E Read/Parity error in receive from host 00bch + 80-FB? scan code(make) + 00-7B? scan code(break) + note: Alps model spits scan code 7B(FB) at least. Set Key Flag command(FC) ------------------------ After 'Power on Reset' firmware enters this command mode and waits for data from host, so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'. +With Alps models you need to send 'FC' command to enter this mode. Data sent from host: @@ -166,8 +170,8 @@ Data sent from host: | `-----`--- scan code `------------- enable bit(0: enable repeat, 1: enable break) - 00-79 Enable repeat - 80-F9 Enable break(FA-FF are used as other commands, see above.) + 00-7B? Enable repeat + 80-FB? Enable break FE Resend(011ah) no need to use FF End(0114h) exits FC command mode. @@ -178,5 +182,5 @@ Response from keyboard: Examples: To enable break code of all keys. - FC 80 81 ... F7 FF + FC 80 81 ... FB FF diff --git a/converter/ibm4704_usb/matrix.c b/converter/ibm4704_usb/matrix.c index 5b91d49f..f25452d5 100644 --- a/converter/ibm4704_usb/matrix.c +++ b/converter/ibm4704_usb/matrix.c @@ -106,8 +106,8 @@ uint8_t matrix_scan(void) if (code==0xFF) { // Not receivd return 0; - } else if ((code&0x7F) >= 0x7A) { - // 0xFF-FA and 0x7F-7A is not scancode + } else if ((code&0x7F) >= 0x7C) { + // 0xFF-FC and 0x7F-7C is not scancode xprintf("Error: %02X\n", code); matrix_clear(); return 0; From 3def1c3065a3b1f85a99cc7336f41f486d9ec67d Mon Sep 17 00:00:00 2001 From: Ethan Apodaca Date: Tue, 1 Mar 2016 21:37:22 -0800 Subject: [PATCH 141/179] Codes appear to be detected correctly, the break codes are broken. --- converter/xt_usb/Makefile | 103 ++++++++ converter/xt_usb/README.md | 84 +++++++ converter/xt_usb/config.h | 71 ++++++ converter/xt_usb/keymap_common.c | 31 +++ converter/xt_usb/keymap_common.h | 144 +++++++++++ converter/xt_usb/keymap_jis.c | 34 +++ converter/xt_usb/keymap_plain.c | 32 +++ converter/xt_usb/keymap_spacefn.c | 61 +++++ converter/xt_usb/led.c | 20 ++ converter/xt_usb/matrix.c | 382 ++++++++++++++++++++++++++++++ tmk_core/protocol.mk | 7 + tmk_core/protocol/pbuff.h | 57 +++++ tmk_core/protocol/ps2_interrupt.c | 60 +---- tmk_core/protocol/xt.h | 75 ++++++ tmk_core/protocol/xt_interrupt.c | 113 +++++++++ tmk_core/protocol/xt_io.h | 7 + tmk_core/protocol/xt_io_avr.c | 34 +++ 17 files changed, 1256 insertions(+), 59 deletions(-) create mode 100644 converter/xt_usb/Makefile create mode 100644 converter/xt_usb/README.md create mode 100644 converter/xt_usb/config.h create mode 100644 converter/xt_usb/keymap_common.c create mode 100644 converter/xt_usb/keymap_common.h create mode 100644 converter/xt_usb/keymap_jis.c create mode 100644 converter/xt_usb/keymap_plain.c create mode 100644 converter/xt_usb/keymap_spacefn.c create mode 100644 converter/xt_usb/led.c create mode 100644 converter/xt_usb/matrix.c create mode 100644 tmk_core/protocol/pbuff.h create mode 100644 tmk_core/protocol/xt.h create mode 100644 tmk_core/protocol/xt_interrupt.c create mode 100644 tmk_core/protocol/xt_io.h create mode 100644 tmk_core/protocol/xt_io_avr.c diff --git a/converter/xt_usb/Makefile b/converter/xt_usb/Makefile new file mode 100644 index 00000000..cd8230cb --- /dev/null +++ b/converter/xt_usb/Makefile @@ -0,0 +1,103 @@ +# +# Makefile for Teensy +# +# Target file name (without extension). +TARGET = xt_usb_lufa + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = keymap_common.c \ + matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_plain.c $(SRC) +endif + +CONFIG_H = config.h + + +# MCU name +#MCU = at90usb1287 +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 = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + + +# Build Options +# comment out to disable the options. +# +#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 +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA + + +# XT/2 Options +# +XT_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin + + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/converter/xt_usb/README.md b/converter/xt_usb/README.md new file mode 100644 index 00000000..74464e26 --- /dev/null +++ b/converter/xt_usb/README.md @@ -0,0 +1,84 @@ +PS/2 to USB keyboard converter +============================== +This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set 2.) + + +Connect Wires +------------- +In case of Teensy2.0(ATMega32U4): + +1. Connect **Vcc** and **GND**. +2. Connect **Clock** and **Data** line. + - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible) + - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`. + - **USART**: **Clock** is on `PD5` and **Data** on `PD2`. +3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. + +To change pin configuration edit **config.h** and **Makefile**. + + +Build Firmware +-------------- +For **PJRC Teensy** just run `make`: + + $ make clean + $ make + +To select keymap: + + $ make clean + $ make KEYMAP=[plain|jis|spacefn|...] + +After that you will find HEX file `ps2_usb_lufa.hex` in current directory. + + +- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`. + +- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`. + + +Keymap +------ +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_.c` and see keymap document(you can find in README.md of top directory) and existent keymap files. + + +PS/2 signal handling implementations +------------------------------------ +Following three methods can be used to implement PS/2 signal handling. + +### Simple and stupid busy-wait(ps2_busywait.c) + This is expected to implemented with portable C code for reference. +### Interrupt driven(ps2_interrupt.c) + Uses pin interrupt to detect falling edge of clock line. +### USART hardware module(ps2_usart.c) + Uses AVR USART engine to receive PS/2 signal. + +To select method edit Makefile. + + +V-USB Support +------------- +With V-USB you can use this converter on ATmega(168/328) but it doesn't support NKRO at this time. + +Circuit: + + +---+ +---------------+ + USB GND | | ATmega168 | + === C3 | | + 5V <-------+--------+---|Vcc,AVCC | PS/2 + R1 | | ==== + D- <----+--+-----R2-----|INT1 RXD|------->DATA + D+ <----|---+----R3-----|INT0 XCK|------->CLOCK + Z1 Z2 | | ->5V + GND<----+---+--+--+-----|GND | ->GND + | | | | + | C2-+--|XTAL1 | + | X1 | | + +--C3-+--|XTAL2 | + +---------------+ + R1: 1.5K Ohm + R2,R3: 68 Ohm + Z1,Z2: Zenner 3.6V + C1,C2: 22pF + C3: 0.1uF + X1: Crystal 20MHz(16MHz/12MHz) diff --git a/converter/xt_usb/config.h b/converter/xt_usb/config.h new file mode 100644 index 00000000..21e76400 --- /dev/null +++ b/converter/xt_usb/config.h @@ -0,0 +1,71 @@ +/* +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 + +#include + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6512 +#define DEVICE_VER 0x0001 +#define MANUFACTURER t.m.k. +#define PRODUCT XT keyboard converter +#define DESCRIPTION convert XT keyboard to USB + + +/* matrix size */ +#define MATRIX_ROWS 16 // keycode bit: 3-0 +#define MATRIX_COLS 8 // keycode bit: 6-4 + + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \ + keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \ +) + + +//#define NO_SUSPEND_POWER_DOWN + +/* + * XT Pin interrupt + */ +#ifdef XT_USE_INT +/* uses INT1 for clock line(ATMega32U4) */ +#define XT_CLOCK_PORT PORTD +#define XT_CLOCK_PIN PIND +#define XT_CLOCK_DDR DDRD +#define XT_CLOCK_BIT 1 +#define XT_DATA_PORT PORTD +#define XT_DATA_PIN PIND +#define XT_DATA_DDR DDRD +#define XT_DATA_BIT 0 +#define XT_INT_INIT() do { \ + EICRA |= ((1< + +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" +#include "progmem.h" + + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; +} diff --git a/converter/xt_usb/keymap_common.h b/converter/xt_usb/keymap_common.h new file mode 100644 index 00000000..b9de6a86 --- /dev/null +++ b/converter/xt_usb/keymap_common.h @@ -0,0 +1,144 @@ +/* +Copyright 2011,2012,2013 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 KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include +#include +#include "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "print.h" +#include "debug.h" +#include "keymap.h" + + +// 32*8(256) byte array which converts PS/2 code into USB code +extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint16_t fn_actions[]; + +/* All keys */ +#define KEYMAP_ALL( \ + K00, K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D, K0E,K0F,K0G, \ + K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B,K1C,K1D, K1E,K1F,K1G, K1H,K1I,K1J,K1K, \ + K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K2E,K2F,K2G, K2H,K2I,K2J, \ + K30,K31,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B, K3D, K3H,K3I,K3J,K3K, \ + K40,K41,K42,K43,K44,K45,K46,K47,K48,K49,K4A, K4D, K4F, K4H,K4I,K4J, \ + K50,K51,K52, K55, K5A,K5B,K5C,K5D, K5E,K5F,K5G, K5H, K5J,K5K, \ + \ + K60, K61, K62, /* System Power, Sleep, Wake */ \ + K70, K71, K72, /* Mute, Volume Up, Volume Down */ \ + K80, K81, K82, K83, K84, /* Next, Previous, Stop, Pause, Media Select */ \ + K90, K91, K92, /* Mail, Calculator, My Computer */ \ + KA0, KA1, KA2, KA3, /* WWW Search, Home, Back, Forward */ \ + KB0, KB1, KB2 /* WWW Stop, Refresh, Favorites */ \ +) { \ + { KC_NO, KC_##K00, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \ + { KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K20 }, \ + { KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28 }, \ + { KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K3D, KC_##K50, KC_##K31, KC_##K32 }, \ + { KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A }, \ + { KC_##K3B, KC_##K10, KC_##K40, KC_##K2D, KC_##K41, KC_##K42, KC_##K43, KC_##K44 }, \ + { KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4D, KC_##K1J }, \ + { KC_##K52, KC_##K55, KC_##K30, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \ + { KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K1H, KC_##K0F, KC_##K2H }, \ + { KC_##K2I, KC_##K2J, KC_##K1K, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K4H }, \ + { KC_##K4I, KC_##K4J, KC_##K5H, KC_##K5J, KC_##K5K, KC_##K5D, KC_##K1I, KC_##K0C }, \ + { KC_##K0D, KC_##K5A, KC_##K80, KC_##K51, KC_##K5B, KC_##K5C, KC_##K60, KC_##K61 }, \ + { KC_##K70, KC_##K91, KC_##K83, KC_##K62, KC_##K82, KC_##KA0, KC_##KB2, KC_##KB1 }, \ + { KC_##KB0, KC_##KA3, KC_##KA2, KC_##K92, KC_##K90, KC_##K84, KC_##K81, KC_##K1F }, \ + { KC_##K4F, KC_##K1G, KC_##K72, KC_##K5E, KC_##K71, KC_##K5G, KC_##KA1, KC_##K2F }, \ + { KC_##K5F, KC_##K2G, KC_##K1E, KC_##K2E, KC_##K0E, KC_##K0G, KC_NO , KC_NO } \ +} + +/* US layout */ +#define KEYMAP( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +/* ISO layout */ +#define KEYMAP_ISO( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \ + K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +/* JIS layout */ +#define KEYMAP_JIS( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \ +) \ +KEYMAP_ALL( \ + K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ + K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \ + K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \ + K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \ + K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \ + K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \ + \ + SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \ + AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \ + MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \ + MAIL, CALCULATOR, MY_COMPUTER, \ + WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \ + WWW_STOP, WWW_REFRESH, WWW_FAVORITES \ +) + +#endif diff --git a/converter/xt_usb/keymap_jis.c b/converter/xt_usb/keymap_jis.c new file mode 100644 index 00000000..02585150 --- /dev/null +++ b/converter/xt_usb/keymap_jis.c @@ -0,0 +1,34 @@ +/* + * JIS layout Japanese keyboard + */ +#include "keymap_common.h" + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: JIS LAYOUT + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| + * `---' `---------------' `---------------' `---------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| JY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | |Del|End|PgD| | 7| 8| 9| | + * |------------------------------------------------------` | `-----------' |-----------| +| + * |CapsLo| A| S| D| F| G| H| J| K| L| ;| :| \| | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------|Ent| + * |Ctrl |Gui |Alt |MHEN| Space |HENK|KANA|Alt |Gui |Menu|Ctrl| |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, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, P7, P8, P9, + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, ENT, P4, P5, P6, PPLS, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, UP, P1, P2, P3, + LCTL,LGUI,LALT, MHEN,SPC, HENK,KANA, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), +}; + +const uint16_t PROGMEM fn_actions[] = { +}; diff --git a/converter/xt_usb/keymap_plain.c b/converter/xt_usb/keymap_plain.c new file mode 100644 index 00000000..51b2fddb --- /dev/null +++ b/converter/xt_usb/keymap_plain.c @@ -0,0 +1,32 @@ +#include "keymap_common.h" + + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: default + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| + * `---' `---------------' `---------------' `---------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| | + * |-----------------------------------------------------------| `-----------' |-----------| +| + * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------|Ent| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + 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, + 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 uint16_t PROGMEM fn_actions[] = { +}; diff --git a/converter/xt_usb/keymap_spacefn.c b/converter/xt_usb/keymap_spacefn.c new file mode 100644 index 00000000..bffd2bc6 --- /dev/null +++ b/converter/xt_usb/keymap_spacefn.c @@ -0,0 +1,61 @@ +/* + * SpaceFN layout + * http://geekhack.org/index.php?topic=51069.0 + */ +#include "keymap_common.h" + + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: default + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| + * `---' `---------------' `---------------' `---------------' `-----------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| | + * |-----------------------------------------------------------| `-----------' |-----------| +| + * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| | + * |-----------------------------------------------------------| ,---. |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------|Ent| + * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, + LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), + + /* 1: SpaceFN + * ,-----------------------------------------------------------. + * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | + * |-----------------------------------------------------------| + * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins | + * |-----------------------------------------------------------| + * | | | | | | |PgU|Lef|Dow|Rig| | | | + * |-----------------------------------------------------------| + * | | | | | |Spc|PgD|` |~ | |Men| | + * |-----------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------------' + */ + KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, + TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS, + TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3, + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), + [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde +}; + diff --git a/converter/xt_usb/led.c b/converter/xt_usb/led.c new file mode 100644 index 00000000..8eaa88bd --- /dev/null +++ b/converter/xt_usb/led.c @@ -0,0 +1,20 @@ +/* +Copyright 2016 Ethan Apodaca + +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 . +*/ + +void led_set(uint8_t usb_led) { + //XT Keyboards do not have LEDs, nothing to do. +} diff --git a/converter/xt_usb/matrix.c b/converter/xt_usb/matrix.c new file mode 100644 index 00000000..4218e39b --- /dev/null +++ b/converter/xt_usb/matrix.c @@ -0,0 +1,382 @@ +/* +Copyright 2011 Jun Wako +Copyright 2016 Ethan Apodaca + +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 "action.h" +#include "print.h" +#include "util.h" +#include "debug.h" +#include "xt.h" +#include "matrix.h" + + +static void matrix_make(uint8_t code); +static void matrix_break(uint8_t code); +static void matrix_clear(void); +#ifdef MATRIX_HAS_GHOST +static bool matrix_has_ghost_in_row(uint8_t row); +#endif + +static uint8_t matrix[MATRIX_ROWS]; +#define ROW(code) (code>>3) +#define COL(code) (code&0x07) + +// matrix positions for exceptional keys +#define PRINT_SCREEN (0x7C) +#define PAUSE (0x7D) + +static bool is_modified = false; + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + xt_host_init(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; + + return; +} + +static uint8_t move_codes(uint8_t code) { + switch(code) { + case 0x10: + code += 0x5E; + break; + case 0x19: + code += 0x41; + break; + case 0x1C: + case 0x1D: + code += 0x38; + break; + case 0x20: + case 0x21: + case 0x22: + case 0x24: + code += 0x40; + break; + case 0x2E: + case 0x30: + case 0x32: + code += 0x44; + break; + case 0x35: + case 0x38: + code += 0x21; + break; + case 0x47: + case 0x48: + case 0x49: + case 0x4B: + case 0x4D: + case 0x4F: + case 0x50: + case 0x51: + case 0x52: + case 0x53: + code += 0x28; + break; + } + return code; +} + +uint8_t matrix_scan(void) +{ + + // scan code reading states + static enum { + INIT, + E0, + E0_2A, + E0_2A_E0, + E0_B7, + E0_B7_E0, + + // print screen + E1, + E1_1D, + E1_1D_45, + E1_1D_45_E1, + E1_1D_45_E1_9D, + // pause + } state = INIT; + + + is_modified = false; + + // 'pseudo break code' hack + if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) { + matrix_break(PAUSE); + } + + uint8_t code = xt_host_recv(); + if (code) xprintf("%X\r\n", code); + switch (state) { + case INIT: + switch (code) { + case 0xE0: + state = E0; + break; + case 0xE1: + state = E1; + break; + case 0x00: + break; + default: // normal key make + if (code < 0x80) { + xprintf("make: %X\r\n", code); + matrix_make(code); + } else if (code > 0x80 && code < 0xFF) { + xprintf("break %X\r\n", code); + matrix_break(code - 0x80); + } else { + matrix_clear(); + clear_keyboard(); + xprintf("unexpected scan code at INIT: %02X\n", code); + } + state = INIT; + } + break; + case E0: // E0-Prefixed + switch (code) { //move these codes to unused places on the matrix + case 0x2A: + state = E0_2A; + break; + case 0xB7: + state = E0_B7; + break; + case 0x00: + state = INIT; + break; + default: + if (code < 0x80) { + matrix_make(move_codes(code)); + } else if (code > 0x80 && code < 0xFF) { + matrix_break(move_codes(code - 0x80)); + } else { + matrix_clear(); + clear_keyboard(); + xprintf("unexpected scan code at E0: %02X\n", code); + } + state = INIT; + } + break; + case E0_2A: + switch (code) { + case 0xE0: + state = E0_2A_E0; + break; + default: + state = INIT; + } + break; + case E0_2A_E0: + switch (code) { + case 0x37: + matrix_make(PRINT_SCREEN); + break; + default: + state = INIT; + } + break; + case E0_B7: + switch (code) { + case 0xE0: + state = E0_B7; + break; + default: + state = INIT; + } + break; + case E0_B7_E0: + switch (code) { + case 0xAA: + matrix_break(PRINT_SCREEN); + break; + default: + state = INIT; + } + break; + case E1: + switch (code) { + case 0x1D: + state = E1_1D; + break; + default: + state = INIT; + } + break; + case E1_1D: + switch (code) { + case 0x45: + state = E1_1D_45; + break; + default: + state = INIT; + } + break; + case E1_1D_45: + switch (code) { + case 0xE1: + state = E1_1D_45_E1; + break; + default: + state = INIT; + } + break; + case E1_1D_45_E1: + switch (code) { + case 0x9D: + state = E1_1D_45_E1_9D; + break; + default: + state = INIT; + } + break; + case E1_1D_45_E1_9D: + switch (code) { + case 0xC5: + matrix_make(PAUSE); + break; + default: + state = INIT; + } + break; + default: + state = INIT; + } + + // TODO: request RESEND when error occurs? +/* + if (PS2_IS_FAILED(ps2_error)) { + uint8_t ret = ps2_host_send(PS2_RESEND); + xprintf("Resend: %02X\n", ret); + } +*/ + return 1; +} + +bool matrix_is_modified(void) +{ + return is_modified; +} + +inline +bool matrix_has_ghost(void) +{ +#ifdef MATRIX_HAS_GHOST + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + if (matrix_has_ghost_in_row(i)) + return true; + } +#endif + return false; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & (1< #include #include +#include "pbuff.h" #include "ps2.h" #include "ps2_io.h" #include "print.h" @@ -57,13 +58,6 @@ POSSIBILITY OF SUCH DAMAGE. uint8_t ps2_error = PS2_ERR_NONE; - -static inline uint8_t pbuf_dequeue(void); -static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); -static inline void pbuf_clear(void); - - void ps2_host_init(void) { idle(); @@ -225,55 +219,3 @@ void ps2_host_set_led(uint8_t led) ps2_host_send(0xED); ps2_host_send(led); } - - -/*-------------------------------------------------------------------- - * Ring buffer to store scan codes from keyboard - *------------------------------------------------------------------*/ -#define PBUF_SIZE 32 -static uint8_t pbuf[PBUF_SIZE]; -static uint8_t pbuf_head = 0; -static uint8_t pbuf_tail = 0; -static inline void pbuf_enqueue(uint8_t data) -{ - uint8_t sreg = SREG; - cli(); - uint8_t next = (pbuf_head + 1) % PBUF_SIZE; - if (next != pbuf_tail) { - pbuf[pbuf_head] = data; - pbuf_head = next; - } else { - print("pbuf: full\n"); - } - SREG = sreg; -} -static inline uint8_t pbuf_dequeue(void) -{ - uint8_t val = 0; - - uint8_t sreg = SREG; - cli(); - if (pbuf_head != pbuf_tail) { - val = pbuf[pbuf_tail]; - pbuf_tail = (pbuf_tail + 1) % PBUF_SIZE; - } - SREG = sreg; - - return val; -} -static inline bool pbuf_has_data(void) -{ - uint8_t sreg = SREG; - cli(); - bool has_data = (pbuf_head != pbuf_tail); - SREG = sreg; - return has_data; -} -static inline void pbuf_clear(void) -{ - uint8_t sreg = SREG; - cli(); - pbuf_head = pbuf_tail = 0; - SREG = sreg; -} - diff --git a/tmk_core/protocol/xt.h b/tmk_core/protocol/xt.h new file mode 100644 index 00000000..55efd75d --- /dev/null +++ b/tmk_core/protocol/xt.h @@ -0,0 +1,75 @@ +/* +Copyright 2010,2011,2012,2013 Jun WAKO +Copyright 2016 Ethan Apodaca + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef XT_H +#define XT_H + +#include +#include "wait.h" +#include "xt_io.h" +#include "print.h" + +void xt_host_init(void); +uint8_t xt_host_recv(void); + + +/*-------------------------------------------------------------------- + * static functions + *------------------------------------------------------------------*/ +static inline uint16_t wait_clock_lo(uint16_t us) +{ + while (clock_in() && us) { asm(""); wait_us(1); us--; } + return us; +} +static inline uint16_t wait_clock_hi(uint16_t us) +{ + while (!clock_in() && us) { asm(""); wait_us(1); us--; } + return us; +} +static inline uint16_t wait_data_lo(uint16_t us) +{ + while (data_in() && us) { asm(""); wait_us(1); us--; } + return us; +} +static inline uint16_t wait_data_hi(uint16_t us) +{ + while (!data_in() && us) { asm(""); wait_us(1); us--; } + return us; +} + +#endif diff --git a/tmk_core/protocol/xt_interrupt.c b/tmk_core/protocol/xt_interrupt.c new file mode 100644 index 00000000..2a351c5b --- /dev/null +++ b/tmk_core/protocol/xt_interrupt.c @@ -0,0 +1,113 @@ +/* +Copyright 2010,2011,2012,2013 Jun WAKO + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * PS/2 protocol Pin interrupt version + */ + +#include +#include +#include +#include "pbuff.h" +#include "xt.h" +#include "xt_io.h" +#include "wait.h" +#include "print.h" + +void xt_host_init(void) +{ + XT_INT_INIT(); + XT_INT_ON(); +} + +/* get data received by interrupt */ +uint8_t xt_host_recv(void) +{ + if (pbuf_has_data()) { + return pbuf_dequeue(); + } else { + return 0; + } +} + +ISR(XT_INT_VECT) +{ + static enum { + INIT, + BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, + STOP, + } state = INIT; + static uint8_t data = 0; + // wait for clock falling edge + if(state != INIT) + wait_clock_lo(70); + + switch (state) { + case INIT: + if (data_in()) + state++; + break; + case BIT0: + case BIT1: + case BIT2: + case BIT3: + case BIT4: + case BIT5: + case BIT6: + case BIT7: + state++; + data >>= 1; + if (data_in()) { + data |= 0x80; + } + break; + case STOP: + if (!data_in()) + goto DONE; + pbuf_enqueue(data); + goto DONE; + break; + default: + goto DONE; + } + goto RETURN; +DONE: + state = INIT; + data = 0; +RETURN: + return; +} diff --git a/tmk_core/protocol/xt_io.h b/tmk_core/protocol/xt_io.h new file mode 100644 index 00000000..2e5f31b2 --- /dev/null +++ b/tmk_core/protocol/xt_io.h @@ -0,0 +1,7 @@ +#ifndef XT_IO_H +#define XT_IO_H + +bool clock_in(void); +bool data_in(void); + +#endif diff --git a/tmk_core/protocol/xt_io_avr.c b/tmk_core/protocol/xt_io_avr.c new file mode 100644 index 00000000..6cd153a1 --- /dev/null +++ b/tmk_core/protocol/xt_io_avr.c @@ -0,0 +1,34 @@ +#include +#include +#include + +/* Check port settings for clock and data line */ +#if !(defined(XT_CLOCK_PORT) && \ + defined(XT_CLOCK_PIN) && \ + defined(XT_CLOCK_DDR) && \ + defined(XT_CLOCK_BIT)) +# error "XT clock port setting is required in config.h" +#endif + +#if !(defined(XT_DATA_PORT) && \ + defined(XT_DATA_PIN) && \ + defined(XT_DATA_DDR) && \ + defined(XT_DATA_BIT)) +# error "XT data port setting is required in config.h" +#endif + +bool clock_in(void) +{ + XT_CLOCK_DDR &= ~(1< Date: Thu, 3 Mar 2016 16:18:19 +0900 Subject: [PATCH 142/179] core: Actionmap support --- tmk_core/common.mk | 8 +- tmk_core/common/action_code.h | 4 +- tmk_core/common/action_layer.c | 3 +- tmk_core/common/actionmap.c | 39 +++ tmk_core/common/actionmap.h | 459 +++++++++++++++++++++++++++++++++ tmk_core/common/bootmagic.c | 66 +++-- tmk_core/common/bootmagic.h | 2 +- tmk_core/common/keycode.h | 10 +- tmk_core/common/report.h | 68 ++--- 9 files changed, 586 insertions(+), 73 deletions(-) create mode 100644 tmk_core/common/actionmap.c create mode 100644 tmk_core/common/actionmap.h diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 4c943f04..1efd5d8f 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -6,7 +6,6 @@ SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/action_macro.c \ $(COMMON_DIR)/action_layer.c \ $(COMMON_DIR)/action_util.c \ - $(COMMON_DIR)/keymap.c \ $(COMMON_DIR)/print.c \ $(COMMON_DIR)/debug.c \ $(COMMON_DIR)/util.c \ @@ -17,6 +16,13 @@ SRC += $(COMMON_DIR)/host.c \ # Option modules +ifdef ACTIONMAP_ENABLE + SRC += $(COMMON_DIR)/actionmap.c + OPT_DEFS += -DACTIONMAP_ENABLE +else + SRC += $(COMMON_DIR)/keymap.c +endif + ifdef BOOTMAGIC_ENABLE SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/avr/eeconfig.c diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index da93f77b..b39c6441 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -251,8 +251,8 @@ enum layer_pram_tap_op { OP_OFF_ON, OP_SET_CLEAR, }; -#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) -#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) +#define ACTION_LAYER_BITOP(op, part, bits, on) ACTION(ACT_LAYER, (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) +#define ACTION_LAYER_TAP(layer, key) ACTION(ACT_LAYER_TAP, (layer)<<8 | (key)) /* Default Layer */ #define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4)) #define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4)) diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index c535615f..e6db388d 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -114,8 +114,7 @@ void layer_debug(void) action_t layer_switch_get_action(keypos_t key) { - action_t action; - action.code = ACTION_TRANSPARENT; + action_t action = { .code = ACTION_TRANSPARENT }; #ifndef NO_ACTION_LAYER uint32_t layers = layer_state | default_layer_state; diff --git a/tmk_core/common/actionmap.c b/tmk_core/common/actionmap.c new file mode 100644 index 00000000..49d0f5ce --- /dev/null +++ b/tmk_core/common/actionmap.c @@ -0,0 +1,39 @@ +/* +Copyright 2015 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 "action_code.h" +#include "actionmap.h" + +/* Converts key to action */ +__attribute__ ((weak)) +action_t action_for_key(uint8_t layer, keypos_t key) +{ + return (action_t)pgm_read_word(&actionmaps[(layer)][(key.row)][(key.col)]); +} + +/* Macro */ +__attribute__ ((weak)) +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + return MACRO_NONE; +} + +/* Function */ +__attribute__ ((weak)) +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +} diff --git a/tmk_core/common/actionmap.h b/tmk_core/common/actionmap.h new file mode 100644 index 00000000..cbbcfe93 --- /dev/null +++ b/tmk_core/common/actionmap.h @@ -0,0 +1,459 @@ +/* +Copyright 2015 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 ACTIONMAP_H +#define ACTIONMAP_H + +#include "keyboard.h" +#include "report.h" +#include "keycode.h" +#include "action_code.h" +#include "action.h" + + +/* Keymapping with 16bit action codes */ +extern const uint16_t actionmaps[][MATRIX_ROWS][MATRIX_COLS]; + + +/* Modified key */ +#define AC_c(kc) ACTION_MODS_KEY(MOD_LCTL, KC_##kc) +#define AC_s(kc) ACTION_MODS_KEY(MOD_LSFT, KC_##kc) +#define AC_a(kc) ACTION_MODS_KEY(MOD_LALT, KC_##kc) +#define AC_g(kc) ACTION_MODS_KEY(MOD_LSFT, KC_##kc) + +/* Normal key */ +#define AC_NO ACTION_KEY(KC_NO) +#define AC_TRANSPARENT ACTION_KEY(KC_TRANSPARENT) +#define AC_ROLL_OVER ACTION_KEY(KC_ROLL_OVER) +#define AC_POST_FAIL ACTION_KEY(KC_POST_FAIL) +#define AC_UNDEFINED ACTION_KEY(KC_UNDEFINED) +#define AC_A ACTION_KEY(KC_A) +#define AC_B ACTION_KEY(KC_B) +#define AC_C ACTION_KEY(KC_C) +#define AC_D ACTION_KEY(KC_D) +#define AC_E ACTION_KEY(KC_E) +#define AC_F ACTION_KEY(KC_F) +#define AC_G ACTION_KEY(KC_G) +#define AC_H ACTION_KEY(KC_H) +#define AC_I ACTION_KEY(KC_I) +#define AC_J ACTION_KEY(KC_J) +#define AC_K ACTION_KEY(KC_K) +#define AC_L ACTION_KEY(KC_L) +#define AC_M ACTION_KEY(KC_M) +#define AC_N ACTION_KEY(KC_N) +#define AC_O ACTION_KEY(KC_O) +#define AC_P ACTION_KEY(KC_P) +#define AC_Q ACTION_KEY(KC_Q) +#define AC_R ACTION_KEY(KC_R) +#define AC_S ACTION_KEY(KC_S) +#define AC_T ACTION_KEY(KC_T) +#define AC_U ACTION_KEY(KC_U) +#define AC_V ACTION_KEY(KC_V) +#define AC_W ACTION_KEY(KC_W) +#define AC_X ACTION_KEY(KC_X) +#define AC_Y ACTION_KEY(KC_Y) +#define AC_Z ACTION_KEY(KC_Z) +#define AC_1 ACTION_KEY(KC_1) +#define AC_2 ACTION_KEY(KC_2) +#define AC_3 ACTION_KEY(KC_3) +#define AC_4 ACTION_KEY(KC_4) +#define AC_5 ACTION_KEY(KC_5) +#define AC_6 ACTION_KEY(KC_6) +#define AC_7 ACTION_KEY(KC_7) +#define AC_8 ACTION_KEY(KC_8) +#define AC_9 ACTION_KEY(KC_9) +#define AC_0 ACTION_KEY(KC_0) +#define AC_ENTER ACTION_KEY(KC_ENTER) +#define AC_ESCAPE ACTION_KEY(KC_ESCAPE) +#define AC_BSPACE ACTION_KEY(KC_BSPACE) +#define AC_TAB ACTION_KEY(KC_TAB) +#define AC_SPACE ACTION_KEY(KC_SPACE) +#define AC_MINUS ACTION_KEY(KC_MINUS) +#define AC_EQUAL ACTION_KEY(KC_EQUAL) +#define AC_LBRACKET ACTION_KEY(KC_LBRACKET) +#define AC_RBRACKET ACTION_KEY(KC_RBRACKET) +#define AC_BSLASH ACTION_KEY(KC_BSLASH) +#define AC_NONUS_HASH ACTION_KEY(KC_NONUS_HASH) +#define AC_SCOLON ACTION_KEY(KC_SCOLON) +#define AC_QUOTE ACTION_KEY(KC_QUOTE) +#define AC_GRAVE ACTION_KEY(KC_GRAVE) +#define AC_COMMA ACTION_KEY(KC_COMMA) +#define AC_DOT ACTION_KEY(KC_DOT) +#define AC_SLASH ACTION_KEY(KC_SLASH) +#define AC_CAPSLOCK ACTION_KEY(KC_CAPSLOCK) +#define AC_F1 ACTION_KEY(KC_F1) +#define AC_F2 ACTION_KEY(KC_F2) +#define AC_F3 ACTION_KEY(KC_F3) +#define AC_F4 ACTION_KEY(KC_F4) +#define AC_F5 ACTION_KEY(KC_F5) +#define AC_F6 ACTION_KEY(KC_F6) +#define AC_F7 ACTION_KEY(KC_F7) +#define AC_F8 ACTION_KEY(KC_F8) +#define AC_F9 ACTION_KEY(KC_F9) +#define AC_F10 ACTION_KEY(KC_F10) +#define AC_F11 ACTION_KEY(KC_F11) +#define AC_F12 ACTION_KEY(KC_F12) +#define AC_PSCREEN ACTION_KEY(KC_PSCREEN) +#define AC_SCROLLLOCK ACTION_KEY(KC_SCROLLLOCK) +#define AC_PAUSE ACTION_KEY(KC_PAUSE) +#define AC_INSERT ACTION_KEY(KC_INSERT) +#define AC_HOME ACTION_KEY(KC_HOME) +#define AC_PGUP ACTION_KEY(KC_PGUP) +#define AC_DELETE ACTION_KEY(KC_DELETE) +#define AC_END ACTION_KEY(KC_END) +#define AC_PGDOWN ACTION_KEY(KC_PGDOWN) +#define AC_RIGHT ACTION_KEY(KC_RIGHT) +#define AC_LEFT ACTION_KEY(KC_LEFT) +#define AC_DOWN ACTION_KEY(KC_DOWN) +#define AC_UP ACTION_KEY(KC_UP) +#define AC_NUMLOCK ACTION_KEY(KC_NUMLOCK) +#define AC_KP_SLASH ACTION_KEY(KC_KP_SLASH) +#define AC_KP_ASTERISK ACTION_KEY(KC_KP_ASTERISK) +#define AC_KP_MINUS ACTION_KEY(KC_KP_MINUS) +#define AC_KP_PLUS ACTION_KEY(KC_KP_PLUS) +#define AC_KP_ENTER ACTION_KEY(KC_KP_ENTER) +#define AC_KP_1 ACTION_KEY(KC_KP_1) +#define AC_KP_2 ACTION_KEY(KC_KP_2) +#define AC_KP_3 ACTION_KEY(KC_KP_3) +#define AC_KP_4 ACTION_KEY(KC_KP_4) +#define AC_KP_5 ACTION_KEY(KC_KP_5) +#define AC_KP_6 ACTION_KEY(KC_KP_6) +#define AC_KP_7 ACTION_KEY(KC_KP_7) +#define AC_KP_8 ACTION_KEY(KC_KP_8) +#define AC_KP_9 ACTION_KEY(KC_KP_9) +#define AC_KP_0 ACTION_KEY(KC_KP_0) +#define AC_KP_DOT ACTION_KEY(KC_KP_DOT) +#define AC_NONUS_BSLASH ACTION_KEY(KC_NONUS_BSLASH) +#define AC_APPLICATION ACTION_KEY(KC_APPLICATION) +#define AC_POWER ACTION_KEY(KC_POWER) +#define AC_KP_EQUAL ACTION_KEY(KC_KP_EQUAL) +#define AC_F13 ACTION_KEY(KC_F13) +#define AC_F14 ACTION_KEY(KC_F14) +#define AC_F15 ACTION_KEY(KC_F15) +#define AC_F16 ACTION_KEY(KC_F16) +#define AC_F17 ACTION_KEY(KC_F17) +#define AC_F18 ACTION_KEY(KC_F18) +#define AC_F19 ACTION_KEY(KC_F19) +#define AC_F20 ACTION_KEY(KC_F20) +#define AC_F21 ACTION_KEY(KC_F21) +#define AC_F22 ACTION_KEY(KC_F22) +#define AC_F23 ACTION_KEY(KC_F23) +#define AC_F24 ACTION_KEY(KC_F24) +#define AC_EXECUTE ACTION_KEY(KC_EXECUTE) +#define AC_HELP ACTION_KEY(KC_HELP) +#define AC_MENU ACTION_KEY(KC_MENU) +#define AC_SELECT ACTION_KEY(KC_SELECT) +#define AC_STOP ACTION_KEY(KC_STOP) +#define AC_AGAIN ACTION_KEY(KC_AGAIN) +#define AC_UNDO ACTION_KEY(KC_UNDO) +#define AC_CUT ACTION_KEY(KC_CUT) +#define AC_COPY ACTION_KEY(KC_COPY) +#define AC_PASTE ACTION_KEY(KC_PASTE) +#define AC_FIND ACTION_KEY(KC_FIND) +#define AC__MUTE ACTION_KEY(KC__MUTE) +#define AC__VOLUP ACTION_KEY(KC__VOLUP) +#define AC__VOLDOWN ACTION_KEY(KC__VOLDOWN) +#define AC_LOCKING_CAPS ACTION_KEY(KC_LOCKING_CAPS) +#define AC_LOCKING_NUM ACTION_KEY(KC_LOCKING_NUM) +#define AC_LOCKING_SCROLL ACTION_KEY(KC_LOCKING_SCROLL) +#define AC_KP_COMMA ACTION_KEY(KC_KP_COMMA) +#define AC_KP_EQUAL_AS400 ACTION_KEY(KC_KP_EQUAL_AS400) +#define AC_INT1 ACTION_KEY(KC_INT1) +#define AC_INT2 ACTION_KEY(KC_INT2) +#define AC_INT3 ACTION_KEY(KC_INT3) +#define AC_INT4 ACTION_KEY(KC_INT4) +#define AC_INT5 ACTION_KEY(KC_INT5) +#define AC_INT6 ACTION_KEY(KC_INT6) +#define AC_INT7 ACTION_KEY(KC_INT7) +#define AC_INT8 ACTION_KEY(KC_INT8) +#define AC_INT9 ACTION_KEY(KC_INT9) +#define AC_LANG1 ACTION_KEY(KC_LANG1) +#define AC_LANG2 ACTION_KEY(KC_LANG2) +#define AC_LANG3 ACTION_KEY(KC_LANG3) +#define AC_LANG4 ACTION_KEY(KC_LANG4) +#define AC_LANG5 ACTION_KEY(KC_LANG5) +#define AC_LANG6 ACTION_KEY(KC_LANG6) +#define AC_LANG7 ACTION_KEY(KC_LANG7) +#define AC_LANG8 ACTION_KEY(KC_LANG8) +#define AC_LANG9 ACTION_KEY(KC_LANG9) +#define AC_ALT_ERASE ACTION_KEY(KC_ALT_ERASE) +#define AC_SYSREQ ACTION_KEY(KC_SYSREQ) +#define AC_CANCEL ACTION_KEY(KC_CANCEL) +#define AC_CLEAR ACTION_KEY(KC_CLEAR) +#define AC_PRIOR ACTION_KEY(KC_PRIOR) +#define AC_RETURN ACTION_KEY(KC_RETURN) +#define AC_SEPARATOR ACTION_KEY(KC_SEPARATOR) +#define AC_OUT ACTION_KEY(KC_OUT) +#define AC_OPER ACTION_KEY(KC_OPER) +#define AC_CLEAR_AGAIN ACTION_KEY(KC_CLEAR_AGAIN) +#define AC_CRSEL ACTION_KEY(KC_CRSEL) +#define AC_EXSEL ACTION_KEY(KC_EXSEL) +#define AC_KP_00 ACTION_KEY(KC_KP_00) +#define AC_KP_000 ACTION_KEY(KC_KP_000) +#define AC_THOUSANDS_SEPARATOR ACTION_KEY(KC_THOUSANDS_SEPARATOR) +#define AC_DECIMAL_SEPARATOR ACTION_KEY(KC_DECIMAL_SEPARATOR) +#define AC_CURRENCY_UNIT ACTION_KEY(KC_CURRENCY_UNIT) +#define AC_CURRENCY_SUB_UNIT ACTION_KEY(KC_CURRENCY_SUB_UNIT) +#define AC_KP_LPAREN ACTION_KEY(KC_KP_LPAREN) +#define AC_KP_RPAREN ACTION_KEY(KC_KP_RPAREN) +#define AC_KP_LCBRACKET ACTION_KEY(KC_KP_LCBRACKET) +#define AC_KP_RCBRACKET ACTION_KEY(KC_KP_RCBRACKET) +#define AC_KP_TAB ACTION_KEY(KC_KP_TAB) +#define AC_KP_BSPACE ACTION_KEY(KC_KP_BSPACE) +#define AC_KP_A ACTION_KEY(KC_KP_A) +#define AC_KP_B ACTION_KEY(KC_KP_B) +#define AC_KP_C ACTION_KEY(KC_KP_C) +#define AC_KP_D ACTION_KEY(KC_KP_D) +#define AC_KP_E ACTION_KEY(KC_KP_E) +#define AC_KP_F ACTION_KEY(KC_KP_F) +#define AC_KP_XOR ACTION_KEY(KC_KP_XOR) +#define AC_KP_HAT ACTION_KEY(KC_KP_HAT) +#define AC_KP_PERC ACTION_KEY(KC_KP_PERC) +#define AC_KP_LT ACTION_KEY(KC_KP_LT) +#define AC_KP_GT ACTION_KEY(KC_KP_GT) +#define AC_KP_AND ACTION_KEY(KC_KP_AND) +#define AC_KP_LAZYAND ACTION_KEY(KC_KP_LAZYAND) +#define AC_KP_OR ACTION_KEY(KC_KP_OR) +#define AC_KP_LAZYOR ACTION_KEY(KC_KP_LAZYOR) +#define AC_KP_COLON ACTION_KEY(KC_KP_COLON) +#define AC_KP_HASH ACTION_KEY(KC_KP_HASH) +#define AC_KP_SPACE ACTION_KEY(KC_KP_SPACE) +#define AC_KP_ATMARK ACTION_KEY(KC_KP_ATMARK) +#define AC_KP_EXCLAMATION ACTION_KEY(KC_KP_EXCLAMATION) +#define AC_KP_MEM_STORE ACTION_KEY(KC_KP_MEM_STORE) +#define AC_KP_MEM_RECALL ACTION_KEY(KC_KP_MEM_RECALL) +#define AC_KP_MEM_CLEAR ACTION_KEY(KC_KP_MEM_CLEAR) +#define AC_KP_MEM_ADD ACTION_KEY(KC_KP_MEM_ADD) +#define AC_KP_MEM_SUB ACTION_KEY(KC_KP_MEM_SUB) +#define AC_KP_MEM_MUL ACTION_KEY(KC_KP_MEM_MUL) +#define AC_KP_MEM_DIV ACTION_KEY(KC_KP_MEM_DIV) +#define AC_KP_PLUS_MINUS ACTION_KEY(KC_KP_PLUS_MINUS) +#define AC_KP_CLEAR ACTION_KEY(KC_KP_CLEAR) +#define AC_KP_CLEAR_ENTRY ACTION_KEY(KC_KP_CLEAR_ENTRY) +#define AC_KP_BINARY ACTION_KEY(KC_KP_BINARY) +#define AC_KP_OCTAL ACTION_KEY(KC_KP_OCTAL) +#define AC_KP_DECIMAL ACTION_KEY(KC_KP_DECIMAL) +#define AC_KP_HEXADECIMAL ACTION_KEY(KC_KP_HEXADECIMAL) + +/* Modifiers */ +#define AC_LCTRL ACTION_KEY(KC_LCTRL) +#define AC_LSHIFT ACTION_KEY(KC_LSHIFT) +#define AC_LALT ACTION_KEY(KC_LALT) +#define AC_LGUI ACTION_KEY(KC_LGUI) +#define AC_RCTRL ACTION_KEY(KC_RCTRL) +#define AC_RSHIFT ACTION_KEY(KC_RSHIFT) +#define AC_RALT ACTION_KEY(KC_RALT) +#define AC_RGUI ACTION_KEY(KC_RGUI) + +/* + * TMK extensions + */ +/* Sytem Control */ +#define AC_SYSTEM_POWER ACTION_USAGE_SYSTEM(SYSTEM_POWER_DOWN) +#define AC_SYSTEM_SLEEP ACTION_USAGE_SYSTEM(SYSTEM_SLEEP) +#define AC_SYSTEM_WAKE ACTION_USAGE_SYSTEM(SYSTEM_WAKE_UP) +/* Consumer Page */ +#define AC_AUDIO_MUTE ACTION_USAGE_CONSUMER(AUDIO_MUTE) +#define AC_AUDIO_VOL_UP ACTION_USAGE_CONSUMER(AUDIO_VOL_UP) +#define AC_AUDIO_VOL_DOWN ACTION_USAGE_CONSUMER(AUDIO_VOL_DOWN) +#define AC_MEDIA_NEXT_TRACK ACTION_USAGE_CONSUMER(TRANSPORT_NEXT_TRACK) +#define AC_MEDIA_PREV_TRACK ACTION_USAGE_CONSUMER(TRANSPORT_PREV_TRACK) +#define AC_MEDIA_FAST_FORWARD ACTION_USAGE_CONSUMER(TRANSPORT_FAST_FORWARD) +#define AC_MEDIA_REWIND ACTION_USAGE_CONSUMER(TRANSPORT_REWIND) +#define AC_MEDIA_STOP ACTION_USAGE_CONSUMER(TRANSPORT_STOP) +#define AC_MEDIA_PLAY_PAUSE ACTION_USAGE_CONSUMER(TRANSPORT_PLAY_PAUSE) +#define AC_MEDIA_EJECT ACTION_USAGE_CONSUMER(TRANSPORT_STOP_EJECT) +#define AC_MEDIA_SELECT ACTION_USAGE_CONSUMER(APPLAUNCH_CC_CONFIG) +#define AC_MAIL ACTION_USAGE_CONSUMER(APPLAUNCH_EMAIL) +#define AC_CALCULATOR ACTION_USAGE_CONSUMER(APPLAUNCH_CALCULATOR) +#define AC_MY_COMPUTER ACTION_USAGE_CONSUMER(APPLAUNCH_LOCAL_BROWSER) +#define AC_WWW_SEARCH ACTION_USAGE_CONSUMER(APPCONTROL_SEARCH) +#define AC_WWW_HOME ACTION_USAGE_CONSUMER(APPCONTROL_HOME) +#define AC_WWW_BACK ACTION_USAGE_CONSUMER(APPCONTROL_BACK) +#define AC_WWW_FORWARD ACTION_USAGE_CONSUMER(APPCONTROL_FORWARD) +#define AC_WWW_STOP ACTION_USAGE_CONSUMER(APPCONTROL_STOP) +#define AC_WWW_REFRESH ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH) +#define AC_WWW_FAVORITES ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS) +/* Jump to bootloader */ +#define AC_BOOTLOADER ACTION_KEY(KC_BOOTLOADER) +/* Fn key */ +/* +#define AC_FN0 ACTION_KEY(KC_FN0) +#define AC_FN1 ACTION_KEY(KC_FN1) +#define AC_FN2 ACTION_KEY(KC_FN2) +#define AC_FN3 ACTION_KEY(KC_FN3) +#define AC_FN4 ACTION_KEY(KC_FN4) +#define AC_FN5 ACTION_KEY(KC_FN5) +#define AC_FN6 ACTION_KEY(KC_FN6) +#define AC_FN7 ACTION_KEY(KC_FN7) +#define AC_FN8 ACTION_KEY(KC_FN8) +#define AC_FN9 ACTION_KEY(KC_FN9) +#define AC_FN10 ACTION_KEY(KC_FN10) +#define AC_FN11 ACTION_KEY(KC_FN11) +#define AC_FN12 ACTION_KEY(KC_FN12) +#define AC_FN13 ACTION_KEY(KC_FN13) +#define AC_FN14 ACTION_KEY(KC_FN14) +#define AC_FN15 ACTION_KEY(KC_FN15) +#define AC_FN16 ACTION_KEY(KC_FN16) +#define AC_FN17 ACTION_KEY(KC_FN17) +#define AC_FN18 ACTION_KEY(KC_FN18) +#define AC_FN19 ACTION_KEY(KC_FN19) +#define AC_FN20 ACTION_KEY(KC_FN20) +#define AC_FN21 ACTION_KEY(KC_FN21) +#define AC_FN22 ACTION_KEY(KC_FN22) +#define AC_FN23 ACTION_KEY(KC_FN23) +#define AC_FN24 ACTION_KEY(KC_FN24) +#define AC_FN25 ACTION_KEY(KC_FN25) +#define AC_FN26 ACTION_KEY(KC_FN26) +#define AC_FN27 ACTION_KEY(KC_FN27) +#define AC_FN28 ACTION_KEY(KC_FN28) +#define AC_FN29 ACTION_KEY(KC_FN29) +#define AC_FN30 ACTION_KEY(KC_FN30) +#define AC_FN31 ACTION_KEY(KC_FN31) +*/ +/* Mousekey */ +#define AC_MS_UP ACTION_MOUSEKEY(KC_MS_UP) +#define AC_MS_DOWN ACTION_MOUSEKEY(KC_MS_DOWN) +#define AC_MS_LEFT ACTION_MOUSEKEY(KC_MS_LEFT) +#define AC_MS_RIGHT ACTION_MOUSEKEY(KC_MS_RIGHT) +#define AC_MS_BTN1 ACTION_MOUSEKEY(KC_MS_BTN1) +#define AC_MS_BTN2 ACTION_MOUSEKEY(KC_MS_BTN2) +#define AC_MS_BTN3 ACTION_MOUSEKEY(KC_MS_BTN3) +#define AC_MS_BTN4 ACTION_MOUSEKEY(KC_MS_BTN4) +#define AC_MS_BTN5 ACTION_MOUSEKEY(KC_MS_BTN5) +#define AC_MS_WH_UP ACTION_MOUSEKEY(KC_MS_WH_UP) +#define AC_MS_WH_DOWN ACTION_MOUSEKEY(KC_MS_WH_DOWN) +#define AC_MS_WH_LEFT ACTION_MOUSEKEY(KC_MS_WH_LEFT) +#define AC_MS_WH_RIGHT ACTION_MOUSEKEY(KC_MS_WH_RIGHT) +#define AC_MS_ACCEL0 ACTION_MOUSEKEY(KC_MS_ACCEL0) +#define AC_MS_ACCEL1 ACTION_MOUSEKEY(KC_MS_ACCEL1) +#define AC_MS_ACCEL2 ACTION_MOUSEKEY(KC_MS_ACCEL2) + +/* + * Short names + */ +#define AC_LCTL ACTION_KEY(KC_LCTRL) +#define AC_RCTL ACTION_KEY(KC_RCTRL) +#define AC_LSFT ACTION_KEY(KC_LSHIFT) +#define AC_RSFT ACTION_KEY(KC_RSHIFT) +#define AC_ESC ACTION_KEY(KC_ESCAPE) +#define AC_BSPC ACTION_KEY(KC_BSPACE) +#define AC_ENT ACTION_KEY(KC_ENTER) +#define AC_DEL ACTION_KEY(KC_DELETE) +#define AC_INS ACTION_KEY(KC_INSERT) +#define AC_CAPS ACTION_KEY(KC_CAPSLOCK) +#define AC_CLCK ACTION_KEY(KC_CAPSLOCK) +#define AC_RGHT ACTION_KEY(KC_RIGHT) +#define AC_PGDN ACTION_KEY(KC_PGDOWN) +#define AC_PSCR ACTION_KEY(KC_PSCREEN) +#define AC_SLCK ACTION_KEY(KC_SCROLLLOCK) +#define AC_PAUS ACTION_KEY(KC_PAUSE) +#define AC_BRK ACTION_KEY(KC_PAUSE) +#define AC_NLCK ACTION_KEY(KC_NUMLOCK) +#define AC_SPC ACTION_KEY(KC_SPACE) +#define AC_MINS ACTION_KEY(KC_MINUS) +#define AC_EQL ACTION_KEY(KC_EQUAL) +#define AC_GRV ACTION_KEY(KC_GRAVE) +#define AC_RBRC ACTION_KEY(KC_RBRACKET) +#define AC_LBRC ACTION_KEY(KC_LBRACKET) +#define AC_COMM ACTION_KEY(KC_COMMA) +#define AC_BSLS ACTION_KEY(KC_BSLASH) +#define AC_SLSH ACTION_KEY(KC_SLASH) +#define AC_SCLN ACTION_KEY(KC_SCOLON) +#define AC_QUOT ACTION_KEY(KC_QUOTE) +#define AC_APP ACTION_KEY(KC_APPLICATION) +#define AC_NUHS ACTION_KEY(KC_NONUS_HASH) +#define AC_NUBS ACTION_KEY(KC_NONUS_BSLASH) +#define AC_LCAP ACTION_KEY(KC_LOCKING_CAPS) +#define AC_LNUM ACTION_KEY(KC_LOCKING_NUM) +#define AC_LSCR ACTION_KEY(KC_LOCKING_SCROLL) +#define AC_ERAS ACTION_KEY(KC_ALT_ERASE,) +#define AC_CLR ACTION_KEY(KC_CLEAR) +/* Japanese specific */ +#define AC_ZKHK ACTION_KEY(KC_GRAVE) +#define AC_RO ACTION_KEY(KC_INT1) +#define AC_KANA ACTION_KEY(KC_INT2) +#define AC_JYEN ACTION_KEY(KC_INT3) +#define AC_HENK ACTION_KEY(KC_INT4) +#define AC_MHEN ACTION_KEY(KC_INT5) +/* Keypad */ +#define AC_P1 ACTION_KEY(KC_KP_1) +#define AC_P2 ACTION_KEY(KC_KP_2) +#define AC_P3 ACTION_KEY(KC_KP_3) +#define AC_P4 ACTION_KEY(KC_KP_4) +#define AC_P5 ACTION_KEY(KC_KP_5) +#define AC_P6 ACTION_KEY(KC_KP_6) +#define AC_P7 ACTION_KEY(KC_KP_7) +#define AC_P8 ACTION_KEY(KC_KP_8) +#define AC_P9 ACTION_KEY(KC_KP_9) +#define AC_P0 ACTION_KEY(KC_KP_0) +#define AC_PDOT ACTION_KEY(KC_KP_DOT) +#define AC_PCMM ACTION_KEY(KC_KP_COMMA) +#define AC_PSLS ACTION_KEY(KC_KP_SLASH) +#define AC_PAST ACTION_KEY(KC_KP_ASTERISK) +#define AC_PMNS ACTION_KEY(KC_KP_MINUS) +#define AC_PPLS ACTION_KEY(KC_KP_PLUS) +#define AC_PEQL ACTION_KEY(KC_KP_EQUAL) +#define AC_PENT ACTION_KEY(KC_KP_ENTER) +/* Mousekey */ +#define AC_MS_U ACTION_MOUSEKEY(KC_MS_UP) +#define AC_MS_D ACTION_MOUSEKEY(KC_MS_DOWN) +#define AC_MS_L ACTION_MOUSEKEY(KC_MS_LEFT) +#define AC_MS_R ACTION_MOUSEKEY(KC_MS_RIGHT) +#define AC_BTN1 ACTION_MOUSEKEY(KC_MS_BTN1) +#define AC_BTN2 ACTION_MOUSEKEY(KC_MS_BTN2) +#define AC_BTN3 ACTION_MOUSEKEY(KC_MS_BTN3) +#define AC_BTN4 ACTION_MOUSEKEY(KC_MS_BTN4) +#define AC_BTN5 ACTION_MOUSEKEY(KC_MS_BTN5) +#define AC_WH_U ACTION_MOUSEKEY(KC_MS_WH_UP) +#define AC_WH_D ACTION_MOUSEKEY(KC_MS_WH_DOWN) +#define AC_WH_L ACTION_MOUSEKEY(KC_MS_WH_LEFT) +#define AC_WH_R ACTION_MOUSEKEY(KC_MS_WH_RIGHT) +#define AC_ACL0 ACTION_MOUSEKEY(KC_MS_ACCEL0) +#define AC_ACL1 ACTION_MOUSEKEY(KC_MS_ACCEL1) +#define AC_ACL2 ACTION_MOUSEKEY(KC_MS_ACCEL2) +/* Sytem Control */ +#define AC_PWR ACTION_USAGE_SYSTEM(SYSTEM_POWER_DOWN) +#define AC_SLEP ACTION_USAGE_SYSTEM(SYSTEM_SLEEP) +#define AC_WAKE ACTION_USAGE_SYSTEM(SYSTEM_WAKE_UP) +/* Consumer Page */ +#define AC_MUTE ACTION_USAGE_CONSUMER(AUDIO_MUTE) +#define AC_VOLU ACTION_USAGE_CONSUMER(AUDIO_VOL_UP) +#define AC_VOLD ACTION_USAGE_CONSUMER(AUDIO_VOL_DOWN) +#define AC_MNXT ACTION_USAGE_CONSUMER(TRANSPORT_NEXT_TRACK) +#define AC_MPRV ACTION_USAGE_CONSUMER(TRANSPORT_PREV_TRACK) +#define AC_MFFD ACTION_USAGE_CONSUMER(TRANSPORT_FAST_FORWARD) +#define AC_MRWD ACTION_USAGE_CONSUMER(TRANSPORT_REWIND) +#define AC_MSTP ACTION_USAGE_CONSUMER(TRANSPORT_STOP) +#define AC_MPLY ACTION_USAGE_CONSUMER(TRANSPORT_PLAY_PAUSE) +#define AC_EJCT ACTION_USAGE_CONSUMER(TRANSPORT_STOP_EJECT) +#define AC_MSEL ACTION_USAGE_CONSUMER(APPLAUNCH_CC_CONFIG) +#define AC_MAIL ACTION_USAGE_CONSUMER(APPLAUNCH_EMAIL) +#define AC_CALC ACTION_USAGE_CONSUMER(APPLAUNCH_CALCULATOR) +#define AC_MYCM ACTION_USAGE_CONSUMER(APPLAUNCH_LOCAL_BROWSER) +#define AC_WSCH ACTION_USAGE_CONSUMER(APPCONTROL_SEARCH) +#define AC_WHOM ACTION_USAGE_CONSUMER(APPCONTROL_HOME) +#define AC_WBAK ACTION_USAGE_CONSUMER(APPCONTROL_BACK) +#define AC_WFWD ACTION_USAGE_CONSUMER(APPCONTROL_FORWARD) +#define AC_WSTP ACTION_USAGE_CONSUMER(APPCONTROL_STOP) +#define AC_WREF ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH) +#define AC_WFAV ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS) +/* Jump to bootloader */ +#define AC_BTLD ACTION_KEY(KC_BOOTLOADER) +/* Transparent */ +#define AC_TRNS ACTION_KEY(KC_TRANSPARENT) + +#endif diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 08241f7d..61236bec 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -5,6 +5,7 @@ #include "bootloader.h" #include "debug.h" #include "keymap.h" +#include "actionmap.h" #include "host.h" #include "action_layer.h" #include "eeconfig.h" @@ -26,28 +27,28 @@ void bootmagic(void) print("done.\n"); /* bootmagic skip */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SKIP)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SKIP)) { return; } /* eeconfig clear */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_EEPROM_CLEAR)) { eeconfig_init(); } /* bootloader */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_BOOTLOADER)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_BOOTLOADER)) { bootloader_jump(); } /* debug enable */ debug_config.raw = eeconfig_read_debug(); - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_ENABLE)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MATRIX)) { debug_config.matrix = !debug_config.matrix; - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) { + } else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) { debug_config.keyboard = !debug_config.keyboard; - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MOUSE)) { + } else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MOUSE)) { debug_config.mouse = !debug_config.mouse; } else { debug_config.enable = !debug_config.enable; @@ -57,28 +58,28 @@ void bootmagic(void) /* keymap config */ keymap_config.raw = eeconfig_read_keymap(); - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) { keymap_config.capslock_to_control = !keymap_config.capslock_to_control; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) { keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) { keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_NO_GUI)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_NO_GUI)) { keymap_config.no_gui = !keymap_config.no_gui; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) { keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc; } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) { + if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) { keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace; } - if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) { + if (bootmagic_scan_key(BOOTMAGIC_HOST_NKRO)) { keymap_config.nkro = !keymap_config.nkro; } eeconfig_write_keymap(keymap_config.raw); @@ -89,14 +90,14 @@ void bootmagic(void) /* default layer */ uint8_t default_layer = 0; - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); } + if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); } if (default_layer) { eeconfig_write_default_layer(default_layer); default_layer_set((uint32_t)default_layer); @@ -106,13 +107,22 @@ void bootmagic(void) } } -static bool scan_keycode(uint8_t keycode) +static bool scan_key(uint16_t code) { for (uint8_t r = 0; r < MATRIX_ROWS; r++) { matrix_row_t matrix_row = matrix_get_row(r); for (uint8_t c = 0; c < MATRIX_COLS; c++) { if (matrix_row & ((matrix_row_t)1<. #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 #define KC_EJCT KC_MEDIA_EJECT +#define KC_MSEL KC_MEDIA_SELECT #define KC_MAIL KC_MAIL #define KC_CALC KC_CALCULATOR #define KC_MYCM KC_MY_COMPUTER @@ -420,10 +420,12 @@ enum internal_special_keycodes { KC_AUDIO_VOL_DOWN, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PREV_TRACK, + KC_MEDIA_FAST_FORWARD, + KC_MEDIA_REWIND, KC_MEDIA_STOP, KC_MEDIA_PLAY_PAUSE, - KC_MEDIA_SELECT, KC_MEDIA_EJECT, + KC_MEDIA_SELECT, KC_MAIL, KC_CALCULATOR, KC_MY_COMPUTER, @@ -433,9 +435,7 @@ enum internal_special_keycodes { KC_WWW_FORWARD, KC_WWW_STOP, KC_WWW_REFRESH, - KC_WWW_FAVORITES, - KC_MEDIA_FAST_FORWARD, - KC_MEDIA_REWIND, /* 0xBC */ + KC_WWW_FAVORITES, /* 0xBC */ /* Jump to bootloader */ KC_BOOTLOADER = 0xBF, diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index 0c799eca..f21e84ee 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -46,25 +46,25 @@ along with this program. If not, see . #define TRANSPORT_STOP_EJECT 0x00CC #define TRANSPORT_PLAY_PAUSE 0x00CD /* application launch */ -#define AL_CC_CONFIG 0x0183 -#define AL_EMAIL 0x018A -#define AL_CALCULATOR 0x0192 -#define AL_LOCAL_BROWSER 0x0194 +#define APPLAUNCH_CC_CONFIG 0x0183 +#define APPLAUNCH_EMAIL 0x018A +#define APPLAUNCH_CALCULATOR 0x0192 +#define APPLAUNCH_LOCAL_BROWSER 0x0194 /* application control */ -#define AC_SEARCH 0x0221 -#define AC_HOME 0x0223 -#define AC_BACK 0x0224 -#define AC_FORWARD 0x0225 -#define AC_STOP 0x0226 -#define AC_REFRESH 0x0227 -#define AC_BOOKMARKS 0x022A +#define APPCONTROL_SEARCH 0x0221 +#define APPCONTROL_HOME 0x0223 +#define APPCONTROL_BACK 0x0224 +#define APPCONTROL_FORWARD 0x0225 +#define APPCONTROL_STOP 0x0226 +#define APPCONTROL_REFRESH 0x0227 +#define APPCONTROL_BOOKMARKS 0x022A /* supplement for Bluegiga iWRAP HID(not supported by Windows?) */ -#define AL_LOCK 0x019E +#define APPLAUNCH_LOCK 0x019E #define TRANSPORT_RECORD 0x00B2 #define TRANSPORT_FAST_FORWARD 0x00B3 #define TRANSPORT_REWIND 0x00B4 #define TRANSPORT_EJECT 0x00B8 -#define AC_MINIMIZE 0x0206 +#define APPCONTROL_MINIMIZE 0x0206 /* Generic Desktop Page(0x01) - system power control */ #define SYSTEM_POWER_DOWN 0x0081 @@ -159,27 +159,27 @@ typedef struct { /* keycode to consumer usage */ #define KEYCODE2CONSUMER(key) \ - (key == KC_AUDIO_MUTE ? AUDIO_MUTE : \ - (key == KC_AUDIO_VOL_UP ? AUDIO_VOL_UP : \ - (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 : \ - (key == KC_MEDIA_SELECT ? AL_CC_CONFIG : \ - (key == KC_MAIL ? AL_EMAIL : \ - (key == KC_CALCULATOR ? AL_CALCULATOR : \ - (key == KC_MY_COMPUTER ? AL_LOCAL_BROWSER : \ - (key == KC_WWW_SEARCH ? AC_SEARCH : \ - (key == KC_WWW_HOME ? AC_HOME : \ - (key == KC_WWW_BACK ? AC_BACK : \ - (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_AUDIO_MUTE ? AUDIO_MUTE : \ + (key == KC_AUDIO_VOL_UP ? AUDIO_VOL_UP : \ + (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 : \ + (key == KC_MEDIA_SELECT ? APPLAUNCH_CC_CONFIG : \ + (key == KC_MAIL ? APPLAUNCH_EMAIL : \ + (key == KC_CALCULATOR ? APPLAUNCH_CALCULATOR : \ + (key == KC_MY_COMPUTER ? APPLAUNCH_LOCAL_BROWSER : \ + (key == KC_WWW_SEARCH ? APPCONTROL_SEARCH : \ + (key == KC_WWW_HOME ? APPCONTROL_HOME : \ + (key == KC_WWW_BACK ? APPCONTROL_BACK : \ + (key == KC_WWW_FORWARD ? APPCONTROL_FORWARD : \ + (key == KC_WWW_STOP ? APPCONTROL_STOP : \ + (key == KC_WWW_REFRESH ? APPCONTROL_REFRESH : \ + (key == KC_WWW_FAVORITES ? APPCONTROL_BOOKMARKS : 0))))))))))))))))))))) #ifdef __cplusplus } From a9bce90c6090803a728592ae7ea563e2f3286e38 Mon Sep 17 00:00:00 2001 From: Ethan Apodaca Date: Wed, 2 Mar 2016 23:34:13 -0800 Subject: [PATCH 143/179] Mostly working. Is unstable, will emit bad codes after a while. --- converter/xt_usb/matrix.c | 129 ++++++++++--------------------- tmk_core/protocol/xt_interrupt.c | 51 ++++-------- 2 files changed, 56 insertions(+), 124 deletions(-) diff --git a/converter/xt_usb/matrix.c b/converter/xt_usb/matrix.c index 4218e39b..92fa6935 100644 --- a/converter/xt_usb/matrix.c +++ b/converter/xt_usb/matrix.c @@ -140,7 +140,6 @@ uint8_t matrix_scan(void) } uint8_t code = xt_host_recv(); - if (code) xprintf("%X\r\n", code); switch (state) { case INIT: switch (code) { @@ -150,19 +149,13 @@ uint8_t matrix_scan(void) case 0xE1: state = E1; break; - case 0x00: - break; default: // normal key make - if (code < 0x80) { + if (code < 0x80 && code != 0x00) { xprintf("make: %X\r\n", code); matrix_make(code); - } else if (code > 0x80 && code < 0xFF) { + } else if (code > 0x80 && code < 0xFF && code != 0x00) { xprintf("break %X\r\n", code); matrix_break(code - 0x80); - } else { - matrix_clear(); - clear_keyboard(); - xprintf("unexpected scan code at INIT: %02X\n", code); } state = INIT; } @@ -175,114 +168,72 @@ uint8_t matrix_scan(void) case 0xB7: state = E0_B7; break; - case 0x00: - state = INIT; - break; default: - if (code < 0x80) { + if (code < 0x80 && code != 0x00) { matrix_make(move_codes(code)); - } else if (code > 0x80 && code < 0xFF) { + } else if (code > 0x80 && code < 0xFF && code != 0x00) { matrix_break(move_codes(code - 0x80)); - } else { - matrix_clear(); - clear_keyboard(); - xprintf("unexpected scan code at E0: %02X\n", code); } state = INIT; } break; case E0_2A: - switch (code) { - case 0xE0: - state = E0_2A_E0; - break; - default: - state = INIT; - } + if(code == 0xE0) + state = E0_2A_E0; + else + state = INIT; break; case E0_2A_E0: - switch (code) { - case 0x37: - matrix_make(PRINT_SCREEN); - break; - default: - state = INIT; - } + if(code == 0x37) + matrix_make(PRINT_SCREEN); + else + state = INIT; break; case E0_B7: - switch (code) { - case 0xE0: - state = E0_B7; - break; - default: - state = INIT; - } + if(code == 0xE0) + state = E0_B7; + else + state = INIT; break; case E0_B7_E0: - switch (code) { - case 0xAA: - matrix_break(PRINT_SCREEN); - break; - default: - state = INIT; - } + if(code == 0xAA) + matrix_break(PRINT_SCREEN); + else + state = INIT; break; case E1: - switch (code) { - case 0x1D: - state = E1_1D; - break; - default: - state = INIT; - } + if (code == 0x1D) + state = E1_1D; + else + state = INIT; break; case E1_1D: - switch (code) { - case 0x45: - state = E1_1D_45; - break; - default: - state = INIT; - } + if(code == 0x45) + state = E1_1D_45; + else + state = INIT; break; case E1_1D_45: - switch (code) { - case 0xE1: - state = E1_1D_45_E1; - break; - default: - state = INIT; - } + if(code == 0xE1) + state = E1_1D_45_E1; + else + state = INIT; break; case E1_1D_45_E1: - switch (code) { - case 0x9D: - state = E1_1D_45_E1_9D; - break; - default: - state = INIT; - } + if(code == 0x9D) + state = E1_1D_45_E1_9D; + else + state = INIT; break; case E1_1D_45_E1_9D: - switch (code) { - case 0xC5: - matrix_make(PAUSE); - break; - default: - state = INIT; - } + if(code == 0xC5) + matrix_make(PAUSE); + else + state = INIT; break; default: state = INIT; } - - // TODO: request RESEND when error occurs? -/* - if (PS2_IS_FAILED(ps2_error)) { - uint8_t ret = ps2_host_send(PS2_RESEND); - xprintf("Resend: %02X\n", ret); - } -*/ return 1; } diff --git a/tmk_core/protocol/xt_interrupt.c b/tmk_core/protocol/xt_interrupt.c index 2a351c5b..94b47db4 100644 --- a/tmk_core/protocol/xt_interrupt.c +++ b/tmk_core/protocol/xt_interrupt.c @@ -66,47 +66,28 @@ uint8_t xt_host_recv(void) ISR(XT_INT_VECT) { - static enum { - INIT, - BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, - STOP, - } state = INIT; + static uint8_t state = 0; static uint8_t data = 0; - // wait for clock falling edge - if(state != INIT) - wait_clock_lo(70); - switch (state) { - case INIT: - if (data_in()) - state++; - break; - case BIT0: - case BIT1: - case BIT2: - case BIT3: - case BIT4: - case BIT5: - case BIT6: - case BIT7: + if (state == 0) { + if (data_in()) state++; - data >>= 1; - if (data_in()) { - data |= 0x80; - } - break; - case STOP: - if (!data_in()) - goto DONE; - pbuf_enqueue(data); - goto DONE; - break; - default: - goto DONE; + } else if (state >= 1 && state <= 8) { + wait_clock_lo(20); + data >>= 1; + if (data_in()) + data |= 0x80; + if (state == 8) + goto END; + state++; + } else { + goto DONE; } goto RETURN; +END: + pbuf_enqueue(data); DONE: - state = INIT; + state = 0; data = 0; RETURN: return; From 0ed5017640cfc6b3ace569f43011e881b4b5a996 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 3 Mar 2016 17:05:22 +0900 Subject: [PATCH 144/179] alps64: Add actionmaps --- keyboard/alps64/Makefile | 23 +++-- keyboard/alps64/actionmap_common.h | 54 +++++++++++ keyboard/alps64/actionmap_hasu.c | 149 +++++++++++++++++++++++++++++ keyboard/alps64/actionmap_plain.c | 52 ++++++++++ 4 files changed, 270 insertions(+), 8 deletions(-) create mode 100644 keyboard/alps64/actionmap_common.h create mode 100644 keyboard/alps64/actionmap_hasu.c create mode 100644 keyboard/alps64/actionmap_plain.c diff --git a/keyboard/alps64/Makefile b/keyboard/alps64/Makefile index e90dcedb..6eadd4f1 100644 --- a/keyboard/alps64/Makefile +++ b/keyboard/alps64/Makefile @@ -48,16 +48,9 @@ TMK_DIR = ../../tmk_core TARGET_DIR = . # project specific files -SRC = keymap_common.c \ - matrix.c \ +SRC = matrix.c \ led.c -ifdef KEYMAP - SRC := keymap_$(KEYMAP).c $(SRC) -else - SRC := keymap_plain.c $(SRC) -endif - CONFIG_H = config.h @@ -120,6 +113,20 @@ 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 +ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes + + +ifdef ACTIONMAP_ENABLE + KEYMAP_FILE = actionmap +else + KEYMAP_FILE = keymap + SRC := keymap_common.c $(SRC) +endif +ifdef KEYMAP + SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) +else + SRC := $(KEYMAP_FILE)_plain.c $(SRC) +endif # Optimize size but this may cause error "relocation truncated to fit" diff --git a/keyboard/alps64/actionmap_common.h b/keyboard/alps64/actionmap_common.h new file mode 100644 index 00000000..cc45edb0 --- /dev/null +++ b/keyboard/alps64/actionmap_common.h @@ -0,0 +1,54 @@ +/* +Copyright 2015 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 ACTIONMAP_COMMON_H +#define ACTIONMAP_COMMON_H + + +/* Alps64 keymap definition macro */ +#define ACTIONMAP( \ + K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \ + K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \ + K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \ + K31, K41, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, K22, \ + K30, K40, K50, K60, K70, K00, K10, K20 \ +) { \ + { AC_##K00, AC_##K01, AC_##K02, AC_##K03, AC_##K04, AC_##K05, AC_##K06, AC_##K07 }, \ + { AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17 }, \ + { AC_##K20, AC_##K21, AC_##K22, AC_##K23, AC_##K24, AC_##K25, AC_##K26, AC_##K27 }, \ + { AC_##K30, AC_##K31, AC_##K32, AC_##K33, AC_##K34, AC_##K35, AC_##K36, AC_##K37 }, \ + { AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_##K47 }, \ + { AC_##K50, AC_##K51, AC_##K52, AC_##K53, AC_##K54, AC_##K55, AC_##K56, AC_##K57 }, \ + { AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_##K64, AC_##K65, AC_##K66, AC_##K67 }, \ + { AC_##K70, AC_##K71, AC_##K72, AC_##K73, AC_##K74, AC_##K75, AC_##K76, AC_##K77 } \ +} + +/* AEK US */ +#define ACTIONMAP_AEK( \ + K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K27, \ + K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \ + K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \ + K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \ + K30, K40, K50, K60, K00, K10, K20 \ +) ACTIONMAP( \ + K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NUHS,K27, \ + K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \ + K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \ + K31, NUBS,K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, ESC, \ + K30, K40, K50, K60, APP, K00, K10, K20 \ +) + +#endif diff --git a/keyboard/alps64/actionmap_hasu.c b/keyboard/alps64/actionmap_hasu.c new file mode 100644 index 00000000..e5aee15d --- /dev/null +++ b/keyboard/alps64/actionmap_hasu.c @@ -0,0 +1,149 @@ +#include +#include "actionmap.h" +#include "action_code.h" +#include "actionmap_common.h" + + +/* + * Actions + */ +#define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer +#define AC_LT1 ACTION_LAYER_TAP_KEY(1, KC_ENTER) // HHKB layer +#define AC_LT2 ACTION_LAYER_TAP_KEY(2, KC_SLASH) // Cursor layer with Slash* +#define AC_LT3 ACTION_LAYER_TAP_KEY(3, KC_SCLN) // Mousekey layer with Semicolon* +#define AC_LT4 ACTION_LAYER_TAP_KEY(4, KC_SPC) // Space Fn +#define AC_LM3 ACTION_LAYER_MOMENTARY(3) // Mousekey layer(IJKL) +#define AC_APSW ACTION_MACRO(ALT_TAB) // Application switching +#define AC_BACK ACTION_MODS_KEY(MOD_LALT, KC_LEFT) +#define AC_FRWD ACTION_MODS_KEY(MOD_LALT, KC_RIGHT) +#define AC_LM5 ACTION_LAYER_MOMENTARY(5) + + +/* + * Macro definition + */ +enum macro_id { + ALT_TAB, +}; +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) { + case ALT_TAB: + return (record->event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; +} + + +const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Default Layer + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc | + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + */ + [0] = ACTIONMAP_AEK( \ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ + LCTL,A, S, D, F, G, H, J, K, L, LT3, QUOT,LT1, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, LT2, RSFT, \ + LCTL,LGUI,LALT, LT4, LM5, LM3, LM1), + /* HHKB mode[HHKB Fn] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` | + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Del | + * |-----------------------------------------------------------| + * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | + * |-----------------------------------------------------------| + * |Shift | | | | | | +| -|End|PgD|Dow|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + */ + [1] = ACTIONMAP_AEK( \ + PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,DEL, \ + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS), + + /* Vi mode[Slash] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del | + * |-----------------------------------------------------------| + * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs| + * |-----------------------------------------------------------| + * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return | + * |-----------------------------------------------------------| + * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + */ + [2] = ACTIONMAP_AEK( \ + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ + TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, TRNS,TRNS,TRNS,DEL, \ + TRNS,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS,ENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS), + + /* Mouse mode(IJKL)[Semicolon] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T| + * |-----------------------------------------------------------| + * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return | + * |-----------------------------------------------------------| + * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel + */ + [3] = ACTIONMAP_AEK( \ + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \ + TRNS,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,TRNS,TRNS,\ + TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,FRWD,TRNS,TRNS, \ + TRNS,TRNS,TRNS, BTN1, TRNS,TRNS,TRNS), + + /* Layer 4: Mouse mode(IJKL)[Space] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T| + * |-----------------------------------------------------------| + * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return | + * |-----------------------------------------------------------| + * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel + */ + [4] = ACTIONMAP_AEK( \ + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ + APSW,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \ + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,MS_L,MS_D,MS_R,BTN1,TRNS,ENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS), + + /* 40% */ + [5] = ACTIONMAP_AEK( \ + TRNS,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS,TRNS,TRNS, \ + TRNS,s(1),s(2),s(3),s(4),s(5),s(6),s(7),s(8),s(9),s(0),TRNS,TRNS,TRNS, \ + TRNS,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS), +}; diff --git a/keyboard/alps64/actionmap_plain.c b/keyboard/alps64/actionmap_plain.c new file mode 100644 index 00000000..4a78b7a1 --- /dev/null +++ b/keyboard/alps64/actionmap_plain.c @@ -0,0 +1,52 @@ +#include +#include "actionmap.h" +#include "action_code.h" +#include "actionmap_common.h" + + +/* + * Actions + */ +#define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer + + +const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Default Layer + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BSpc | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + */ + [0] = ACTIONMAP_AEK( \ + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ + LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \ + LCTL,LGUI,LALT, SPC, RALT,RGUI,LM1), + /* HHKB mode[HHKB Fn] + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` | + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Del | + * |-----------------------------------------------------------| + * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | + * |-----------------------------------------------------------| + * |Shift | | | | | | +| -|End|PgD|Dow|Shift | + * |-----------------------------------------------------------| + * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl | + * `-----------------------------------------------------------' + */ + [1] = ACTIONMAP_AEK( \ + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,DEL, \ + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS), +}; From 81c3c1082a59c70236da56fbda505f1432cf27c6 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 12 Mar 2016 07:49:06 +0900 Subject: [PATCH 145/179] alps64: Fix keymap(plain and editor) --- keyboard/alps64/Makefile.keymap_editor | 1 + keyboard/alps64/keymap_editor.c | 66 ++++++++++++++++++++++++++ keyboard/alps64/keymap_plain.c | 56 +++++----------------- 3 files changed, 79 insertions(+), 44 deletions(-) create mode 100644 keyboard/alps64/keymap_editor.c diff --git a/keyboard/alps64/Makefile.keymap_editor b/keyboard/alps64/Makefile.keymap_editor index d7ad0cc4..08293d5d 100644 --- a/keyboard/alps64/Makefile.keymap_editor +++ b/keyboard/alps64/Makefile.keymap_editor @@ -1,4 +1,5 @@ # build firmware for keymap editor # KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor +KEYMAP = editor include Makefile diff --git a/keyboard/alps64/keymap_editor.c b/keyboard/alps64/keymap_editor.c new file mode 100644 index 00000000..68c629f0 --- /dev/null +++ b/keyboard/alps64/keymap_editor.c @@ -0,0 +1,66 @@ +#include "keymap_common.h" + +#ifdef KEYMAP_SECTION_ENABLE +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { +#else +const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { +#endif + /* 0: qwerty + * ,-----------------------------------------------------------. + * |` | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| #|Bsp| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * |-----------------------------------------------------------| + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | + * |-----------------------------------------------------------| + * |Shft| \| Z| X| C| V| B| N| M| ,| .| /|Shift |Esc| + * |-----------------------------------------------------------' + * |Ctrl|Gui |Alt | Space |App |Alt |Gui |Ctrl | + * `-----------------------------------------------------------' + */ + KEYMAP( \ + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \ + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ + CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,ESC, \ + LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,RCTL), +}; + +#ifdef KEYMAP_SECTION_ENABLE +const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { +#else +const uint16_t fn_actions[] PROGMEM = { +#endif + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_MOMENTARY(3), + [3] = ACTION_LAYER_MOMENTARY(4), + [4] = ACTION_LAYER_MOMENTARY(5), + [5] = ACTION_LAYER_MOMENTARY(6), + [6] = ACTION_LAYER_MOMENTARY(7), + [7] = ACTION_LAYER_TOGGLE(1), + [8] = ACTION_LAYER_TOGGLE(2), + [9] = ACTION_LAYER_TOGGLE(3), + [10] = ACTION_LAYER_TAP_TOGGLE(1), + [11] = ACTION_LAYER_TAP_TOGGLE(2), + [12] = ACTION_LAYER_TAP_TOGGLE(3), + [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), + [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), + [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), + [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), + [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), + [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), + [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), + [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), + [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), + [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), + [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), + [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), + [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), + [26] = ACTION_MODS_ONESHOT(MOD_LCTL), + [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), + [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), + [29] = ACTION_MODS_ONESHOT(MOD_LSFT), + [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), + [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), +}; diff --git a/keyboard/alps64/keymap_plain.c b/keyboard/alps64/keymap_plain.c index d6ff119f..11a43d59 100644 --- a/keyboard/alps64/keymap_plain.c +++ b/keyboard/alps64/keymap_plain.c @@ -1,10 +1,6 @@ #include "keymap_common.h" -#ifdef KEYMAP_SECTION_ENABLE -const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { -#else const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { -#endif /* 0: qwerty * ,-----------------------------------------------------------. * |` | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| #|Bsp| @@ -18,48 +14,20 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { * |Ctrl|Gui |Alt | Space |App |Alt |Gui |Ctrl | * `-----------------------------------------------------------' */ - KEYMAP( \ + [0] = KEYMAP( \ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ - LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,ESC, \ - LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,RCTL), + LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \ + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \ + LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,FN0), + [1] = KEYMAP( \ + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ + CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS,BSPC, \ + TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \ + TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), }; -#ifdef KEYMAP_SECTION_ENABLE -const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { + +const uint16_t fn_actions[] PROGMEM = { [0] = ACTION_LAYER_MOMENTARY(1), - [1] = ACTION_LAYER_MOMENTARY(2), - [2] = ACTION_LAYER_MOMENTARY(3), - [3] = ACTION_LAYER_MOMENTARY(4), - [4] = ACTION_LAYER_MOMENTARY(5), - [5] = ACTION_LAYER_MOMENTARY(6), - [6] = ACTION_LAYER_MOMENTARY(7), - [7] = ACTION_LAYER_TOGGLE(1), - [8] = ACTION_LAYER_TOGGLE(2), - [9] = ACTION_LAYER_TOGGLE(3), - [10] = ACTION_LAYER_TAP_TOGGLE(1), - [11] = ACTION_LAYER_TAP_TOGGLE(2), - [12] = ACTION_LAYER_TAP_TOGGLE(3), - [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH), - [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB), - [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER), - [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), - [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), - [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), - [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), - [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), - [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), - [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), - [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), - [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), - [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), - [26] = ACTION_MODS_ONESHOT(MOD_LCTL), - [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), - [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), - [29] = ACTION_MODS_ONESHOT(MOD_LSFT), - [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE), - [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), }; -#else -const uint16_t fn_actions[] PROGMEM = {}; -#endif From 882059c018a15e1dc64821d51015be8410bfbad5 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 16 Mar 2016 16:17:33 +0900 Subject: [PATCH 146/179] alps64: Use keymap as default instead of actionmap --- keyboard/alps64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboard/alps64/Makefile b/keyboard/alps64/Makefile index 6eadd4f1..c82c126b 100644 --- a/keyboard/alps64/Makefile +++ b/keyboard/alps64/Makefile @@ -113,7 +113,7 @@ 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 -ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes +#ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes ifdef ACTIONMAP_ENABLE From 6527e1d98a3323aaa9ada032395b69128f11842b Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 19 Mar 2016 08:08:49 +0900 Subject: [PATCH 147/179] ps2_usb: Fix for VUSB configuration --- converter/ps2_usb/Makefile.vusb | 5 +++-- converter/ps2_usb/config.h | 23 +++++++++++++++++++++++ tmk_core/protocol/vusb.mk | 1 + tmk_core/protocol/vusb/main.c | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb index d9fa12bc..1f2c209a 100644 --- a/converter/ps2_usb/Makefile.vusb +++ b/converter/ps2_usb/Makefile.vusb @@ -36,7 +36,8 @@ OPT_DEFS += -DDEBUG_LEVEL=0 #MCU = atmega32u4 # Teensy 2.0 #MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb1286 # Teensy++ 2.0 -MCU = atmega168 +#MCU = atmega168 +MCU = atmega328p # Processor frequency. @@ -44,7 +45,7 @@ MCU = atmega168 # so your program will run at the correct speed. You should also set this # variable to same clock speed. The _delay_ms() macro uses this, and many # examples use this variable to calculate timings. Do not add a "UL" here. -F_CPU = 20000000 +F_CPU = 12000000 # Build Options diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h index c0a4fab1..35eb414f 100644 --- a/converter/ps2_usb/config.h +++ b/converter/ps2_usb/config.h @@ -61,6 +61,7 @@ along with this program. If not, see . * PS/2 Pin interrupt */ #ifdef PS2_USE_INT +#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) /* uses INT1 for clock line(ATMega32U4) */ #define PS2_CLOCK_PORT PORTD #define PS2_CLOCK_PIN PIND @@ -81,6 +82,28 @@ along with this program. If not, see . EIMSK &= ~(1< Date: Sat, 26 Mar 2016 22:40:45 -0400 Subject: [PATCH 148/179] clarify layer documentation --- tmk_core/doc/keymap.md | 67 +++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index 566936c6..572cf2f8 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -3,9 +3,9 @@ Keymap framework - how to define your keymap ***NOTE: This is not final version, may be inconsistent with source code and changed occasionally for a while.*** ## 0. Keymap and layers -**Keymap** is comprised of multiple layers of key layout, you can define **32 layers** at most. -**Layer** is an array of **keycodes** to define **actions** for each physical keys. -respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence. +The **keymap** is an array composed of one or more layers. +Each **layer** is an array of **keycodes**, defining **actions** for each physical key. +Layers can be activated and deactivated independently. Multiple layers may be active at once, resulting in the currently-active **layer state**. Each layer has an index between 0-31. As active layers are stacked together, higher layers take precedence over lower layers. Keymap: 32 Layers Layer: Keycode matrix ----------------- --------------------- @@ -21,14 +21,35 @@ respective layers can be validated simultaneously. Layers are indexed with 0 to 1 /___________// | 1 `-------------------------- 0 /___________/ V low 0 `-------------------------- +**Note:** The keymap array is limited to **32 layers**. -### 0.1 Keymap status -Keymap has its state in two parameters: -**`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit. -Keymap layer '0' is usually `default_layer` and which is the only valid layer and other layers is initially off after boot up firmware, though, you can configured them in `config.h`. -To change `default_layer` will be useful when you switch key layout completely, say you want Colmak instead of Qwerty. +### 0.1 Layer state +The current keymap layer state is determined by two parameters: the *default layer*, and the individual *layer states*. Changing the default layer is useful for switching key layouts completely; for example, switching to Dvorak, Colemak or Workman instead of QWERTY. Individual layer states, on the other hand, can be used to overlay the base layer with other functions such as navigation keys, function keys (F1-F12), media keys or other actions. + +Because the default layer is really just a special case affecting the overall layer state, it is important to first understand how the layer state is determined. + +#### 0.1.1 The layer state +The **layer state** indicates the current on/off status of all layers. It is defined in the firmware by a 32-bit integer, `layer_state`, which stores each layer's on/off status in a single bit: 0 for off, 1 for on. As layers are activated and deactivated, their respective bits are flipped, changing the value of `layer_state`. + + Overlay feature layer + --------------------- bit|status + ____________ ---+------ + 31 / / 31 | 0 + 30 /___________// -----> 30 | 1 + 29 /___________/ -----> 29 | 1 + : : | : + : ____________ : | : + 2 / / 2 | 0 + ,->1 /___________/ -----> 1 | 1 + | 0 0 | 0 + | + + `--- default_layer = 1 | + layer_state = 0x60000002 <-' + +#### 0.1.2 The default layer +The **default layer** is the base keymap layer (0-31) which is always active and considered the "bottom" of the stack. When the firmware boots, the default layer is the only active layer. It is set to layer 0 by default, though this can be changed ~~in *config.h*~~ via Boot Magic settings. Initial state of Keymap Change base layout ----------------------- ------------------ @@ -45,22 +66,22 @@ To change `default_layer` will be useful when you switch key layout completely, `--- default_layer = 0 `--- default_layer = 1 layer_state = 0x00000001 layer_state = 0x00000002 -On the other hand, you shall change `layer_state` to overlay base layer with some layers for feature such as navigation keys, function key(F1-F12), media keys or special actions. +Note that the `default_layer_state` variable only determines the lowest value to which `layer_state` may be set, and that `default_layer_state` is used by the core firmware when determining the starting value of `layer_state` before applying changes. In other words, the default layer will *always* be set to *on* in `layer_state`. - Overlay feature layer - --------------------- bit|status - ____________ ---+------ - 31 / / 31 | 0 - 30 /___________// -----> 30 | 1 - 29 /___________/ -----> 29 | 1 - : : | : - : ____________ : | : - 2 / / 2 | 0 - ,->1 /___________/ -----> 1 | 1 - | 0 0 | 0 - | + - `--- default_layer = 1 | - layer_state = 0x60000002 <-' +The default layer is defined in the firmware by the `default_layer_state` variable, which is identical in format to the `layer_state` variable exlpained above. The value may be changed using the following functions: + +- `default_layer_state_set(state)` sets the state to the specified 32-bit integer value. +- AND/OR/XOR functions set the state based on a boolean logic comparison between the current state and the specified 32-bit integer value: + - `default_layer_state_and(state)` + - `default_layer_state_or(state)` + - `default_layer_state_xor(state)` + +For example, to set layer 3 as the default layer: + +```C +// convert 3 to a 32-bit unsigned long value, and set the default layer +default_layer_state_set(1UL<<3); +``` From fd4d342568d613438879efdd9e3151f06d75c5f5 Mon Sep 17 00:00:00 2001 From: Nick Bair Date: Sat, 26 Mar 2016 22:51:52 -0400 Subject: [PATCH 149/179] Clarify layer precedence --- tmk_core/doc/keymap.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index 572cf2f8..80ea793c 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -86,11 +86,12 @@ default_layer_state_set(1UL<<3); ### 0.2 Layer Precedence and Transparency -Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred. +Note that ***higher layers have priority in the layer stack***. The firmware starts at the topmost active layer, and works down to the bottom to find the an active keycode. Once the search encounters any keycode other than **`KC_TRNS`** (transparent) on an active layer, the search is halted and the remaining lower layers aren't examined, even if they are active. + +**Note:** a layer must be activated before it may be included in the stack search. + +`KC_TRNS` is a special placeholder which can be used on overlay layers. This allows for the creation of "partial" layers which fall back on the lower layers, eliminating a good deal of repetition in keymap files. -You can place `KC_TRNS` on overlay layer changes just part of layout to fall back on lower or base layer. -Key with `KC_TRANS` doesn't has its own keycode and refers to lower valid layers for keycode, instead. -See example below. ### 0.3 Keymap Example From b17d2d176c2ba3460cf101d3b45b24653a952955 Mon Sep 17 00:00:00 2001 From: Nick Bair Date: Sat, 26 Mar 2016 23:06:13 -0400 Subject: [PATCH 150/179] Clean up wording in keymap example --- tmk_core/doc/keymap.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index 80ea793c..4c9b974c 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -95,17 +95,17 @@ Note that ***higher layers have priority in the layer stack***. The firmware sta ### 0.3 Keymap Example -Keymap is **`keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array. +The keymap is defined in the **`keymaps[]`** array, a 2-dimensional array of rows and columns corresponding to positions in the keyboard matrix. But most often the layers are defined using C macros to allow for easier reading and editing of the keymap files. To use complex actions you need to define `Fn` keycodes in the **`fn_actions[]`** array. -This is a keymap example for [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. -This example has three layers, 'Qwerty' as base layer, 'Cursor' and 'Mousekey'. +This is a keymap example for the [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. +This example has three layers: the QWERTY base layer, and two overlay layers for cursor and mousekey control, respectively. In this example, - `Fn0` is a **momentary layer switching** key, you can use keys on Cursor layer while holding the key. + `Fn0` is a **momentary layer switching** key--you can use keys on the Cursor layer while holding the key. - `Fn1` is a momentary layer switching key with tapping feature, you can get semicolon **';'** with taping the key and switch layers while holding the key. The word **'tap'** or **'tapping'** mean to press and release a key quickly. + `Fn1` is a momentary layer switching key with tapping function--tapping the key as one would normally use it, sends the semicolon **';'** keycode, while holding the key down switches layers. - `Fn2` is a **toggle layer switch** key, you can stay switched layer after releasing the key unlike momentary switching. + `Fn2` is a **toggle layer switch** key--pressing the key toggles the layer on until you press it again. You can find other keymap definitions in file `keymap.c` located on project directories. From 24cee117d0abe1e8ba9a136f6908f10c30a11bb9 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 29 Mar 2016 06:58:58 +0900 Subject: [PATCH 151/179] core: Fix media/consumer keys --- tmk_core/common/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index 134e01c2..25161748 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -142,7 +142,7 @@ static action_t keycode_to_action(uint8_t keycode) case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); break; - case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: + case KC_AUDIO_MUTE ... KC_WWW_FAVORITES: action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); break; case KC_MS_UP ... KC_MS_ACCEL2: From 1414ea35315a4bb867e031d0b085f1a966fbeabf Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 29 Mar 2016 07:00:56 +0900 Subject: [PATCH 152/179] hhkb: Fix name of consumer keys --- keyboard/hhkb/rn42/rn42.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboard/hhkb/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c index 6fabf99f..710169ef 100644 --- a/keyboard/hhkb/rn42/rn42.c +++ b/keyboard/hhkb/rn42/rn42.c @@ -184,9 +184,9 @@ static void send_system(uint16_t data) static uint16_t usage2bits(uint16_t usage) { switch (usage) { - case AC_HOME: return 0x01; - case AL_EMAIL: return 0x02; - case AC_SEARCH: return 0x04; + case APPCONTROL_HOME: return 0x01; + case APPLAUNCH_EMAIL: return 0x02; + case APPCONTROL_SEARCH: return 0x04; //case AL_KBD_LAYOUT: return 0x08; // Apple virtual keybaord toggle case AUDIO_VOL_UP: return 0x10; case AUDIO_VOL_DOWN: return 0x20; From 532e85075184ad6d99e83959e2783b0c2858d779 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 29 Mar 2016 07:10:17 +0900 Subject: [PATCH 153/179] hhkb: Add Makefile.rn42.jp --- keyboard/hhkb/Makefile.rn42.jp | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 keyboard/hhkb/Makefile.rn42.jp diff --git a/keyboard/hhkb/Makefile.rn42.jp b/keyboard/hhkb/Makefile.rn42.jp new file mode 100644 index 00000000..a3494e96 --- /dev/null +++ b/keyboard/hhkb/Makefile.rn42.jp @@ -0,0 +1,3 @@ +HHKB_JP = yes +include Makefile.rn42 + From e3994a620b430df62ca675d433be8a11a79ba7f3 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 29 Mar 2016 10:52:25 +0900 Subject: [PATCH 154/179] x68k_usb: Change config for TMK converter --- converter/x68k_usb/Makefile | 34 ++++++++++++++++++++++++++------ converter/x68k_usb/config_pjrc.h | 3 ++- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile index 60e9a574..fd2eb199 100644 --- a/converter/x68k_usb/Makefile +++ b/converter/x68k_usb/Makefile @@ -4,7 +4,7 @@ # Target file name (without extension). -TARGET = x68k_usb_pjrc +TARGET = x68k_usb # Directory common source filess exist TMK_DIR = ../../tmk_core @@ -24,9 +24,10 @@ CONFIG_H = config_pjrc.h # MCU name, you MUST set this to match the board you are using # type "make clean" after changing this, so all files will be rebuilt #MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 +#MCU = atmega32u4 # Teensy 2.0 #MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb1286 # Teensy++ 2.0 +MCU = atmega32u2 # Teensy 2.0 # Processor frequency. @@ -37,6 +38,29 @@ MCU = atmega32u4 # Teensy 2.0 F_CPU = 16000000 +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + # Boot Section Size in bytes # Teensy halfKay 512 # Atmel DFU loader 4096 @@ -85,9 +109,7 @@ AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) -#PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) -#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex -PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex +PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) # Search Path @@ -95,7 +117,7 @@ VPATH += $(TARGET_DIR) VPATH += $(TMK_DIR) -include $(TMK_DIR)/protocol/pjrc.mk include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/protocol/lufa.mk include $(TMK_DIR)/common.mk include $(TMK_DIR)/rules.mk diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h index c49b4a73..77989fe3 100644 --- a/converter/x68k_usb/config_pjrc.h +++ b/converter/x68k_usb/config_pjrc.h @@ -21,6 +21,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6800 +#define DEVICE_VER 0x0001 #define MANUFACTURER t.m.k. #define PRODUCT SHARP X68000 keyboard converter #define DESCRIPTION converts SHARP X68000 keyboard protocol into USB @@ -45,7 +46,7 @@ along with this program. If not, see . /* USART configuration * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control */ -#ifdef __AVR_ATmega32U4__ +#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) #define SERIAL_UART_BAUD 2400 #define SERIAL_UART_DATA UDR1 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) From 5a2a781fc9ef32ffd80626dddede12b8d49cc138 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 29 Mar 2016 11:15:09 +0900 Subject: [PATCH 155/179] next_usb: Stop debug print while no keyboard --- converter/next_usb/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/next_usb/matrix.c b/converter/next_usb/matrix.c index d91cd257..524d5784 100644 --- a/converter/next_usb/matrix.c +++ b/converter/next_usb/matrix.c @@ -187,7 +187,7 @@ uint8_t matrix_scan(void) uint32_t resp = (next_kbd_recv()); - if (resp == NEXT_KBD_KMBUS_IDLE) + if (!resp || resp == NEXT_KBD_KMBUS_IDLE) { return 0; } From 0a0463aad2f1a96551ce32d33392f320895c6bb7 Mon Sep 17 00:00:00 2001 From: Grant Rettke Date: Mon, 11 Apr 2016 15:39:23 -0500 Subject: [PATCH 156/179] Extenal -> External --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f03c9165..f2a28413 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ 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 +### External projects using tmk_keyboard * [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org] * [mcdox][mcdox_tmk] - [mcdox][mcdox] From 7613efca999f1b0b90c57cedfa67eda1161b8d44 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 13 Apr 2016 14:26:52 +0900 Subject: [PATCH 157/179] adb_usb: Fix for ISO swapped keys(issue #35) --- converter/adb_usb/keymap_common.h | 76 ++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h index bdca38e1..bc99ab72 100644 --- a/converter/adb_usb/keymap_common.h +++ b/converter/adb_usb/keymap_common.h @@ -93,10 +93,10 @@ extern const uint16_t fn_actions[]; */ #define KEYMAP_EXT_ISO( \ K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ - K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ + K0A,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, K56,K57,K58,K45, \ - K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ + K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ @@ -121,21 +121,21 @@ extern const uint16_t fn_actions[]; /* M0116 Apple Standard Keyboard ANSI -* +-------+ -* | power | -* +-------+ -* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+ -* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * | -* +---------------------------------------------------------+ +---+---+---+---+ -* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + | -* +-----------------------------------------------------+ | +---+---+---+---+ -* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - | -* +---------------------------------------------------------+ +---+---+---+---+ -* | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | | -* +---------------------------------------------------------+ +-------+---|ent| -* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | | -* +---------------------------------------------------------+ +-------+---+---+ -*/ + * +-------+ + * | power | + * +-------+ + * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+ + * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * | + * +---------------------------------------------------------+ +---+---+---+---+ + * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + | + * +-----------------------------------------------------+ | +---+---+---+---+ + * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - | + * +---------------------------------------------------------+ +---+---+---+---+ + * | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | | + * +---------------------------------------------------------+ +-------+---|ent| + * |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | | + * +---------------------------------------------------------+ +-------+---+---+ + */ #define KEYMAP_M0116_ANSI( \ K7F, \ K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \ @@ -162,6 +162,48 @@ extern const uint16_t fn_actions[]; { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \ } +/* M0118 Apple Standard Keyboard ISO + * +-------+ + * | power | + * +-------+ + * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+ + * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * | + * +---------------------------------------------------------+ +---+---+---+---+ + * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |Ret| | 7 | 8 | 9 | + | + * +-----------------------------------------------------` | +---+---+---+---+ + * | caps | a | s | d | f | g | h | j | k | l | ; | ' | # | | | 4 | 5 | 6 | - | + * +---------------------------------------------------------+ +---+---+---+---+ + * |shif| \ | z | x | c | v | b | n | m | , | . | / |Shif| up| | 1 | 2 | 3 | | + * +---------------------------------------------------------+ +-------+---|ent| + * |ctrl|opt |comnd| |comnd |lef|rig|dwn| | 0 | . | | + * +---------------------------------------------------------+ +-------+---+---+ + */ +#define KEYMAP_M0118_ISO( \ + K7F, \ + K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \ + K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \ + K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A,K24, K56,K57,K58,K4E, \ + K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K7B,K3E, K53,K54,K55, \ + K36,K3A,K37, K31, K3B,K3C,K3D, K52, K41,K4C \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ + { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ + { KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \ + { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \ + { KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ + { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_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, KC_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, KC_NO }, \ + { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \ +} + #endif From 71381457fa1311dfa0b58ba882a96db740640871 Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 21 Apr 2016 14:35:48 +0900 Subject: [PATCH 158/179] Squashed 'tmk_core/' changes from ee8c5ba..d5c5ac6 d5c5ac6 Merge branch 'develop' 5957682 Merge branch 'hotfix-mediakey' a478c62 Merge branch 'hotfix-vusb' cccebfe Merge branch 'njbair-docfix' 0aaab57 Clean up wording in keymap example dc8bbc3 Clarify layer precedence 9e0b4c1 clarify layer documentation 915eb48 core: Fix media/consumer keys 88f90f3 Fix for VUSB configuration 3e290cd Fix including board.mk in chibios.mk 32c69e0 Merge branch 'newapi' into develop c9a56f9 Merge remote-tracking branch 'flabbergast/chibios' into develop 01e33ea Fix chibios and mbed common.mk for hook.c bea79d9 hook: Change func name of usb events 3e97536 hook: Change file and func names(*_hook -> hook_*) c286d8c Merge pull request #10 from fredizzimo/chibios-contrib2 062d74e Update ChibiOS instructions d47150f Add support for new version of ChibiOS and Contrib 62b5401 Chibios: disable LTO (link-time optimisation). c64e9aa hooks: Fix for LUFA 54e68b0 hooks: Remove led_restore_hook 325c09d Chibios: make the default bootloader_jump redefinable (weak). 078c722 Chibios: fix STM32_BOOTLOADER_ADDRESS name. e73cfe5 hooks: Fix for keyboard LED update e6120c5 Implement basic hooks. 7c370e9 Chibios: Update the main chibios README. 7f0198d Chibios: implement sleep LED for STM32. afef9b4 Fix hard-coded path of CHIBIOS 95c5b19 Merge pull request #7 from fredizzimo/sysvsize 27128a8 Sysv format for ChibiOS arm-none-eabi-size d4b8e68 core: Fix chibios user compile options b85d462 Merge branch 'chibios' of https://github.com/flabbergast/tmk_keyboard into flabbergast_chibios de41aa1 core: Fix ps2_mouse.c debug print d79d925 Removed duplicate debug message code and surrounded it with IFDEF as needed 8f28589 Chibios: Revert common.mk change (fix AVR linking problem). ec9eff2 Chibios: cleanup usb_main code. 28c4665 Chibios: Fix a HardFault bug (wait after start). git-subtree-dir: tmk_core git-subtree-split: d5c5ac63e60dfc6da6661a21bd968b4d577a27d5 --- common.mk | 1 + common/action.c | 2 + common/action_layer.c | 2 + common/bootmagic.c | 4 ++ common/chibios/bootloader.c | 1 + common/chibios/sleep_led.c | 74 ++++++++++++++++++++++++++++--- common/hook.c | 61 +++++++++++++++++++++++++ common/hook.h | 74 +++++++++++++++++++++++++++++++ common/keyboard.c | 13 ++++-- common/keymap.c | 2 +- doc/keymap.md | 88 +++++++++++++++++++++++-------------- protocol/chibios/README.md | 34 ++++++++------ protocol/chibios/main.c | 37 +++++++++++++--- protocol/chibios/usb_main.c | 37 +++++++++++----- protocol/chibios/usb_main.h | 6 +-- protocol/lufa/lufa.c | 56 +++++++++++++++++------ protocol/ps2_mouse.c | 6 +-- protocol/vusb.mk | 1 + protocol/vusb/main.c | 2 +- tool/chibios/chibios.mk | 58 +++++++++++++++++------- tool/chibios/common.mk | 5 ++- tool/mbed/common.mk | 1 + 22 files changed, 446 insertions(+), 119 deletions(-) create mode 100644 common/hook.c create mode 100644 common/hook.h diff --git a/common.mk b/common.mk index 4c943f04..6d4be85f 100644 --- a/common.mk +++ b/common.mk @@ -10,6 +10,7 @@ SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/print.c \ $(COMMON_DIR)/debug.c \ $(COMMON_DIR)/util.c \ + $(COMMON_DIR)/hook.c \ $(COMMON_DIR)/avr/suspend.c \ $(COMMON_DIR)/avr/xprintf.S \ $(COMMON_DIR)/avr/timer.c \ diff --git a/common/action.c b/common/action.c index 339b3ee6..b9040f5b 100644 --- a/common/action.c +++ b/common/action.c @@ -26,6 +26,7 @@ along with this program. If not, see . #include "action_macro.h" #include "action_util.h" #include "action.h" +#include "hook.h" #ifdef DEBUG_ACTION #include "debug.h" @@ -39,6 +40,7 @@ void action_exec(keyevent_t event) if (!IS_NOEVENT(event)) { dprint("\n---- action_exec: start -----\n"); dprint("EVENT: "); debug_event(event); dprintln(); + hook_matrix_change(event); } keyrecord_t record = { .event = event }; diff --git a/common/action_layer.c b/common/action_layer.c index c535615f..0c1d5d21 100644 --- a/common/action_layer.c +++ b/common/action_layer.c @@ -3,6 +3,7 @@ #include "action.h" #include "util.h" #include "action_layer.h" +#include "hook.h" #ifdef DEBUG_ACTION #include "debug.h" @@ -62,6 +63,7 @@ static void layer_state_set(uint32_t state) dprint("layer_state: "); layer_debug(); dprint(" to "); layer_state = state; + hook_layer_change(layer_state); layer_debug(); dprintln(); clear_keyboard_but_mods(); // To avoid stuck keys } diff --git a/common/bootmagic.c b/common/bootmagic.c index 08241f7d..056806f2 100644 --- a/common/bootmagic.c +++ b/common/bootmagic.c @@ -9,6 +9,7 @@ #include "action_layer.h" #include "eeconfig.h" #include "bootmagic.h" +#include "hook.h" keymap_config_t keymap_config; @@ -40,6 +41,9 @@ void bootmagic(void) bootloader_jump(); } + /* user-defined checks */ + hook_bootmagic(); + /* debug enable */ debug_config.raw = eeconfig_read_debug(); if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { diff --git a/common/chibios/bootloader.c b/common/chibios/bootloader.c index c8888f3c..8a533ab6 100644 --- a/common/chibios/bootloader.c +++ b/common/chibios/bootloader.c @@ -42,5 +42,6 @@ void bootloader_jump(void) { #endif /* defined(KIIBOHD_BOOTLOADER) */ #else /* neither STM32 nor KINETIS */ +__attribute__((weak)) void bootloader_jump(void) {} #endif \ No newline at end of file diff --git a/common/chibios/sleep_led.c b/common/chibios/sleep_led.c index 50cf4eb7..4c35cfcb 100644 --- a/common/chibios/sleep_led.c +++ b/common/chibios/sleep_led.c @@ -4,11 +4,27 @@ #include "led.h" #include "sleep_led.h" -#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ -/* All right, we go the "software" way: LP timer, toggle LED in interrupt. +/* All right, we go the "software" way: timer, toggle LED in interrupt. * Based on hasu's code for AVRs. + * Use LP timer on Kinetises, TIM14 on STM32F0. */ +#if defined(KL2x) || defined(K20x) + +/* Use Low Power Timer (LPTMR) */ +#define TIMER_INTERRUPT_VECTOR KINETIS_LPTMR0_IRQ_VECTOR +#define RESET_COUNTER LPTMR0->CSR |= LPTMRx_CSR_TCF + +#elif defined(STM32F0XX) + +/* Use TIM14 manually */ +#define TIMER_INTERRUPT_VECTOR STM32_TIM14_HANDLER +#define RESET_COUNTER STM32_TIM14->SR &= ~STM32_TIM_SR_UIF + +#endif + +#if defined(KL2x) || defined(K20x) || defined(STM32F0XX) /* common parts for timers/interrupts */ + /* Breathing Sleep LED brighness(PWM On period) table * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle * @@ -22,8 +38,8 @@ static const uint8_t breathing_table[64] = { 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -/* Low Power Timer interrupt handler */ -OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { +/* interrupt handler */ +OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) { OSAL_IRQ_PROLOGUE(); /* Software PWM @@ -55,11 +71,16 @@ OSAL_IRQ_HANDLER(KINETIS_LPTMR0_IRQ_VECTOR) { } /* Reset the counter */ - LPTMR0->CSR |= LPTMRx_CSR_TCF; + RESET_COUNTER; OSAL_IRQ_EPILOGUE(); } +#endif /* common parts for known platforms */ + + +#if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ + /* LPTMR clock options */ #define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ #define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ @@ -144,7 +165,48 @@ void sleep_led_toggle(void) { LPTMR0->CSR ^= LPTMRx_CSR_TEN; } -#else /* platform selection: not on familiar Kinetis chips */ +#elif defined(STM32F0XX) /* platform selection: STM32F0XX */ + +/* Initialise the timer */ +void sleep_led_init(void) { + /* enable clock */ + rccEnableTIM14(FALSE); /* low power enable = FALSE */ + rccResetTIM14(); + + /* prescale */ + /* Assuming 48MHz internal clock */ + /* getting cca 65484 irqs/sec */ + STM32_TIM14->PSC = 733; + + /* auto-reload */ + /* 0 => interrupt every time */ + STM32_TIM14->ARR = 3; + + /* enable counter update event interrupt */ + STM32_TIM14->DIER |= STM32_TIM_DIER_UIE; + + /* register interrupt vector */ + nvicEnableVector(STM32_TIM14_NUMBER, 2); /* vector, priority */ +} + +void sleep_led_enable(void) { + /* Enable the timer */ + STM32_TIM14->CR1 = STM32_TIM_CR1_CEN | STM32_TIM_CR1_URS; + /* URS => update event only on overflow; setting UG bit disabled */ +} + +void sleep_led_disable(void) { + /* Disable the timer */ + STM32_TIM14->CR1 = 0; +} + +void sleep_led_toggle(void) { + /* Toggle the timer */ + STM32_TIM14->CR1 ^= STM32_TIM_CR1_CEN; +} + + +#else /* platform selection: not on familiar chips */ void sleep_led_init(void) { } diff --git a/common/hook.c b/common/hook.c new file mode 100644 index 00000000..204407b7 --- /dev/null +++ b/common/hook.c @@ -0,0 +1,61 @@ +/* +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 "keyboard.h" +#include "hook.h" + +/* ------------------------------------------------- + * Definitions of hardware-independent default hooks + * ------------------------------------------------- */ + +/* Called on layer state change event. */ +/* Default behaviour: do nothing. */ +__attribute__((weak)) +void hook_layer_change(uint8_t layer_state) { + (void)layer_state; +} + +/* Called periodically from the matrix scan loop (very often!) */ +/* Default behaviour: do nothing. */ +__attribute__((weak)) +void hook_keyboard_loop(void) {} + +/* Called on matrix state change event (every keypress => often!) */ +/* Default behaviour: do nothing. */ +__attribute__((weak)) +void hook_matrix_change(keyevent_t event) { + (void)event; +} + +/* Called on indicator LED update event (when reported from host). */ +/* Default behaviour: calls led_set (for compatibility). */ +__attribute__((weak)) +void hook_keyboard_leds_change(uint8_t led_status) { + keyboard_set_leds(led_status); +} + +/* Called once, on checking the bootmagic combos. */ +/* Default behaviour: do nothing. */ +__attribute__((weak)) +void hook_bootmagic(void) { + /* An example: */ + // #include "bootmagic.h" + // #include "keymap.h" + // if(bootmagic_scan_keycode(KC_W)) { + // // do something + // } +} diff --git a/common/hook.h b/common/hook.h new file mode 100644 index 00000000..ff569d49 --- /dev/null +++ b/common/hook.h @@ -0,0 +1,74 @@ +/* +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 . +*/ + +#ifndef _HOOKS_H_ +#define _HOOKS_H_ + +#include "keyboard.h" +#include "led.h" + +/* ------------------------------------- + * Hardware / one-off hooks + * ------------------------------------- */ + +/* Called once, before initialising USB. */ +/* Default behaviour: do nothing. */ +void hook_early_init(void); + +/* Called once, after USB is connected and keyboard initialised. */ +/* Default behaviour: do nothing. */ +void hook_late_init(void); + +/* Called once, on getting SUSPEND event from USB. */ +/* Default behaviour: do nothing. */ +void hook_usb_suspend_entry(void); + +/* Called repeatedly during the SUSPENDed state. */ +/* Default behaviour: power down and periodically check + * the matrix, cause wakeup if needed. */ +void hook_usb_suspend_loop(void); + +/* Called once, on getting WAKE event from USB. */ +/* Default behaviour: disables sleep LED breathing and restores + * the "normal" indicator LED status by default. */ +void hook_usb_wakeup(void); + +/* Called once, on checking the bootmagic combos. */ +/* Default behaviour: do nothing. */ +void hook_bootmagic(void); + +/* ------------------------------------- + * Keyboard / periodic hooks + * ------------------------------------- */ + +/* Called periodically from the keyboard loop (very often!) */ +/* Default behaviour: do nothing. */ +void hook_keyboard_loop(void); + +/* Called on matrix state change event (every keypress => often!) */ +/* Default behaviour: do nothing. */ +void hook_matrix_change(keyevent_t event); + +/* Called on layer state change event. */ +/* Default behaviour: do nothing. */ +void hook_layer_change(uint8_t layer_state); + +/* Called on indicator LED update event (when reported from host). */ +/* Default behaviour: calls keyboard_set_leds (for compatibility). */ +void hook_keyboard_leds_change(uint8_t led_status); + +#endif /* _HOOKS_H_ */ diff --git a/common/keyboard.c b/common/keyboard.c index eb7b096b..707351bc 100644 --- a/common/keyboard.c +++ b/common/keyboard.c @@ -30,6 +30,7 @@ along with this program. If not, see . #include "bootmagic.h" #include "eeconfig.h" #include "backlight.h" +#include "hook.h" #ifdef MOUSEKEY_ENABLE # include "mousekey.h" #endif @@ -128,11 +129,13 @@ void keyboard_task(void) if (debug_matrix) matrix_print(); for (uint8_t c = 0; c < MATRIX_COLS; c++) { if (matrix_change & ((matrix_row_t)1<1 /___________/ - ,->0 /___________/ | 0 - | | - `--- default_layer = 0 `--- default_layer = 1 - layer_state = 0x00000001 layer_state = 0x00000002 - -On the other hand, you shall change `layer_state` to overlay base layer with some layers for feature such as navigation keys, function key(F1-F12), media keys or special actions. +#### 0.1.1 The layer state +The **layer state** indicates the current on/off status of all layers. It is defined in the firmware by a 32-bit integer, `layer_state`, which stores each layer's on/off status in a single bit: 0 for off, 1 for on. As layers are activated and deactivated, their respective bits are flipped, changing the value of `layer_state`. Overlay feature layer --------------------- bit|status @@ -62,28 +48,64 @@ On the other hand, you shall change `layer_state` to overlay base layer with som `--- default_layer = 1 | layer_state = 0x60000002 <-' +#### 0.1.2 The default layer +The **default layer** is the base keymap layer (0-31) which is always active and considered the "bottom" of the stack. When the firmware boots, the default layer is the only active layer. It is set to layer 0 by default, though this can be changed ~~in *config.h*~~ via Boot Magic settings. + + Initial state of Keymap Change base layout + ----------------------- ------------------ + + 31 31 + 30 30 + 29 29 + : : + : : ____________ + 2 ____________ 2 / / + 1 / / ,->1 /___________/ + ,->0 /___________/ | 0 + | | + `--- default_layer = 0 `--- default_layer = 1 + layer_state = 0x00000001 layer_state = 0x00000002 + +Note that the `default_layer_state` variable only determines the lowest value to which `layer_state` may be set, and that `default_layer_state` is used by the core firmware when determining the starting value of `layer_state` before applying changes. In other words, the default layer will *always* be set to *on* in `layer_state`. + +The default layer is defined in the firmware by the `default_layer_state` variable, which is identical in format to the `layer_state` variable exlpained above. The value may be changed using the following functions: + +- `default_layer_state_set(state)` sets the state to the specified 32-bit integer value. +- AND/OR/XOR functions set the state based on a boolean logic comparison between the current state and the specified 32-bit integer value: + - `default_layer_state_and(state)` + - `default_layer_state_or(state)` + - `default_layer_state_xor(state)` + +For example, to set layer 3 as the default layer: + +```C +// convert 3 to a 32-bit unsigned long value, and set the default layer +default_layer_state_set(1UL<<3); +``` + ### 0.2 Layer Precedence and Transparency -Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred. +Note that ***higher layers have priority in the layer stack***. The firmware starts at the topmost active layer, and works down to the bottom to find the an active keycode. Once the search encounters any keycode other than **`KC_TRNS`** (transparent) on an active layer, the search is halted and the remaining lower layers aren't examined, even if they are active. + +**Note:** a layer must be activated before it may be included in the stack search. + +`KC_TRNS` is a special placeholder which can be used on overlay layers. This allows for the creation of "partial" layers which fall back on the lower layers, eliminating a good deal of repetition in keymap files. -You can place `KC_TRNS` on overlay layer changes just part of layout to fall back on lower or base layer. -Key with `KC_TRANS` doesn't has its own keycode and refers to lower valid layers for keycode, instead. -See example below. ### 0.3 Keymap Example -Keymap is **`keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array. +The keymap is defined in the **`keymaps[]`** array, a 2-dimensional array of rows and columns corresponding to positions in the keyboard matrix. But most often the layers are defined using C macros to allow for easier reading and editing of the keymap files. To use complex actions you need to define `Fn` keycodes in the **`fn_actions[]`** array. -This is a keymap example for [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. -This example has three layers, 'Qwerty' as base layer, 'Cursor' and 'Mousekey'. +This is a keymap example for the [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard. +This example has three layers: the QWERTY base layer, and two overlay layers for cursor and mousekey control, respectively. In this example, - `Fn0` is a **momentary layer switching** key, you can use keys on Cursor layer while holding the key. + `Fn0` is a **momentary layer switching** key--you can use keys on the Cursor layer while holding the key. - `Fn1` is a momentary layer switching key with tapping feature, you can get semicolon **';'** with taping the key and switch layers while holding the key. The word **'tap'** or **'tapping'** mean to press and release a key quickly. + `Fn1` is a momentary layer switching key with tapping function--tapping the key as one would normally use it, sends the semicolon **';'** keycode, while holding the key down switches layers. - `Fn2` is a **toggle layer switch** key, you can stay switched layer after releasing the key unlike momentary switching. + `Fn2` is a **toggle layer switch** key--pressing the key toggles the layer on until you press it again. You can find other keymap definitions in file `keymap.c` located on project directories. diff --git a/protocol/chibios/README.md b/protocol/chibios/README.md index 9796f8c7..81f115ad 100644 --- a/protocol/chibios/README.md +++ b/protocol/chibios/README.md @@ -1,21 +1,30 @@ ## TMK running on top of ChibiOS +This code can be used to run TMK keyboard logic on top of [ChibiOS], meaning that you can run TMK on whatever [ChibiOS] supports. The notable examples are ARM-based Teensies (3.x and LC) and on the boards with STM32 MCUs. + +### Usage + +- To use, unpack or symlink [ChibiOS] to `tmk_core/tool/chibios/chibios`. For Kinetis support (this means Teensies, Infinity keyboard, WhiteFox keyboard), you'll need a fork which implements the USB driver, e.g. [this one](https://github.com/flabbergast/ChibiOS/tree/kinetis). +- You will also need to install an ARM toolchain, for instance from [here](https://launchpad.net/gcc-arm-embedded). On linux, this is usually also present as a package for your distribution (as `gcc-arm` or something similar). On OS X, you can use [homebrew](http://brew.sh/) with an appropriate tap. + ### Notes -- To use, unpack or symlink [ChibiOS] {currently 3.0.2} to `tmk_core/tool/chibios/chibios`. For Kinetis support, you'll need a fork which implements the USB driver, e.g. [this one](https://github.com/flabbergast/ChibiOS/tree/kinetis). +- Some comments about ChibiOS syntax and the most commonly used GPIO functions are, as well as an example for ARM Teensies, is [here](https://github.com/tmk/tmk_keyboard/blob/master/keyboard/teensy_lc_onekey/instructions.md). - For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. -- There are some random constants left so far, e.g. 5ms sleep between calling `keyboard_task`, or 1.5sec wait for USB init, in `main.c`. There should be no such in `usb_main.c` (the main USB stack). Everything is based on timers/interrupts/kernel scheduling (well except `keyboard_task`), so no periodically called things (again, except `keyboard_task`, which is just how TMK is designed). - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. -- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. Also, a patch to upstream ChibiOS is needed (supplied), because it `ResetHandler` needs adjusting. -- Sleep LED works, but at the moment only on/off, i.e. no breathing. +- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. An additional startup code is also needed; the best way to deal with this is to define custom board files. (Example forthcoming.) + +### Experimental pre-ChibiOS 4 support +- As an alternative to the mentioned flabbergast branch above, you can use the [master branch of ChibiOS](https://github.com/ChibiOS/ChibiOS). +- Note that the Kinetis support has moved to the [ChibiOS-Contrib repository](https://github.com/ChibiOS/ChibiOS-Contrib), so you need to put that into your repository in the same way as you did for the main ChibiOS repository. +- You also need to define CHIBIOS_CONTRIB in your makefile and point it to the right directory. +- You need to add some new options to chconf.h, or you will get compiler errors. Just copy the new options from samples provided by the ChibiOS-Contrib repository. ### Immediate todo -- host-wakeup packet sending during suspend -- power saving for suspend? -- PWM for sleep led +- power saving for suspend ### Not tested, but possibly working @@ -27,14 +36,14 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ### Tried with -- ChibiOS 3.0.1, 3.0.2 and ST F072RB DISCOVERY board. -- Need to test on other STM32 chips (F3, F4) to make it as much chip-independent as possible. -- ChibiOS with Kinetis patches and Teensy LC and 3.0. +- Infinity, WhiteFox keyboards +- all ARM-based Teensies +- some STM32-based boards (e.g. ST-F072RB-DISCOVERY board, STM32F042 breakout board, Maple Mini (STM32F103-based)) -## ChibiOS-supported MCUs (as of 3.0.2) +## ChibiOS-supported MCUs - Pretty much all STM32 chips. -- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), but again, no official USB stack yet. However the `kinetis` branch of [my ChibiOS fork](https://github.com/flabbergast/ChibiOS). With this fork, TMK work normally on all the ARM Teensies. +- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), but again, no official USB stack yet. However the `kinetis` branch of [flabbergast's ChibiOS fork](https://github.com/flabbergast/ChibiOS). With this fork, TMK work normally on all the ARM Teensies. - There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. - I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. @@ -43,7 +52,6 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. - STM32F0x2 chips can do crystal-less USB, but they still need a 3.3V voltage regulator. - The BOOT0 pin should be tied to GND. - For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. -- For breathing the caps lock LED during the suspended state ("sleep LED"), it is desirable to have that LED on a hardware PWM pin (there's usually plenty of those, look for TIMERs in the datasheet). However this is not strictly necessary, because instead of direct output of a timer to a pin (better of course), it is easy to define timer callbacks in ChibiOS that turn on/off an arbitrary pin. diff --git a/protocol/chibios/main.c b/protocol/chibios/main.c index b62cfa9c..9c5254fa 100644 --- a/protocol/chibios/main.c +++ b/protocol/chibios/main.c @@ -35,6 +35,7 @@ #include "sleep_led.h" #endif #include "suspend.h" +#include "hook.h" /* ------------------------- @@ -58,6 +59,22 @@ host_driver_t chibios_driver = { send_consumer }; +/* Default hooks definitions. */ +__attribute__((weak)) +void hook_early_init(void) {} + +__attribute__((weak)) +void hook_late_init(void) {} + +__attribute__((weak)) +void hook_usb_suspend_loop(void) { + /* Do this in the suspended state */ + suspend_power_down(); // on AVR this deep sleeps for 15ms + /* Remote wakeup */ + if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { + send_remote_wakeup(&USB_DRIVER); + } +} /* TESTING * Amber LED blinker thread, times are in milliseconds. @@ -91,6 +108,8 @@ int main(void) { // TESTING // chThdCreateStatic(waBlinkerThread, sizeof(waBlinkerThread), NORMALPRIO, blinkerThread, NULL); + hook_early_init(); + /* Init USB */ init_usb_driver(&USB_DRIVER); @@ -101,6 +120,13 @@ int main(void) { while(USB_DRIVER.state != USB_ACTIVE) chThdSleepMilliseconds(50); + /* Do need to wait here! + * Otherwise the next print might start a transfer on console EP + * before the USB is completely ready, which sometimes causes + * HardFaults. + */ + chThdSleepMilliseconds(50); + print("USB configured.\n"); /* init TMK modules */ @@ -113,21 +139,18 @@ int main(void) { print("Keyboard start.\n"); + hook_late_init(); + /* Main loop */ while(true) { if(USB_DRIVER.state == USB_SUSPENDED) { print("[s]"); while(USB_DRIVER.state == USB_SUSPENDED) { - /* Do this in the suspended state */ - suspend_power_down(); // on AVR this deep sleeps for 15ms - /* Remote wakeup */ - if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { - send_remote_wakeup(&USB_DRIVER); - } + hook_usb_suspend_loop(); } /* Woken up */ - // variables has been already cleared by the wakeup hook + // variables have been already cleared send_keyboard_report(); #ifdef MOUSEKEY_ENABLE mousekey_send(); diff --git a/protocol/chibios/usb_main.c b/protocol/chibios/usb_main.c index d248b447..106ce087 100644 --- a/protocol/chibios/usb_main.c +++ b/protocol/chibios/usb_main.c @@ -27,15 +27,34 @@ #include "sleep_led.h" #include "led.h" #endif +#include "hook.h" + +/* TMK hooks */ +__attribute__((weak)) +void hook_usb_wakeup(void) { +#ifdef SLEEP_LED_ENABLE + sleep_led_disable(); + // NOTE: converters may not accept this + led_set(host_keyboard_leds()); +#endif /* SLEEP_LED_ENABLE */ +} + + __attribute__((weak)) +void hook_usb_suspend_entry(void) { +#ifdef SLEEP_LED_ENABLE + sleep_led_enable(); +#endif /* SLEEP_LED_ENABLE */ +} + /* --------------------------------------------------------- * Global interface variables and declarations * --------------------------------------------------------- */ -uint8_t keyboard_idle = 0; -uint8_t keyboard_protocol = 1; -uint16_t keyboard_led_stats = 0; +uint8_t keyboard_idle __attribute__((aligned(2))) = 0; +uint8_t keyboard_protocol __attribute__((aligned(2))) = 1; +uint16_t keyboard_led_stats __attribute__((aligned(2))) = 0; volatile uint16_t keyboard_idle_count = 0; static virtual_timer_t keyboard_idle_timer; static void keyboard_idle_timer_cb(void *arg); @@ -795,19 +814,13 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { case USB_EVENT_SUSPEND: //TODO: from ISR! print("[S]"); -#ifdef SLEEP_LED_ENABLE - sleep_led_enable(); -#endif /* SLEEP_LED_ENABLE */ + hook_usb_suspend_entry(); return; case USB_EVENT_WAKEUP: //TODO: from ISR! print("[W]"); suspend_wakeup_init(); -#ifdef SLEEP_LED_ENABLE - sleep_led_disable(); - // NOTE: converters may not accept this - led_set(host_keyboard_leds()); -#endif /* SLEEP_LED_ENABLE */ + hook_usb_wakeup(); return; case USB_EVENT_STALLED: @@ -1350,7 +1363,7 @@ int8_t sendchar(uint8_t c) { return 0; } osalSysUnlock(); - /* Timeout after 5us if the queue is full. + /* Timeout after 100us if the queue is full. * Increase this timeout if too much stuff is getting * dropped (i.e. the buffer is getting full too fast * for USB/HIDRAW to dequeue). Another possibility diff --git a/protocol/chibios/usb_main.h b/protocol/chibios/usb_main.h index d8f30e95..30d8fcae 100644 --- a/protocol/chibios/usb_main.h +++ b/protocol/chibios/usb_main.h @@ -58,9 +58,6 @@ void send_remote_wakeup(USBDriver *usbp); #define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1) #endif -/* this defines report_keyboard_t and computes REPORT_SIZE defines */ -// #include "report.h" - /* extern report_keyboard_t keyboard_report_sent; */ /* keyboard IN request callback handler */ @@ -122,8 +119,7 @@ typedef struct { #define CONSOLE_EPSIZE 16 /* Number of IN reports that can be stored inside the output queue */ -#define CONSOLE_QUEUE_CAPACITY 2 -#define CONSOLE_QUEUE_BUFFER_SIZE (CONSOLE_QUEUE_CAPACITY * CONSOLE_EPSIZE) +#define CONSOLE_QUEUE_CAPACITY 4 /* Console flush time */ #define CONSOLE_FLUSH_MS 50 diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index 345630aa..beec6b2b 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -48,6 +48,7 @@ #include "sleep_led.h" #endif #include "suspend.h" +#include "hook.h" #include "descriptor.h" #include "lufa.h" @@ -180,21 +181,13 @@ void EVENT_USB_Device_Reset(void) void EVENT_USB_Device_Suspend() { print("[S]"); -#ifdef SLEEP_LED_ENABLE - sleep_led_enable(); -#endif + hook_usb_suspend_entry(); } void EVENT_USB_Device_WakeUp() { print("[W]"); - suspend_wakeup_init(); - -#ifdef SLEEP_LED_ENABLE - sleep_led_disable(); - // NOTE: converters may not accept this - led_set(host_keyboard_leds()); -#endif + hook_usb_wakeup(); } #ifdef CONSOLE_ENABLE @@ -592,6 +585,7 @@ int main(void) __attribute__ ((weak)); int main(void) { setup_mcu(); + hook_early_init(); keyboard_setup(); setup_usb(); sei(); @@ -614,13 +608,11 @@ int main(void) #endif print("Keyboard start.\n"); + hook_late_init(); while (1) { while (USB_DeviceState == DEVICE_STATE_Suspended) { print("[s]"); - suspend_power_down(); - if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { - USB_Device_SendRemoteWakeup(); - } + hook_usb_suspend_loop(); } keyboard_task(); @@ -630,3 +622,39 @@ int main(void) #endif } } + + +/* hooks */ +__attribute__((weak)) +void hook_early_init(void) {} + +__attribute__((weak)) +void hook_late_init(void) {} + + __attribute__((weak)) +void hook_usb_suspend_entry(void) +{ +#ifdef SLEEP_LED_ENABLE + sleep_led_enable(); +#endif +} + +__attribute__((weak)) +void hook_usb_suspend_loop(void) +{ + suspend_power_down(); + if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { + USB_Device_SendRemoteWakeup(); + } +} + +__attribute__((weak)) +void hook_usb_wakeup(void) +{ + suspend_wakeup_init(); +#ifdef SLEEP_LED_ENABLE + sleep_led_disable(); + // NOTE: converters may not accept this + led_set(host_keyboard_leds()); +#endif +} diff --git a/protocol/ps2_mouse.c b/protocol/ps2_mouse.c index c3e8b3c1..b0f77a83 100644 --- a/protocol/ps2_mouse.c +++ b/protocol/ps2_mouse.c @@ -85,17 +85,13 @@ void ps2_mouse_task(void) if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); return; } - xprintf("%ud ", timer_read()); - print("ps2_mouse raw: ["); - phex(mouse_report.buttons); print("|"); - print_hex8((uint8_t)mouse_report.x); print(" "); - print_hex8((uint8_t)mouse_report.y); print("]\n"); /* if mouse moves or buttons state changes */ if (mouse_report.x || mouse_report.y || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { #ifdef PS2_MOUSE_DEBUG + xprintf("%ud ", timer_read()); print("ps2_mouse raw: ["); phex(mouse_report.buttons); print("|"); print_hex8((uint8_t)mouse_report.x); print(" "); diff --git a/protocol/vusb.mk b/protocol/vusb.mk index 3cba3f71..d541dd0f 100644 --- a/protocol/vusb.mk +++ b/protocol/vusb.mk @@ -10,6 +10,7 @@ SRC += $(VUSB_DIR)/main.c \ ifdef NO_UART +OPT_DEFS += -DNO_UART SRC += $(COMMON_DIR)/sendchar_null.c else SRC += $(COMMON_DIR)/sendchar_uart.c \ diff --git a/protocol/vusb/main.c b/protocol/vusb/main.c index 8e4a266e..0d809536 100644 --- a/protocol/vusb/main.c +++ b/protocol/vusb/main.c @@ -49,7 +49,7 @@ int main(void) #endif CLKPR = 0x80, CLKPR = 0; -#ifndef PS2_USE_USART +#ifndef NO_UART uart_init(UART_BAUD_RATE); #endif diff --git a/tool/chibios/chibios.mk b/tool/chibios/chibios.mk index a67e067a..2dabd515 100644 --- a/tool/chibios/chibios.mk +++ b/tool/chibios/chibios.mk @@ -35,7 +35,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = yes + USE_LTO = no endif # If enabled, this option allows to compile the application in THUMB mode. @@ -83,21 +83,44 @@ endif # # Imported source files and paths -CHIBIOS = $(TMK_DIR)/tool/chibios/chibios -# Startup files. -include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk +CHIBIOS ?= $(TMK_DIR)/tool/chibios/chibios +# Startup files. Try a few different locations, for compability with old versions and +# for things hardware in the contrib repository +STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk +ifeq ("$(wildcard $(STARTUP_MK))","") + STARTUP_MK = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk + ifeq ("$(wildcard $(STARTUP_MK))","") + STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk + endif +endif +include $(STARTUP_MK) # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk -include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk -ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD))","") - include $(TARGET_DIR)/boards/$(BOARD)/board.mk -else - include $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk + +PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk +ifeq ("$(wildcard $(PLATFORM_MK))","") +PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk endif +include $(PLATFORM_MK) + + +BOARD_MK = $(TARGET_DIR)/boards/$(BOARD)/board.mk +ifeq ("$(wildcard $(BOARD_MK))","") + BOARD_MK = $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk + ifeq ("$(wildcard $(BOARD_MK))","") + BOARD_MK = $(CHIBIOS_CONTRIB)/os/hal/boards/$(BOARD)/board.mk + endif +endif +include $(BOARD_MK) include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk +# Compability with old version +PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk +ifeq ("$(wildcard $(PORT_V))","") +PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk +endif +include $(PORT_V) # Other files (optional). # Define linker script file here @@ -175,7 +198,7 @@ CP = $(TRGT)objcopy AS = $(TRGT)gcc -x assembler-with-cpp AR = $(TRGT)ar OD = $(TRGT)objdump -SZ = $(TRGT)size +SZ = $(TRGT)size -A HEX = $(CP) -O ihex BIN = $(CP) -O binary @@ -201,10 +224,10 @@ CPPWARN = -Wall -Wextra -Wundef # List all user C define here, like -D_DEBUG=1 ## Select which interfaces to include here! -UDEFS = $(OPT_DEFS) +UDEFS += $(OPT_DEFS) # Define ASM defines here -UADEFS = $(OPT_DEFS) +UADEFS += $(OPT_DEFS) # bootloader definitions may be used in the startup .s file ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","") UADEFS += -include $(TARGET_DIR)/bootloader_defs.h @@ -215,17 +238,20 @@ else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","") endif # List all user directories here -UINCDIR = +#UINCDIR = # List the user directory to look for the libraries here -ULIBDIR = +#ULIBDIR = # List all user libraries here -ULIBS = +#ULIBS = # # End of user defines ############################################################################## RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +ifeq ("$(wildcard $(RULESPATH)/rules.mk)","") +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC +endif include $(RULESPATH)/rules.mk diff --git a/tool/chibios/common.mk b/tool/chibios/common.mk index 7e3cccc9..1531c575 100644 --- a/tool/chibios/common.mk +++ b/tool/chibios/common.mk @@ -10,6 +10,7 @@ SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/print.c \ $(COMMON_DIR)/debug.c \ $(COMMON_DIR)/util.c \ + $(COMMON_DIR)/hook.c \ $(COMMON_DIR)/chibios/suspend.c \ $(COMMON_DIR)/chibios/printf.c \ $(COMMON_DIR)/chibios/timer.c \ @@ -80,6 +81,6 @@ endif OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) # Bootloader address -ifdef BOOTLOADER_ADDRESS - OPT_DEFS += -DBOOTLOADER_ADDRESS=$(BOOTLOADER_ADDRESS) +ifdef STM32_BOOTLOADER_ADDRESS + OPT_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS) endif diff --git a/tool/mbed/common.mk b/tool/mbed/common.mk index a0aa8717..2905d07d 100644 --- a/tool/mbed/common.mk +++ b/tool/mbed/common.mk @@ -10,6 +10,7 @@ OBJECTS += \ $(OBJDIR)/common/print.o \ $(OBJDIR)/common/debug.o \ $(OBJDIR)/common/util.o \ + $(OBJDIR)/common/hook.o \ $(OBJDIR)/common/mbed/suspend.o \ $(OBJDIR)/common/mbed/timer.o \ $(OBJDIR)/common/mbed/xprintf.o \ From d4982a21ac8f3ba003da41ceb581bffb4e78fefa Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 21 Apr 2016 14:39:42 +0900 Subject: [PATCH 159/179] Fix a link in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2a28413..7edce607 100644 --- a/README.md +++ b/README.md @@ -244,4 +244,4 @@ Coding Style Other Keyboard Firmware Projects ------------------ -You can learn a lot about keyboard firmware from these. See [Other Projects](https://github.com/tmk/tmk_keyboard/wiki/Other-Protjects) other than TMK. +You can learn a lot about keyboard firmware from these. See [Other Projects](https://github.com/tmk/tmk_keyboard/wiki/Other-Projects) other than TMK. From 7847d5dd9f3e743f298d1e7754c11dcfb7255382 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 29 Apr 2016 14:54:52 +0900 Subject: [PATCH 160/179] news_usb: Add TMK converter support --- converter/news_usb/Makefile | 93 ++++++++++++++++++++++++++++++++ converter/news_usb/Makefile.pjrc | 3 +- converter/news_usb/config.h | 63 ++++++++++++++++++++++ converter/news_usb/config_pjrc.h | 2 +- 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 converter/news_usb/Makefile create mode 100644 converter/news_usb/config.h diff --git a/converter/news_usb/Makefile b/converter/news_usb/Makefile new file mode 100644 index 00000000..e94a4f61 --- /dev/null +++ b/converter/news_usb/Makefile @@ -0,0 +1,93 @@ +# Target file name (without extension). +TARGET = news_usb + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# keyboard dependent files +SRC = keymap.c \ + matrix.c \ + led.c \ + news.c + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +#MCU = at90usb162 # Teensy 1.0 +#MCU = atmega32u4 # Teensy 2.0 +#MCU = at90usb646 # Teensy++ 1.0 +#MCU = at90usb1286 # Teensy++ 2.0 +MCU ?= atmega32u2 # TMK Converter Rev.2 + + +# 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 = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# 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 + + +# Build Options +# *Comment out* to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+5000) +EXTRAKEY_ENABLE = yes # Audio control and System control(+600) +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +#NKRO_ENABLE = yes # USB Nkey Rollover(+500) + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + + +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/converter/news_usb/Makefile.pjrc b/converter/news_usb/Makefile.pjrc index 80cadcc7..be7dd92e 100644 --- a/converter/news_usb/Makefile.pjrc +++ b/converter/news_usb/Makefile.pjrc @@ -24,9 +24,10 @@ CONFIG_H = config_pjrc.h # MCU name, you MUST set this to match the board you are using # type "make clean" after changing this, so all files will be rebuilt #MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 +#MCU = atmega32u4 # Teensy 2.0 #MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb1286 # Teensy++ 2.0 +MCU = atmega32u2 # TMK Converter Rev.2 # Processor frequency. diff --git a/converter/news_usb/config.h b/converter/news_usb/config.h new file mode 100644 index 00000000..c444941a --- /dev/null +++ b/converter/news_usb/config.h @@ -0,0 +1,63 @@ +/* +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x5021 +#define DEVICE_VER 0x0001 +#define MANUFACTURER t.m.k. +#define PRODUCT SONY NEWS keyboard converter +#define DESCRIPTION converts SONY NEWS protocol into USB + + +/* matrix size */ +#define MATRIX_ROWS 16 // keycode bit: 3-0 +#define MATRIX_COLS 8 // keycode bit: 6-4 + + +/* legacy keymap support */ +#define USE_LEGACY_KEYMAP + + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \ + keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \ +) + + +/* Asynchronous USART + * 8-data bit, non parity, 1-stop bit, no flow control + */ +#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) +# define NEWS_KBD_RX_VECT USART1_RX_vect +# define NEWS_KBD_RX_DATA UDR1 +# define NEWS_KBD_RX_BAUD 9600 +# define NEWS_KBD_RX_UBBR ((F_CPU/(16UL*NEWS_KBD_RX_BAUD))-1) +# define NEWS_KBD_RX_INIT() do { \ + UBRR1L = (uint8_t) NEWS_KBD_RX_UBBR; \ + UBRR1H = (uint8_t) (NEWS_KBD_RX_UBBR>>8); \ + UCSR1B |= (1<. /* Asynchronous USART * 8-data bit, non parity, 1-stop bit, no flow control */ -#ifdef __AVR_ATmega32U4__ +#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) # define NEWS_KBD_RX_VECT USART1_RX_vect # define NEWS_KBD_RX_DATA UDR1 # define NEWS_KBD_RX_BAUD 9600 From e7808f7ea4015dbed19f38a6dbbd82b0a3146fe6 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 29 Apr 2016 15:30:32 +0900 Subject: [PATCH 161/179] x68k_usb: Convert legacy keymap into current one --- converter/x68k_usb/Makefile | 2 +- .../x68k_usb/{config_pjrc.h => config.h} | 3 -- converter/x68k_usb/keymap.c | 42 +++++-------------- 3 files changed, 12 insertions(+), 35 deletions(-) rename converter/x68k_usb/{config_pjrc.h => config.h} (97%) diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile index fd2eb199..9df264b3 100644 --- a/converter/x68k_usb/Makefile +++ b/converter/x68k_usb/Makefile @@ -18,7 +18,7 @@ SRC = keymap.c \ led.c \ protocol/serial_uart.c -CONFIG_H = config_pjrc.h +CONFIG_H = config.h # MCU name, you MUST set this to match the board you are using diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config.h similarity index 97% rename from converter/x68k_usb/config_pjrc.h rename to converter/x68k_usb/config.h index 77989fe3..b552223a 100644 --- a/converter/x68k_usb/config_pjrc.h +++ b/converter/x68k_usb/config.h @@ -39,9 +39,6 @@ along with this program. If not, see . keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \ ) -/* legacy keymap support */ -#define USE_LEGACY_KEYMAP - /* USART configuration * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c index 5e09f55d..671e5dec 100644 --- a/converter/x68k_usb/keymap.c +++ b/converter/x68k_usb/keymap.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include #include "keycode.h" +#include "action.h" #include "util.h" #include "keymap.h" @@ -70,30 +71,12 @@ along with this program. If not, see . } -// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. -static const uint8_t PROGMEM fn_layer[] = { - 0, // Fn0 - 0, // Fn1 - 0, // Fn2 - 0, // Fn3 - 0, // Fn4 - 0, // Fn5 - 0, // Fn6 - 0 // Fn7 +static const uint16_t fn_actions[] PROGMEM = { }; -// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. -// See layer.c for details. -static const uint8_t PROGMEM fn_keycode[] = { - KC_NO, // Fn0 - KC_NO, // Fn1 - KC_NO, // Fn2 - KC_NO, // Fn3 - KC_NO, // Fn4 - KC_NO, // Fn5 - KC_NO, // Fn6 - KC_NO // Fn7 -}; +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +} static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -134,17 +117,14 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { - return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); } -uint8_t keymap_fn_layer(uint8_t index) +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) { - return pgm_read_byte(&fn_layer[index]); -} - -uint8_t keymap_fn_keycode(uint8_t index) -{ - return pgm_read_byte(&fn_keycode[index]); + return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; } From 3c109203c3d0451dd5009acbe3fc5452934b0449 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 29 Apr 2016 15:33:33 +0900 Subject: [PATCH 162/179] x68k_usb: Add toggle LED sample --- converter/x68k_usb/keymap.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c index 671e5dec..836752bf 100644 --- a/converter/x68k_usb/keymap.c +++ b/converter/x68k_usb/keymap.c @@ -21,6 +21,7 @@ along with this program. If not, see . #include "keycode.h" #include "action.h" #include "util.h" +#include "serial.h" #include "keymap.h" @@ -72,10 +73,22 @@ along with this program. If not, see . static const uint16_t fn_actions[] PROGMEM = { + [0] = ACTION_FUNCTION(0), // toggle all LEDs }; void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static bool led = false; + switch (id) { + case 0: + if (record->event.pressed) { + if ((led = !led)) + serial_send(0x80); // all on + else + serial_send(0xff); // all off + } + break; + } } @@ -98,7 +111,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ /* ANSI */ KEYMAP( - F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13, + FN0, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,F18, UP, P4, P5, P6, PEQL, From 0c8c77450cd0768c7b93aae8ce152a149fdb6935 Mon Sep 17 00:00:00 2001 From: esell Date: Thu, 5 May 2016 12:50:05 -0600 Subject: [PATCH 163/179] update macro names in bluefruit --- tmk_core/protocol/bluefruit/bluefruit.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tmk_core/protocol/bluefruit/bluefruit.c b/tmk_core/protocol/bluefruit/bluefruit.c index cf26b83d..7f7d0625 100644 --- a/tmk_core/protocol/bluefruit/bluefruit.c +++ b/tmk_core/protocol/bluefruit/bluefruit.c @@ -150,25 +150,25 @@ static void send_system(uint16_t data) +-------------------------------------+-------+ */ #define CONSUMER2BLUEFRUIT(usage) \ - (usage == AUDIO_MUTE ? 0x0000 : \ - (usage == AUDIO_VOL_UP ? 0x1000 : \ - (usage == AUDIO_VOL_DOWN ? 0x2000 : \ - (usage == TRANSPORT_NEXT_TRACK ? 0x0002 : \ - (usage == TRANSPORT_PREV_TRACK ? 0x0004 : \ - (usage == TRANSPORT_STOP ? 0x0010 : \ - (usage == TRANSPORT_STOP_EJECT ? 0x0000 : \ - (usage == TRANSPORT_PLAY_PAUSE ? 0x4000 : \ - (usage == AL_CC_CONFIG ? 0x0000 : \ - (usage == AL_EMAIL ? 0x0000 : \ - (usage == AL_CALCULATOR ? 0x0000 : \ - (usage == AL_LOCAL_BROWSER ? 0x0000 : \ - (usage == AC_SEARCH ? 0x0400 : \ - (usage == AC_HOME ? 0x0100 : \ - (usage == AC_BACK ? 0x0000 : \ - (usage == AC_FORWARD ? 0x0000 : \ - (usage == AC_STOP ? 0x0000 : \ - (usage == AC_REFRESH ? 0x0000 : \ - (usage == AC_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) + (usage == AUDIO_MUTE ? 0x0000 : \ + (usage == AUDIO_VOL_UP ? 0x1000 : \ + (usage == AUDIO_VOL_DOWN ? 0x2000 : \ + (usage == TRANSPORT_NEXT_TRACK ? 0x0002 : \ + (usage == TRANSPORT_PREV_TRACK ? 0x0004 : \ + (usage == TRANSPORT_STOP ? 0x0010 : \ + (usage == TRANSPORT_STOP_EJECT ? 0x0000 : \ + (usage == TRANSPORT_PLAY_PAUSE ? 0x4000 : \ + (usage == APPLAUNCH_CC_CONFIG ? 0x0000 : \ + (usage == APPLAUNCH_EMAIL ? 0x0000 : \ + (usage == APPLAUNCH_CALCULATOR ? 0x0000 : \ + (usage == APPLAUNCH_LOCAL_BROWSER ? 0x0000 : \ + (usage == APPCONTROL_SEARCH ? 0x0400 : \ + (usage == APPCONTROL_HOME ? 0x0100 : \ + (usage == APPCONTROL_BACK ? 0x0000 : \ + (usage == APPCONTROL_FORWARD ? 0x0000 : \ + (usage == APPCONTROL_STOP ? 0x0000 : \ + (usage == APPCONTROL_REFRESH ? 0x0000 : \ + (usage == APPCONTROL_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) static void send_consumer(uint16_t data) { From d3332d32daacde13cb0ff488d1c1dd0f79a3d423 Mon Sep 17 00:00:00 2001 From: John Hickey Date: Mon, 9 May 2016 22:56:33 -0700 Subject: [PATCH 164/179] Add hardware serial support for sun_usb converter Tested with a Sun Type 5c keyboard and a 7404 inverter. --- converter/sun_usb/Makefile | 11 ++- converter/sun_usb/README | 4 +- converter/sun_usb/config.h | 135 +++++++++++++++++++++++-------------- 3 files changed, 95 insertions(+), 55 deletions(-) diff --git a/converter/sun_usb/Makefile b/converter/sun_usb/Makefile index f046bfdd..12eceb5e 100644 --- a/converter/sun_usb/Makefile +++ b/converter/sun_usb/Makefile @@ -11,8 +11,8 @@ TARGET_DIR = . SRC = keymap.c \ matrix.c \ led.c \ - command_extra.c \ - protocol/serial_soft.c + command_extra.c + CONFIG_H = config.h @@ -64,8 +64,15 @@ MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration +#HARDWARE_SERIAL = yes # Use hardware serial (requires inverted serial, see README) #NKRO_ENABLE = yes # USB Nkey Rollover +ifdef HARDWARE_SERIAL + SRC := protocol/serial_uart.c $(SRC) + OPT_DEFS += -DHARDWARE_SERIAL +else + SRC := protocol/serial_soft.c $(SRC) +endif # Boot Section Size in bytes # Teensy halfKay 512 diff --git a/converter/sun_usb/README b/converter/sun_usb/README index 98340dd3..405a86ba 100644 --- a/converter/sun_usb/README +++ b/converter/sun_usb/README @@ -48,7 +48,9 @@ Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit To use AVR UART engine you need external inverter in front of RX and TX pin. Otherwise you can software serial routine to communicate the keyboard. -This converter uses software method, you doesn't need any inverter part. +This converter uses software method by default, so you don't need any inverter part. But +it can also be built with 'make HARDWARE_SERIAL=y' to enable hardware serial if there +is an inverter present. Good results have been obtained using a 74LS04 and hardware serial. Commands From System To Keyboard diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h index 66036da9..414fd563 100644 --- a/converter/sun_usb/config.h +++ b/converter/sun_usb/config.h @@ -39,57 +39,88 @@ along with this program. If not, see . /* legacy keymap support */ #define USE_LEGACY_KEYMAP - -/* Serial(USART) configuration - * asynchronous, negative logic, 1200baud, no flow control - * 1-start bit, 8-data bit, non parity, 1-stop bit +/* HARDWARE_SERAIL assumes that a logic inverter (7404) is placed + * in front of RX/TX to produce the positive logic the MCU expects. + * The default is Software Serial. */ -#define SERIAL_SOFT_BAUD 1200 -#define SERIAL_SOFT_PARITY_NONE -#define SERIAL_SOFT_BIT_ORDER_LSB -#define SERIAL_SOFT_LOGIC_NEGATIVE -/* RXD Port */ -#define SERIAL_SOFT_RXD_ENABLE -#define SERIAL_SOFT_RXD_DDR DDRD -#define SERIAL_SOFT_RXD_PORT PORTD -#define SERIAL_SOFT_RXD_PIN PIND -#define SERIAL_SOFT_RXD_BIT 2 -#define SERIAL_SOFT_RXD_VECT INT2_vect -/* RXD Interupt */ -#ifdef SERIAL_SOFT_LOGIC_NEGATIVE -/* enable interrupt: INT2(rising edge) */ -#define INTR_TRIG_EDGE ((1<>8); /* baud rate */ \ + UCSR1B = (1< Date: Sat, 14 May 2016 14:29:05 -0700 Subject: [PATCH 165/179] Make Bell and Click work on Sun Type 5c. It seems that the Sun Type 5c keyboard will not send the arrow key codes if both shift keys are pressed. To get bell and keyclick working, I used Home/End as toggle keys instead. --- converter/sun_usb/command_extra.c | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/converter/sun_usb/command_extra.c b/converter/sun_usb/command_extra.c index aba3fe6d..08f3a710 100644 --- a/converter/sun_usb/command_extra.c +++ b/converter/sun_usb/command_extra.c @@ -5,41 +5,47 @@ #include "print.h" #include "command.h" +bool sun_bell = false; +bool sun_click = false; + + bool command_extra(uint8_t code) { switch (code) { case KC_H: case KC_SLASH: /* ? */ print("\n\n----- Sun converter Help -----\n"); - print("Up: Bell On\n"); - print("Down: Bell Off\n"); - print("Left: Click On\n"); - print("Right: Click Off\n"); - print("PgUp: LED all On\n"); - print("PgDown: LED all On\n"); - print("Insert: Layout\n"); - print("Delete: Reset\n"); + print("Home: Toggle Bell\n"); + print("End: Toggle Click\n"); + print("PgUp: LED all On\n"); + print("PgDown: LED all On\n"); + print("Insert: Layout\n"); + print("Delete: Reset\n"); return false; case KC_DEL: print("Reset\n"); serial_send(0x01); break; - case KC_UP: - print("Bell On\n"); - serial_send(0x02); - break; - case KC_DOWN: - print("Bell Off\n"); - serial_send(0x03); - break; - case KC_LEFT: - print("Click On\n"); - serial_send(0x0A); - break; - case KC_RIGHT: - print("Click Off\n"); - serial_send(0x0B); + case KC_HOME: + sun_bell = !sun_bell; + if (sun_bell) { + print("Bell On\n"); + serial_send(0x02); + } else { + print("Bell Off\n"); + serial_send(0x03); + } break; + case KC_END: + sun_click = !sun_click; + if (sun_click) { + print("Click On\n"); + serial_send(0x0A); + } else { + print("Click Off\n"); + serial_send(0x0B); + } + break; case KC_PGUP: print("LED all on\n"); serial_send(0x0E); @@ -55,6 +61,7 @@ bool command_extra(uint8_t code) serial_send(0x0F); break; default: + xprintf("Unknown extra command: %02X\n", code); return false; } return true; From d702fe7504753617911501d886c4e4e0a33d607f Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 19 May 2016 16:25:13 +0900 Subject: [PATCH 166/179] core: Add adb_host_talk() --- tmk_core/protocol/adb.c | 104 ++++++++++++++++++++-------------------- tmk_core/protocol/adb.h | 18 +++++++ 2 files changed, 70 insertions(+), 52 deletions(-) diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index 5c6c99b4..3f4e14ba 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c @@ -60,7 +60,6 @@ static inline void place_bit1(void); static inline void send_byte(uint8_t data); static inline uint16_t wait_data_lo(uint16_t us); static inline uint16_t wait_data_hi(uint16_t us); -static inline uint16_t adb_host_dev_recv(uint8_t device); void adb_host_init(void) @@ -87,49 +86,9 @@ bool adb_host_psw(void) * * */ - -// ADB Bit Cells -// -// bit cell time: 70-130us -// low part of bit0: 60-70% of bit cell -// low part of bit1: 30-40% of bit cell -// -// bit cell time 70us 130us -// -------------------------------------------- -// low part of bit0 42-49 78-91 -// high part of bit0 21-28 39-52 -// low part of bit1 21-28 39-52 -// high part of bit1 42-49 78-91 -// -// -// bit0: -// 70us bit cell: -// ____________~~~~~~ -// 42-49 21-28 -// -// 130us bit cell: -// ____________~~~~~~ -// 78-91 39-52 -// -// bit1: -// 70us bit cell: -// ______~~~~~~~~~~~~ -// 21-28 42-49 -// -// 130us bit cell: -// ______~~~~~~~~~~~~ -// 39-52 78-91 -// -// [from Apple IIgs Hardware Reference Second Edition] - -enum { - ADDR_KEYB = 0x20, - ADDR_MOUSE = 0x30 -}; - uint16_t adb_host_kbd_recv(void) { - return adb_host_dev_recv(ADDR_KEYB); + return adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_0); } #ifdef ADB_MOUSE_ENABLE @@ -139,16 +98,16 @@ void adb_mouse_init(void) { uint16_t adb_host_mouse_recv(void) { - return adb_host_dev_recv(ADDR_MOUSE); + return adb_host_talk(ADB_ADDR_MOUSE, ADB_REG_0); } #endif -static inline uint16_t adb_host_dev_recv(uint8_t device) +uint16_t adb_host_talk(uint8_t addr, uint8_t reg) { uint16_t data = 0; cli(); attention(); - send_byte(device|0x0C); // Addr:Keyboard(0010)/Mouse(0011), Cmd:Talk(11), Register0(00) + send_byte((addr<<4) | (ADB_CMD_TALK<<2) | reg); place_bit0(); // Stopbit(0) if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored sei(); @@ -158,20 +117,20 @@ static inline uint16_t adb_host_dev_recv(uint8_t device) sei(); return 0; // No data to send } - + uint8_t n = 17; // start bit + 16 data bits do { uint8_t lo = (uint8_t) wait_data_hi(130); if (!lo) goto error; - + uint8_t hi = (uint8_t) wait_data_lo(lo); if (!hi) goto error; - + hi = lo - hi; lo = 130 - lo; - + data <<= 1; if (lo < hi) { data |= 1; @@ -205,7 +164,7 @@ void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l) place_bit0(); // Stopbit(0) _delay_us(200); // Tlt/Stop to Start place_bit1(); // Startbit(1) - send_byte(data_h); + send_byte(data_h); send_byte(data_l); place_bit0(); // Stopbit(0); sei(); @@ -375,7 +334,7 @@ Commands A A A A 1 1 R R Talk(read from a device) The command to read keycodes from keyboard is 0x2C which - consist of keyboard address 2 and Talk against register 0. + consist of keyboard address 2 and Talk against register 0. Address: 2: keyboard @@ -457,7 +416,7 @@ Keyboard Data(Register0) Keyboard LEDs & state of keys(Register2) This register hold current state of three LEDs and nine keys. The state of LEDs can be changed by sending Listen command. - + 1514 . . . . . . 7 6 5 . 3 2 1 0 | | | | | | | | | | | | | | | +- LED1(NumLock) | | | | | | | | | | | | | | +--- LED2(CapsLock) @@ -474,5 +433,46 @@ Keyboard LEDs & state of keys(Register2) | +----------------------------- Delete +------------------------------- Reserved +ADB Bit Cells + bit cell time: 70-130us + low part of bit0: 60-70% of bit cell + low part of bit1: 30-40% of bit cell + + bit cell time 70us 130us + -------------------------------------------- + low part of bit0 42-49 78-91 + high part of bit0 21-28 39-52 + low part of bit1 21-28 39-52 + high part of bit1 42-49 78-91 + + + bit0: + 70us bit cell: + ____________~~~~~~ + 42-49 21-28 + + 130us bit cell: + ____________~~~~~~ + 78-91 39-52 + + bit1: + 70us bit cell: + ______~~~~~~~~~~~~ + 21-28 42-49 + + 130us bit cell: + ______~~~~~~~~~~~~ + 39-52 78-91 + + [from Apple IIgs Hardware Reference Second Edition] + +Keyboard Handle ID + Apple Standard Keyboard M0116: 0x01 + Apple Extended Keyboard M0115: 0x02 + Apple Extended Keyboard II M3501: 0x02 + Apple Adjustable Keybaord: 0x10 + + http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L802 + END_OF_ADB */ diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h index b4b3633c..d81c4a77 100644 --- a/tmk_core/protocol/adb.h +++ b/tmk_core/protocol/adb.h @@ -52,11 +52,29 @@ POSSIBILITY OF SUCH DAMAGE. #define ADB_CAPS 0x39 +/* ADB commands */ +#define ADB_ADDR_KEYBOARD 2 +#define ADB_ADDR_MOUSE 3 +#define ADB_CMD_LISTEN 2 +#define ADB_CMD_TALK 3 +#define ADB_REG_0 0 +#define ADB_REG_1 1 +#define ADB_REG_2 2 +#define ADB_REG_3 3 + +/* ADB keyboard handle id */ +#define ADB_HANDLE_M0116 0x01 +#define ADB_HANDLE_M0115 0x02 +#define ADB_HANDLE_M3501 0x02 +#define ADB_HANDLE_M1242 0x10 + + // ADB host void adb_host_init(void); bool adb_host_psw(void); uint16_t adb_host_kbd_recv(void); uint16_t adb_host_mouse_recv(void); +uint16_t adb_host_talk(uint8_t addr, uint8_t reg); void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); void adb_host_kbd_led(uint8_t led); void adb_mouse_task(void); From 49f44a2aedce6d727d9e6aa7998e766b899c6eda Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 19 May 2016 16:26:01 +0900 Subject: [PATCH 167/179] adb_usb: autodetect ISO keyboards and swap codes --- converter/adb_usb/Makefile | 2 +- converter/adb_usb/keymap_common.h | 53 ++++++++++++++++++++--- converter/adb_usb/keymap_plain.c | 42 ++++++++++++++++++ converter/adb_usb/matrix.c | 72 ++++++++++++++++++++++++++++--- 4 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 converter/adb_usb/keymap_plain.c diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile index 7b385749..76e10950 100644 --- a/converter/adb_usb/Makefile +++ b/converter/adb_usb/Makefile @@ -56,7 +56,7 @@ SRC = keymap_common.c \ ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) else - SRC := keymap_ansi.c $(SRC) + SRC := keymap_plain.c $(SRC) endif CONFIG_H = config.h diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h index bc99ab72..0a917cbc 100644 --- a/converter/adb_usb/keymap_common.h +++ b/converter/adb_usb/keymap_common.h @@ -33,6 +33,49 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; +/* Common layout: ANSI+ISO + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| + * `---' `---------------' `---------------' `---------------' `-----------' `---' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -| + * |-----------------------------------------------------------| `-----------' |---------------| + * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------|Ent| + * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ +#define KEYMAP( \ + K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ + K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ + K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ + K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ + K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ + K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ + { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ + { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ + { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ + { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \ + { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \ + { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ + { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \ + { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \ + { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ + { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \ +} + + /* M0115 Apple Extended Keyboard ANSI * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| @@ -93,10 +136,10 @@ extern const uint16_t fn_actions[]; */ #define KEYMAP_EXT_ISO( \ K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ - K0A,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ + K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, K56,K57,K58,K45, \ - K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ + K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ @@ -183,16 +226,16 @@ extern const uint16_t fn_actions[]; K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A,K24, K56,K57,K58,K4E, \ - K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K7B,K3E, K53,K54,K55, \ + K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K7B,K3E, K53,K54,K55, \ K36,K3A,K37, K31, K3B,K3C,K3D, K52, K41,K4C \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ - { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ + { KC_##K08, KC_##K09, KC_##K0A KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ + { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ { KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \ { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \ diff --git a/converter/adb_usb/keymap_plain.c b/converter/adb_usb/keymap_plain.c new file mode 100644 index 00000000..433a5cb3 --- /dev/null +++ b/converter/adb_usb/keymap_plain.c @@ -0,0 +1,42 @@ +#include "keymap_common.h" + + +/* + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| + * `---' `---------------' `---------------' `---------------' `-----------' `---' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -| + * |-----------------------------------------------------------| `-----------' |---------------| + * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------|Ent| + * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | + * `-----------------------------------------------------------' `-----------' `---------------' + */ +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, + FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, + TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN1, DEL, END, PGDN, P7, P8, P9, PMNS, + LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, + LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, + LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + ), + [1] = KEYMAP( + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, + FN0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3, + TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN1, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D, + LCAP,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U, + LSFT,NUBS,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R, + LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3 + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_TAP_KEY(1, KC_GRV), + [1] = ACTION_LAYER_TAP_KEY(1, KC_BSLS), +}; diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index dad71758..6857e692 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -39,6 +39,7 @@ along with this program. If not, see . #endif +static bool is_iso_layout = false; static bool is_modified = false; static report_mouse_t mouse_report = {}; @@ -72,6 +73,21 @@ void matrix_init(void) adb_host_init(); // wait for keyboard to boot up and receive command _delay_ms(1000); + + // Determine ISO keyboard by handle id + // http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L815 + uint16_t handle_id = adb_host_talk(ADB_ADDR_KEYBOARD, 3); + switch (handle_id) { + case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: + case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: + case 0xC4: case 0xC7: + is_iso_layout = true; + break; + default: + is_iso_layout = false; + break; + } + // Enable keyboard left/right modifier distinction // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11) // upper byte: reserved bits 0000, device address 0010 @@ -92,6 +108,9 @@ void matrix_init(void) _delay_ms(500); DDRD |= (1<<6); PORTD &= ~(1<<6); + uint16_t handle_id2 = adb_host_talk(ADB_ADDR_KEYBOARD, 3); + xprintf("handle_id: %02X -> %02X\n", handle_id&0xff, handle_id2&0xff); + return; } @@ -106,10 +125,10 @@ void adb_mouse_task(void) { uint16_t codes; int16_t x, y; - static int8_t mouseacc; + static int8_t mouseacc; _delay_ms(12); // delay for preventing overload of poor ADB keyboard controller codes = adb_host_mouse_recv(); - // If nothing received reset mouse acceleration, and quit. + // If nothing received reset mouse acceleration, and quit. if (!codes) { mouseacc = 1; return; @@ -119,12 +138,12 @@ void adb_mouse_task(void) mouse_report.buttons |= MOUSE_BTN1; if (codes & (1 << 15)) mouse_report.buttons &= ~MOUSE_BTN1; - // lower seven bits are movement, as signed int_7. - // low byte is X-axis, high byte is Y. + // lower seven bits are movement, as signed int_7. + // low byte is X-axis, high byte is Y. y = (codes>>8 & 0x3F); x = (codes>>0 & 0x3F); // bit seven and fifteen is negative - // usb does not use int_8, but int_7 (measuring distance) with sign-bit. + // usb does not use int_8, but int_7 (measuring distance) with sign-bit. if (codes & (1 << 6)) x = (x-0x40); if (codes & (1 << 14)) @@ -132,7 +151,7 @@ void adb_mouse_task(void) // Accelerate mouse. (They weren't meant to be used on screens larger than 320x200). x *= mouseacc; y *= mouseacc; - // Cap our two bytes per axis to one byte. + // Cap our two bytes per axis to one byte. // Easier with a MIN-function, but since -MAX(-a,-b) = MIN(a,b)... // I.E. MIN(MAX(x,-127),127) = -MAX(-MAX(x, -127), -127) = MIN(-MIN(-x,127),127) mouse_report.x = -MAX(-MAX(x, -127), -127); @@ -145,7 +164,7 @@ void adb_mouse_task(void) print_decs(mouse_report.x); print(" "); print_decs(mouse_report.y); print("]\n"); } - // Send result by usb. + // Send result by usb. host_mouse_send(&mouse_report); // increase acceleration of mouse mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 ); @@ -192,6 +211,45 @@ uint8_t matrix_scan(void) xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes); return key1; } else { + /* Swap codes for ISO keyboard + * + * ANSI + * ,----------- ----------. + * | *a| 1| 2 =|Backspa| + * |----------- ----------| + * |Tab | Q| | ]| *c| + * |----------- ----------| + * |CapsLo| A| '|Return | + * |----------- ----------| + * |Shift | Shift | + * `----------- ----------' + * + * ISO + * ,----------- ----------. + * | *a| 1| 2 =|Backspa| + * |----------- ----------| + * |Tab | Q| | ]|Retur| + * |----------- -----` | + * |CapsLo| A| '| *c| | + * |----------- ----------| + * |Shif| *b| Shift | + * `----------- ----------' + * + * ADB scan code USB usage + * ------------- --------- + * Key ANSI ISO ANSI ISO + * --------------------------------------------- + * *a 0x32 0x0A 0x35 0x35 + * *b ---- 0x32 ---- 0x64 + * *c 0x2A 0x2A 0x31 0x31(or 0x32) + */ + if (is_iso_layout) { + if (key0 == 0x32) { + key0 = 0x0A; + } else if (key0 == 0x0A) { + key0 = 0x32; + } + } register_key(key0); if (key1 != 0xFF) // key1 is 0xFF when no second key. extra_key = key1<<8 | 0xFF; // process in a separate call From 4fc0efd3ab8f1720eb799e29ef436a3788aa1890 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 20 May 2016 03:30:46 +0900 Subject: [PATCH 168/179] adb_usb: reinitialize for plug-in after startup --- converter/adb_usb/README.md | 28 ++++++++++++---------------- converter/adb_usb/matrix.c | 2 ++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md index aa06c8db..034540c9 100644 --- a/converter/adb_usb/README.md +++ b/converter/adb_usb/README.md @@ -1,10 +1,11 @@ ADB to USB keyboard converter ============================= -This firmware converts ADB keyboard protocol to USB. -You can use TMK Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) for this. But binary size is probably more than 10KB and it won't fit into 8K flash. +This firmware converts Apple ADB keyboard protocol to USB. You can use TMK Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) for this. But binary size is probably more than 10KB and it won't fit into 8K flash. Discuss: http://geekhack.org/showwiki.php?title=Island:14290 +TMK Converter: https://geekhack.org/index.php?topic=72052.0 + README FIRST @@ -57,29 +58,25 @@ Build firmware and Program microcontroller ------------------------------------------ See [doc/build.md](../../tmk_core/doc/build.md). -To build firmware: +To build firmware and program TMK Converter run these commands: $ make -f Makefile clean - $ make -f Makefile + $ make -f Makefile [KEYMAP=(plain|ansi|iso|hasu)] + $ make -f Makefile [KEYMAP=(plain|ansi|iso|hasu)] dfu -You can select keymap(ansi is default) like this: +You can select keymap with optional `KEYMAP=` (plain is default). Push button on the converter before running `dfu` target. - $ make -f Makefile KEYMAP=[ansi|iso|hasu] +Use **Makefile.rev1** for old TMK Converter rev.1 and **Makefile.teensy** for Teensy2.0 instead of **Makefile**. For TMK Converter rev.2 just use **Makefile**. -To program TMK Converter: +To program Teensy you can use `teensy` target: - $ make -f Makefile dfu + $ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy -To program Teensy2.0: - - $ make -f Makefile.teensy teensy - -Use **Makefile.rev1** for TMK Converter rev.1 and **Makefile.teensy** for Teensy2.0 instead of **Makefile**. For TMK Converter rev.2 just use **Makefile**. Keymap ------ -You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c. +You can change a keymap by editing code of keymap_[plain|ansi|iso|hasu|yours].c. How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see [doc/keymap.md](../../tmk_core/doc/keymap.md) for more detail. @@ -112,8 +109,7 @@ modifiers except for GUI key(Windows/Command). And most ADB keyboard has no diodes in its matrix so they are not NKRO, though ADB protocol itself supports it. See protocol/adb.c for more info. -If keyboard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI -keymap you will suffer from swapped keys problem. +If keyboard has ISO layout you may have swapped keys problem, see this for the detail. https://github.com/tmk/tmk_keyboard/issues/35 diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index 6857e692..abcc0cc9 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -209,6 +209,8 @@ uint8_t matrix_scan(void) register_key(0xFF); } else if (key0 == 0xFF) { // error xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes); + // something wrong or plug-in + matrix_init(); return key1; } else { /* Swap codes for ISO keyboard From e661296200233c2c721be857d551644324793536 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 20 May 2016 12:15:25 +0900 Subject: [PATCH 169/179] core: Add comment of register 3 of ADB --- tmk_core/protocol/adb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index 3f4e14ba..b9b0be98 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c @@ -433,6 +433,16 @@ Keyboard LEDs & state of keys(Register2) | +----------------------------- Delete +------------------------------- Reserved +Address, Handler ID and bits(Register3) + 1514131211 . . 8 7 . . . . . . 0 + | | | | | | | | | | | | | | | | + | | | | | | | | +-+-+-+-+-+-+-+- Handler ID + | | | | +-+-+-+----------------- Address + | | | +------------------------- 0 + | | +--------------------------- Service request enable(1 = enabled) + | +----------------------------- Exeptional event(alwyas 1 if not used) + +------------------------------- 0 + ADB Bit Cells bit cell time: 70-130us low part of bit0: 60-70% of bit cell From 82e8e6fbaad8636118f2439996efcff23aa91c22 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Fri, 20 May 2016 22:45:03 +0100 Subject: [PATCH 170/179] Chibios: update examples to current chibios git. Match the changes in mainline chibios: - update chconf.h - update supplied ld scripts structure - update Teensy instructions (switch to official chibios and introduce contrib) --- keyboard/infinity_chibios/chconf.h | 63 +++++++--- keyboard/stm32_f072_onekey/chconf.h | 59 ++++++--- keyboard/stm32_f103_onekey/Makefile | 2 +- keyboard/stm32_f103_onekey/chconf.h | 59 ++++++--- keyboard/stm32_f103_onekey/ld/STM32F103x8.ld | 53 -------- .../ld/STM32F103x8_stm32duino_bootloader.ld | 83 +++++++++---- keyboard/teensy_lc_onekey/chconf.h | 61 ++++++---- keyboard/teensy_lc_onekey/instructions.md | 8 +- keyboard/teensy_lc_onekey/ld/MKL26Z64.ld | 113 ++++++++++++------ 9 files changed, 309 insertions(+), 192 deletions(-) delete mode 100644 keyboard/stm32_f103_onekey/ld/STM32F103x8.ld diff --git a/keyboard/infinity_chibios/chconf.h b/keyboard/infinity_chibios/chconf.h index b7a340d6..b886c383 100644 --- a/keyboard/infinity_chibios/chconf.h +++ b/keyboard/infinity_chibios/chconf.h @@ -25,8 +25,10 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ /*===========================================================================*/ /** @@ -103,6 +105,10 @@ */ #define CH_CFG_NO_IDLE_THREAD FALSE +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + /** @} */ /*===========================================================================*/ @@ -262,14 +268,6 @@ */ #define CH_CFG_USE_MAILBOXES TRUE -/** - * @brief I/O Queues APIs. - * @details If enabled then the I/O queues APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#define CH_CFG_USE_QUEUES TRUE - /** * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included @@ -357,12 +355,18 @@ /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -427,10 +431,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -444,6 +444,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -451,6 +465,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -460,6 +475,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -488,12 +504,21 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/keyboard/stm32_f072_onekey/chconf.h b/keyboard/stm32_f072_onekey/chconf.h index be362a95..99fa8ce3 100644 --- a/keyboard/stm32_f072_onekey/chconf.h +++ b/keyboard/stm32_f072_onekey/chconf.h @@ -25,8 +25,10 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ /*===========================================================================*/ /** @@ -266,14 +268,6 @@ */ #define CH_CFG_USE_MAILBOXES TRUE -/** - * @brief I/O Queues APIs. - * @details If enabled then the I/O queues APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#define CH_CFG_USE_QUEUES TRUE - /** * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included @@ -361,12 +355,18 @@ /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -431,10 +431,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -448,6 +444,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -455,6 +465,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -464,6 +475,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -492,12 +504,21 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/keyboard/stm32_f103_onekey/Makefile b/keyboard/stm32_f103_onekey/Makefile index 79ca4238..19c84ace 100644 --- a/keyboard/stm32_f103_onekey/Makefile +++ b/keyboard/stm32_f103_onekey/Makefile @@ -31,7 +31,7 @@ BOARD = GENERIC_STM32_F103 # MAPLE MINI # OPT_DEFS = -DCORTEX_VTOR_INIT=0x5000 -# MCU_LDSCRIPT = STM32F103xE_maplemini_bootloader +# MCU_LDSCRIPT = STM32F103xB_maplemini_bootloader # BOARD = MAPLEMINI_STM32_F103 ## chip/board settings diff --git a/keyboard/stm32_f103_onekey/chconf.h b/keyboard/stm32_f103_onekey/chconf.h index acce6a1f..dfb1f9df 100644 --- a/keyboard/stm32_f103_onekey/chconf.h +++ b/keyboard/stm32_f103_onekey/chconf.h @@ -25,8 +25,10 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ /*===========================================================================*/ /** @@ -266,14 +268,6 @@ */ #define CH_CFG_USE_MAILBOXES TRUE -/** - * @brief I/O Queues APIs. - * @details If enabled then the I/O queues APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#define CH_CFG_USE_QUEUES TRUE - /** * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included @@ -361,12 +355,18 @@ /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -431,10 +431,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -448,6 +444,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -455,6 +465,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -464,6 +475,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -492,12 +504,21 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld b/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld deleted file mode 100644 index 54105375..00000000 --- a/keyboard/stm32_f103_onekey/ld/STM32F103x8.ld +++ /dev/null @@ -1,53 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. - - This file is part of ChibiOS. - - ChibiOS 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 3 of the License, or - (at your option) any later version. - - ChibiOS 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 . -*/ - -/* - * ST32F103xB memory setup. - */ -MEMORY -{ - flash : org = 0x08000000, len = 64k - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -INCLUDE rules.ld diff --git a/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld index 425616af..00613328 100644 --- a/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld +++ b/keyboard/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld @@ -1,40 +1,73 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - This file is part of ChibiOS. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS 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 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS 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 . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /* - * ST32F103xB memory setup. + * ST32F103xB memory setup for use with the maplemini bootloader. + * You will have to + * #define CORTEX_VTOR_INIT 0x5000 + * in your projects chconf.h */ MEMORY { - flash : org = 0x08002000, len = 64k - 0x2000 - ram0 : org = 0x20000C00, len = 20k - 0xC00 - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 + flash0 : org = 0x08002000, len = 128k - 0x2000 + flash1 : org = 0x00000000, len = 0 + flash2 : org = 0x00000000, len = 0 + flash3 : org = 0x00000000, len = 0 + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x20000000, len = 20k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 } +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + /* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts*/ + of all exceptions and interrupts.*/ REGION_ALIAS("MAIN_STACK_RAM", ram0); /* RAM region to be used for the process stack. This is the stack used by @@ -43,6 +76,7 @@ REGION_ALIAS("PROCESS_STACK_RAM", ram0); /* RAM region to be used for data segment.*/ REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); /* RAM region to be used for BSS segment.*/ REGION_ALIAS("BSS_RAM", ram0); @@ -50,4 +84,5 @@ REGION_ALIAS("BSS_RAM", ram0); /* RAM region to be used for the default heap.*/ REGION_ALIAS("HEAP_RAM", ram0); +/* Generic rules inclusion.*/ INCLUDE rules.ld diff --git a/keyboard/teensy_lc_onekey/chconf.h b/keyboard/teensy_lc_onekey/chconf.h index ee527d47..cb36996c 100644 --- a/keyboard/teensy_lc_onekey/chconf.h +++ b/keyboard/teensy_lc_onekey/chconf.h @@ -25,8 +25,10 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ /*===========================================================================*/ /** @@ -178,7 +180,7 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE /** * @brief Mutexes APIs. @@ -266,14 +268,6 @@ */ #define CH_CFG_USE_MAILBOXES TRUE -/** - * @brief I/O Queues APIs. - * @details If enabled then the I/O queues APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#define CH_CFG_USE_QUEUES TRUE - /** * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included @@ -361,12 +355,18 @@ /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -431,10 +431,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -448,6 +444,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -455,6 +465,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -464,6 +475,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -492,12 +504,21 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/keyboard/teensy_lc_onekey/instructions.md b/keyboard/teensy_lc_onekey/instructions.md index b8beb108..16886a01 100644 --- a/keyboard/teensy_lc_onekey/instructions.md +++ b/keyboard/teensy_lc_onekey/instructions.md @@ -1,12 +1,14 @@ # Teensy LC, 3.0, 3.1, 3.2 support -These ARM Teensies are now supported through [chibios](http://chibios.org). +These ARM Teensies are now supported through [ChibiOS](http://chibios.org). You'll need to install an ARM toolchain, for instance from [gcc ARM embedded](https://launchpad.net/gcc-arm-embedded) website, or using your favourite package manager. After installing, you should be able to run `arm-none-eabi-gcc -v` in the command prompt and get sensible output. This toolchain is used instead of `avr-gcc`, which is only for AVR chips. Naturally you'll also need the usual development tools (e.g. `make`), just as in the AVR setting. -You'll need this fork/branch of TMK. If you're reading this from your own hard drive, then you already have it ;) Anyway, you can get a zip from [here](https://github.com/flabbergast/tmk_keyboard/archive/chibios.zip) {or clone this repo from github and checkout the `chibios` branch}. +Next, you'll need ChibiOS. For Teensies, you'll need code from two repositories: [chibios-main](https://github.com/ChibiOS/ChibiOS) and [chibios-contrib](https://github.com/ChibiOS/ChibiOS). If you're not using git, you can just download a [zip of chibios from here](https://github.com/ChibiOS/ChibiOS/archive/a7df9a891067621e8e1a5c2a2c0ceada82403afe.zip), unpack the zip, and rename/move the unpacked directory (named `ChibiOS-`) to `tmk_core/tool/chibios/chibios` (so that the file `tmk_core/tool/chibios/chibios/license.txt` exists). Now the same procedure with a [zip of chibios-contrib from here](https://github.com/ChibiOS/ChibiOS-Contrib/archive/e1311c4db6cd366cf760673f769e925741ac0ad3.zip): unpack and move `ChibiOS-Contrib-` to `tmk_core/tool/chibios/chibios-contrib`. -Next, you'll need ChibiOS. The current release (3.0.4) does not have sufficient Kinetis support, so you'll need to get a patched version from [my fork](https://github.com/flabbergast/ChibiOS/tree/kinetis): you can download a current tree zipped from [here](https://github.com/flabbergast/ChibiOS/archive/kinetis.zip) {or clone that repo from github and checkout the `kinetis` branch}. Unpack the zip, rename the newly created `ChibiOS-kinetis` to `chibios`, and move it to `tmk/tool/chibios/` (so that the ChibiOS files reside in `tmk/tool/chibios/chibios`). +(If you're using git, you can just clone the two repos: [chibios](https://github.com/ChibiOS/ChibiOS) and [chibios-contrib](https://github.com/ChibiOS/ChibiOS-Contrib). However - be warned that things may be somewhat out-of-sync (updates at different rates), so you may need to hunt a bit for the right commits.) + +(Why do we need chibios-contrib? Well, the main repo focuses on STM32 chips, and Freescale/NXP Kinetis chips are supported via the Contrib repository.) This should be it. Running `make` in `keyboard/teensy_lc_onekey` should create a working firmware in `build/`, called `ch.hex`. diff --git a/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld index 9e9e9250..fb141f88 100644 --- a/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld +++ b/keyboard/teensy_lc_onekey/ld/MKL26Z64.ld @@ -1,47 +1,86 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio. - - This file is part of ChibiOS. - - ChibiOS 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 3 of the License, or - (at your option) any later version. - - ChibiOS 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 . -*/ + * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com + * (C) 2016 flabbergast + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ /* * KL26Z64 memory setup. */ MEMORY { - flash0 : org = 0x00000000, len = 0xc0 - flashcfg : org = 0x00000400, len = 0x10 - flash : org = 0x00000410, len = 62k - 0x410 - eeprom_emu : org = 0x0000F800, len = 2k - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 + flash0 : org = 0x00000000, len = 0x100 + flash1 : org = 0x00000400, len = 0x10 + flash2 : org = 0x00000410, len = 62k - 0x410 + flash3 : org = 0x0000F800, len = 2k + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x1FFFF800, len = 8k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 } -__eeprom_workarea_start__ = ORIGIN(eeprom_emu); -__eeprom_workarea_size__ = LENGTH(eeprom_emu); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; +/* Flash region for the configuration bytes.*/ +SECTIONS +{ + .cfmprotect : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.cfmconfig)) + } > flash1 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash2); +REGION_ALIAS("XTORS_FLASH_LMA", flash2); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash2); +REGION_ALIAS("TEXT_FLASH_LMA", flash2); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash2); +REGION_ALIAS("RODATA_FLASH_LMA", flash2); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash2); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); /* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts*/ + of all exceptions and interrupts.*/ REGION_ALIAS("MAIN_STACK_RAM", ram0); /* RAM region to be used for the process stack. This is the stack used by @@ -50,6 +89,7 @@ REGION_ALIAS("PROCESS_STACK_RAM", ram0); /* RAM region to be used for data segment.*/ REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash2); /* RAM region to be used for BSS segment.*/ REGION_ALIAS("BSS_RAM", ram0); @@ -57,4 +97,9 @@ REGION_ALIAS("BSS_RAM", ram0); /* RAM region to be used for the default heap.*/ REGION_ALIAS("HEAP_RAM", ram0); -INCLUDE ld/rules_kinetis.ld +__eeprom_workarea_start__ = ORIGIN(flash3); +__eeprom_workarea_size__ = LENGTH(flash3); +__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; + +/* Generic rules inclusion.*/ +INCLUDE rules.ld From 20b787fc1284176834cbe7ca2134e4b36bec5828 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 22 May 2016 22:49:29 +0900 Subject: [PATCH 171/179] Squashed 'tmk_core/' changes from d5c5ac6..8da1898 8da1898 Merge remote-tracking branch 'flabbergast/chibios' f0fdd8a ChibiOS: update instructions.md. 24dd0b5 ChibiOS: update mk to match chibios/master. cdee266 Merge branch 'develop' into chibios 221663c Fix signatre of layer state change hooks 5a364cb Merge branch 'hotfix-chibios' into develop af664cd Merge branch 'newapi' into develop 04feeaa Clean hook codes 0ca106d Fix code and table in hook.txt 714d418 Add hook document from njbair's work b715129 Chibios: add default location for chibios-contrib. fb3a323 Merge branch 'master' into newapi 8b7fbbd Merge branch 'master' into develop e49851a Chibios: add default location for chibios-contrib. git-subtree-dir: tmk_core git-subtree-split: 8da189851ba83b9bb46a4290cd76b7b7fef6134e --- common/action_layer.c | 1 + common/hook.c | 38 +++++-------- common/hook.h | 24 +++++--- doc/hook.txt | 111 +++++++++++++++++++++++++++++++++++++ protocol/chibios/README.md | 19 +++---- tool/chibios/.gitignore | 1 + tool/chibios/chibios.mk | 12 ++-- 7 files changed, 157 insertions(+), 49 deletions(-) create mode 100644 doc/hook.txt diff --git a/common/action_layer.c b/common/action_layer.c index 0c1d5d21..6c0be46f 100644 --- a/common/action_layer.c +++ b/common/action_layer.c @@ -22,6 +22,7 @@ static void default_layer_state_set(uint32_t state) debug("default_layer_state: "); default_layer_debug(); debug(" to "); default_layer_state = state; + hook_default_layer_change(default_layer_state); default_layer_debug(); debug("\n"); clear_keyboard_but_mods(); // To avoid stuck keys } diff --git a/common/hook.c b/common/hook.c index 204407b7..4ed2403c 100644 --- a/common/hook.c +++ b/common/hook.c @@ -19,43 +19,31 @@ along with this program. If not, see . #include "hook.h" /* ------------------------------------------------- - * Definitions of hardware-independent default hooks + * Definitions of default hooks * ------------------------------------------------- */ -/* Called on layer state change event. */ -/* Default behaviour: do nothing. */ -__attribute__((weak)) -void hook_layer_change(uint8_t layer_state) { - (void)layer_state; -} - -/* Called periodically from the matrix scan loop (very often!) */ -/* Default behaviour: do nothing. */ __attribute__((weak)) void hook_keyboard_loop(void) {} -/* Called on matrix state change event (every keypress => often!) */ -/* Default behaviour: do nothing. */ __attribute__((weak)) void hook_matrix_change(keyevent_t event) { - (void)event; + (void)event; +} + +__attribute__((weak)) +void hook_default_layer_change(uint32_t default_layer_state) { + (void)default_layer_state; +} + +__attribute__((weak)) +void hook_layer_change(uint32_t layer_state) { + (void)layer_state; } -/* Called on indicator LED update event (when reported from host). */ -/* Default behaviour: calls led_set (for compatibility). */ __attribute__((weak)) void hook_keyboard_leds_change(uint8_t led_status) { keyboard_set_leds(led_status); } -/* Called once, on checking the bootmagic combos. */ -/* Default behaviour: do nothing. */ __attribute__((weak)) -void hook_bootmagic(void) { - /* An example: */ - // #include "bootmagic.h" - // #include "keymap.h" - // if(bootmagic_scan_keycode(KC_W)) { - // // do something - // } -} +void hook_bootmagic(void) {} diff --git a/common/hook.h b/common/hook.h index ff569d49..56fe5677 100644 --- a/common/hook.h +++ b/common/hook.h @@ -22,14 +22,14 @@ along with this program. If not, see . #include "led.h" /* ------------------------------------- - * Hardware / one-off hooks + * Protocol hooks * ------------------------------------- */ -/* Called once, before initialising USB. */ +/* Called once, very early stage of initialization, just after processor startup. */ /* Default behaviour: do nothing. */ void hook_early_init(void); -/* Called once, after USB is connected and keyboard initialised. */ +/* Called once, very last stage of initialization, just before keyboard loop. */ /* Default behaviour: do nothing. */ void hook_late_init(void); @@ -47,12 +47,9 @@ void hook_usb_suspend_loop(void); * the "normal" indicator LED status by default. */ void hook_usb_wakeup(void); -/* Called once, on checking the bootmagic combos. */ -/* Default behaviour: do nothing. */ -void hook_bootmagic(void); /* ------------------------------------- - * Keyboard / periodic hooks + * Keyboard hooks * ------------------------------------- */ /* Called periodically from the keyboard loop (very often!) */ @@ -63,12 +60,21 @@ void hook_keyboard_loop(void); /* Default behaviour: do nothing. */ void hook_matrix_change(keyevent_t event); +/* Called on default layer state change event. */ +/* Default behaviour: do nothing. */ +void hook_default_layer_change(uint32_t default_layer_state); + /* Called on layer state change event. */ /* Default behaviour: do nothing. */ -void hook_layer_change(uint8_t layer_state); +void hook_layer_change(uint32_t layer_state); /* Called on indicator LED update event (when reported from host). */ -/* Default behaviour: calls keyboard_set_leds (for compatibility). */ +/* Default behaviour: calls keyboard_set_leds. */ void hook_keyboard_leds_change(uint8_t led_status); +/* Called once, on checking the bootmagic combos. */ +/* Default behaviour: do nothing. */ +void hook_bootmagic(void); + + #endif /* _HOOKS_H_ */ diff --git a/doc/hook.txt b/doc/hook.txt new file mode 100644 index 00000000..1689034e --- /dev/null +++ b/doc/hook.txt @@ -0,0 +1,111 @@ +Hooks +----- +Hooks allow you to execute custom code at certain predefined points in the firmware execution. To use them, just define the hook function in your keymap file. + +The following hooks are available available: + +Hook function | Timing +--------------------------------|----------------------------------------------- +`hook_early_init(void)` | Early in the boot process, before the matrix is initialized and before a connection is made with the host. Thus, this hook has access to very few parameters, but it is a good place to define any custom parameters needed by other early processes. +`hook_late_init(void)` | Near the end of the boot process, after Boot Magic has run and LEDs have been initialized. +`hook_bootmagic(void)` | During the Boot Magic window, after EEPROM and Bootloader checks are made, but before any other built-in Boot Magic checks are made. +`hook_usb_wakeup(void)` | When the device wakes up from USB suspend state. +`hook_usb_suspend_entry(void)` | When the device enters USB suspend state. +`hook_usb_suspend_loop(void)` | Continuously, while the device is in USB suspend state. *Default action:* power down and periodically check the matrix, causing wakeup if needed. +`hook_keyboard_loop(void)` | Continuously, during the main loop, after the matrix is checked. +`hook_matrix_change(keyevent_t event)` | When a matrix state change is detected, before any other actions are processed. +`hook_layer_change(uint32_t layer_state)` | When any layer is changed. +`hook_default_layer_change(uint32_t default_layer_state)` | When any default layer is changed. +`hook_keyboard_leds_change(uint8_t led_status)` | Whenever a change in the LED status is performed. *Default action:* call `keyboard_set_leds(led_status)` + + + + + +### Hooks Examples + +You can try these out by copying the code to your keymap file, or any .c file in the Makefile `SRC`. + +#### Activate keymap layer 5 on startup + +```C +#include "action_layer.h" + +void hook_late_init(void) +{ + layer_on(5); + print("Layer 5 enabled!"); +} +``` + +#### Blink the Caps Lock LED every .5 seconds + +```C +#include "timer.h" +#include "led.h" + +bool my_led_status = 0; +uint16_t my_led_timer; + +void hook_keyboard_loop(void) +{ + // check if we've reached 500 milliseconds yet... + if (timer_elapsed(my_led_timer) > 500) + { + // we've reached 500 milliseconds! + // reset the timer + my_led_timer = timer_read(); + + // check the current LED state + if (my_led_status) + { + // LED is on, so let's turn it off + led_set(host_keyboard_leds() & ~(1< 50) + { + led_set(host_keyboard_leds()); + + my_led_status = 0; + } + } +} + +``` diff --git a/protocol/chibios/README.md b/protocol/chibios/README.md index 81f115ad..63e6641f 100644 --- a/protocol/chibios/README.md +++ b/protocol/chibios/README.md @@ -4,23 +4,19 @@ This code can be used to run TMK keyboard logic on top of [ChibiOS], meaning tha ### Usage -- To use, unpack or symlink [ChibiOS] to `tmk_core/tool/chibios/chibios`. For Kinetis support (this means Teensies, Infinity keyboard, WhiteFox keyboard), you'll need a fork which implements the USB driver, e.g. [this one](https://github.com/flabbergast/ChibiOS/tree/kinetis). +- To use, [get a zip of chibios](https://github.com/ChibiOS/ChibiOS/archive/a7df9a891067621e8e1a5c2a2c0ceada82403afe.zip) and unpack/rename it to `tmk_core/tool/chibios/chibios`; or you can just clone [the repo](https://github.com/ChibiOS/ChibiOS) there. For Freescale/NXP Kinetis support (meaning ARM Teensies and the Infinity keyboard), you'll also need [a zip of chibios-contrib](https://github.com/ChibiOS/ChibiOS-Contrib/archive/e1311c4db6cd366cf760673f769e925741ac0ad3.zip), unpacked/renamed to `tmk_core/tool/chibios/chibios-contrib`. Likewise, for git-savvy people, just clone [the repo](https://github.com/ChibiOS/ChibiOS-Contrib) there. +- Note: the abovementioned directories are the defaults. You can have the two chibios repositories wherever you want, just define their location in `CHIBIOS` and `CHIBIOS_CONTRIB` variables in your `Makefile`. - You will also need to install an ARM toolchain, for instance from [here](https://launchpad.net/gcc-arm-embedded). On linux, this is usually also present as a package for your distribution (as `gcc-arm` or something similar). On OS X, you can use [homebrew](http://brew.sh/) with an appropriate tap. ### Notes - Some comments about ChibiOS syntax and the most commonly used GPIO functions are, as well as an example for ARM Teensies, is [here](https://github.com/tmk/tmk_keyboard/blob/master/keyboard/teensy_lc_onekey/instructions.md). - For gcc options, inspect `tmk_core/tool/chibios/chibios.mk`. For instance, I enabled `-Wno-missing-field-initializers`, because TMK common bits generated a lot of warnings on that. -Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. +- For debugging, it is sometimes useful disable gcc optimisations, you can do that by adding `-O0` to `OPT_DEFS` in your `Makefile`. - USB string descriptors are messy. I did not find a way to cleanly generate the right structures from actual strings, so the definitions in individual keyboards' `config.h` are ugly as heck. - It is easy to add some code for testing (e.g. blink LED, do stuff on button press, etc...) - just create another thread in `main.c`, it will run independently of the keyboard business. -- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. An additional startup code is also needed; the best way to deal with this is to define custom board files. (Example forthcoming.) +- Jumping to (the built-in) bootloaders on STM32 works, but it is not entirely pleasant, since it is very much MCU dependent. So, one needs to dig out the right address to jump to, and either pass it to the compiler in the `Makefile`, or better, define it in `/bootloader_defs.h`. An additional startup code is also needed; the best way to deal with this is to define custom board files. (Example forthcoming.) In any case, there are no problems for Teensies. -### Experimental pre-ChibiOS 4 support -- As an alternative to the mentioned flabbergast branch above, you can use the [master branch of ChibiOS](https://github.com/ChibiOS/ChibiOS). -- Note that the Kinetis support has moved to the [ChibiOS-Contrib repository](https://github.com/ChibiOS/ChibiOS-Contrib), so you need to put that into your repository in the same way as you did for the main ChibiOS repository. -- You also need to define CHIBIOS_CONTRIB in your makefile and point it to the right directory. -- You need to add some new options to chconf.h, or you will get compiler errors. Just copy the new options from samples provided by the ChibiOS-Contrib repository. ### Immediate todo @@ -43,15 +39,16 @@ Also pay attention to `-O0` (enabled for debugging); for deployment use `-O2`. ## ChibiOS-supported MCUs - Pretty much all STM32 chips. -- There is some support for K20x and KL2x Freescale chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), but again, no official USB stack yet. However the `kinetis` branch of [flabbergast's ChibiOS fork](https://github.com/flabbergast/ChibiOS). With this fork, TMK work normally on all the ARM Teensies. -- There is also support for AVR8, but the USB stack is not implemented for them yet, and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. -- I've seen community support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but not sure about the extent. +- K20x and KL2x Freescale/NXP chips (i.e. Teensy 3.x/LC, mchck, FRDM-KL2{5,6}Z, FRDM-K20D50M), via the [ChibiOS-Contrib](https://github.com/ChibiOS/ChibiOS-Contrib) repository. +- There is also support for AVR8, but the USB stack is not implemented for them yet (some news on that front recently though), and also the kernel itself takes about 1k of RAM. I think people managed to get ChibiOS running on atmega32[8p/u4] though. +- There is also support for Nordic NRF51822 (the chip in Adafruit's Bluefruit bluetooth-low-energy boards), but be aware that that chip does *not* have USB, and the BLE softdevice (i.e. Bluetooth) is not supported directly at the moment. ## STM32-based keyboard design considerations - STM32F0x2 chips can do crystal-less USB, but they still need a 3.3V voltage regulator. - The BOOT0 pin should be tied to GND. - For a hardware way of accessing the in-built DFU bootloader, in addition to the reset button, put another button between the BOOT0 pin and 3V3. +- There is a working example of a STM32F042-based keyboard: [firmware here](https://github.com/flabbergast/flabber_kbs/tree/master/kb45p) and [hardware (kicad) here](https://github.com/flabbergast/kicad/tree/master/kb45p). You can check this example firmware for custom board files, and a more complicated matrix than just one key. diff --git a/tool/chibios/.gitignore b/tool/chibios/.gitignore index 3118dbef..88bbafe3 100644 --- a/tool/chibios/.gitignore +++ b/tool/chibios/.gitignore @@ -1 +1,2 @@ chibios +chibios-contrib diff --git a/tool/chibios/chibios.mk b/tool/chibios/chibios.mk index 2dabd515..f2fedd22 100644 --- a/tool/chibios/chibios.mk +++ b/tool/chibios/chibios.mk @@ -84,6 +84,7 @@ endif # Imported source files and paths CHIBIOS ?= $(TMK_DIR)/tool/chibios/chibios +CHIBIOS_CONTRIB ?= $(TMK_DIR)/tool/chibios/chibios-contrib # Startup files. Try a few different locations, for compability with old versions and # for things hardware in the contrib repository STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk @@ -122,6 +123,7 @@ PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk endif include $(PORT_V) # Other files (optional). +include $(CHIBIOS)/os/hal/lib/streams/streams.mk # Define linker script file here ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld)","") @@ -139,7 +141,7 @@ CSRC = $(STARTUPSRC) \ $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ + $(STREAMSSRC) \ $(TMK_DIR)/protocol/chibios/usb_main.c \ $(TMK_DIR)/protocol/chibios/main.c \ $(SRC) @@ -169,11 +171,13 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = +ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) -INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ +INCDIR = $(CHIBIOS)/os/license \ + $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \ + $(STREAMSINC) $(CHIBIOS)/os/various \ $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \ $(TMK_DIR)/protocol $(TARGET_DIR) From 4d9e66baeccc130f5263460f8e1228bb85cb92c7 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 25 May 2016 10:25:32 +0900 Subject: [PATCH 172/179] adb_usb: Fix swap ISO codes bug --- converter/adb_usb/matrix.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index abcc0cc9..12c3ada7 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -74,10 +74,10 @@ void matrix_init(void) // wait for keyboard to boot up and receive command _delay_ms(1000); - // Determine ISO keyboard by handle id + // Determine ISO keyboard by handler id // http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L815 - uint16_t handle_id = adb_host_talk(ADB_ADDR_KEYBOARD, 3); - switch (handle_id) { + uint16_t handler_id = adb_host_talk(ADB_ADDR_KEYBOARD, 3); + switch (handler_id) { case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: case 0xC4: case 0xC7: @@ -108,8 +108,8 @@ void matrix_init(void) _delay_ms(500); DDRD |= (1<<6); PORTD &= ~(1<<6); - uint16_t handle_id2 = adb_host_talk(ADB_ADDR_KEYBOARD, 3); - xprintf("handle_id: %02X -> %02X\n", handle_id&0xff, handle_id2&0xff); + uint16_t handler_id2 = adb_host_talk(ADB_ADDR_KEYBOARD, 3); + xprintf("handler_id: %02X -> %02X\n", (handler_id & 0xff), (handler_id2 & 0xff)); return; } @@ -214,6 +214,7 @@ uint8_t matrix_scan(void) return key1; } else { /* Swap codes for ISO keyboard + * https://github.com/tmk/tmk_keyboard/issues/35 * * ANSI * ,----------- ----------. @@ -246,10 +247,10 @@ uint8_t matrix_scan(void) * *c 0x2A 0x2A 0x31 0x31(or 0x32) */ if (is_iso_layout) { - if (key0 == 0x32) { - key0 = 0x0A; - } else if (key0 == 0x0A) { - key0 = 0x32; + if ((key0 & 0x7F) == 0x32) { + key0 = (key0 & 0x80) | 0x0A; + } else if ((key0 & 0x7F) == 0x0A) { + key0 = (key0 & 0x80) | 0x32; } } register_key(key0); From 5cbc226addd2983076aae47611491c96b92d0344 Mon Sep 17 00:00:00 2001 From: Matija Kovacic Date: Wed, 1 Jun 2016 16:57:31 +0200 Subject: [PATCH 173/179] Update config.h Please see the post at https://deskthority.net/keyboards-f2/tmk-firmware-for-xt-keyboards-t13847.html --- converter/xt_usb/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/xt_usb/config.h b/converter/xt_usb/config.h index 21e76400..a9f44ca8 100644 --- a/converter/xt_usb/config.h +++ b/converter/xt_usb/config.h @@ -57,7 +57,7 @@ along with this program. If not, see . #define XT_DATA_BIT 0 #define XT_INT_INIT() do { \ EICRA |= ((1< Date: Wed, 1 Jun 2016 08:34:14 -0700 Subject: [PATCH 174/179] Update XT converter readme. - Add mac os garbage to git ignore. --- .gitignore | 1 + converter/xt_usb/README.md | 54 +++----------------------------------- 2 files changed, 4 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index f3f46872..0d87fe42 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ tags *~ build/ *.bak +.DS_Store diff --git a/converter/xt_usb/README.md b/converter/xt_usb/README.md index 74464e26..b9641a03 100644 --- a/converter/xt_usb/README.md +++ b/converter/xt_usb/README.md @@ -1,6 +1,6 @@ -PS/2 to USB keyboard converter +XT to USB keyboard converter ============================== -This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set 2.) +This firmware converts XT keyboard protocol to USB.(It supports Scan Code Set 1.) Connect Wires @@ -10,8 +10,6 @@ In case of Teensy2.0(ATMega32U4): 1. Connect **Vcc** and **GND**. 2. Connect **Clock** and **Data** line. - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible) - - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`. - - **USART**: **Clock** is on `PD5` and **Data** on `PD2`. 3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. To change pin configuration edit **config.h** and **Makefile**. @@ -29,56 +27,10 @@ To select keymap: $ make clean $ make KEYMAP=[plain|jis|spacefn|...] -After that you will find HEX file `ps2_usb_lufa.hex` in current directory. - - -- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`. - -- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`. +After that you will find HEX file `xt_usb_lufa.hex` in current directory. Keymap ------ Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_.c` and see keymap document(you can find in README.md of top directory) and existent keymap files. - -PS/2 signal handling implementations ------------------------------------- -Following three methods can be used to implement PS/2 signal handling. - -### Simple and stupid busy-wait(ps2_busywait.c) - This is expected to implemented with portable C code for reference. -### Interrupt driven(ps2_interrupt.c) - Uses pin interrupt to detect falling edge of clock line. -### USART hardware module(ps2_usart.c) - Uses AVR USART engine to receive PS/2 signal. - -To select method edit Makefile. - - -V-USB Support -------------- -With V-USB you can use this converter on ATmega(168/328) but it doesn't support NKRO at this time. - -Circuit: - - +---+ +---------------+ - USB GND | | ATmega168 | - === C3 | | - 5V <-------+--------+---|Vcc,AVCC | PS/2 - R1 | | ==== - D- <----+--+-----R2-----|INT1 RXD|------->DATA - D+ <----|---+----R3-----|INT0 XCK|------->CLOCK - Z1 Z2 | | ->5V - GND<----+---+--+--+-----|GND | ->GND - | | | | - | C2-+--|XTAL1 | - | X1 | | - +--C3-+--|XTAL2 | - +---------------+ - R1: 1.5K Ohm - R2,R3: 68 Ohm - Z1,Z2: Zenner 3.6V - C1,C2: 22pF - C3: 0.1uF - X1: Crystal 20MHz(16MHz/12MHz) From 230ed4bdef855202a4c340fe645f05e2ca124521 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 4 Jun 2016 19:02:41 +0900 Subject: [PATCH 175/179] core: change API of adb.c to accept device address --- tmk_core/protocol/adb.c | 22 +++++++++++----------- tmk_core/protocol/adb.h | 26 ++++++++++++++++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index b9b0be98..164255ef 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c @@ -86,9 +86,9 @@ bool adb_host_psw(void) * * */ -uint16_t adb_host_kbd_recv(void) +uint16_t adb_host_kbd_recv(uint8_t addr) { - return adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_0); + return adb_host_talk(addr, ADB_REG_0); } #ifdef ADB_MOUSE_ENABLE @@ -156,11 +156,11 @@ error: return -n; } -void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l) +void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l) { cli(); attention(); - send_byte(cmd); + send_byte((addr<<4) | (ADB_CMD_LISTEN<<2) | reg); place_bit0(); // Stopbit(0) _delay_us(200); // Tlt/Stop to Start place_bit1(); // Startbit(1) @@ -171,12 +171,12 @@ void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l) } // send state of LEDs -void adb_host_kbd_led(uint8_t led) +void adb_host_kbd_led(uint8_t addr, uint8_t led) { - // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) - // send upper byte (not used) - // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0: - adb_host_listen(0x2A,0,led&0x07); + // Listen Register2 + // upper byte: not used + // lower byte: bit2=ScrollLock, bit1=CapsLock, bit0=NumLock + adb_host_listen(addr, 2, 0, led & 0x07); } @@ -325,7 +325,7 @@ Commands bits commands ------------------------------------------------------ - - - - - 0 0 0 0 Send Request(reset all devices) + - - - - 0 0 0 0 Send Reset(reset all devices) A A A A 0 0 0 1 Flush(reset a device) - - - - 0 0 1 0 Reserved - - - - 0 0 1 1 Reserved @@ -440,7 +440,7 @@ Address, Handler ID and bits(Register3) | | | | +-+-+-+----------------- Address | | | +------------------------- 0 | | +--------------------------- Service request enable(1 = enabled) - | +----------------------------- Exeptional event(alwyas 1 if not used) + | +----------------------------- Exceptional event(alwyas 1 if not used) +------------------------------- 0 ADB Bit Cells diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h index d81c4a77..a8b97ea5 100644 --- a/tmk_core/protocol/adb.h +++ b/tmk_core/protocol/adb.h @@ -53,30 +53,40 @@ POSSIBILITY OF SUCH DAMAGE. /* ADB commands */ +// Default Address +#define ADB_ADDR_DONGLE 1 #define ADB_ADDR_KEYBOARD 2 #define ADB_ADDR_MOUSE 3 +#define ADB_ADDR_TABLET 4 +#define ADB_ADDR_APPLIANCE 7 +// Command Type +#define ADB_CMD_RESET 0 +#define ADB_CMD_FLUSH 1 #define ADB_CMD_LISTEN 2 #define ADB_CMD_TALK 3 +// Register #define ADB_REG_0 0 #define ADB_REG_1 1 #define ADB_REG_2 2 #define ADB_REG_3 3 -/* ADB keyboard handle id */ -#define ADB_HANDLE_M0116 0x01 -#define ADB_HANDLE_M0115 0x02 -#define ADB_HANDLE_M3501 0x02 -#define ADB_HANDLE_M1242 0x10 +/* ADB keyboard handler id */ +#define ADB_HANDLER_M0116 0x01 +#define ADB_HANDLER_IIGS 0x01 +#define ADB_HANDLER_M0115 0x02 +#define ADB_HANDLER_M3501 0x02 +#define ADB_HANDLER_M1242_ANSI 0x10 +#define ADB_HANDLER_EXTENDED_PROTOCOL 0x03 // ADB host void adb_host_init(void); bool adb_host_psw(void); -uint16_t adb_host_kbd_recv(void); +uint16_t adb_host_kbd_recv(uint8_t addr); uint16_t adb_host_mouse_recv(void); uint16_t adb_host_talk(uint8_t addr, uint8_t reg); -void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); -void adb_host_kbd_led(uint8_t led); +void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l); +void adb_host_kbd_led(uint8_t addr, uint8_t led); void adb_mouse_task(void); void adb_mouse_init(void); From b653b622a623f0e8e2c03af8254e6ac3d29b71c7 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 4 Jun 2016 19:29:02 +0900 Subject: [PATCH 176/179] adb_usb: Add support for Apple Adjustable keybaord media keys --- converter/adb_usb/MEMO.txt | 27 +++++++++ converter/adb_usb/keymap_common.h | 22 +++---- converter/adb_usb/keymap_plain.c | 8 +-- converter/adb_usb/led.c | 2 +- converter/adb_usb/matrix.c | 95 ++++++++++++++++++++++++++----- 5 files changed, 124 insertions(+), 30 deletions(-) create mode 100644 converter/adb_usb/MEMO.txt diff --git a/converter/adb_usb/MEMO.txt b/converter/adb_usb/MEMO.txt new file mode 100644 index 00000000..f079442c --- /dev/null +++ b/converter/adb_usb/MEMO.txt @@ -0,0 +1,27 @@ +ADB keyboard handle id +====================== +0x01 Apple Standard keyboard M0116 ANSI +0x01 Apple Desktop Bus keyboard 658-4081 ANSI +0x02 Apple Extended Keyboard M0115 ANSI +0x02 Apple Extended Keyboard II M3501 ANSI +0x03 Logical id for Extended Protocol +0x10 Apple Adjustable keyboard M1242 ANSI + + +Adjustable Keyboard media key +============================= +Media key part has different address than the main keyboard(0x02). + +Device Address: 0x07(Appliances/Misc devices) +Handler ID: 0x02 + +Scan Codes +---------- +Media key ADB Code Code in Matix +----------------------------------------- +Volume Up: 0x03 0x48 +Volume Down: 0x02 0x49 +Mute: 0x01 0x4a +Mic: 0x00 0x42 + +As for these keys raw ADB codes are translate into logical codes in matrix. diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h index 0a917cbc..cb643c8f 100644 --- a/converter/adb_usb/keymap_common.h +++ b/converter/adb_usb/keymap_common.h @@ -34,9 +34,9 @@ extern const uint16_t fn_actions[]; /* Common layout: ANSI+ISO - * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. - * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| - * `---' `---------------' `---------------' `---------------' `-----------' `---' + * ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---------------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' * ,-----------------------------------------------------------. ,-----------. ,---------------. * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| * |-----------------------------------------------------------| |-----------| |---------------| @@ -46,16 +46,16 @@ extern const uint16_t fn_actions[]; * |-----------------------------------------------------------| ,---. |---------------| * |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | * |-----------------------------------------------------------| ,-----------. |-----------|Ent| - * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | + * |Ctrl |Opt |Cmd | Space |App |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| | * `-----------------------------------------------------------' `-----------' `---------------' */ #define KEYMAP( \ - K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ + K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K49,K48,K4A,K7F, \ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ - K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ + K36,K3A,K37, K31, K42,K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ ) { \ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ @@ -65,12 +65,12 @@ extern const uint16_t fn_actions[]; { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \ - { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \ - { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \ + { KC_F17, KC_##K41, KC_##K42, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \ + { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \ { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ - { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \ - { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \ - { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \ + { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_JYEN, KC_RO, KC_PCMM }, \ + { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_HANJ, KC_##K67 }, \ + { KC_HAEN, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \ { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \ } diff --git a/converter/adb_usb/keymap_plain.c b/converter/adb_usb/keymap_plain.c index 433a5cb3..2f11f86a 100644 --- a/converter/adb_usb/keymap_plain.c +++ b/converter/adb_usb/keymap_plain.c @@ -19,20 +19,20 @@ */ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,NO, FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN1, DEL, END, PGDN, P7, P8, P9, PMNS, LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, - LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT + LCTL,LALT,LGUI, SPC, APP, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT ), [1] = KEYMAP( - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, VOLD,VOLU,MUTE,NO, FN0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3, TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN1, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D, LCAP,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U, LSFT,NUBS,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R, - LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3 + LCTL,LALT,LGUI, SPC, APP, RALT,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3 ), }; diff --git a/converter/adb_usb/led.c b/converter/adb_usb/led.c index 3ee64a8e..ea9bf77b 100644 --- a/converter/adb_usb/led.c +++ b/converter/adb_usb/led.c @@ -23,5 +23,5 @@ along with this program. If not, see . void led_set(uint8_t usb_led) { - adb_host_kbd_led(~usb_led); + adb_host_kbd_led(ADB_ADDR_KEYBOARD, ~usb_led); } diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c index 12c3ada7..6190c71a 100644 --- a/converter/adb_usb/matrix.c +++ b/converter/adb_usb/matrix.c @@ -39,6 +39,7 @@ along with this program. If not, see . #endif +static bool has_media_keys = false; static bool is_iso_layout = false; static bool is_modified = false; static report_mouse_t mouse_report = {}; @@ -70,13 +71,26 @@ uint8_t matrix_cols(void) void matrix_init(void) { + // LED on + DDRD |= (1<<6); PORTD |= (1<<6); + adb_host_init(); // wait for keyboard to boot up and receive command - _delay_ms(1000); + _delay_ms(2000); + + // device scan + xprintf("Before init:\n"); + for (uint8_t addr = 1; addr < 16; addr++) { + uint16_t reg3 = adb_host_talk(addr, ADB_REG_3); + if (reg3) { + xprintf("Scan: addr:%d, reg3:%04X\n", addr, reg3); + } + _delay_ms(20); + } // Determine ISO keyboard by handler id // http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L815 - uint16_t handler_id = adb_host_talk(ADB_ADDR_KEYBOARD, 3); + uint16_t handler_id = adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_3); switch (handler_id) { case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: @@ -88,11 +102,27 @@ void matrix_init(void) break; } + // Adjustable keyboard media keys: address=0x07 and handlerID=0x02 + has_media_keys = (0x02 == (adb_host_talk(ADB_ADDR_APPLIANCE, ADB_REG_3) & 0xff)); + if (has_media_keys) { + xprintf("Found: media keys\n"); + } + // Enable keyboard left/right modifier distinction - // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11) - // upper byte: reserved bits 0000, device address 0010 - // lower byte: device handler 00000011 - adb_host_listen(0x2B,0x02,0x03); + // Listen Register3 + // upper byte: reserved bits 0000, keyboard address 0010 + // lower byte: device handler 00000011 + adb_host_listen(ADB_ADDR_KEYBOARD, ADB_REG_3, ADB_ADDR_KEYBOARD, ADB_HANDLER_EXTENDED_PROTOCOL); + + // device scan + xprintf("After init:\n"); + for (uint8_t addr = 1; addr < 16; addr++) { + uint16_t reg3 = adb_host_talk(addr, ADB_REG_3); + if (reg3) { + xprintf("Scan: addr:%d, reg3:%04X\n", addr, reg3); + } + _delay_ms(20); + } // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; @@ -103,14 +133,8 @@ void matrix_init(void) //debug_mouse = true; print("debug enabled.\n"); - // LED flash - DDRD |= (1<<6); PORTD |= (1<<6); - _delay_ms(500); + // LED off DDRD |= (1<<6); PORTD &= ~(1<<6); - - uint16_t handler_id2 = adb_host_talk(ADB_ADDR_KEYBOARD, 3); - xprintf("handler_id: %02X -> %02X\n", (handler_id & 0xff), (handler_id2 & 0xff)); - return; } @@ -192,7 +216,50 @@ uint8_t matrix_scan(void) if ( codes == 0xFFFF ) { _delay_ms(12); // delay for preventing overload of poor ADB keyboard controller - codes = adb_host_kbd_recv(); + codes = adb_host_kbd_recv(ADB_ADDR_KEYBOARD); + + // Adjustable keybaord media keys + if (codes == 0 && has_media_keys && + (codes = adb_host_kbd_recv(ADB_ADDR_APPLIANCE))) { + // key1 + switch (codes & 0x7f ) { + case 0x00: // Mic + codes = (codes & ~0x007f) | 0x42; + break; + case 0x01: // Mute + codes = (codes & ~0x007f) | 0x4a; + break; + case 0x02: // Volume down + codes = (codes & ~0x007f) | 0x49; + break; + case 0x03: // Volume Up + codes = (codes & ~0x007f) | 0x48; + break; + case 0x7F: // no code + break; + default: + xprintf("ERROR: media key1\n"); + return 0x11; + } + // key0 + switch ((codes >> 8) & 0x7f ) { + case 0x00: // Mic + codes = (codes & ~0x7f00) | (0x42 << 8); + break; + case 0x01: // Mute + codes = (codes & ~0x7f00) | (0x4a << 8); + break; + case 0x02: // Volume down + codes = (codes & ~0x7f00) | (0x49 << 8); + break; + case 0x03: // Volume Up + codes = (codes & ~0x7f00) | (0x48 << 8); + break; + default: + xprintf("ERROR: media key0\n"); + return 0x10; + } + } } key0 = codes>>8; key1 = codes&0xFF; From 279876ef5e7d20bffaaa727fdca3a8fa15017781 Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 6 Jun 2016 01:29:46 +0900 Subject: [PATCH 177/179] core: Fix LUFA report descriptor - Logical Min/Max contains signed value and needs 16 bit to indicate 255 https://github.com/jackhumbert/qmk_firmware/issues/312 --- tmk_core/protocol/lufa/descriptor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c index c13a81bd..61afb89a 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/lufa/descriptor.c @@ -73,10 +73,10 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] = HID_RI_OUTPUT(8, HID_IOF_CONSTANT), HID_RI_USAGE_PAGE(8, 0x07), /* Keyboard */ - HID_RI_USAGE_MINIMUM(8, 0x00), /* Reserved (no event indicated) */ - HID_RI_USAGE_MAXIMUM(8, 0xFF), /* Keyboard Application */ + HID_RI_USAGE_MINIMUM(8, 0x00), + HID_RI_USAGE_MAXIMUM(8, 0xFF), /* Usage ID 0x00-0xFF */ HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0x00FF), /* needs 16 bit to indicate positive value */ HID_RI_REPORT_COUNT(8, 0x06), HID_RI_REPORT_SIZE(8, 0x08), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), From 7ce326dee5f5ae6dc558356a79c58f8d4c150fe0 Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 8 Jun 2016 05:17:47 +0900 Subject: [PATCH 178/179] core: Fix Logical Maximum in report descriptor --- tmk_core/protocol/chibios/usb_main.c | 4 ++-- tmk_core/protocol/lufa/descriptor.c | 4 ++-- tmk_core/protocol/mbed/HIDKeyboard.cpp | 2 +- tmk_core/protocol/pjrc/usb.c | 4 ++-- tmk_core/protocol/vusb/vusb.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 106ce087..fbf0ceba 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -153,7 +153,7 @@ static const uint8_t keyboard_hid_report_desc_data[] = { 0x95, KBD_REPORT_KEYS, // Report Count (), 0x75, 0x08, // Report Size (8), 0x15, 0x00, // Logical Minimum (0), - 0x25, 0xFF, // Logical Maximum(255), + 0x26, 0xFF, 0x00, // Logical Maximum(255), 0x05, 0x07, // Usage Page (Key Codes), 0x19, 0x00, // Usage Minimum (0), 0x29, 0xFF, // Usage Maximum (255), @@ -299,7 +299,7 @@ static const uint8_t extra_hid_report_desc_data[] = { 0xa1, 0x01, // COLLECTION (Application) 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) + 0x26, 0xb7, 0x00, // LOGICAL_MAXIMUM (0xb7) 0x19, 0x01, // USAGE_MINIMUM (0x1) 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) 0x75, 0x10, // REPORT_SIZE (16) diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c index 61afb89a..6c2cacb5 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/lufa/descriptor.c @@ -172,13 +172,13 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = HID_RI_COLLECTION(8, 0x01), /* Application */ HID_RI_USAGE(8, 0x75), /* Vendor Usage 0x75 */ HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0x00FF), HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE), HID_RI_REPORT_SIZE(8, 0x08), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), HID_RI_USAGE(8, 0x76), /* Vendor Usage 0x76 */ HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), + HID_RI_LOGICAL_MAXIMUM(16, 0x00FF), HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE), HID_RI_REPORT_SIZE(8, 0x08), HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), diff --git a/tmk_core/protocol/mbed/HIDKeyboard.cpp b/tmk_core/protocol/mbed/HIDKeyboard.cpp index 947077cd..cc2250ec 100644 --- a/tmk_core/protocol/mbed/HIDKeyboard.cpp +++ b/tmk_core/protocol/mbed/HIDKeyboard.cpp @@ -97,7 +97,7 @@ uint8_t * HIDKeyboard::reportDesc() { REPORT_COUNT(1), 0x06, REPORT_SIZE(1), 0x08, LOGICAL_MINIMUM(1), 0x00, - LOGICAL_MAXIMUM(1), 0xFF, + LOGICAL_MAXIMUM(2), 0xFF, 0x00, USAGE_PAGE(1), 0x07, // Key Codes USAGE_MINIMUM(1), 0x00, USAGE_MAXIMUM(1), 0xFF, diff --git a/tmk_core/protocol/pjrc/usb.c b/tmk_core/protocol/pjrc/usb.c index 1e6ba871..9f9c4e1b 100644 --- a/tmk_core/protocol/pjrc/usb.c +++ b/tmk_core/protocol/pjrc/usb.c @@ -184,7 +184,7 @@ static const uint8_t PROGMEM keyboard_hid_report_desc[] = { 0x95, KBD_REPORT_KEYS, // Report Count (), 0x75, 0x08, // Report Size (8), 0x15, 0x00, // Logical Minimum (0), - 0x25, 0xFF, // Logical Maximum(255), + 0x26, 0xFF, 0x00, // Logical Maximum(255), 0x05, 0x07, // Usage Page (Key Codes), 0x19, 0x00, // Usage Minimum (0), 0x29, 0xFF, // Usage Maximum (255), @@ -307,7 +307,7 @@ static const uint8_t PROGMEM extra_hid_report_desc[] = { 0xa1, 0x01, // COLLECTION (Application) 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) + 0x26, 0xb7, 0x00, // LOGICAL_MAXIMUM (0xb7) 0x19, 0x01, // USAGE_MINIMUM (0x1) 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) 0x75, 0x10, // REPORT_SIZE (16) diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 7d0292ed..5d00165c 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -266,7 +266,7 @@ const PROGMEM uchar keyboard_hid_report[] = { 0x95, 0x06, // Report Count (6), 0x75, 0x08, // Report Size (8), 0x15, 0x00, // Logical Minimum (0), - 0x25, 0xFF, // Logical Maximum(255), + 0x26, 0xFF, 0x00, // Logical Maximum(255), 0x05, 0x07, // Usage Page (Key Codes), 0x19, 0x00, // Usage Minimum (0), 0x29, 0xFF, // Usage Maximum (255), @@ -336,7 +336,7 @@ const PROGMEM uchar mouse_hid_report[] = { 0xa1, 0x01, // COLLECTION (Application) 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) + 0x26, 0xb7, 0x00, // LOGICAL_MAXIMUM (0xb7) 0x19, 0x01, // USAGE_MINIMUM (0x1) 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) 0x75, 0x10, // REPORT_SIZE (16) From 60b88f155ec0c4150a541cba19db50a5db72a18d Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 8 Jun 2016 09:54:19 +0900 Subject: [PATCH 179/179] hhkb: Fix links in README.md. Close #358 --- keyboard/hhkb/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboard/hhkb/README.md b/keyboard/hhkb/README.md index fcd72e19..da85bceb 100644 --- a/keyboard/hhkb/README.md +++ b/keyboard/hhkb/README.md @@ -46,7 +46,7 @@ See [doc/HHKB.txt](doc/HHKB.txt) and files under [doc/](doc/) for internal of HH ##Build Firmware & Program -See [this document](../../doc/build.md) first. +See [this document](../../tmk_core/doc/build.md) first. ### Configuration If your target is **HHKB JP** you need to set `HHKB_JP` build option in `Makefile` or use `Makefile.jp` instead of `Makefile`. @@ -76,7 +76,7 @@ Use [Teensy Loader] if your controller is Teensy/Teensy++. ##Keymap -To define your own keymap create file named `keymap_.c` and see [keymap document](../../doc/keymap.md) and existent keymap files. +To define your own keymap create file named `keymap_.c` and see [keymap document](../../tmk_core/doc/keymap.md) and existent keymap files. ##Hardware