diff --git a/converter/pc98_usb/Makefile b/converter/pc98_usb/Makefile index 9892276d..601e30a9 100644 --- a/converter/pc98_usb/Makefile +++ b/converter/pc98_usb/Makefile @@ -10,7 +10,6 @@ TARGET_DIR = . # keyboard dependent files SRC = keymap.c \ matrix.c \ - led.c \ protocol/serial_uart.c # protocol/serial_soft.c @@ -20,9 +19,10 @@ CONFIG_H = config.h # MCU name, you MUST set this to match the board you are using # type "make clean" after changing this, so all files will be rebuilt #MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 +#MCU = atmega32u4 # Teensy 2.0 #MCU = at90usb646 # Teensy++ 1.0 #MCU = at90usb1286 # Teensy++ 2.0 +MCU = atmega32u2 # TMK Converter # Processor frequency. @@ -62,6 +62,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 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 #NKRO_ENABLE = yes # USB Nkey Rollover diff --git a/converter/pc98_usb/README b/converter/pc98_usb/README index c9bdf3d8..3fc0a4b9 100644 --- a/converter/pc98_usb/README +++ b/converter/pc98_usb/README @@ -1,6 +1,6 @@ PC98 to USB keyboard protocol converter ======================================= -Target MCU is ATMega32u4 but other USB capable AVR will also work. +Target MCU is ATMega32u2 but other USB capable AVR will also work. Connector @@ -12,7 +12,7 @@ Connector / 8 7 6 \ | 5 4 3 | \_ 2 1 _/ - \_____/ + \_____/ (receptacle) @@ -25,8 +25,8 @@ Wiring: You can change this with editing config.h. 3 ~RDY PD4 4 RXD PD2 5 ~RTY PD5 - 6 NC - 7 NC + 6 NC + 7 NC 8 5V VCC @@ -59,9 +59,31 @@ 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 + +NEC PC-9801-98-S02 - raku raku keyboard: +https://deskthority.net/photos-f62/nec-pc-9801-98-s02-t5212.html + + + 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: -0x9C, 0x70 + 0x9C, 0x70 + +LED control: + 9Dh 7xh + + second byte: + 0111 xxxx + |||`- NumLock + ||`-- ? + |`--- CapsLock + `---- Kana diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h index b8d676e4..9341708f 100644 --- a/converter/pc98_usb/config.h +++ b/converter/pc98_usb/config.h @@ -32,10 +32,20 @@ along with this program. If not, see . /* key combination for command */ #define IS_COMMAND() ( \ - host_get_first_key() == KC_CANCEL \ + keyboard_report->keys[0] == KC_STOP || \ + keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) \ ) +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* Control LED indicatiors, which doesn't work well with locking support */ +//#define PC98_LED_CONTROL + + /* PC98 Reset Port shared with TXD */ #define PC98_RST_DDR DDRD #define PC98_RST_PORT PORTD @@ -47,7 +57,7 @@ along with this program. If not, see . /* PC98 Retry Port */ #define PC98_RTY_DDR DDRD #define PC98_RTY_PORT PORTD -#define PC98_RTY_BIT 5 +#define PC98_RTY_BIT 1 /* * PC98 Serial(USART) configuration @@ -101,7 +111,7 @@ along with this program. If not, see . /* * Hardware Serial(UART) */ -#ifdef __AVR_ATmega32U4__ +#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) #define SERIAL_UART_BAUD 19200 #define SERIAL_UART_DATA UDR1 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) @@ -113,6 +123,7 @@ along with this program. If not, see . UCSR1B |= (1< - -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 . -*/ - -#include "stdint.h" -#include "serial.h" -#include "led.h" - - -void led_set(uint8_t usb_led) -{ - uint8_t sun_led = 0; - if (usb_led & (1<. #include "print.h" #include "util.h" #include "matrix.h" +#include "led.h" #include "debug.h" #include "protocol/serial.h" @@ -47,38 +48,46 @@ static uint8_t matrix[MATRIX_ROWS]; #define COL(code) (code&0x07) +static void pc98_send(uint8_t data) +{ + PC98_RDY_PORT |= (1<