Merge remote-tracking branch 'tmk/master'

This commit is contained in:
Mark Sikora 2023-07-05 11:35:30 -04:00
commit d7c2455549
20 changed files with 9461 additions and 10189 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -811,11 +811,6 @@ void matrix_init(void)
{ {
} }
uint8_t matrix_scan(void)
{
return 0;
}
inline inline
matrix_row_t matrix_get_row(uint8_t row) matrix_row_t matrix_get_row(uint8_t row)
{ {
@ -832,7 +827,7 @@ void led_set(uint8_t usb_led)
adb_host_kbd_led(ADB_ADDR_KEYBOARD, ~usb_led); adb_host_kbd_led(ADB_ADDR_KEYBOARD, ~usb_led);
} }
void hook_main_loop(void) uint8_t matrix_scan(void)
{ {
static uint16_t poll_ms; static uint16_t poll_ms;
static uint16_t detect_ms; static uint16_t detect_ms;

View file

@ -85,8 +85,38 @@ IBMPC_SECONDARY ?= yes # enable secondary interface(+800)
IBMPC_MOUSE_ENABLE ?= yes # enable mouse support(+2000) IBMPC_MOUSE_ENABLE ?= yes # enable mouse support(+2000)
# Optimize size but this may cause error "relocation truncated to fit" # Size optimization
#EXTRALDFLAGS = -Wl,--relax # https://github.com/obdev/v-usb/blob/master/usbdrv/Readme.txt
# https://p5r.uk/blog/2008/avr-gcc-optimisations.html
# Confirmed 5.4.0, 7.3.0 and 8-12
GCC_MAJOR = $(shell avr-gcc -dumpversion | cut -d. -f1)
EXTRALDFLAGS = -Wl,--relax
# GCC8-12: disable LTO with function-sections
ifeq ($(GCC_MAJOR),$(filter $(GCC_MAJOR),8 9 10 11 12))
# disable feature to reduce size
COMMAND_ENABLE = no
EXTRACFLAGS += -fno-lto
EXTRACFLAGS += -ffunction-sections
EXTRACFLAGS += -fdata-sections
else
EXTRACFLAGS += -fno-function-sections
EXTRACFLAGS += -fno-data-sections
endif
EXTRACFLAGS += -fno-move-loop-invariants
EXTRACFLAGS += -fno-tree-scev-cprop
EXTRACFLAGS += -fno-inline-small-functions
# GCC8-9: disable LTO
ifeq ($(GCC_MAJOR),$(filter $(GCC_MAJOR),8 9))
EXTRACPPFLAGS += -fno-lto
endif
EXTRACPPFLAGS += -fno-function-sections
EXTRACPPFLAGS += -fno-data-sections
EXTRACPPFLAGS += -fno-move-loop-invariants
EXTRACPPFLAGS += -fno-tree-scev-cprop
EXTRACPPFLAGS += -fno-inline-small-functions
# #

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

View file

@ -179,6 +179,14 @@ DONE:
return id; return id;
} }
static void clear_stuck_keys(void)
{
matrix_clear();
clear_keyboard();
xprintf("\n[CLR] ");
}
uint8_t IBMPCConverter::process_interface(void) uint8_t IBMPCConverter::process_interface(void)
{ {
if (ibmpc.error) { if (ibmpc.error) {
@ -191,9 +199,8 @@ uint8_t IBMPCConverter::process_interface(void)
* IBMPC_ERR_TIMEOUT Reinit * IBMPC_ERR_TIMEOUT Reinit
* IBMPC_ERR_FULL Ignore * IBMPC_ERR_FULL Ignore
* IBMPC_ERR_ILLEGAL Reinit * IBMPC_ERR_ILLEGAL Reinit
* IBMPC_ERR_FF Ignore(not used)
*/ */
// when recv error, neither send error nor buffer full // send error and buffer full are ignored TODO: refactor
if (!(ibmpc.error & (IBMPC_ERR_SEND | IBMPC_ERR_FULL))) { if (!(ibmpc.error & (IBMPC_ERR_SEND | IBMPC_ERR_FULL))) {
state = ERROR; state = ERROR;
if (ibmpc.error == IBMPC_ERR_PARITY_AA) { if (ibmpc.error == IBMPC_ERR_PARITY_AA) {
@ -506,19 +513,6 @@ MOUSE_DONE:
break; break;
} }
// Keyboard Error/Overrun([3]p.26) or Buffer full
// Scan Code Set 1: 0xFF
// Scan Code Set 2 and 3: 0x00
// Buffer full(IBMPC_ERR_FULL): 0xFF
if (keyboard_kind != PC_MOUSE && (code == 0x00 || code == 0xFF)) {
// clear stuck keys
matrix_clear();
clear_keyboard();
xprintf("\n[CLR] ");
break;
}
switch (keyboard_kind) { switch (keyboard_kind) {
case PC_XT: case PC_XT:
if (process_cs1(code) == -1) state = ERROR; if (process_cs1(code) == -1) state = ERROR;
@ -657,8 +651,7 @@ MOUSE_DONE:
xprintf("E%u ", timer_read()); xprintf("E%u ", timer_read());
// reinit state // reinit state
init(); init();
matrix_clear(); clear_stuck_keys();
clear_keyboard();
state = INIT; state = INIT;
break; break;
default: default:
@ -673,7 +666,7 @@ MOUSE_DONE:
* *
* See [3], [a] * See [3], [a]
* *
* E0-escaped scan codes are translated into unused range of the matrix.(54-7F) * E0-prefixed scan codes are translated into unused range of the matrix.(54-7F)
* *
* 01-53: Normal codes used in original XT keyboard * 01-53: Normal codes used in original XT keyboard
* 54-7F: Not used in original XT keyboard * 54-7F: Not used in original XT keyboard
@ -684,8 +677,8 @@ MOUSE_DONE:
* 70 x * * x * * x * * x * x * x x * * 70 x * * x * * x * * x * x * x x *
* *
* -: codes existed in original XT keyboard * -: codes existed in original XT keyboard
* *: E0-escaped codes translated * *: E0-prefixed codes translated
* x: Non-espcaped codes(Some are not used in real keyboards probably) * x: Non-prefixed codes(Some are not used in real keyboards probably)
* *
* Codes assigned in range 54-7F: * Codes assigned in range 54-7F:
* *
@ -750,6 +743,9 @@ int8_t IBMPCConverter::process_cs1(uint8_t code)
switch (state_cs1) { switch (state_cs1) {
case CS1_INIT: case CS1_INIT:
switch (code) { switch (code) {
case 0xFF: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xE0: case 0xE0:
state_cs1 = CS1_E0; state_cs1 = CS1_E0;
break; break;
@ -898,8 +894,9 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x41: if (0xAB90 == keyboard_id || 0xAB91 == keyboard_id) case 0x41: if (0xAB90 == keyboard_id || 0xAB91 == keyboard_id)
return 0x7C; // Keypad ,(5576) -> Keypad * return 0x7C; // Keypad ,(5576) -> Keypad *
else else
return (code & 0x7F); return (code & 0x7F); // unknown
// standard E0-prefixed codes [a]
case 0x14: return 0x19; // right control case 0x14: return 0x19; // right control
case 0x1F: return 0x17; // left GUI case 0x1F: return 0x17; // left GUI
case 0x27: return 0x1F; // right GUI case 0x27: return 0x1F; // right GUI
@ -919,7 +916,6 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x7D: return 0x5E; // page up case 0x7D: return 0x5E; // page up
case 0x7C: return 0x7F; // Print Screen case 0x7C: return 0x7F; // Print Screen
case 0x7E: return 0x00; // Control'd Pause case 0x7E: return 0x00; // Control'd Pause
case 0x21: return 0x65; // volume down case 0x21: return 0x65; // volume down
case 0x32: return 0x6E; // volume up case 0x32: return 0x6E; // volume up
case 0x23: return 0x6F; // mute case 0x23: return 0x6F; // mute
@ -950,7 +946,11 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x0D: return 0x19; // LCompose DEC LK411 -> LGUI case 0x0D: return 0x19; // LCompose DEC LK411 -> LGUI
case 0x79: return 0x6D; // KP- DEC LK411 -> PCMM case 0x79: return 0x6D; // KP- DEC LK411 -> PCMM
case 0x83: return 0x28; // F17 DEC LK411 case 0x83: return 0x28; // F17 DEC LK411
default: return (code & 0x7F);
// https://github.com/tmk/tmk_keyboard/pull/760
case 0x00: return 0x65; // TERM FUNC Siemens F500 -> VOLD
default: return (code & 0x7F); // unknown
} }
} }
@ -1010,6 +1010,9 @@ int8_t IBMPCConverter::process_cs2(uint8_t code)
code = translate_5576_cs2(code); code = translate_5576_cs2(code);
} }
switch (code) { switch (code) {
case 0x00: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xE0: case 0xE0:
state_cs2 = CS2_E0; state_cs2 = CS2_E0;
break; break;
@ -1046,7 +1049,7 @@ int8_t IBMPCConverter::process_cs2(uint8_t code)
} }
} }
break; break;
case CS2_E0: // E0-Prefixed case CS2_E0: // E0-prefixed
switch (code) { switch (code) {
case 0x12: // to be ignored case 0x12: // to be ignored
case 0x59: // to be ignored case 0x59: // to be ignored
@ -1258,6 +1261,9 @@ int8_t IBMPCConverter::process_cs3(uint8_t code)
code = translate_televideo_dec_cs3(code); code = translate_televideo_dec_cs3(code);
} }
switch (code) { switch (code) {
case 0x00: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xF0: case 0xF0:
state_cs3 = CS3_F0; state_cs3 = CS3_F0;
break; break;

View file

@ -59,7 +59,6 @@ CONSOLE_ENABLE ?= yes # Console for debug
COMMAND_ENABLE ?= yes # Commands for debug and configuration COMMAND_ENABLE ?= yes # Commands for debug and configuration
#NKRO_ENABLE ?= yes # USB Nkey Rollover #NKRO_ENABLE ?= yes # USB Nkey Rollover
UNIMAP_ENABLE ?= yes UNIMAP_ENABLE ?= yes
#KYMAP_SECTION_ENABLE ?= yes
# Boot Section Size in bytes # Boot Section Size in bytes

View file

@ -1,14 +1,14 @@
PC98 to USB keyboard protocol converter PC98 to USB keyboard protocol converter
======================================= =======================================
Main target is TMK prebuilt converter(ATMega32u2) but it will work on dev boards with ATMega32u4. TMK Keyboard protocol converter for NEC PC-9801 series that allows you to use PC-9801 keyboard on modern USB PC.
To initialize keyboard correctly you have to connect keyboard with converter first and then plug them into USB port. Main target is TMK prebuilt converter(ATMega32u2) but it will work on dev boards with ATMega32u4.
Otherwise, keyboard may not work.
You can buy [TMK prebuilt converter](https://geekhack.org/index.php?topic=72052.0) here to support this project. You can buy [TMK prebuilt converter](https://geekhack.org/index.php?topic=72052.0) here to support this project.
Discuss or report issue on github or [this thread](https://geekhack.org/index.php?topic=110094.0). Discuss or report issue on github or [this thread](https://geekhack.org/index.php?topic=110094.0).
See [this wiki page](https://github.com/tmk/tmk_keyboard/wiki/PC-9801-Keyboard) for PC98 keyboard technical infos.
@ -26,9 +26,7 @@ On host/converter:
(receptacle) (receptacle)
Wiring: You can change this with editing config.h. Pin mini DIN AVR Pins
Pin mini DIN MCU
---------------------------------- ----------------------------------
1 ~RST(TXD) PD3 1 ~RST(TXD) PD3
2 GND GND 2 GND GND
@ -41,13 +39,6 @@ Wiring: You can change this with editing config.h.
Protocol
--------
Signal: Asynchronous, Positive logic, 19200baud, Least bit first
Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
Prebilt Firmware Prebilt Firmware
---------------- ----------------
Prebuilt firmware HEX files are available under 'binary' directory. Prebuilt firmware HEX files are available under 'binary' directory.
@ -56,6 +47,7 @@ Prebuilt firmware HEX files are available under 'binary' directory.
Build Firmware Build Firmware
-------------- --------------
### TMK PC98 Converter
Just use 'make' to bild firmware for TMK PC98 converter(ATMega32u2). Just use 'make' to bild firmware for TMK PC98 converter(ATMega32u2).
$ make clean $ make clean
@ -67,6 +59,8 @@ To flash firmware run this command
then push button on the converter to flash firmware. then push button on the converter to flash firmware.
### Ohter boards
If you are using ATMega32u4 based board use following commands to get firmware HEX file. If you are using ATMega32u4 based board use following commands to get firmware HEX file.
$ make -f Makefile.32u4 clean $ make -f Makefile.32u4 clean
@ -76,76 +70,10 @@ And flash it on your board using specific program method.
PC98 Scan Codes
---------------
,---. ,---. ,------------------------. ,------------------------. ,------------------------.
|Stp| |Cpy| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
`---' `---' `------------------------' `------------------------' `------------------------'
,-------------------------------------------------------------. ,-------. ,---------------.
| Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|Hlp| -| /|
|-------------------------------------------------------------| |-------| |---------------|
| Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |RUp|RDn| | 7| 8| 9| *|
|-------------------------------------------------------`Enter| |-------| |---------------|
|Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +|
|-------------------------------------------------------------| |-------| |---------------|
| Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift | |Lef|Rig| | 1| 2| 3| =|
`-------------------------------------------------------------' |-------| |---------------|
|Kana|Win|GRP|NFER| Space |XFER| ^2|Win| ^3| | Down | | 0| ,| .| ^1|
`-------------------------------------------------------' `-------' `---------------'
^1: Enter on keypad is identical to Enter on alphanumeric portion
^2: ALT on DIGITAL WAVE Dboard while Menu on PC-9821 keyboard
^3: HOME on PC98XL keyboard
^4: CAPS and Kana are locking keys, either mechanically or by firmware emulation
,---. ,---. ,------------------------. ,------------------------. ,------------------------.
| 60| | 61| | 62 | 63 | 64 | 65 | 66 | | 67 | 68 | 69 | 6A | 6B | | 52 | 53 | 54 | 55 | 56 |
`---' `---' `------------------------' `------------------------' `------------------------'
,-------------------------------------------------------------. ,-------. ,---------------.
| 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | | 38| 39| | 3E| 3F| 4D| 41|
|-------------------------------------------------------------| |-------| |---------------|
| 0F | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| | | 36| 37| | 42| 43| 44| 45|
|-------------------------------------------------------` 1C | |-------| |---------------|
| 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| | | 3A | | 46| 47| 48| 49|
|-------------------------------------------------------------| |-------| |---------------|
| 70 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D | | 3B| 3C| | 4A| 4B| 4C| 4D|
`-------------------------------------------------------------' |-------| |---------------|
| 72 | 77| 73| 51 | 34 | 35 | 79| 78| 5E| | 3D | | 4E| 4F| 50| 1C|
`-------------------------------------------------------' `-------' `---------------'
5E: HOME on PC98XL keyboard
79: ALT on DIGITAL WAVE Dboard
77,78,79: Left Win, right Win and Application on PC-9821 keyboard
PC98 keyboard commands
----------------------
http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
response from keyboard:
FAh: ACK
FCh: NACK
Inhibit repeating key:
9Ch, 70h
LED control:
9Dh 7xh
second byte:
0111 xxxx
|||`- NumLock
||`-- ?
|`--- CapsLock
`---- Kana
Enabling Win and App key on PC-9821 keyboard:
95h, 03h
Raku Raku keyboard support Raku Raku keyboard support
-------------------------- --------------------------
This is not supported actively anymore.
NEC PC-9801-98-S02 - raku raku keyboard: NEC PC-9801-98-S02 - raku raku keyboard:
https://deskthority.net/photos-f62/nec-pc-9801-98-s02-t5212.html https://deskthority.net/photos-f62/nec-pc-9801-98-s02-t5212.html
@ -155,59 +83,5 @@ To build firmware for the keyboard
$ make KEYMAP=rakuraku $ make KEYMAP=rakuraku
$ make KEYMAP=rakuraku dfu $ make KEYMAP=rakuraku dfu
Its scan code map is very different from standard types. This is not tested. Its scan code map is very different from standard types.
See `unimap_trans.h` and `unimap_rakuraku.c`.
Other PC98 converter projects and resource
------------------------------------------
### TMK wiki
- https://github.com/tmk/tmk_keyboard/wiki/PC-9801-Keyboard
### PC-9800シリーズ テクニカルデータブック HARDWARE 編 1993年 p139, p343
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n151
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n355
### PC98 to USB
- http://davy.nyacom.net/kbd98usb/
### PC98 to PS/2
- http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
- http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
### Scan code
- http://ixsvr.dyndns.org/usb2pc98
NOTES
-----
### Tested on
- PC-9801V
- DIGITAL WAVE Dboard
### RDY
PC98 host keeps RDY line high to prevent keyboard from sending data while processing.
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n359
PC-9801V keyboard requires RDY pulse as acknowledgement from host, it doesn't next data without this. Dboard doesn't need this.
### Inhibit key repeating
The command(9Ch, 70h) works with Raku Raku keybaord but not with Dboard.
### LED indicater
Dboard has LEDs but replys with FA to 9D command but ignore it. The LED indicates just its internal states. Dboard replays with FA to 9C command but it doesn't seem to understand repeat setting.
PC-9801V has no LEDs and doesn't accept LED command. It replys with 9D to 9D command. PC-9801V doesn't accept repeat setting command. It replys with 9C to 9C command.
### PC-9801V
Note that you have to connect this keyboard with converter before plug in USB port. It seems this keyboard requires for host to send any command before starting to send scan code.
### Connection order
Converter doesn't support hotplugging due to limitation of PC-9801 keyboard.
You will have to plug keyboard into converter during without power first, and then plug them into USB port.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COLS 8 #define MATRIX_COLS 8
/* key combination for command */ /* key combination for command */
#ifndef __ASSEMBLER__
#include "matrix.h"
#endif
#define IS_COMMAND() ( \ #define IS_COMMAND() ( \
matrix_is_on(12, 0) || /* STOP */ \ matrix_is_on(12, 0) || /* STOP */ \
keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) \ keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) \

View file

@ -60,8 +60,11 @@ static void pc98_send(uint8_t data)
static int16_t pc98_wait_response(void) static int16_t pc98_wait_response(void)
{ {
int16_t code = -1; int16_t code;
uint8_t timeout = 255; uint8_t timeout;
RETRY:
code = -1;
timeout = 255;
while (timeout-- && (code = serial_recv2()) == -1) _delay_ms(1); while (timeout-- && (code = serial_recv2()) == -1) _delay_ms(1);
// Keyboards require RDY pulse >=37us to send next data // Keyboards require RDY pulse >=37us to send next data
@ -71,6 +74,7 @@ static int16_t pc98_wait_response(void)
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
xprintf("r%04X ", code); xprintf("r%04X ", code);
if (code == 0xFB) goto RETRY;
return code; return code;
} }
@ -105,6 +109,19 @@ static bool pc98_is_newtype(void)
return true; return true;
} }
static void pc98_enable_winkey(void)
{
uint16_t code;
RETRY:
pc98_send(0x95);
code = pc98_wait_response();
if (code != 0xFA) return;
pc98_send(0x03);
code = pc98_wait_response();
if (code != 0xFA) goto RETRY;
}
static uint8_t pc98_led = 0; static uint8_t pc98_led = 0;
static void pc98_led_set(void) static void pc98_led_set(void)
{ {
@ -139,10 +156,16 @@ void matrix_init(void)
serial_init(); serial_init();
_delay_ms(50); _delay_ms(500);
if (pc98_is_newtype()) xprintf("new type\n"); else xprintf("old type\n"); xprintf("\nKeyboard Type: ");
if (pc98_is_newtype()) xprintf("[NEW]"); else xprintf("[OLD]");
xprintf("\nInhibit Repeat: ");
pc98_inhibit_repeat(); pc98_inhibit_repeat();
xprintf("\nEnable Winkey: ");
pc98_enable_winkey();
// initialize matrix state: all keys off // initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;

View file

@ -25,28 +25,28 @@ const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section ("
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
#endif #endif
/* /*
,---. ,---. ,------------------------. ,------------------------. ,------------------------. * ,---.,---. ,------------------------.,------------------------. ,------------------------.
| | |PrS| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15| * |Pau||PrS| | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
`---' `---' `------------------------' `------------------------' `------------------------' * `---'`---' `------------------------'`------------------------' `------------------------'
,-------------------------------------------------------------. ,-------. ,---------------. * ,-------------------------------------------------------------. -------. ,---------------.
| Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|End| -| /| * | Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|End| -| /|
|-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------| |-------| |---------------|
| Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |PgD|PgU| | 7| 8| 9| *| * | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |PgD|PgU| | 7| 8| 9| *|
|-------------------------------------------------------`Enter| |-------| |---------------| * |-------------------------------------------------------`Enter| |-------| |---------------|
|Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +| * |Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +|
|-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------|,-----------.|---------------|
| Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift | |Lef|Rig| | 1| 2| 3|KP=| * | Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift ||Lef|Mut|Rig|| 1| 2| 3| =|
`-------------------------------------------------------------' |-------| |---------------| * `-------------------------------------------------------------|`-----------'|---------------|
|Kana|Gui| Alt|MHEN| Space |HENK|Alt|Gui|App| | Down | | 0| ,| .|Ent| * |Kana|Gui|Alt|MHEN| Space |HENK|Gui|App| | Down | | 0| ,| .| ^1|
`--------------------------------------------------------' `-------' `---------------' * `---------------------------------------------------------' `-------' `---------------'
Caps and Kana are locking keys. * ^1: Enter on keypad is identical to Enter on alphanumeric portion.
*/ */
UNIMAP_PC98( UNIMAP_PC98(
NO, PSCR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, NO, PSCR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15,
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, DEL, HOME,END, PMNS,PSLS, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, DEL, HOME,END, PMNS,PSLS,
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, PGDN,PGUP, P7, P8, P9, PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, PGDN,PGUP, P7, P8, P9, PAST,
LCTL,LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS,ENT, UP, P4, P5, P6, PPLS, LCTL,LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS,ENT, UP, P4, P5, P6, PPLS,
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,RGHT, P1, P2, P3, PEQL, LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT,LEFT,MUTE,RGHT,P1, P2, P3, PEQL,
KANA,LGUI,LALT,MHEN, SPC, HENK,RALT,RGUI,APP, DOWN, P0, PCMM,PDOT,PENT KANA,LGUI,LALT,MHEN, SPC, HENK,RGUI,APP, DOWN, P0, PCMM,PDOT
), ),
}; };

View file

@ -25,41 +25,38 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Mapping PC98 scan codes to UNIMAP layout codes /* Mapping PC98 scan codes to UNIMAP layout codes
* *
* PC98 scan codes * PC98 scan codes
* ,---. ,---. ,------------------------. ,------------------------. ,------------------------. * ,---.,---. ,------------------------.,------------------------. ,------------------------.
* | 60| | 61| | 62 | 63 | 64 | 65 | 66 | | 67 | 68 | 69 | 6A | 6B | | 52 | 53 | 54 | 55 | 56 | * | 60|| 61| | 62 | 63 | 64 | 65 | 66 || 67 | 68 | 69 | 6A | 6B | | 52 | 53 | 54 | 55 | 56 |
* `---' `---' `------------------------' `------------------------' `------------------------' * `---'`---' `------------------------'`------------------------' `------------------------'
* ,-------------------------------------------------------------. ,-------. ,---------------. * ,-------------------------------------------------------------. ,-------. ,---------------.
* | 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | | 38| 39| | 3E| 3F| 4D| 41| * | 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | | 38| 39| | 3E| 3F| 4D| 41|
* |-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------| |-------| |---------------|
* | 0F | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| | | 36| 37| | 42| 43| 44| 45| * | 0F | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| | | 36| 37| | 42| 43| 44| 45|
* |-------------------------------------------------------` 1C | |-------| |---------------| * |-------------------------------------------------------` 1C | |-------| |---------------|
* | 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| | | 3A | | 46| 47| 48| 49| * | 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| | | 3A | | 46| 47| 48| 49|
* |-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------|,-----------.|---------------|
* | 70 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D | | 3B| 3C| | 4A| 4B| 4C| 4D| * | 70 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D || 3B| 5E| 3C|| 4A| 4B| 4C| 4D|
* `-------------------------------------------------------------' |-------| |---------------| * `-------------------------------------------------------------'`-----------'|---------------|
* | 72 | 77| 73| 51 | 34 | 35 | 79| 78| 5E| | 3D | | 4E| 4F| 50| 1C| * | 72 | 77| 73| 51 | 34 | 35 | 78| 79| | 3D | | 4E| 4F| 50| 1C|
* `-------------------------------------------------------' `-------' `---------------' * `---------------------------------------------------------' `-------' `---------------'
* 5E: HOME on PC98XL keyboard * 5E: HOME on PC98XL keyboard
* 79: ALT on DIGITAL WAVE Dboard * 79: ALT on DIGITAL WAVE Dboard
* 77,78,79: Left Win, right Win and Application on PC-9821 keyboard * 77,78,79: Left Win, right Win and Application on PC-9821 keyboard
* *
* UNIMAP layout * ,---.,---. ,------------------------.,------------------------. ,------------------------.
* ,-----------------------------------------------. * |Stp||Cpy| | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
* |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24| * `---'`---' `------------------------'`------------------------' `------------------------'
* ,---. |-----------------------------------------------| ,-----------. ,-----------. * ,-------------------------------------------------------------. -------. ,---------------.
* |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut| * | Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|Hlp| -| /|
* `---' `-----------------------------------------------' `-----------' `-----------' * |-------------------------------------------------------------| |-------| |---------------|
* ,-----------------------------------------------------------. ,-----------. ,---------------. * | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |RUp|RDn| | 7| 8| 9| *|
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| * |-------------------------------------------------------`Enter| |-------| |---------------|
* |-----------------------------------------------------------| |-----------| |---------------| * |Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| * |-------------------------------------------------------------|,-----------.|---------------|
* |-----------------------------------------------------------| `-----------' |---------------| * | Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift ||Lef|Hom|Rig|| 1| 2| 3| =|
* |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Retn| | 4| 5| 6|KP,| * `-------------------------------------------------------------|`-----------'|---------------|
* |-----------------------------------------------------------| ,---. |---------------| * |Kana|Win|GRP|NFER| Space |XFER|Win|App| | Down | | 0| ,| .|Ent|
* |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|Ent| * `---------------------------------------------------------' `-------' `---------------'
* |-----------------------------------------------------------| ,-----------. |---------------|
* |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|KP=|
* `-----------------------------------------------------------' `-----------' `---------------'
*/ */
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = { const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
{ UNIMAP_ESC, UNIMAP_1, UNIMAP_2, UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6, UNIMAP_7 }, /* 00-07 */ { UNIMAP_ESC, UNIMAP_1, UNIMAP_2, UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6, UNIMAP_7 }, /* 00-07 */
@ -73,43 +70,39 @@ const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
{ UNIMAP_PMNS, UNIMAP_PSLS, UNIMAP_P7, UNIMAP_P8, UNIMAP_P9, UNIMAP_PAST, UNIMAP_P4, UNIMAP_P5 }, /* 40-47 */ { UNIMAP_PMNS, UNIMAP_PSLS, UNIMAP_P7, UNIMAP_P8, UNIMAP_P9, UNIMAP_PAST, UNIMAP_P4, UNIMAP_P5 }, /* 40-47 */
{ UNIMAP_P6, UNIMAP_PPLS, UNIMAP_P1, UNIMAP_P2, UNIMAP_P3, UNIMAP_PEQL, UNIMAP_P0, UNIMAP_PCMM }, /* 48-4F */ { UNIMAP_P6, UNIMAP_PPLS, UNIMAP_P1, UNIMAP_P2, UNIMAP_P3, UNIMAP_PEQL, UNIMAP_P0, UNIMAP_PCMM }, /* 48-4F */
{ UNIMAP_PDOT, UNIMAP_MHEN, UNIMAP_F11, UNIMAP_F12, UNIMAP_F13, UNIMAP_F14, UNIMAP_F15, UNIMAP_NO }, /* 50-57 */ { UNIMAP_PDOT, UNIMAP_MHEN, UNIMAP_F11, UNIMAP_F12, UNIMAP_F13, UNIMAP_F14, UNIMAP_F15, UNIMAP_NO }, /* 50-57 */
{ UNIMAP_F21, UNIMAP_F22, UNIMAP_F23, UNIMAP_F24, UNIMAP_NO, UNIMAP_NO, UNIMAP_APP, UNIMAP_NO }, /* 58-5F */ { UNIMAP_F21, UNIMAP_F22, UNIMAP_F23, UNIMAP_F24, UNIMAP_NO, UNIMAP_NO, UNIMAP_MUTE, UNIMAP_NO }, /* 58-5F */
{ UNIMAP_PAUS, UNIMAP_PSCR, UNIMAP_F1, UNIMAP_F2, UNIMAP_F3, UNIMAP_F4, UNIMAP_F5, UNIMAP_F6 }, /* 60-67 */ { UNIMAP_PAUS, UNIMAP_PSCR, UNIMAP_F1, UNIMAP_F2, UNIMAP_F3, UNIMAP_F4, UNIMAP_F5, UNIMAP_F6 }, /* 60-67 */
{ UNIMAP_F7, UNIMAP_F8, UNIMAP_F9, UNIMAP_F10, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 68-6F */ { UNIMAP_F7, UNIMAP_F8, UNIMAP_F9, UNIMAP_F10, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 68-6F */
{ UNIMAP_LSFT, UNIMAP_CAPS, UNIMAP_KANA, UNIMAP_LALT, UNIMAP_LCTL, UNIMAP_NO, UNIMAP_NO, UNIMAP_LGUI }, /* 70-77 */ { UNIMAP_LSFT, UNIMAP_CAPS, UNIMAP_KANA, UNIMAP_LALT, UNIMAP_LCTL, UNIMAP_NO, UNIMAP_NO, UNIMAP_LGUI }, /* 70-77 */
{ UNIMAP_RGUI, UNIMAP_RALT, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_RSFT, UNIMAP_NO, UNIMAP_NO } /* 78-7F */ { UNIMAP_RGUI, UNIMAP_APP, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_RSFT, UNIMAP_NO, UNIMAP_NO } /* 78-7F */
}; };
/* PC-9801/9821 keyboard /* PC-9801/9821 keyboard
,---. ,---. ,------------------------. ,------------------------. ,------------------------. * ,---.,---. ,------------------------.,------------------------. ,------------------------.
|Pau| |PrS| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15| * |Pau||PrS| | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
`---' `---' `------------------------' `------------------------' `------------------------' * `---'`---' `------------------------'`------------------------' `------------------------'
,-------------------------------------------------------------. ,-------. ,---------------. * ,-------------------------------------------------------------. -------. ,---------------.
| Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|End| -| /| * | Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|End| -| /|
|-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------| |-------| |---------------|
| Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |PgD|PgU| | 7| 8| 9| *| * | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |PgD|PgU| | 7| 8| 9| *|
|-------------------------------------------------------`Enter| |-------| |---------------| * |-------------------------------------------------------`Enter| |-------| |---------------|
|Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +| * |Ctl|Cap| A| S| D| F| G| H| J| K| L| ;| '| \| | | Up | | 4| 5| 6| +|
|-------------------------------------------------------------| |-------| |---------------| * |-------------------------------------------------------------|,-----------.|---------------|
| Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift | |Lef|Rig| | 1| 2| 3| =| * | Shift | Z| X| C| V| B| N| M| ,| .| /| RO| Shift ||Lef|Mut|Rig|| 1| 2| 3| =|
`-------------------------------------------------------------' |-------| |---------------| * `-------------------------------------------------------------|`-----------'|---------------|
^3|Kana|Gui|Alt|MHEN| Space |HENK|Alt|Gui|App|^2 | Down | | 0| ,| .| ^1| * |Kana|Gui|Alt|MHEN| Space |HENK|Gui|App| | Down | | 0| ,| .|Ent|
`-------------------------------------------------------' `-------' `---------------' * `---------------------------------------------------------' `-------' `---------------'
^1: Enter on keypad is identical to Enter on alphanumeric portion. */
^2: Right Alt is ALT on DIGITAL WAVE Dboard while Menu on PC-9821 keyboard.
App is HOME key on PC98XL keyboard.
^3: Caps and Kana are locking keys, either mechanically or by firmware emulation.
*/
#define UNIMAP_PC98( \ #define UNIMAP_PC98( \
K48, K46, K3A,K3B,K3C,K3D,K3E, K3F,K40,K41,K42,K43, K44,K45,K68,K69,K6A, \ K48, K46, K3A,K3B,K3C,K3D,K3E, K3F,K40,K41,K42,K43, K44,K45,K68,K69,K6A, \
K29,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A, K49,K4C, K4A,K4D,K56,K54, \ K29,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K74,K2A, K49,K4C, K4A,K4D,K56,K54, \
K2B, K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K4B,K4E, K5F,K60,K61,K55, \ K2B, K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K4E,K4B, K5F,K60,K61,K55, \
K78,K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K31,K28, K52, K5C,K5D,K5E,K57, \ K78,K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K31,K28, K52, K5C,K5D,K5E,K57, \
K79, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,K75, K7D, K50,K4F, K59,K5A,K5B,K67, \ K79, K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38,K75, K7D,K50,K03,K4F,K59,K5A,K5B,K67, \
K00,K7B,K7A,K77, K2C, K76,K7E,K7F,K65, K51, K62,K66,K63,K58 \ K00,K7B,K7A,K77, K2C, K76,K7F,K65, K51, K62,K66,K63 \
) { \ ) { \
{ AC_##K00, AC_NO, AC_NO, AC_NO, AC_##K04, AC_##K05, AC_##K06, AC_##K07, /* 00-07 */ \ { AC_##K00, AC_NO, AC_NO, AC_##K03, AC_##K04, AC_##K05, AC_##K06, AC_##K07, /* 00-07 */ \
AC_##K08, AC_##K09, AC_##K0A, AC_##K0B, AC_##K0C, AC_##K0D, AC_##K0E, AC_##K0F }, /* 08-0F */ \ AC_##K08, AC_##K09, AC_##K0A, AC_##K0B, AC_##K0C, AC_##K0D, AC_##K0E, AC_##K0F }, /* 08-0F */ \
{ AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17, /* 10-17 */ \ { AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17, /* 10-17 */ \
AC_##K18, AC_##K19, AC_##K1A, AC_##K1B, AC_##K1C, AC_##K1D, AC_##K1E, AC_##K1F }, /* 18-1F */ \ AC_##K18, AC_##K19, AC_##K1A, AC_##K1B, AC_##K1C, AC_##K1D, AC_##K1E, AC_##K1F }, /* 18-1F */ \
@ -120,11 +113,11 @@ const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
{ AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_NO, /* 40-47 */ \ { AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_NO, /* 40-47 */ \
AC_##K48, AC_##K49, AC_##K4A, AC_##K4B, AC_##K4C, AC_##K4D, AC_##K4E, AC_##K4F }, /* 48-4F */ \ AC_##K48, AC_##K49, AC_##K4A, AC_##K4B, AC_##K4C, AC_##K4D, AC_##K4E, AC_##K4F }, /* 48-4F */ \
{ AC_##K50, AC_##K51, AC_##K52, AC_NO, AC_##K54, AC_##K55, AC_##K56, AC_##K57, /* 50-57 */ \ { AC_##K50, AC_##K51, AC_##K52, AC_NO, AC_##K54, AC_##K55, AC_##K56, AC_##K57, /* 50-57 */ \
AC_##K58, AC_##K59, AC_##K5A, AC_##K5B, AC_##K5C, AC_##K5D, AC_##K5E, AC_##K5F }, /* 58-5F */ \ AC_NO, AC_##K59, AC_##K5A, AC_##K5B, AC_##K5C, AC_##K5D, AC_##K5E, AC_##K5F }, /* 58-5F */ \
{ AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_NO, AC_##K65, AC_##K66, AC_##K67, /* 60-67 */ \ { AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_NO, AC_##K65, AC_##K66, AC_##K67, /* 60-67 */ \
AC_##K68, AC_##K69, AC_##K6A, AC_NO, AC_NO, AC_NO, AC_NO, AC_NO, }, /* 68-6F */ \ AC_##K68, AC_##K69, AC_##K6A, AC_NO, AC_NO, AC_NO, AC_NO, AC_NO, }, /* 68-6F */ \
{ AC_NO, AC_NO, AC_NO, AC_NO, AC_##K74, AC_##K75, AC_##K76, AC_##K77, /* 70-77 */ \ { AC_NO, AC_NO, AC_NO, AC_NO, AC_##K74, AC_##K75, AC_##K76, AC_##K77, /* 70-77 */ \
AC_##K78, AC_##K79, AC_##K7A, AC_##K7B, AC_NO, AC_##K7D, AC_##K7E, AC_##K7F } /* 78-7F */ \ AC_##K78, AC_##K79, AC_##K7A, AC_##K7B, AC_NO, AC_##K7D, AC_NO, AC_##K7F } /* 78-7F */ \
} }

View file

@ -25,6 +25,9 @@ ifeq (yes,$(strip $(UNIMAP_ENABLE)))
SRC += $(COMMON_DIR)/unimap.c SRC += $(COMMON_DIR)/unimap.c
OPT_DEFS += -DUNIMAP_ENABLE OPT_DEFS += -DUNIMAP_ENABLE
OPT_DEFS += -DACTIONMAP_ENABLE OPT_DEFS += -DACTIONMAP_ENABLE
ifndef KEYMAP_SECTION_ENABLE
KEYMAP_SECTION_ENABLE = yes
endif
else else
ifeq (yes,$(strip $(ACTIONMAP_ENABLE))) ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
SRC += $(COMMON_DIR)/actionmap.c SRC += $(COMMON_DIR)/actionmap.c

View file

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keyboard.h" #include "keyboard.h"
#include "keycode.h" #include "keycode.h"
#include "action_code.h" #include "action_code.h"
#include "action_layer.h"
#include "action_macro.h" #include "action_macro.h"

View file

@ -84,7 +84,6 @@ POSSIBILITY OF SUCH DAMAGE.
#define IBMPC_ERR_TIMEOUT 0x20 #define IBMPC_ERR_TIMEOUT 0x20
#define IBMPC_ERR_FULL 0x40 #define IBMPC_ERR_FULL 0x40
#define IBMPC_ERR_ILLEGAL 0x80 #define IBMPC_ERR_ILLEGAL 0x80
#define IBMPC_ERR_FF 0xF0
#define IBMPC_LED_SCROLL_LOCK 0 #define IBMPC_LED_SCROLL_LOCK 0
#define IBMPC_LED_NUM_LOCK 1 #define IBMPC_LED_NUM_LOCK 1

View file

@ -41,6 +41,7 @@
#include "host_driver.h" #include "host_driver.h"
#include "keyboard.h" #include "keyboard.h"
#include "action.h" #include "action.h"
#include "action_util.h"
#include "led.h" #include "led.h"
#include "sendchar.h" #include "sendchar.h"
#include "ringbuf.h" #include "ringbuf.h"
@ -73,7 +74,7 @@ uint8_t keyboard_idle = 0;
/* 0: Boot Protocol, 1: Report Protocol(default) */ /* 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;
static report_keyboard_t keyboard_report_sent; static report_keyboard_t keyboard_report_sent = (report_keyboard_t){};
#endif #endif
#ifdef MOUSE_ENABLE #ifdef MOUSE_ENABLE
@ -305,6 +306,19 @@ void EVENT_USB_Device_Reset(void)
#ifdef TMK_LUFA_DEBUG #ifdef TMK_LUFA_DEBUG
print("[R]"); print("[R]");
#endif #endif
// reset to initial state: protocol to Report(default)
#ifndef NO_KEYBOARD
keyboard_protocol = 1;
keyboard_idle = 0;
keyboard_led_stats = 0;
keyboard_report_sent = (report_keyboard_t){};
// keyboard_report keys/bits part is not compatible between Boot and Report protocol
clear_keys();
#endif
#ifdef MOUSE_ENABLE
mouse_protocol = 1;
#endif
} }
void EVENT_USB_Device_Suspend() void EVENT_USB_Device_Suspend()