Explorar el Código

Add a keymap layer into ADB converter.

tags/v1.9
tmk hace 12 años
padre
commit
76033dcd89
Se han modificado 4 ficheros con 38 adiciones y 10 borrados
  1. 4
    1
      converter/adb_usb/Makefile
  2. 28
    3
      converter/adb_usb/keymap.c
  3. 6
    5
      converter/adb_usb/matrix.c
  4. 0
    1
      protocol/adb.c

+ 4
- 1
converter/adb_usb/Makefile Ver fichero

# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
#MOUSEKEY_ENABLE = yes # Mouse keys
MOUSEKEY_ENABLE = yes # Mouse keys
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
EXTRAKEY_ENABLE = yes # Audio control and System control EXTRAKEY_ENABLE = yes # Audio control and System control
#NKRO_ENABLE = yes # USB Nkey Rollover #NKRO_ENABLE = yes # USB Nkey Rollover
include $(TOP_DIR)/protocol.mk include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/common.mk include $(TOP_DIR)/common.mk
include $(TOP_DIR)/rules.mk include $(TOP_DIR)/rules.mk

dfu: PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
dfu: program

+ 28
- 3
converter/adb_usb/keymap.c Ver fichero



// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
static const uint8_t PROGMEM fn_layer[] = { static const uint8_t PROGMEM fn_layer[] = {
0, // Fn0
1, // Fn0
0, // Fn1 0, // Fn1
0, // Fn2 0, // Fn2
0, // Fn3 0, // Fn3
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Default Layer: plain keymap /* Default Layer: plain keymap
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
* |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| |Fn0|
* `---' `---------------' `---------------' `---------------' `-----------' `---' * `---' `---------------' `---------------' `---------------' `-----------' `---'
* ,-----------------------------------------------------------. ,-----------. ,---------------. * ,-----------------------------------------------------------. ,-----------. ,---------------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
* `-----------------------------------------------------------' `-----------' `---------------' * `-----------------------------------------------------------' `-----------' `---------------'
*/ */
KEYMAP( KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, PWR,
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, FN0,
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, 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, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, 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, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT
), ),

/* Default Layer: plain keymap
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
* |` | |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Fn0|
* `---' `---------------' `---------------' `---------------' `-----------' `---'
* ,-----------------------------------------------------------. ,-----------. ,---------------.
* |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
* |-----------------------------------------------------------| |-----------| |---------------|
* |Tab | Q| W| E| R| T| Y| U|PrS|ScL|Pau|Up |Ins| \| |Del|End|PgD| |MwD|McU|MwU|MwD|
* |-----------------------------------------------------------| `-----------' |---------------|
* |CapsLo|VoD|VoU|Mut| F| G| H| J|Hom|PgU|Lef|Rig|Return | |McL|McD|McR|MwU|
* |-----------------------------------------------------------| ,---. |---------------|
* |Shift | Z| X| C| V| B| N| M|End|PgD|Dow|Shift | |PgU| |MwL|McD|MwR| |
* |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
* |Ctrl |Gui |Alt | Space | | | | |Hom|PgD|End| | Mb1|Mb2| |
* `-----------------------------------------------------------' `-----------' `---------------'
*/
KEYMAP(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, FN0,
ESC, 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, BSLS, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D,
CAPS,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U,
LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
LCTL,LGUI,LALT, SPC, HOME,PGDN,END, BTN1, BTN2,BTN3
),
}; };





+ 6
- 5
converter/adb_usb/matrix.c Ver fichero

key0 = codes>>8; key0 = codes>>8;
key1 = codes&0xFF; key1 = codes&0xFF;


if (debug_enable && codes) {
print("adb_host_kbd_recv: "); phex16(codes); print("\n");
}

#ifdef MATRIX_HAS_LOCKING_CAPS #ifdef MATRIX_HAS_LOCKING_CAPS
// Send Caps key up event // Send Caps key up event
if (matrix_is_on(ROW(CAPS), COL(CAPS))) { if (matrix_is_on(ROW(CAPS), COL(CAPS))) {
_register_key(key1); _register_key(key1);
} }


if (debug_enable) {
print("adb_host_kbd_recv: "); phex16(codes); print("\n");
}
return 1; return 1;
} }


void matrix_print(void) void matrix_print(void)
{ {
#if (MATRIX_COLS <= 8) #if (MATRIX_COLS <= 8)
print("\nr/c 01234567\n");
print("r/c 01234567\n");
#else #else
print("\nr/c 0123456789ABCDEF\n");
print("r/c 0123456789ABCDEF\n");
#endif #endif
for (uint8_t row = 0; row < matrix_rows(); row++) { for (uint8_t row = 0; row < matrix_rows(); row++) {
phex(row); print(": "); phex(row); print(": ");

+ 0
- 1
protocol/adb.c Ver fichero

You can read the state from PSW line(active low) however You can read the state from PSW line(active low) however
the switch has a special scancode 0x7F7F, so you can the switch has a special scancode 0x7F7F, so you can
also read from Data line. It uses 0xFFFF for release scancode. also read from Data line. It uses 0xFFFF for release scancode.
Release code seems to delay about some 100ms. Due to Mac soft power?


Keyboard LEDs & state of keys(Register2) Keyboard LEDs & state of keys(Register2)
This register hold current state of three LEDs and nine keys. This register hold current state of three LEDs and nine keys.

Cargando…
Cancelar
Guardar