Merge remote-tracking branch 'tmk/master'
This commit is contained in:
commit
41c36024ba
14 changed files with 6540 additions and 3557 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) \
|
||||
)
|
||||
|
||||
// G80-2551 terminal keyboard support
|
||||
#define G80_2551_SUPPORT
|
||||
|
||||
|
||||
/*
|
||||
* Pin and interrupt configuration
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019 Jun Wako <wakojun@gmail.com>
|
||||
Copyright 2019,2020 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
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
|
||||
|
|
@ -68,6 +68,7 @@ static uint16_t read_keyboard_id(void)
|
|||
if (code == -1) { id = 0x0000; goto DONE; } // AT
|
||||
id = (code & 0xFF)<<8;
|
||||
|
||||
// Mouse responds with one-byte 00, this returns 00FF [y] p.14
|
||||
code = read_wait(500);
|
||||
id |= code & 0xFF;
|
||||
|
||||
|
|
@ -218,25 +219,43 @@ uint8_t matrix_scan(void)
|
|||
case READ_ID:
|
||||
xprintf("R%u ", timer_read());
|
||||
|
||||
// SKIDATA-2-DE(and some other keyboards?) stores 'Code Set' setting in nonvlatile memory
|
||||
// and keeps it until receiving reset. Sending reset here may be useful to clear it, perhaps.
|
||||
// https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#select-alternate-scan-codesf0
|
||||
//ibmpc_host_send(0xFF); // reset command
|
||||
//read_wait(500); // BAT takes 600-900ms(84-key) or 300-500ms(101/102-key) [8] 4-7, 4-39
|
||||
|
||||
keyboard_id = read_keyboard_id();
|
||||
if (ibmpc_error) {
|
||||
xprintf("\nERR:%02X\n", ibmpc_error);
|
||||
ibmpc_error = IBMPC_ERR_NONE;
|
||||
}
|
||||
|
||||
if (0xAB00 == (keyboard_id & 0xFF00)) { // CodeSet2 PS/2
|
||||
if (0x0000 == keyboard_id) { // CodeSet2 AT(IBM PC AT 84-key)
|
||||
keyboard_kind = PC_AT;
|
||||
} else if (0xFFFF == keyboard_id) { // CodeSet1 XT
|
||||
keyboard_kind = PC_XT;
|
||||
} else if (0xFFFE == keyboard_id) { // CodeSet2 PS/2 fails to response?
|
||||
keyboard_kind = PC_AT;
|
||||
} else if (0x00FF == keyboard_id) { // Mouse is not supported
|
||||
xprintf("Mouse: not supported\n");
|
||||
keyboard_kind = NONE;
|
||||
#ifdef G80_2551_SUPPORT
|
||||
} else if (0xAB86 == keyboard_id) { // CodeSet2 PS/2 Terminal
|
||||
// For G80-2551 and other 122-key terminal keyboards
|
||||
// https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#ab86
|
||||
if ((0xFA == ibmpc_host_send(0xF0)) &&
|
||||
(0xFA == ibmpc_host_send(0x03))) {
|
||||
// switch to code set 3
|
||||
keyboard_kind = PC_TERMINAL;
|
||||
} else {
|
||||
keyboard_kind = PC_AT;
|
||||
}
|
||||
#endif
|
||||
} else if (0xAB00 == (keyboard_id & 0xFF00)) { // CodeSet2 PS/2
|
||||
keyboard_kind = PC_AT;
|
||||
} else if (0xBF00 == (keyboard_id & 0xFF00)) { // CodeSet3 Terminal
|
||||
keyboard_kind = PC_TERMINAL;
|
||||
} else if (0x0000 == keyboard_id) { // CodeSet2 AT
|
||||
keyboard_kind = PC_AT;
|
||||
} else if (0xFFFF == keyboard_id) { // CodeSet1 XT
|
||||
keyboard_kind = PC_XT;
|
||||
} else if (0xFFFE == keyboard_id) { // CodeSet2 PS/2 fails to response?
|
||||
keyboard_kind = PC_AT;
|
||||
} else if (0x00FF == keyboard_id) { // Mouse is not supported
|
||||
xprintf("Mouse: not supported\n");
|
||||
keyboard_kind = NONE;
|
||||
} else {
|
||||
keyboard_kind = PC_AT;
|
||||
}
|
||||
|
|
@ -254,6 +273,7 @@ uint8_t matrix_scan(void)
|
|||
led_set(host_keyboard_leds());
|
||||
break;
|
||||
case PC_TERMINAL:
|
||||
// Set all keys to make/break type
|
||||
ibmpc_host_send(0xF8);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -327,7 +347,7 @@ void matrix_clear(void)
|
|||
|
||||
void led_set(uint8_t usb_led)
|
||||
{
|
||||
if (keyboard_kind != PC_AT) return;
|
||||
//if (keyboard_kind != PC_AT) return;
|
||||
|
||||
uint8_t ibmpc_led = 0;
|
||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
|
||||
|
|
@ -839,6 +859,11 @@ static int8_t process_cs3(void)
|
|||
static enum {
|
||||
READY,
|
||||
F0,
|
||||
#ifdef G80_2551_SUPPORT
|
||||
// G80-2551 four extra keys around cursor keys
|
||||
G80,
|
||||
G80_F0,
|
||||
#endif
|
||||
} state = READY;
|
||||
|
||||
uint16_t code = ibmpc_host_recv();
|
||||
|
|
@ -861,18 +886,41 @@ static int8_t process_cs3(void)
|
|||
case 0xF0:
|
||||
state = F0;
|
||||
break;
|
||||
case 0x83: // F7
|
||||
case 0x83: // PrintScreen
|
||||
matrix_make(0x02);
|
||||
break;
|
||||
case 0x84: // keypad -
|
||||
case 0x84: // Keypad *
|
||||
matrix_make(0x7F);
|
||||
break;
|
||||
case 0x85: // Muhenkan
|
||||
matrix_make(0x0B);
|
||||
break;
|
||||
case 0x86: // Henkan
|
||||
matrix_make(0x06);
|
||||
break;
|
||||
case 0x87: // Hiragana
|
||||
matrix_make(0x00);
|
||||
break;
|
||||
case 0x8B: // Left GUI
|
||||
matrix_make(0x01);
|
||||
break;
|
||||
case 0x8C: // Right GUI
|
||||
matrix_make(0x09);
|
||||
break;
|
||||
case 0x8D: // Application
|
||||
matrix_make(0x0A);
|
||||
break;
|
||||
#ifdef G80_2551_SUPPORT
|
||||
case 0x80: // G80-2551 four extra keys around cursor keys
|
||||
state = G80;
|
||||
break;
|
||||
#endif
|
||||
default: // normal key make
|
||||
if (code < 0x80) {
|
||||
matrix_make(code);
|
||||
} else {
|
||||
xprintf("!CS3_READY!\n");
|
||||
return -1;
|
||||
//return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -889,24 +937,100 @@ static int8_t process_cs3(void)
|
|||
state = READY;
|
||||
return -1;
|
||||
break;
|
||||
case 0x83: // F7
|
||||
case 0x83: // PrintScreen
|
||||
matrix_break(0x02);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x84: // keypad -
|
||||
case 0x84: // Keypad *
|
||||
matrix_break(0x7F);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x85: // Muhenkan
|
||||
matrix_break(0x0B);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x86: // Henkan
|
||||
matrix_break(0x06);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x87: // Hiragana
|
||||
matrix_break(0x00);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x8B: // Left GUI
|
||||
matrix_break(0x01);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x8C: // Right GUI
|
||||
matrix_break(0x09);
|
||||
state = READY;
|
||||
break;
|
||||
case 0x8D: // Application
|
||||
matrix_break(0x0A);
|
||||
state = READY;
|
||||
break;
|
||||
default:
|
||||
state = READY;
|
||||
if (code < 0x80) {
|
||||
matrix_break(code);
|
||||
} else {
|
||||
xprintf("!CS3_F0!\n");
|
||||
return -1;
|
||||
//return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef G80_2551_SUPPORT
|
||||
/*
|
||||
* G80-2551 terminal keyboard support
|
||||
* https://deskthority.net/wiki/Cherry_G80-2551
|
||||
* https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#g80-2551-in-code-set-3
|
||||
*/
|
||||
case G80: // G80-2551 four extra keys around cursor keys
|
||||
switch (code) {
|
||||
case (0x26): // TD= -> JYEN
|
||||
matrix_make(0x5D);
|
||||
break;
|
||||
case (0x25): // page with edge -> NUHS
|
||||
matrix_make(0x53);
|
||||
break;
|
||||
case (0x16): // two pages -> RO
|
||||
matrix_make(0x51);
|
||||
break;
|
||||
case (0x1E): // calc -> KANA
|
||||
matrix_make(0x00);
|
||||
break;
|
||||
case (0xF0):
|
||||
state = G80_F0;
|
||||
return 0;
|
||||
default:
|
||||
// Not supported
|
||||
matrix_clear();
|
||||
break;
|
||||
}
|
||||
state = READY;
|
||||
break;
|
||||
case G80_F0:
|
||||
switch (code) {
|
||||
case (0x26): // TD= -> JYEN
|
||||
matrix_break(0x5D);
|
||||
break;
|
||||
case (0x25): // page with edge -> NUHS
|
||||
matrix_break(0x53);
|
||||
break;
|
||||
case (0x16): // two pages -> RO
|
||||
matrix_break(0x51);
|
||||
break;
|
||||
case (0x1E): // calc -> KANA
|
||||
matrix_break(0x00);
|
||||
break;
|
||||
default:
|
||||
// Not supported
|
||||
matrix_clear();
|
||||
break;
|
||||
}
|
||||
state = READY;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -941,6 +1065,9 @@ static int8_t process_cs3(void)
|
|||
* [7] The IBM 6110344 Keyboard - Scan Code Set 3 of 122-key terminal keyboard
|
||||
* https://www.seasip.info/VintagePC/ibm_6110344.html
|
||||
*
|
||||
* [8] IBM PC AT Technical Reference 1986
|
||||
* http://bitsavers.org/pdf/ibm/pc/at/6183355_PC_AT_Technical_Reference_Mar86.pdf
|
||||
*
|
||||
* [y] TrackPoint Engineering Specifications for version 3E
|
||||
* https://web.archive.org/web/20100526161812/http://wwwcssrv.almaden.ibm.com/trackpoint/download.html
|
||||
*
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
* | 43| 44| | 38 | 39 | 3A | 52 | 53 | |
|
||||
* `-------' `--------------------------------------------------------------------------'
|
||||
* [3], [a]
|
||||
* unused: UNIMAP_NUBS
|
||||
*/
|
||||
const uint8_t PROGMEM unimap_cs1[MATRIX_ROWS][MATRIX_COLS] = {
|
||||
{ UNIMAP_NO, UNIMAP_ESC, UNIMAP_1, UNIMAP_2, UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6 }, /* 00-07 */
|
||||
|
|
@ -162,15 +163,15 @@ const uint8_t PROGMEM unimap_cs2[MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|
|
||||
* `-----------------------------------------------'
|
||||
* ,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* |PrS|Esc| | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|Hom|PgU| |NmL| /| *| -|
|
||||
* |Mut|Hkn| | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY| BS| | /|PgU|PgD| |Esc|NmL|ScL| *|
|
||||
* |-------| |-----------------------------------------------------------| |-----------| |---------------|
|
||||
* |ScL|Hen| |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| +|
|
||||
* |VoU|Pau| |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |End|Ins|Del| | 7| 8| 9| +|
|
||||
* |-------| |-----------------------------------------------------------| `-----------' |-----------|---|
|
||||
* |Pau|Muh| |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| Ret| |Up | | 4| 5| 6| ,|
|
||||
* |VoD|Mhk| |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| Ret| |Up | | 4| 5| 6| -|
|
||||
* |-------| |-----------------------------------------------------------| ,-----------. |---------------|
|
||||
* |VoD|VoU| |Shif| \| Z| X| C| V| B| N| M| ,| ,| /| RO| Shift| |Lef|App|Rig| | 1| 2| 3|Ent|
|
||||
* |Psc|App| |Shif| \| Z| X| C| V| B| N| M| ,| ,| /| RO| Shift| |Lef|Hom|Rig| | 1| 2| 3|Ent|
|
||||
* |-------| |-----------------------------------------------------------| `-----------' |-----------|---|
|
||||
* |Gui|Gui| |Ctrl| |Alt | Space |Alt | |Ctrl| |Dow| |Kan| 0| .| =|
|
||||
* |Gui|Gui| |Ctrl| |Alt | Space |Alt | |Ctrl| |Dow| | ,| 0| .| =|
|
||||
* `-------' `----' `---------------------------------------' `----' `---' `---------------'
|
||||
*
|
||||
* ,-----------------------------------------------.
|
||||
|
|
@ -189,12 +190,12 @@ const uint8_t PROGMEM unimap_cs2[MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* |-------| |-----------------------------------------------------------| `-----------' |---------------|
|
||||
* | 01| 09| | 11 | |19 | 29 |39 | | 58 | | 60| | 68| 70| 71| 78|
|
||||
* `-------' `-----' `---------------------------------------' `-----' `---' `---------------'
|
||||
* *: 83=02, 84=7F
|
||||
* *: remapped 83->02, 84->7F
|
||||
* 51, 5C, 5D, 68, 78: Hidden keys in IBM 122-key terminal keyboard [7]
|
||||
*/
|
||||
const uint8_t PROGMEM unimap_cs3[MATRIX_ROWS][MATRIX_COLS] = {
|
||||
{ UNIMAP_NO, UNIMAP_LGUI, UNIMAP_VOLD, UNIMAP_PAUSE, UNIMAP_SLCK, UNIMAP_PSCR, UNIMAP_ESC, UNIMAP_F1 }, /* 00-07 */
|
||||
{ UNIMAP_F13, UNIMAP_RGUI, UNIMAP_VOLU, UNIMAP_MHEN, UNIMAP_HENK, UNIMAP_TAB, UNIMAP_GRV, UNIMAP_F2 }, /* 08-0F */
|
||||
{ UNIMAP_KANA, UNIMAP_LGUI, UNIMAP_PSCR, UNIMAP_VOLD, UNIMAP_VOLU, UNIMAP_MUTE, UNIMAP_HENK, UNIMAP_F1 }, /* 00-07 */
|
||||
{ UNIMAP_F13, UNIMAP_RGUI, UNIMAP_APP, UNIMAP_MHEN, UNIMAP_PAUS, UNIMAP_TAB, UNIMAP_GRV, UNIMAP_F2 }, /* 08-0F */
|
||||
{ UNIMAP_F14, UNIMAP_LCTL, UNIMAP_LSHIFT,UNIMAP_NUBS, UNIMAP_CAPS, UNIMAP_Q, UNIMAP_1, UNIMAP_F3 }, /* 10-17 */
|
||||
{ UNIMAP_F15, UNIMAP_LALT, UNIMAP_Z, UNIMAP_S, UNIMAP_A, UNIMAP_W, UNIMAP_2, UNIMAP_F4 }, /* 18-1F */
|
||||
{ UNIMAP_F16, UNIMAP_C, UNIMAP_X, UNIMAP_D, UNIMAP_E, UNIMAP_4, UNIMAP_3, UNIMAP_F5 }, /* 20-27 */
|
||||
|
|
@ -205,10 +206,10 @@ const uint8_t PROGMEM unimap_cs3[MATRIX_ROWS][MATRIX_COLS] = {
|
|||
{ UNIMAP_F21, UNIMAP_DOT, UNIMAP_SLASH, UNIMAP_L, UNIMAP_SCOLON,UNIMAP_P, UNIMAP_MINUS, UNIMAP_F10 }, /* 48-4F */
|
||||
{ UNIMAP_F22, UNIMAP_RO, UNIMAP_QUOTE, UNIMAP_NUHS, UNIMAP_LBRC, UNIMAP_EQUAL, UNIMAP_F11, UNIMAP_F23 }, /* 50-57 */
|
||||
{ UNIMAP_RCTL, UNIMAP_RSHIFT,UNIMAP_ENTER, UNIMAP_RBRC, UNIMAP_BSLASH,UNIMAP_JYEN, UNIMAP_F12, UNIMAP_F24 }, /* 58-5F */
|
||||
{ UNIMAP_DOWN, UNIMAP_LEFT, UNIMAP_APP, UNIMAP_UP, UNIMAP_DEL, UNIMAP_END, UNIMAP_BSPACE,UNIMAP_INS }, /* 60-67 */
|
||||
{ UNIMAP_KANA, UNIMAP_P1, UNIMAP_RIGHT, UNIMAP_P4, UNIMAP_P7, UNIMAP_PGDN, UNIMAP_HOME, UNIMAP_PGUP }, /* 68-6F */
|
||||
{ UNIMAP_P0, UNIMAP_PDOT, UNIMAP_P2, UNIMAP_P5, UNIMAP_P6, UNIMAP_P8, UNIMAP_NLCK, UNIMAP_PSLS }, /* 70-77 */
|
||||
{ UNIMAP_PEQL, UNIMAP_PENT, UNIMAP_P3, UNIMAP_PCMM, UNIMAP_PPLS, UNIMAP_P9, UNIMAP_PAST, UNIMAP_PMNS }, /* 78-7F */
|
||||
{ UNIMAP_DOWN, UNIMAP_LEFT, UNIMAP_HOME, UNIMAP_UP, UNIMAP_END, UNIMAP_INS, UNIMAP_BSPACE,UNIMAP_PSLS }, /* 60-67 */
|
||||
{ UNIMAP_PCMM, UNIMAP_P1, UNIMAP_RIGHT, UNIMAP_P4, UNIMAP_P7, UNIMAP_DEL, UNIMAP_PGUP, UNIMAP_PGDN }, /* 68-6F */
|
||||
{ UNIMAP_P0, UNIMAP_PDOT, UNIMAP_P2, UNIMAP_P5, UNIMAP_P6, UNIMAP_P8, UNIMAP_ESC, UNIMAP_NLCK }, /* 70-77 */
|
||||
{ UNIMAP_PEQL, UNIMAP_PENT, UNIMAP_P3, UNIMAP_PMNS, UNIMAP_PPLS, UNIMAP_P9, UNIMAP_SLCK, UNIMAP_PAST }, /* 78-7F */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,28 @@
|
|||
# Target file name (without extension).
|
||||
TARGET = sun_usb
|
||||
TARGET ?= sun_usb
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
TMK_DIR ?= ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
TARGET_DIR ?= .
|
||||
|
||||
# keyboard dependent files
|
||||
SRC = keymap.c \
|
||||
matrix.c \
|
||||
SRC ?= matrix.c \
|
||||
led.c \
|
||||
command_extra.c
|
||||
|
||||
|
||||
CONFIG_H = config.h
|
||||
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
|
||||
# at90usb162 # Teensy 1.0
|
||||
# atmega32u4 # Teensy 2.0
|
||||
# at90usb646 # Teensy++ 1.0
|
||||
# at90usb1286 # Teensy++ 2.0
|
||||
MCU ?= atmega32u2
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
|
|
@ -31,14 +30,14 @@ MCU = atmega32u2
|
|||
# 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
|
||||
F_CPU ?= 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
ARCH ?= AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
|
|
@ -51,7 +50,7 @@ ARCH = AVR8
|
|||
#
|
||||
# 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)
|
||||
F_USB ?= $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
|
@ -60,12 +59,14 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|||
# Build Options
|
||||
# *Comment out* to disable the options.
|
||||
#
|
||||
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
|
||||
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
|
||||
UNIMAP_ENABLE = yes
|
||||
KEYMAP_SECTION_ENABLE = yes
|
||||
|
||||
ifdef HARDWARE_SERIAL
|
||||
SRC := protocol/serial_uart.c $(SRC)
|
||||
|
|
@ -78,7 +79,27 @@ endif
|
|||
# Teensy halfKay 512
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
# Bootloader size can be calculated from fuse bits
|
||||
#OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
|
||||
#
|
||||
# Keymap file
|
||||
#
|
||||
ifeq (yes,$(strip $(UNIMAP_ENABLE)))
|
||||
KEYMAP_FILE = unimap
|
||||
else
|
||||
ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
|
||||
KEYMAP_FILE = actionmap
|
||||
else
|
||||
KEYMAP_FILE = keymap
|
||||
endif
|
||||
endif
|
||||
ifdef KEYMAP
|
||||
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := $(KEYMAP_FILE).c $(SRC)
|
||||
endif
|
||||
|
||||
|
||||
# Search Path
|
||||
|
|
|
|||
5
converter/sun_usb/Makefile.atmega32u4
Normal file
5
converter/sun_usb/Makefile.atmega32u4
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
TARGET = sun_usb_atmega32u4
|
||||
MCU = atmega32u4
|
||||
|
||||
include Makefile
|
||||
|
||||
|
|
@ -1,30 +1,31 @@
|
|||
Sun to USB keyboard protocol converter
|
||||
======================================
|
||||
Target MCU is ATMega32u4 but other USB capable AVR will also work.
|
||||
Target MCU is ATMega32u2/4 but other USB capable AVR will also work.
|
||||
|
||||
This converter will work with Sun Type 2-5 Keyboards.
|
||||
|
||||
|
||||
Tested on:
|
||||
Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
|
||||
CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p
|
||||
Check wiki pages for other information about TMK keyobard firware.
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/wiki
|
||||
|
||||
|
||||
Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository.
|
||||
https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb
|
||||
|
||||
Update
|
||||
------
|
||||
2020-04-08 Added unimap support
|
||||
|
||||
|
||||
Connector
|
||||
---------
|
||||
8Pin mini DIN
|
||||
___ ___
|
||||
/ |_| \
|
||||
/ 8 7 6 \
|
||||
| 5 4 3 |
|
||||
\_ 2 1 _/
|
||||
\_____/
|
||||
(receptacle)
|
||||
Modern Type 4 and 5 keyboards uses 8Pin mini DIN.
|
||||
|
||||
___ ___
|
||||
/ |_| \
|
||||
/ 8 7 6 \
|
||||
| 5 4 3 |
|
||||
\_ 2 1 _/
|
||||
\_____/
|
||||
(receptacle)
|
||||
|
||||
Wiring:
|
||||
Pin mini DIN MCU
|
||||
|
|
@ -42,18 +43,19 @@ Connector
|
|||
Protocol
|
||||
--------
|
||||
Signal: Asynchronous, Negative logic, 1200baud, No Flow control
|
||||
|
||||
Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
|
||||
|
||||
AVR USART engine expects positive logic while Sun keyboard signal is negative.
|
||||
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.
|
||||
AVR USART engine expects positive logic while Sun keyboard signal is negative.
|
||||
To use AVR UART engine you need external inverter in front of RX and TX pin.
|
||||
Otherwise you can use software serial to communicate the keyboard.
|
||||
|
||||
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.
|
||||
This firmware uses software serial by default, so you don't need any inverter.
|
||||
It can be still built with 'make HARDWARE_SERIAL=y' to enable hardware serial if you have inverter. You can use 74LS04 for example.
|
||||
|
||||
|
||||
Commands From System To Keyboard
|
||||
### Commands From System To Keyboard
|
||||
|
||||
0x01 Reset
|
||||
Keyboard responds with following byte sequence:
|
||||
Success: 0xFF 0x04 0x7F
|
||||
|
|
@ -69,27 +71,33 @@ Commands From System To Keyboard
|
|||
0x0F Layout
|
||||
Keyboard responds with 'Layout Response' 0xFE 0xXX
|
||||
|
||||
Commands From Keyboard To System
|
||||
### Commands From Keyboard To System
|
||||
0x7F Idle
|
||||
means no keys pressed.
|
||||
0xFE Layout Response
|
||||
0xFF Reset Response(followed by 0x04)
|
||||
|
||||
Reference
|
||||
http://kentie.net/article/sunkbd/page2.htm
|
||||
http://kentie.net/article/sunkbd/KBD.pdf
|
||||
|
||||
### Reference
|
||||
- http://kentie.net/article/sunkbd/page2.htm
|
||||
- http://kentie.net/article/sunkbd/KBD.pdf
|
||||
|
||||
|
||||
Build Firmware
|
||||
--------------
|
||||
Just use 'make'
|
||||
For TMK converter with ATmega32U2 just run `make` to build firmware hex file.
|
||||
For other DIY converters with ATmega32U4 like Teensy2 or Pro Micro use `make -f Makefile.atmega32u4` instead of `make`.
|
||||
|
||||
$ cd sun_usb
|
||||
$ make
|
||||
Then, load the binary to MCU with your favorite programmer.
|
||||
|
||||
Then, load the hex file into MCU with your favorite programmer. If you have `dfu-programmer` installed you can use `make dfu`.
|
||||
|
||||
$ make dfu
|
||||
|
||||
|
||||
Sun commands
|
||||
------------
|
||||
|
||||
Keyboard Control
|
||||
----------------
|
||||
You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
|
||||
https://github.com/tmk/tmk_keyboard#magic-commands
|
||||
|
||||
|
|
@ -106,3 +114,12 @@ PgDown: LED all On
|
|||
Insert: Layout
|
||||
Delete: Reset
|
||||
```
|
||||
|
||||
|
||||
Tested on
|
||||
---------
|
||||
### Type 3
|
||||
http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
|
||||
|
||||
### CTCSP SHORT TYPE KEYBOARD(Type 5)
|
||||
http://imgur.com/a/QIv6p
|
||||
1279
converter/sun_usb/binary/sun_usb.hex
Normal file
1279
converter/sun_usb/binary/sun_usb.hex
Normal file
File diff suppressed because it is too large
Load diff
1284
converter/sun_usb/binary/sun_usb_atmega32u4.hex
Normal file
1284
converter/sun_usb/binary/sun_usb_atmega32u4.hex
Normal file
File diff suppressed because it is too large
Load diff
64
converter/sun_usb/unimap.c
Normal file
64
converter/sun_usb/unimap.c
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Copyright 2020 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
This file is part of TMK keyboard. https://github.com/tmk/tmk_keyboard
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "unimap_trans.h"
|
||||
|
||||
|
||||
#define AC_FN0 ACTION_LAYER_TAP_KEY(1, KC_APPLICATION)
|
||||
|
||||
#ifdef KEYMAP_SECTION_ENABLE
|
||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
||||
#else
|
||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
|
||||
#endif
|
||||
UNIMAP_TYPE5(
|
||||
F23, F24, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,PWR,
|
||||
F13, F14, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
||||
F15, F16, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC, DEL, END, PGDN, P7, P8, P9, PPLS,
|
||||
F17, F18, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6,
|
||||
F19, F20, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PENT,
|
||||
F21, F22, CAPS,LALT,LGUI,MHEN, SPC, HENK,KANA,RGUI,FN0, RALT, LEFT,DOWN,RGHT, P0, PDOT
|
||||
),
|
||||
UNIMAP_TYPE5(
|
||||
TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,BTLD,
|
||||
TRNS,TRNS, GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
|
||||
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
|
||||
TRNS,TRNS, TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT, TRNS, TRNS,TRNS,TRNS,
|
||||
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
|
||||
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS
|
||||
),
|
||||
};
|
||||
/* Templates:
|
||||
UNIMAP_TYPE5(
|
||||
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,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
|
||||
),
|
||||
|
||||
UNIMAP_TYPE3(
|
||||
F10, F11, F1, F2, F3, F4, F5, F6, F7, F8, F9, BSPC, VOLD,MUTE,VOLU,
|
||||
F12, F13, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, MPRV,MPLY,MNXT,
|
||||
F14, F15, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, HOME,UP, PGUP,
|
||||
F16, F17, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, LEFT,INS, RGHT,
|
||||
F18, F19, LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,RCTL, END, DOWN,PGDN,
|
||||
LGUI,LALT, SPC, RALT,RGUI
|
||||
),
|
||||
*/
|
||||
148
converter/sun_usb/unimap_trans.h
Normal file
148
converter/sun_usb/unimap_trans.h
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
Copyright 2020 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
This file is part of TMK keyboard. https://github.com/tmk/tmk_keyboard
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef UNIMAP_TRNAS_H
|
||||
#define UNIMAP_TRNAS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include "unimap.h"
|
||||
|
||||
|
||||
/* Mapping to Universal keyboard layout
|
||||
* ,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------.
|
||||
* | 76 | | 0F| | 05| 06| 08| 0A| | 0C| 0E| 10| 11| | 12| 07| 09| 0B| | 16| 17| 15| | 2D| 02| 04| 30|
|
||||
* `-------' `---' `---------------' `---------------' `---------------' `-----------' `---------------'
|
||||
* ,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* | 01| 03| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2C| 34| 60| | 62| 2E| 2F| 47|
|
||||
* |-------| |-----------------------------------------------------------| |------------ |---------------|
|
||||
* | 19| 1A| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 2B | | 42| 4A| 7B| | 44| 45| 46| |
|
||||
* |-------| |-----------------------------------------------------------| `-----------' |-----------| 7D|
|
||||
* | 31| 33| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D| |
|
||||
* |-------| |-----------------------------------------------------------| ,---. |-----------|---|
|
||||
* | 48| 49| | 63 |+7C| 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D|*6F| 6E | | 14| | 70| 71| 72| |
|
||||
* |-------| |-----------------------------------------------------------| .-----------. |-----------| 5A|
|
||||
* | 5F| 61| | 77 | 13| 78 |*73 | 79 |*74 |*75| 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| |
|
||||
* `-------' `-----------------------------------------------------------' `-----------' `---------------'
|
||||
* ,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------.
|
||||
* | F23 | |F24| | F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |PrS|ScL|Pau| |Mut|VoD|VoU|Ctl|
|
||||
* `-------' `---' `---------------' `---------------' `---------------' `-----------' `---------------'
|
||||
* ,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* |F13|F14| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| |Ins|Hom|PgU| |NmL| /| *| -|
|
||||
* |-------| |-----------------------------------------------------------| |------------ |---------------|
|
||||
* |F15|F16| |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bspc| |Del|End|PgD| | 7| 8| 9| |
|
||||
* |-------| |-----------------------------------------------------------| `-----------' |-----------| +|
|
||||
* |F17|F18| |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| |
|
||||
* |-------| |-----------------------------------------------------------| ,---. |-----------|---|
|
||||
* |F19|F20| |Shft| +\| Z| X| C| V| B| N| M| ,| .| /| RO| Shift| | Up| | 1| 2| 3| |
|
||||
* |-------| |-----------------------------------------------------------| .-----------. |-----------|Ent|
|
||||
* |F21|F22| |Caps|Alt|Gui |MHEN| Space |HENK|KAN| Gui|App|Alt| |Lef|Dow|Rig| | 0| .| |
|
||||
* `-------' `-----------------------------------------------------------' `-----------' `---------------'
|
||||
* SUN scan codes: http://kentie.net/article/sunkbd/KBD.pdf
|
||||
* Japanese specific keys*: http://shikasan.net/sunkey/sunkey_e.html
|
||||
* ISO key+: https://bit.ly/3eennkS
|
||||
*/
|
||||
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
|
||||
{ UNIMAP_NO, UNIMAP_F13, UNIMAP_VOLD, UNIMAP_F14, UNIMAP_VOLU, UNIMAP_F1, UNIMAP_F2, UNIMAP_F10 }, /* 00-07 */
|
||||
{ UNIMAP_F3, UNIMAP_F11, UNIMAP_F4, UNIMAP_F12, UNIMAP_F5, UNIMAP_RALT, UNIMAP_F6, UNIMAP_F24 }, /* 08-0F */
|
||||
{ UNIMAP_F7, UNIMAP_F8, UNIMAP_F9, UNIMAP_LALT, UNIMAP_UP, UNIMAP_PAUS, UNIMAP_PSCR, UNIMAP_SLCK }, /* 10-17 */
|
||||
{ UNIMAP_LEFT, UNIMAP_F15, UNIMAP_F16, UNIMAP_DOWN, UNIMAP_RGHT, UNIMAP_ESC, UNIMAP_1, UNIMAP_2 }, /* 18-1F */
|
||||
{ UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6, UNIMAP_7, UNIMAP_8, UNIMAP_9, UNIMAP_0 }, /* 20-27 */
|
||||
{ UNIMAP_MINS, UNIMAP_EQL, UNIMAP_GRV, UNIMAP_BSPC, UNIMAP_INS, UNIMAP_MUTE, UNIMAP_PSLS, UNIMAP_PAST }, /* 28-2F */
|
||||
{ UNIMAP_RCTL, UNIMAP_F17, UNIMAP_PDOT, UNIMAP_F18, UNIMAP_HOME, UNIMAP_TAB, UNIMAP_Q, UNIMAP_W }, /* 30-37 */
|
||||
{ UNIMAP_E, UNIMAP_R, UNIMAP_T, UNIMAP_Y, UNIMAP_U, UNIMAP_I, UNIMAP_O, UNIMAP_P }, /* 38-3F */
|
||||
{ UNIMAP_LBRC, UNIMAP_RBRC, UNIMAP_DEL, UNIMAP_APP, UNIMAP_P7, UNIMAP_P8, UNIMAP_P9, UNIMAP_PMNS }, /* 40-47 */
|
||||
{ UNIMAP_F19, UNIMAP_F20, UNIMAP_END, UNIMAP_NO, UNIMAP_LCTL, UNIMAP_A, UNIMAP_S, UNIMAP_D }, /* 48-4F */
|
||||
{ UNIMAP_F, UNIMAP_G, UNIMAP_H, UNIMAP_J, UNIMAP_K, UNIMAP_L, UNIMAP_SCLN, UNIMAP_QUOT }, /* 50-57 */
|
||||
{ UNIMAP_BSLS, UNIMAP_ENT, UNIMAP_PENT, UNIMAP_P4, UNIMAP_P5, UNIMAP_P6, UNIMAP_P0, UNIMAP_F21 }, /* 58-5F */
|
||||
{ UNIMAP_PGUP, UNIMAP_F22, UNIMAP_NLCK, UNIMAP_LSFT, UNIMAP_Z, UNIMAP_X, UNIMAP_C, UNIMAP_V }, /* 60-67 */
|
||||
{ UNIMAP_B, UNIMAP_N, UNIMAP_M, UNIMAP_COMM, UNIMAP_DOT, UNIMAP_SLSH, UNIMAP_RSFT, UNIMAP_RO }, /* 68-6F */
|
||||
{ UNIMAP_P1, UNIMAP_P2, UNIMAP_P3, UNIMAP_MHEN, UNIMAP_HENK, UNIMAP_KANA, UNIMAP_F23, UNIMAP_CAPS }, /* 70-77 */
|
||||
{ UNIMAP_LGUI, UNIMAP_SPC, UNIMAP_RGUI, UNIMAP_PGDN, UNIMAP_NUBS, UNIMAP_PPLS, UNIMAP_NO, UNIMAP_NO }, /* 78-7F */
|
||||
};
|
||||
|
||||
|
||||
/* Sun type 5/5c keyboard
|
||||
* ,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------.
|
||||
* | Help | | | | F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |PrS|ScL|Pau| |Mut|VoD|VoU|Pwr|
|
||||
* `-------' `---' `---------------' `---------------' `---------------' `-----------' `---------------'
|
||||
* ,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* |Stp|Agn| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| |Ins|Hom|PgU| |NmL| /| *| -|
|
||||
* |-------| |-----------------------------------------------------------| |------------ |---------------|
|
||||
* |Prp|Und| |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bspc| |Del|End|PgD| | 7| 8| 9| |
|
||||
* |-------| |-----------------------------------------------------------| `-----------' |-----------| +|
|
||||
* |Frt|Cpy| |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| |
|
||||
* |-------| |-----------------------------------------------------------| ,---. |-----------|---|
|
||||
* |Opn|Pst| |Shft| +\| Z| X| C| V| B| N| M| ,| .| /| | Shift| | Up| | 1| 2| 3| |
|
||||
* |-------| |-----------------------------------------------------------| .-----------. |-----------|Ent|
|
||||
* |Fnd|Cut| |Caps|Alt|Meta| | Space | | |Meta|Cmp|Alt| |Lef|Dow|Rig| | 0| .| |
|
||||
* `-------' `-----------------------------------------------------------' `-----------' `---------------'
|
||||
*/
|
||||
#define UNIMAP_TYPE5( \
|
||||
K76, K0F, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \
|
||||
K01,K03, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C,K34,K60, K62,K2E,K2F,K47, \
|
||||
K19,K1A, K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42,K4A,K7B, K44,K45,K46,K7D, \
|
||||
K31,K33, K4C,K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \
|
||||
K48,K49, K63,K7C,K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6F,K6E, K14, K70,K71,K72,K5A, \
|
||||
K5F,K61, K77,K13,K78,K73, K79, K74,K75,K7A,K43,K0D, K18,K1B,K1C, K5E, K32 \
|
||||
) UNIMAP ( \
|
||||
K01,K03,K19,K1A,K31,K33,K48,K49,K5F,K61,K76,K0F, \
|
||||
K1D, K05,K06,K08,K0A,K0C,K0E,K10,K11,K12,K07,K09,K0B, K16,K17,K15, K02,K04,K2D, \
|
||||
K2A,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,NO, K2B, K2C,K34,K60, K62,K2E,K2F,K47, \
|
||||
K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K58, K42,K4A,K7B, K44,K45,K46,K7D, \
|
||||
K77,K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, NO, K59, K5B,K5C,K5D,NO, \
|
||||
K63,K7C,K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6F,K6E, K14, K70,K71,K72,K5A, \
|
||||
K4C,K78,K13,K73, K79, K74,K75,K0D,K7A,K43,K30, K18,K1B,K1C, K5E, K32,NO \
|
||||
)
|
||||
|
||||
|
||||
/* Sun type 3 keyboard
|
||||
* ,-------. ,-----------------------------------------------------------. ,-----------.
|
||||
* | 01| 03| | 05| 06| 08| 0A| 0C| 0E| 10| 11| 12| 2B| | 15| 16| 17|
|
||||
* |-------| |-----------------------------------------------------------| |-----------|
|
||||
* | 19| 1A| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2D| 2E| 2F|
|
||||
* |-------| |-----------------------------------------------------------| |-----------|
|
||||
* | 31| 33| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 44| 45| 46|
|
||||
* |-------| |-----------------------------------------------------------| |-----------|
|
||||
* | 48| 49| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D|
|
||||
* |-------| |-----------------------------------------------------------| |-----------|
|
||||
* | 5F| 61| | 63 | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E| 6F| | 70| 71| 72|
|
||||
* `-------' |-----------------------------------------------------------| `-----------'
|
||||
* | 77 | 78 | 79 | 7A | 13 |
|
||||
* `-----------------------------------------------------------'
|
||||
* http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
|
||||
* https://github.com/dastels/tmk_keyboard/blob/master/converter/sun3_usb/keymap.c
|
||||
*/
|
||||
#define UNIMAP_TYPE3( \
|
||||
K01,K03, K05,K06, K08, K0A, K0C, K0E, K10,K11,K12,K2B, K15,K16,K17, \
|
||||
K19,K1A, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2D,K2E,K2F, \
|
||||
K31,K33, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K44,K45,K46, \
|
||||
K48,K49, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \
|
||||
K5F,K61, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E,K6F, K70,K71,K72, \
|
||||
K77,K78, K79, K7A,K13 \
|
||||
) UNIMAP ( \
|
||||
K01,K03,K19,K1A,K31,K33,K48,K49,K5F,K61,NO, NO, \
|
||||
K1D, K05,K06,K08,K0A,K0C,K0E,K10,K11,K12,NO, NO, NO, K16,K17,K15, NO, NO, K2D, \
|
||||
K2A,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,NO, K2B, NO, NO, NO, NO, K2E,K2F,NO, \
|
||||
K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K58, K42,NO, NO, K44,K45,K46,NO, \
|
||||
K77,K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, NO, K59, K5B,K5C,K5D,NO, \
|
||||
K63,NO, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6F,K6E, NO, K70,K71,K72,NO, \
|
||||
K4C,K78,K13,NO, K79, NO, NO, NO, K7A,NO, NO, NO, NO, NO, NO, NO, NO \
|
||||
)
|
||||
|
||||
#endif
|
||||
|
|
@ -25,7 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif
|
||||
|
||||
|
||||
#define TIMER_DIFF(a, b, max) ((a) >= (b) ? (a) - (b) : (max) - (b) + (a))
|
||||
#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a)-(b))) : ( \
|
||||
(max == UINT16_MAX) ? ((uint16_t)((a)-(b))) : ( \
|
||||
(max == UINT32_MAX) ? ((uint32_t)((a)-(b))) : ( \
|
||||
(a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a) ))))
|
||||
#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX)
|
||||
#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX)
|
||||
#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue