Merge branch 'master' into chibios
This commit is contained in:
commit
b388269407
@ -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_<name>.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.
|
||||
|
50
converter/ibm4704_usb/keymap_alps102key.c
Normal file
50
converter/ibm4704_usb/keymap_alps102key.c
Normal file
@ -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),
|
||||
};
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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))) \
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
)
|
||||
};
|
||||
|
@ -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<<USB_LED_CAPS_LOCK)) {
|
||||
next_kbd_set_leds(true, true);
|
||||
} else {
|
||||
next_kbd_set_leds(false, false);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -194,10 +194,12 @@ uint8_t matrix_scan(void)
|
||||
|
||||
NEXT_KBD_LED1_ON;
|
||||
|
||||
#ifdef NEXT_KBD_SHIFT_FLASH_LEDS
|
||||
next_kbd_set_leds(
|
||||
NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false,
|
||||
NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
|
||||
);
|
||||
#endif
|
||||
|
||||
dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
|
||||
resp, \
|
||||
|
11
doc/build.md
11
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.<variant> 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.<variant> 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/
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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++)
|
||||
;
|
||||
|
@ -232,13 +232,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;
|
||||
@ -327,6 +327,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_read32());
|
||||
|
||||
#ifdef PROTOCOL_PJRC
|
||||
|
@ -156,6 +156,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#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
|
||||
@ -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,
|
||||
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "action_layer.h"
|
||||
#include "action.h"
|
||||
#include "action_macro.h"
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
@ -146,6 +147,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;
|
||||
|
@ -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;
|
||||
|
||||
@ -217,6 +218,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 +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);
|
||||
@ -346,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();
|
||||
}
|
||||
}
|
||||
@ -396,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);
|
||||
|
||||
|
@ -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<<NEXT_KBD_IN_BIT))
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 94c560c854c7a1dfc35e9de9db05de1b202de6c6
|
@ -1 +0,0 @@
|
||||
Subproject commit c30fcdf1f112de581de7b145a97630539e5cff44
|
@ -1 +0,0 @@
|
||||
Subproject commit 77762338286535dabb9c94b87060e33e487ff0f3
|
@ -1 +0,0 @@
|
||||
Subproject commit 77b033420485f7d3d35430c0e8d4d844aa894834
|
Reference in New Issue
Block a user