Browse Source

Merge branch 'master' into chibios

tags/v2.9
flabbergast 8 years ago
parent
commit
b388269407

+ 3
- 0
converter/ibm4704_usb/README.md View File



Update 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/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack!
2015/05/19 Fixed a protocol handling bug. 2015/05/19 Fixed a protocol handling bug.


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. 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
- 0
converter/ibm4704_usb/keymap_alps102key.c View File

#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),
};

+ 27
- 0
converter/ibm4704_usb/keymap_common.h View File

{ 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, } \
} }


/* 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 #endif

+ 2
- 2
converter/next_usb/Makefile View File

# MCU name, you MUST set this to match the board you are using # 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 # type "make clean" after changing this, so all files will be rebuilt
#MCU = at90usb162 # Teensy 1.0 #MCU = at90usb162 # Teensy 1.0
MCU = atmega32u4 # Teensy 2.0
#MCU = atmega32u4 # Teensy 2.0
#MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb646 # Teensy++ 1.0
#MCU = at90usb1286 # Teensy++ 2.0 #MCU = at90usb1286 # Teensy++ 2.0
#MCU = atmega32u2 # TMK converter
MCU = atmega32u2 # TMK converter




# Processor frequency. # Processor frequency.

+ 10
- 8
converter/next_usb/config.h View File



*/ */


#define VENDOR_ID 0xBCBC
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xBCBC #define PRODUCT_ID 0xBCBC
#define DEVICE_VER 0x0500 #define DEVICE_VER 0x0500
#define MANUFACTURER t.m.k. #define MANUFACTURER t.m.k.
#define MATRIX_ROWS 12 // keycode bit: 3-0 #define MATRIX_ROWS 12 // keycode bit: 3-0
#define MATRIX_COLS 8 // keycode bit: 6-4 #define MATRIX_COLS 8 // keycode bit: 6-4


//#define DEBUG_ON_INIT 1
#define DEBUG_ON_INIT 1


//#define TEENSY_CONFIG 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 ============== //============= Start of Arduino Pro Micro Configuration ==============
#ifdef PRO_MICRO_CONFIG #ifdef PRO_MICRO_CONFIG


/* key combination for command */ /* key combination for command */
#define IS_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))) \
) )

+ 1
- 1
converter/next_usb/keymap.c View File

TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U, 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,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, 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
) )
}; };

+ 6
- 1
converter/next_usb/led.c View File



#include "stdint.h" #include "stdint.h"
#include "led.h" #include "led.h"
#include "next_kbd.h"




void led_set(uint8_t usb_led) 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);
}
} }

+ 3
- 1
converter/next_usb/matrix.c View File

/* scan all key states on matrix */ /* scan all key states on matrix */
uint8_t matrix_scan(void) uint8_t matrix_scan(void)
{ {
_delay_ms(20);
_delay_ms(5);
//next_kbd_set_leds(false, false); //next_kbd_set_leds(false, false);
NEXT_KBD_LED1_OFF; NEXT_KBD_LED1_OFF;
NEXT_KBD_LED1_ON; NEXT_KBD_LED1_ON;
#ifdef NEXT_KBD_SHIFT_FLASH_LEDS
next_kbd_set_leds( next_kbd_set_leds(
NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false, NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false,
NEXT_KBD_PRESSED_SHIFT_RGHT(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", \ 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, \ resp, \

+ 5
- 6
doc/build.md View File

-------------------- --------------------
### 1. Install Tools ### 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 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.


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. 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 ### 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`. To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`.
If you have a proper program command in `Makefile` just type this. If you have a proper program command in `Makefile` just type this.
$ make -f Makefile.<variant> dfu $ make -f Makefile.<variant> dfu


#### FLIP GUI tutorial #### 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. 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. At this point you'll see grey-outed widgets on the app get colored and ready.


$ make -f Makefile.<variant> program $ make -f Makefile.<variant> program




[atmelgcc]: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx
[cygwin]: https://www.cygwin.com/ [cygwin]: https://www.cygwin.com/
[mingw]: http://www.mingw.org/ [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 [crosspack]: http://www.obdev.at/products/crosspack/index.html
[flip]: http://www.atmel.com/tools/FLIP.aspx [flip]: http://www.atmel.com/tools/FLIP.aspx
[dfu-prog]: http://dfu-programmer.sourceforge.net/ [dfu-prog]: http://dfu-programmer.sourceforge.net/

+ 1
- 1
tmk_core/common/action_code.h View File

#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) #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_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_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 */ /* With Tapping */
#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) #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) #define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)

+ 2
- 0
tmk_core/common/action_macro.c View File

dprintf("KEY_DOWN(%02X)\n", macro); dprintf("KEY_DOWN(%02X)\n", macro);
if (IS_MOD(macro)) { if (IS_MOD(macro)) {
add_weak_mods(MOD_BIT(macro)); add_weak_mods(MOD_BIT(macro));
send_keyboard_report();
} else { } else {
register_code(macro); register_code(macro);
} }
dprintf("KEY_UP(%02X)\n", macro); dprintf("KEY_UP(%02X)\n", macro);
if (IS_MOD(macro)) { if (IS_MOD(macro)) {
del_weak_mods(MOD_BIT(macro)); del_weak_mods(MOD_BIT(macro));
send_keyboard_report();
} else { } else {
unregister_code(macro); unregister_code(macro);
} }

+ 3
- 3
tmk_core/common/action_util.c View File

void add_key(uint8_t key) void add_key(uint8_t key)
{ {
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if (keyboard_nkro) {
if (keyboard_protocol && keyboard_nkro) {
add_key_bit(key); add_key_bit(key);
return; return;
} }
void del_key(uint8_t key) void del_key(uint8_t key)
{ {
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if (keyboard_nkro) {
if (keyboard_protocol && keyboard_nkro) {
del_key_bit(key); del_key_bit(key);
return; return;
} }
uint8_t get_first_key(void) uint8_t get_first_key(void)
{ {
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if (keyboard_nkro) {
if (keyboard_protocol && keyboard_nkro) {
uint8_t i = 0; uint8_t i = 0;
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
; ;

+ 5
- 2
tmk_core/common/command.c View File

break; break;
case KC_D: case KC_D:
if (debug_enable) { if (debug_enable) {
print("\ndebug: on\n");
print("\ndebug: off\n");
debug_matrix = false; debug_matrix = false;
debug_keyboard = false; debug_keyboard = false;
debug_mouse = false; debug_mouse = false;
debug_enable = false; debug_enable = false;
} else { } else {
print("\ndebug: off\n");
print("\ndebug: on\n");
debug_enable = true; debug_enable = true;
} }
break; break;
print_val_hex8(host_keyboard_leds()); print_val_hex8(host_keyboard_leds());
print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_protocol);
print_val_hex8(keyboard_idle); print_val_hex8(keyboard_idle);
#ifdef NKRO_ENABLE
print_val_hex8(keyboard_nkro);
#endif
print_val_hex32(timer_read32()); print_val_hex32(timer_read32());


#ifdef PROTOCOL_PJRC #ifdef PROTOCOL_PJRC

+ 5
- 0
tmk_core/common/keycode.h View File

#define KC_WSTP KC_WWW_STOP #define KC_WSTP KC_WWW_STOP
#define KC_WREF KC_WWW_REFRESH #define KC_WREF KC_WWW_REFRESH
#define KC_WFAV KC_WWW_FAVORITES #define KC_WFAV KC_WWW_FAVORITES
/* Jump to bootloader */
#define KC_BTLD KC_BOOTLOADER
/* Transparent */ /* Transparent */
#define KC_TRANSPARENT 1 #define KC_TRANSPARENT 1
#define KC_TRNS KC_TRANSPARENT #define KC_TRNS KC_TRANSPARENT
KC_MEDIA_FAST_FORWARD, KC_MEDIA_FAST_FORWARD,
KC_MEDIA_REWIND, /* 0xBC */ KC_MEDIA_REWIND, /* 0xBC */


/* Jump to bootloader */
KC_BOOTLOADER = 0xBF,

/* Fn key */ /* Fn key */
KC_FN0 = 0xC0, KC_FN0 = 0xC0,
KC_FN1, KC_FN1,

+ 6
- 0
tmk_core/common/keymap.c View File

#include "action_layer.h" #include "action_layer.h"
#include "action.h" #include "action.h"
#include "action_macro.h" #include "action_macro.h"
#include "wait.h"
#include "debug.h" #include "debug.h"




case KC_TRNS: case KC_TRNS:
action.code = ACTION_TRANSPARENT; action.code = ACTION_TRANSPARENT;
break; break;
case KC_BOOTLOADER:
clear_keyboard();
wait_ms(50);
bootloader_jump(); // not return
break;
default: default:
action.code = ACTION_NO; action.code = ACTION_NO;
break; break;

+ 7
- 6
tmk_core/protocol/lufa/lufa.c View File

#include "lufa.h" #include "lufa.h"


uint8_t keyboard_idle = 0; uint8_t keyboard_idle = 0;
/* 0: Boot Protocol, 1: Report Protocol(default) */
uint8_t keyboard_protocol = 1; uint8_t keyboard_protocol = 1;
static uint8_t keyboard_led_stats = 0; static uint8_t keyboard_led_stats = 0;




/** Event handler for the USB_ConfigurationChanged event. /** Event handler for the USB_ConfigurationChanged event.
* This is fired when the host sets the current configuration of the USB device after enumeration. * 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) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
#ifdef CONSOLE_ENABLE #ifdef CONSOLE_ENABLE
/* Setup Console HID Report Endpoints */ /* Setup Console HID Report Endpoints */
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE);
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
#if 0 #if 0
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
Endpoint_ClearSETUP(); Endpoint_ClearSETUP();
Endpoint_ClearStatusStage(); 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(); clear_keyboard();
} }
} }


/* Select the Keyboard Report Endpoint */ /* Select the Keyboard Report Endpoint */
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if (keyboard_nkro) {
if (keyboard_protocol && keyboard_nkro) {
/* Report protocol - NKRO */ /* Report protocol - NKRO */
Endpoint_SelectEndpoint(NKRO_IN_EPNUM); Endpoint_SelectEndpoint(NKRO_IN_EPNUM);



+ 12
- 4
tmk_core/protocol/next_kbd.c View File

static inline void reset(void); static inline void reset(void);
static inline uint32_t response(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) void next_kbd_init(void)
{ {


void next_kbd_set_leds(bool left, bool right) void next_kbd_set_leds(bool left, bool right)
{ {
cli();
out_lo_delay(9); out_lo_delay(9);
out_hi_delay(3); out_hi_delay(3);
out_lo_delay(7); out_lo_delay(7);
out_hi(); out_hi();
sei();
} }


#define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<<NEXT_KBD_IN_BIT)) #define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<<NEXT_KBD_IN_BIT))

+ 0
- 1
tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Arduino_Makefile_master

Subproject commit 94c560c854c7a1dfc35e9de9db05de1b202de6c6

+ 0
- 1
tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/RTClib

Subproject commit c30fcdf1f112de581de7b145a97630539e5cff44

+ 0
- 1
tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/generic_storage

Subproject commit 77762338286535dabb9c94b87060e33e487ff0f3

+ 0
- 1
tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/xmem2

Subproject commit 77b033420485f7d3d35430c0e8d4d844aa894834

Loading…
Cancel
Save