diff options
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | converter/terminal_usb/Makefile | 113 | ||||
| -rw-r--r-- | converter/terminal_usb/Makefile.102_pjrc | 61 | ||||
| -rw-r--r-- | converter/terminal_usb/Makefile.122_pjrc | 61 | ||||
| -rw-r--r-- | converter/terminal_usb/README | 40 | ||||
| -rw-r--r-- | converter/terminal_usb/config.h | 138 | ||||
| -rw-r--r-- | converter/terminal_usb/config_102_pjrc.h | 56 | ||||
| -rw-r--r-- | converter/terminal_usb/config_122_pjrc.h | 56 | ||||
| -rw-r--r-- | converter/terminal_usb/keymap.c (renamed from converter/terminal_usb/keymap_122.c) | 15 | ||||
| -rw-r--r-- | converter/terminal_usb/keymap_102.c | 208 | ||||
| -rw-r--r-- | converter/terminal_usb/matrix.c | 110 | ||||
| -rw-r--r-- | doc/other_projects.md | 3 | ||||
| -rw-r--r-- | protocol/ps2.c | 2 | ||||
| -rw-r--r-- | protocol/ps2_usart.c | 2 |
14 files changed, 364 insertions, 513 deletions
| @@ -123,9 +123,9 @@ Following commands can be also executed with `Magic` + key. In console mode `Mag | |||
| 123 | Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. | 123 | Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. |
| 124 | Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. | 124 | Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. |
| 125 | 125 | ||
| 126 | #### EEPROM | 126 | #### General |
| 127 | - Skip reading EEPROM(`ESC`) | 127 | - Skip reading EEPROM to start with default configuration(`ESC`) |
| 128 | - Clear configuration stored in EEPROM(`Backspace`) | 128 | - Clear configuration stored in EEPROM to reset configuration(`Backspace`) |
| 129 | 129 | ||
| 130 | #### Bootloader | 130 | #### Bootloader |
| 131 | - Kick up Bootloader(`B`) | 131 | - Kick up Bootloader(`B`) |
| @@ -147,9 +147,9 @@ Note that you must use keys of **Layer 0** as Magic keys. These settings are sto | |||
| 147 | 147 | ||
| 148 | #### Default Layer | 148 | #### Default Layer |
| 149 | - Set Default Layer to 0(`0`) | 149 | - Set Default Layer to 0(`0`) |
| 150 | - Set Default Layer to 0(`1`) | 150 | - Set Default Layer to 1(`1`) |
| 151 | - Set Default Layer to 0(`2`) | 151 | - Set Default Layer to 2(`2`) |
| 152 | - Set Default Layer to 0(`3`) | 152 | - Set Default Layer to 3(`3`) |
| 153 | 153 | ||
| 154 | **TBD** | 154 | **TBD** |
| 155 | 155 | ||
diff --git a/converter/terminal_usb/Makefile b/converter/terminal_usb/Makefile new file mode 100644 index 000000000..6154d8682 --- /dev/null +++ b/converter/terminal_usb/Makefile | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | # Target file name (without extension). | ||
| 2 | TARGET = terminal_lufa | ||
| 3 | |||
| 4 | # Directory common source filess exist | ||
| 5 | TOP_DIR = ../.. | ||
| 6 | |||
| 7 | # Directory keyboard dependent files exist | ||
| 8 | TARGET_DIR = . | ||
| 9 | |||
| 10 | # keyboard dependent files | ||
| 11 | SRC = keymap.c \ | ||
| 12 | matrix.c \ | ||
| 13 | led.c | ||
| 14 | |||
| 15 | CONFIG_H = config.h | ||
| 16 | |||
| 17 | |||
| 18 | # MCU name, you MUST set this to match the board you are using | ||
| 19 | # type "make clean" after changing this, so all files will be rebuilt | ||
| 20 | #MCU = at90usb162 # Teensy 1.0 | ||
| 21 | MCU = atmega32u4 # Teensy 2.0 | ||
| 22 | #MCU = at90usb646 # Teensy++ 1.0 | ||
| 23 | #MCU = at90usb1286 # Teensy++ 2.0 | ||
| 24 | |||
| 25 | |||
| 26 | # Processor frequency. | ||
| 27 | # Normally the first thing your program should do is set the clock prescaler, | ||
| 28 | # so your program will run at the correct speed. You should also set this | ||
| 29 | # variable to same clock speed. The _delay_ms() macro uses this, and many | ||
| 30 | # examples use this variable to calculate timings. Do not add a "UL" here. | ||
| 31 | F_CPU = 16000000 | ||
| 32 | |||
| 33 | |||
| 34 | # | ||
| 35 | # LUFA specific | ||
| 36 | # | ||
| 37 | # Target architecture (see library "Board Types" documentation). | ||
| 38 | ARCH = AVR8 | ||
| 39 | |||
| 40 | # Input clock frequency. | ||
| 41 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 42 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 43 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 44 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 45 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 46 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 47 | # source code. | ||
| 48 | # | ||
| 49 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 50 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 51 | F_USB = $(F_CPU) | ||
| 52 | |||
| 53 | # Interrupt driven control endpoint task | ||
| 54 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 55 | |||
| 56 | |||
| 57 | # Boot Section Size in bytes | ||
| 58 | # Teensy halfKay 512 | ||
| 59 | # Atmel DFU loader 4096 | ||
| 60 | # LUFA bootloader 4096 | ||
| 61 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 62 | |||
| 63 | |||
| 64 | # Build Options | ||
| 65 | # comment out to disable the options. | ||
| 66 | # | ||
| 67 | #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 68 | #MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 69 | #EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 70 | CONSOLE_ENABLE = yes # Console for debug(+400) | ||
| 71 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 72 | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | ||
| 73 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | ||
| 74 | |||
| 75 | |||
| 76 | # | ||
| 77 | # PS/2 protocol implementations | ||
| 78 | # USART is recommended if it is available, others are for reference purpose. | ||
| 79 | # INT implementation will drop simultaneous key strokes. | ||
| 80 | # | ||
| 81 | PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) | ||
| 82 | #PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin | ||
| 83 | #PS2_USE_BUSYWAIT = yes # uses primitive reference code | ||
| 84 | |||
| 85 | ifdef PS2_USE_USART | ||
| 86 | SRC += protocol/ps2_usart.c | ||
| 87 | OPT_DEFS += -DPS2_USE_USART | ||
| 88 | endif | ||
| 89 | |||
| 90 | ifdef PS2_USE_INT | ||
| 91 | SRC += protocol/ps2.c | ||
| 92 | OPT_DEFS += -DPS2_USE_INT | ||
| 93 | endif | ||
| 94 | |||
| 95 | ifdef PS2_USE_BUSYWAIT | ||
| 96 | SRC += protocol/ps2.c | ||
| 97 | OPT_DEFS += -DPS2_USE_BUSYWAIT | ||
| 98 | endif | ||
| 99 | |||
| 100 | |||
| 101 | #---------------- Programming Options -------------------------- | ||
| 102 | PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex | ||
| 103 | |||
| 104 | |||
| 105 | # Search Path | ||
| 106 | VPATH += $(TARGET_DIR) | ||
| 107 | VPATH += $(TOP_DIR) | ||
| 108 | |||
| 109 | |||
| 110 | include $(TOP_DIR)/protocol/lufa.mk | ||
| 111 | include $(TOP_DIR)/protocol.mk | ||
| 112 | include $(TOP_DIR)/common.mk | ||
| 113 | include $(TOP_DIR)/rules.mk | ||
diff --git a/converter/terminal_usb/Makefile.102_pjrc b/converter/terminal_usb/Makefile.102_pjrc deleted file mode 100644 index e2d1a00a5..000000000 --- a/converter/terminal_usb/Makefile.102_pjrc +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Makefile for PJRC Teensy | ||
| 3 | # | ||
| 4 | |||
| 5 | |||
| 6 | # Target file name (without extension). | ||
| 7 | TARGET = terminal_usb_102_pjrc | ||
| 8 | |||
| 9 | # Directory common source filess exist | ||
| 10 | TOP_DIR = ../.. | ||
| 11 | |||
| 12 | # Directory keyboard dependent files exist | ||
| 13 | TARGET_DIR = . | ||
| 14 | |||
| 15 | # keyboard dependent files | ||
| 16 | SRC = keymap_102.c \ | ||
| 17 | matrix.c \ | ||
| 18 | led.c \ | ||
| 19 | ps2.c | ||
| 20 | |||
| 21 | CONFIG_H = config_102_pjrc.h | ||
| 22 | |||
| 23 | |||
| 24 | # MCU name, you MUST set this to match the board you are using | ||
| 25 | # type "make clean" after changing this, so all files will be rebuilt | ||
| 26 | #MCU = at90usb162 # Teensy 1.0 | ||
| 27 | MCU = atmega32u4 # Teensy 2.0 | ||
| 28 | #MCU = at90usb646 # Teensy++ 1.0 | ||
| 29 | #MCU = at90usb1286 # Teensy++ 2.0 | ||
| 30 | |||
| 31 | |||
| 32 | # Processor frequency. | ||
| 33 | # Normally the first thing your program should do is set the clock prescaler, | ||
| 34 | # so your program will run at the correct speed. You should also set this | ||
| 35 | # variable to same clock speed. The _delay_ms() macro uses this, and many | ||
| 36 | # examples use this variable to calculate timings. Do not add a "UL" here. | ||
| 37 | F_CPU = 16000000 | ||
| 38 | |||
| 39 | |||
| 40 | # Build Options | ||
| 41 | # *Comment out* to disable the options. | ||
| 42 | # | ||
| 43 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 44 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 45 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | #---------------- Programming Options -------------------------- | ||
| 50 | PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex | ||
| 51 | |||
| 52 | |||
| 53 | # Search Path | ||
| 54 | VPATH += $(TARGET_DIR) | ||
| 55 | VPATH += $(TOP_DIR) | ||
| 56 | |||
| 57 | |||
| 58 | include $(TOP_DIR)/protocol/pjrc.mk | ||
| 59 | include $(TOP_DIR)/protocol.mk | ||
| 60 | include $(TOP_DIR)/common.mk | ||
| 61 | include $(TOP_DIR)/rules.mk | ||
diff --git a/converter/terminal_usb/Makefile.122_pjrc b/converter/terminal_usb/Makefile.122_pjrc deleted file mode 100644 index ee42dd743..000000000 --- a/converter/terminal_usb/Makefile.122_pjrc +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Makefile for PJRC Teensy | ||
| 3 | # | ||
| 4 | |||
| 5 | |||
| 6 | # Target file name (without extension). | ||
| 7 | TARGET = terminal_usb_122_pjrc | ||
| 8 | |||
| 9 | # Directory common source filess exist | ||
| 10 | TOP_DIR = ../.. | ||
| 11 | |||
| 12 | # Directory keyboard dependent files exist | ||
| 13 | TARGET_DIR = . | ||
| 14 | |||
| 15 | # keyboard dependent files | ||
| 16 | SRC = keymap_122.c \ | ||
| 17 | matrix.c \ | ||
| 18 | led.c \ | ||
| 19 | ps2.c | ||
| 20 | |||
| 21 | CONFIG_H = config_122_pjrc.h | ||
| 22 | |||
| 23 | |||
| 24 | # MCU name, you MUST set this to match the board you are using | ||
| 25 | # type "make clean" after changing this, so all files will be rebuilt | ||
| 26 | #MCU = at90usb162 # Teensy 1.0 | ||
| 27 | MCU = atmega32u4 # Teensy 2.0 | ||
| 28 | #MCU = at90usb646 # Teensy++ 1.0 | ||
| 29 | #MCU = at90usb1286 # Teensy++ 2.0 | ||
| 30 | |||
| 31 | |||
| 32 | # Processor frequency. | ||
| 33 | # Normally the first thing your program should do is set the clock prescaler, | ||
| 34 | # so your program will run at the correct speed. You should also set this | ||
| 35 | # variable to same clock speed. The _delay_ms() macro uses this, and many | ||
| 36 | # examples use this variable to calculate timings. Do not add a "UL" here. | ||
| 37 | F_CPU = 16000000 | ||
| 38 | |||
| 39 | |||
| 40 | # Build Options | ||
| 41 | # *Comment out* to disable the options. | ||
| 42 | # | ||
| 43 | #MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 44 | #EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 45 | #NKRO_ENABLE = yes # USB Nkey Rollover | ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | #---------------- Programming Options -------------------------- | ||
| 50 | PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex | ||
| 51 | |||
| 52 | |||
| 53 | # Search Path | ||
| 54 | VPATH += $(TARGET_DIR) | ||
| 55 | VPATH += $(TOP_DIR) | ||
| 56 | |||
| 57 | |||
| 58 | include $(TOP_DIR)/protocol/pjrc.mk | ||
| 59 | include $(TOP_DIR)/protocol.mk | ||
| 60 | include $(TOP_DIR)/common.mk | ||
| 61 | include $(TOP_DIR)/rules.mk | ||
diff --git a/converter/terminal_usb/README b/converter/terminal_usb/README index 1ce49f33d..6ff1bc92f 100644 --- a/converter/terminal_usb/README +++ b/converter/terminal_usb/README | |||
| @@ -1,43 +1,33 @@ | |||
| 1 | PS/2 to USB keyboard converter for IBM terminal keyboard | 1 | Keyboard converter for IBM terminal keyboard |
| 2 | ========================================================= | 2 | ============================================ |
| 3 | It supports PS/2 Scan Code Set 3 and runs on Teensy, Teensy++ and boards withATMega32u4/AT90USB. | 3 | It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy. |
| 4 | I tested the converter only on Teensy with 1392595(102keys terminal keyboard), | 4 | I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys). |
| 5 | though, I think it will also work with 122keys boards. | ||
| 6 | 5 | ||
| 7 | http://geekhack.org/showwiki.php?title=Island:27272 | 6 | Source code: https://github.com/tmk/tmk_keyboard |
| 7 | Article: http://geekhack.org/index.php?topic=27272.0 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | CONNECTION | 10 | CONNECTION |
| 11 | ---------- | 11 | ---------- |
| 12 | Data: PD0 | 12 | Keyboard ATMega32U4 |
| 13 | Clock: PD1 | 13 | ---------------------- |
| 14 | VCC and GND, of course. | 14 | Data: PD2 |
| 15 | 15 | Clock: PD5 | |
| 16 | It is the same as Soarer's converter pin configuration. | ||
| 17 | See RESOURCE for keyboard connector pin assign. | ||
| 18 | 16 | ||
| 17 | And VCC and GND, of course. See RESOURCE for keyboard connector pin assign. | ||
| 19 | 18 | ||
| 20 | 19 | ||
| 21 | BUILD | 20 | BUILD |
| 22 | ----- | 21 | ----- |
| 23 | Get source: | ||
| 24 | $ git clone https://github.com/tmk/tmk_keyboard.git | 22 | $ git clone https://github.com/tmk/tmk_keyboard.git |
| 25 | $ cd terminal_usb | 23 | $ cd converter/terminal_usb |
| 26 | 24 | $ make | |
| 27 | For 102keys: | ||
| 28 | $ make -f Makefile.102_pjrc | ||
| 29 | |||
| 30 | For 122keys(not tested): | ||
| 31 | $ make -f Makefile.122_pjrc | ||
| 32 | |||
| 33 | I used WinAVR 20100110 to develop and build. | ||
| 34 | |||
| 35 | 25 | ||
| 36 | 26 | ||
| 37 | RESOURCE | 27 | RESOURCE |
| 38 | -------- | 28 | -------- |
| 39 | Soarer's Converter: http://geekhack.org/showwiki.php?title=Island:17458 | 29 | Soarer's Converter: http://geekhack.org/index.php?topic=17458.0 |
| 40 | 102keys(1392595): http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M | 30 | 102keys(1392595): http://geekhack.org/index.php?topic=10737.0 |
| 41 | 122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html | 31 | 122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html |
| 42 | KbdBabel: http://www.kbdbabel.org/ | 32 | KbdBabel: http://www.kbdbabel.org/ |
| 43 | RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png | 33 | RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png |
diff --git a/converter/terminal_usb/config.h b/converter/terminal_usb/config.h new file mode 100644 index 000000000..ea5ce62ca --- /dev/null +++ b/converter/terminal_usb/config.h | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | |||
| 22 | #define VENDOR_ID 0xFEED | ||
| 23 | #define PRODUCT_ID 0x6535 | ||
| 24 | #define DEVICE_VER 0x0100 | ||
| 25 | #define MANUFACTURER t.m.k. | ||
| 26 | #define PRODUCT PS/2(Set3)-USB Keyboard converter(IBM 122keys) | ||
| 27 | #define DESCRIPTION USB converter for IBM Terminal Keyboard 122keys | ||
| 28 | |||
| 29 | |||
| 30 | /* matrix size */ | ||
| 31 | #define MATRIX_ROWS 17 // keycode bit: 3-0 | ||
| 32 | #define MATRIX_COLS 8 // keycode bit: 6-4 | ||
| 33 | |||
| 34 | |||
| 35 | /* legacy keymap support */ | ||
| 36 | #define USE_LEGACY_KEYMAP | ||
| 37 | |||
| 38 | |||
| 39 | /* key combination for command */ | ||
| 40 | #define IS_COMMAND() ( \ | ||
| 41 | (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \ | ||
| 42 | (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \ | ||
| 43 | ) | ||
| 44 | |||
| 45 | |||
| 46 | /* | ||
| 47 | * PS/2 USART configuration for ATMega32U4 | ||
| 48 | */ | ||
| 49 | #ifdef PS2_USE_USART | ||
| 50 | /* XCK for clock line */ | ||
| 51 | #define PS2_CLOCK_PORT PORTD | ||
| 52 | #define PS2_CLOCK_PIN PIND | ||
| 53 | #define PS2_CLOCK_DDR DDRD | ||
| 54 | #define PS2_CLOCK_BIT 5 | ||
| 55 | /* RXD for data line */ | ||
| 56 | #define PS2_DATA_PORT PORTD | ||
| 57 | #define PS2_DATA_PIN PIND | ||
| 58 | #define PS2_DATA_DDR DDRD | ||
| 59 | #define PS2_DATA_BIT 2 | ||
| 60 | |||
| 61 | /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ | ||
| 62 | /* set DDR of CLOCK as input to be slave */ | ||
| 63 | #define PS2_USART_INIT() do { \ | ||
| 64 | PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \ | ||
| 65 | PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \ | ||
| 66 | UCSR1C = ((1 << UMSEL10) | \ | ||
| 67 | (3 << UPM10) | \ | ||
| 68 | (0 << USBS1) | \ | ||
| 69 | (3 << UCSZ10) | \ | ||
| 70 | (0 << UCPOL1)); \ | ||
| 71 | UCSR1A = 0; \ | ||
| 72 | UBRR1H = 0; \ | ||
| 73 | UBRR1L = 0; \ | ||
| 74 | } while (0) | ||
| 75 | #define PS2_USART_RX_INT_ON() do { \ | ||
| 76 | UCSR1B = ((1 << RXCIE1) | \ | ||
| 77 | (1 << RXEN1)); \ | ||
| 78 | } while (0) | ||
| 79 | #define PS2_USART_RX_POLL_ON() do { \ | ||
| 80 | UCSR1B = (1 << RXEN1); \ | ||
| 81 | } while (0) | ||
| 82 | #define PS2_USART_OFF() do { \ | ||
| 83 | UCSR1C = 0; \ | ||
| 84 | UCSR1B &= ~((1 << RXEN1) | \ | ||
| 85 | (1 << TXEN1)); \ | ||
| 86 | } while (0) | ||
| 87 | #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1)) | ||
| 88 | #define PS2_USART_RX_DATA UDR1 | ||
| 89 | #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1))) | ||
| 90 | #define PS2_USART_RX_VECT USART1_RX_vect | ||
| 91 | #endif | ||
| 92 | |||
| 93 | |||
| 94 | /* | ||
| 95 | * PS/2 Interrupt configuration | ||
| 96 | */ | ||
| 97 | #ifdef PS2_USE_INT | ||
| 98 | /* uses INT1 for clock line(ATMega32U4) */ | ||
| 99 | #define PS2_CLOCK_PORT PORTD | ||
| 100 | #define PS2_CLOCK_PIN PIND | ||
| 101 | #define PS2_CLOCK_DDR DDRD | ||
| 102 | #define PS2_CLOCK_BIT 1 | ||
| 103 | |||
| 104 | #define PS2_DATA_PORT PORTD | ||
| 105 | #define PS2_DATA_PIN PIND | ||
| 106 | #define PS2_DATA_DDR DDRD | ||
| 107 | #define PS2_DATA_BIT 0 | ||
| 108 | |||
| 109 | #define PS2_INT_INIT() do { \ | ||
| 110 | EICRA |= ((1<<ISC11) | \ | ||
| 111 | (0<<ISC10)); \ | ||
| 112 | } while (0) | ||
| 113 | #define PS2_INT_ON() do { \ | ||
| 114 | EIMSK |= (1<<INT1); \ | ||
| 115 | } while (0) | ||
| 116 | #define PS2_INT_OFF() do { \ | ||
| 117 | EIMSK &= ~(1<<INT1); \ | ||
| 118 | } while (0) | ||
| 119 | #define PS2_INT_VECT INT1_vect | ||
| 120 | #endif | ||
| 121 | |||
| 122 | |||
| 123 | /* | ||
| 124 | * PS/2 Busywait configuration | ||
| 125 | */ | ||
| 126 | #ifdef PS2_USE_BUSYWAIT | ||
| 127 | #define PS2_CLOCK_PORT PORTD | ||
| 128 | #define PS2_CLOCK_PIN PIND | ||
| 129 | #define PS2_CLOCK_DDR DDRD | ||
| 130 | #define PS2_CLOCK_BIT 1 | ||
| 131 | |||
| 132 | #define PS2_DATA_PORT PORTD | ||
| 133 | #define PS2_DATA_PIN PIND | ||
| 134 | #define PS2_DATA_DDR DDRD | ||
| 135 | #define PS2_DATA_BIT 0 | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #endif | ||
diff --git a/converter/terminal_usb/config_102_pjrc.h b/converter/terminal_usb/config_102_pjrc.h deleted file mode 100644 index 65001a7d1..000000000 --- a/converter/terminal_usb/config_102_pjrc.h +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | |||
| 22 | #define VENDOR_ID 0xFEED | ||
| 23 | #define PRODUCT_ID 0x6531 | ||
| 24 | #define MANUFACTURER t.m.k. | ||
| 25 | #define PRODUCT PS/2(Set3)-USB Keyboard converter(IBM 102keys) | ||
| 26 | #define DESCRIPTION USB converter for IBM Terminal Keyboard 102keys | ||
| 27 | |||
| 28 | |||
| 29 | /* matrix size */ | ||
| 30 | #define MATRIX_ROWS 17 // keycode bit: 3-0 | ||
| 31 | #define MATRIX_COLS 8 // keycode bit: 6-4 | ||
| 32 | |||
| 33 | |||
| 34 | /* key combination for command */ | ||
| 35 | #define IS_COMMAND() ( \ | ||
| 36 | keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL)) \ | ||
| 37 | ) | ||
| 38 | |||
| 39 | |||
| 40 | /* mouse keys */ | ||
| 41 | #ifdef MOUSEKEY_ENABLE | ||
| 42 | # define MOUSEKEY_DELAY_TIME 255 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | |||
| 46 | /* PS/2 lines */ | ||
| 47 | #define PS2_CLOCK_PORT PORTD | ||
| 48 | #define PS2_CLOCK_PIN PIND | ||
| 49 | #define PS2_CLOCK_DDR DDRD | ||
| 50 | #define PS2_CLOCK_BIT 1 | ||
| 51 | #define PS2_DATA_PORT PORTD | ||
| 52 | #define PS2_DATA_PIN PIND | ||
| 53 | #define PS2_DATA_DDR DDRD | ||
| 54 | #define PS2_DATA_BIT 0 | ||
| 55 | |||
| 56 | #endif | ||
diff --git a/converter/terminal_usb/config_122_pjrc.h b/converter/terminal_usb/config_122_pjrc.h deleted file mode 100644 index 90e5edd31..000000000 --- a/converter/terminal_usb/config_122_pjrc.h +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | |||
| 22 | #define VENDOR_ID 0xFEED | ||
| 23 | #define PRODUCT_ID 0x6532 | ||
| 24 | #define MANUFACTURER t.m.k. | ||
| 25 | #define PRODUCT PS/2(Set3)-USB Keyboard converter(IBM 122keys) | ||
| 26 | #define DESCRIPTION USB converter for IBM Terminal Keyboard 122keys | ||
| 27 | |||
| 28 | |||
| 29 | /* matrix size */ | ||
| 30 | #define MATRIX_ROWS 17 // keycode bit: 3-0 | ||
| 31 | #define MATRIX_COLS 8 // keycode bit: 6-4 | ||
| 32 | |||
| 33 | |||
| 34 | /* key combination for command */ | ||
| 35 | #define IS_COMMAND() ( \ | ||
| 36 | keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL)) \ | ||
| 37 | ) | ||
| 38 | |||
| 39 | |||
| 40 | /* mouse keys */ | ||
| 41 | #ifdef MOUSEKEY_ENABLE | ||
| 42 | # define MOUSEKEY_DELAY_TIME 255 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | |||
| 46 | /* PS/2 lines */ | ||
| 47 | #define PS2_CLOCK_PORT PORTD | ||
| 48 | #define PS2_CLOCK_PIN PIND | ||
| 49 | #define PS2_CLOCK_DDR DDRD | ||
| 50 | #define PS2_CLOCK_BIT 1 | ||
| 51 | #define PS2_DATA_PORT PORTD | ||
| 52 | #define PS2_DATA_PIN PIND | ||
| 53 | #define PS2_DATA_DDR DDRD | ||
| 54 | #define PS2_DATA_BIT 0 | ||
| 55 | |||
| 56 | #endif | ||
diff --git a/converter/terminal_usb/keymap_122.c b/converter/terminal_usb/keymap.c index 79ca11c26..73009cb47 100644 --- a/converter/terminal_usb/keymap_122.c +++ b/converter/terminal_usb/keymap.c | |||
| @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | * IBM Terminal keyboard 1392595(102keys) | 31 | * IBM Terminal keyboard 6110345(122keys)/1392595(102keys) |
| 32 | * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M | 32 | * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M |
| 33 | * http://www.seasip.info/VintagePC/ibm_1391406.html | 33 | * http://www.seasip.info/VintagePC/ibm_1391406.html |
| 34 | * | 34 | * |
| @@ -114,6 +114,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 114 | * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| | | 114 | * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| | |
| 115 | * `----' `---------------------------------------' `----' `-----------' `---------------' | 115 | * `----' `---------------------------------------' `----' `-----------' `---------------' |
| 116 | */ | 116 | */ |
| 117 | /* | ||
| 117 | KEYMAP( | 118 | KEYMAP( |
| 118 | F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, | 119 | F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, |
| 119 | F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, | 120 | F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, |
| @@ -124,6 +125,18 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 124 | APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT, | 125 | APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT, |
| 125 | RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO | 126 | RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO |
| 126 | ), | 127 | ), |
| 128 | */ | ||
| 129 | // pseudo ANSI | ||
| 130 | KEYMAP( | ||
| 131 | F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, | ||
| 132 | F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, | ||
| 133 | |||
| 134 | PSCR,ESC, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||
| 135 | SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, NO, DEL, END, PGDN, P7, P8, P9, PPLS, | ||
| 136 | PAUS,INT5, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, BSLS,ENT, UP, P4, P5, P6, PCMM, | ||
| 137 | APP, INT6, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT, | ||
| 138 | RGUI,LGUI, LCTL, LALT, SPC, LGUI, GRV, DOWN, NO, P0, PDOT,NO | ||
| 139 | ), | ||
| 127 | }; | 140 | }; |
| 128 | 141 | ||
| 129 | 142 | ||
diff --git a/converter/terminal_usb/keymap_102.c b/converter/terminal_usb/keymap_102.c deleted file mode 100644 index e9412b282..000000000 --- a/converter/terminal_usb/keymap_102.c +++ /dev/null | |||
| @@ -1,208 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdint.h> | ||
| 19 | #include <stdbool.h> | ||
| 20 | #include <avr/pgmspace.h> | ||
| 21 | #include "keycode.h" | ||
| 22 | #include "print.h" | ||
| 23 | #include "debug.h" | ||
| 24 | #include "util.h" | ||
| 25 | #include "keymap.h" | ||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | /* | ||
| 31 | * IBM Terminal keyboard 1392595(102keys) | ||
| 32 | * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M | ||
| 33 | * http://www.seasip.info/VintagePC/ibm_1391406.html | ||
| 34 | * | ||
| 35 | * Keymap array: | ||
| 36 | * 8 bytes | ||
| 37 | * +---------+ | ||
| 38 | * 0| | | ||
| 39 | * :| | 0x00-0x87 | ||
| 40 | * ;| | | ||
| 41 | * 17| | | ||
| 42 | * +---------+ | ||
| 43 | */ | ||
| 44 | #define KEYMAP( \ | ||
| 45 | K08, K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, K57,K5F,K62, \ | ||
| 46 | \ | ||
| 47 | K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \ | ||
| 48 | K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \ | ||
| 49 | K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K6B,K73,K74,K7B, \ | ||
| 50 | K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K63, K69,K72,K7A,K79, \ | ||
| 51 | K11, K19, K29, K39, K58, K61,K60,K6A, K68,K70,K71,K78 \ | ||
| 52 | ) { \ | ||
| 53 | { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K07 }, \ | ||
| 54 | { KC_##K08, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K0D, KC_##K0E, KC_##K0F }, \ | ||
| 55 | { KC_NO, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ | ||
| 56 | { KC_NO, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ | ||
| 57 | { KC_NO, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ | ||
| 58 | { KC_NO, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ | ||
| 59 | { KC_NO, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ | ||
| 60 | { KC_NO, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ | ||
| 61 | { KC_NO, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ | ||
| 62 | { KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \ | ||
| 63 | { KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ | ||
| 64 | { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \ | ||
| 65 | { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ | ||
| 66 | { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \ | ||
| 67 | { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ | ||
| 68 | { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \ | ||
| 69 | { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K84, KC_NO, KC_NO, KC_NO, }, \ | ||
| 70 | } | ||
| 71 | |||
| 72 | |||
| 73 | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | ||
| 74 | static const uint8_t PROGMEM fn_layer[] = { | ||
| 75 | 1, // Fn0 | ||
| 76 | 2, // Fn1 | ||
| 77 | 3, // Fn2 | ||
| 78 | 0, // Fn3 | ||
| 79 | 0, // Fn4 | ||
| 80 | 0, // Fn5 | ||
| 81 | 0, // Fn6 | ||
| 82 | 0 // Fn7 | ||
| 83 | }; | ||
| 84 | |||
| 85 | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | ||
| 86 | // See layer.c for details. | ||
| 87 | static const uint8_t PROGMEM fn_keycode[] = { | ||
| 88 | KC_SCLN, // Fn0 | ||
| 89 | KC_SLSH, // Fn1 | ||
| 90 | KC_ESC, // Fn2 | ||
| 91 | KC_NO, // Fn3 | ||
| 92 | KC_NO, // Fn4 | ||
| 93 | KC_NO, // Fn5 | ||
| 94 | KC_NO, // Fn6 | ||
| 95 | KC_NO // Fn7 | ||
| 96 | }; | ||
| 97 | |||
| 98 | |||
| 99 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 100 | /* 0: default | ||
| 101 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | ||
| 102 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | ||
| 103 | * `---' `---------------' `---------------' `---------------' `-----------' | ||
| 104 | * ,-----------------------------------------------------------. ,-----------. ,---------------. | ||
| 105 | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|BS | |Ins|Hom|PgU| |NmL| /| *| -| | ||
| 106 | * |-----------------------------------------------------------| |-----------| |---------------| | ||
| 107 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| | | ||
| 108 | * |-----------------------------------------------------------| `-----------' |-----------| +| | ||
| 109 | * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #|Retu| | 4| 5| 6| | | ||
| 110 | * |-----------------------------------------------------------| ,---. |---------------| | ||
| 111 | * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | | ||
| 112 | * |-----------------------------------------------------------| ,-----------. |-----------|Ent| | ||
| 113 | * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| | | ||
| 114 | * `----' `---------------------------------------' `----' `-----------' `---------------' | ||
| 115 | */ | ||
| 116 | KEYMAP( | ||
| 117 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, | ||
| 118 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||
| 119 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, | ||
| 120 | LCTL,A, S, D, F, G, H, J, K, L, FN0, QUOT, NUHS,ENT, P4, P5, P6, PCMM, | ||
| 121 | LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, FN1, RO, FN2, UP, P1, P2, P3, PENT, | ||
| 122 | LGUI, LALT, SPC, RALT, RCTL, LEFT,DOWN,RGHT, NO, P0, PDOT,NO | ||
| 123 | ), | ||
| 124 | |||
| 125 | /* 1: Mouse keys | ||
| 126 | * ,-----------------------------------------------------------. | ||
| 127 | * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa| | ||
| 128 | * |-----------------------------------------------------------| | ||
| 129 | * |Tab |MwL|MwU|McU|WwU|WwR|MwL|MwD|MwU|MwR| | | | \| | ||
| 130 | * |-----------------------------------------------------------| | ||
| 131 | * |CapsLo| |McL|McD|McR| |McL|McD|McU|McR|Fn0| |Return | | ||
| 132 | * |-----------------------------------------------------------| | ||
| 133 | * |Shift |VoD|VoU|Mut|Mb2|Mb3|Mb2|Mb1|VoD|VoU|Mut|Shift | | ||
| 134 | * |-----------------------------------------------------------| | ||
| 135 | * |Ctrl | |Alt | Mb1 |Alt | |Ctrl| | ||
| 136 | * `-----' `--------------------------------------' `----' | ||
| 137 | * Mc = mouse cursor, Mw = mouse wheel, Mb = mouse button | ||
| 138 | * Vo = Volume, Mut = Mute | ||
| 139 | */ | ||
| 140 | KEYMAP( | ||
| 141 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, | ||
| 142 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||
| 143 | TAB, WH_L,WH_D,MS_U,WH_U,WH_R,WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, | ||
| 144 | LCTL,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN0, NO, NO, ENT, P4, P5, P6, PCMM, | ||
| 145 | LSFT,NO, VOLD,VOLU,MUTE,BTN2,BTN3,BTN2,BTN1,VOLD,VOLU,MUTE, NO, RSFT, UP, P1, P2, P3, PENT, | ||
| 146 | LGUI, LALT, BTN1, RALT, RCTL, LEFT,DOWN,RGHT, NO, P0, PDOT,NO | ||
| 147 | ), | ||
| 148 | |||
| 149 | /* 2: Cursor keys | ||
| 150 | * ,-----------------------------------------------------------. | ||
| 151 | * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa| | ||
| 152 | * |-----------------------------------------------------------| | ||
| 153 | * |Tab |Hom|PgU| Up|PgU|End|Hom|PgD|PgU|End| | | | \| | ||
| 154 | * |-----------------------------------------------------------| | ||
| 155 | * |CapsLo| |Lef|Dow|Rig| |Lef|Dow| Up|Rig| | |Return | | ||
| 156 | * |-----------------------------------------------------------| | ||
| 157 | * |Shift | | | | | |Hom|PgD|PgU|End|Fn1|Shift | | ||
| 158 | * |-----------------------------------------------------------| | ||
| 159 | * |Ctrl | |Alt | Space |Alt | |Ctrl| | ||
| 160 | * `-----' `--------------------------------------' `----' | ||
| 161 | */ | ||
| 162 | KEYMAP( | ||
| 163 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, | ||
| 164 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||
| 165 | TAB, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, | ||
| 166 | LCTL,NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, P4, P5, P6, PCMM, | ||
| 167 | LSFT,NO, VOLD,VOLU,MUTE,NO, NO, HOME,PGDN,PGUP,END, FN1, NO, RSFT, UP, P1, P2, P3, PENT, | ||
| 168 | LGUI, LALT, SPC, RALT, RCTL, LEFT,DOWN,RGHT, NO, P0, PDOT,NO | ||
| 169 | ), | ||
| 170 | |||
| 171 | /* 3: HHKB | ||
| 172 | * ,-----------------------------------------------------------. | ||
| 173 | * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| | ||
| 174 | * |-----------------------------------------------------------| | ||
| 175 | * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| | ||
| 176 | * |-----------------------------------------------------------| | ||
| 177 | * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | | ||
| 178 | * |-----------------------------------------------------------| | ||
| 179 | * |Shift | | | | | | +| -|End|PgD|Dow|Fn2 | | ||
| 180 | * |-----------------------------------------------------------| | ||
| 181 | * |Ctrl | |Alt | Space |Alt | |Ctrl| | ||
| 182 | * `-----' `--------------------------------------' `----' | ||
| 183 | */ | ||
| 184 | KEYMAP( | ||
| 185 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, | ||
| 186 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F8, F10, F11, F12, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||
| 187 | CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,BRK, UP, NO, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, | ||
| 188 | LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT, NO, ENT, P4, P5, P6, PCMM, | ||
| 189 | LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN, NO, FN2, UP, P1, P2, P3, PENT, | ||
| 190 | LGUI, LALT, SPC, RALT, RCTL, LEFT,DOWN,RGHT, NO, P0, PDOT,NO | ||
| 191 | ), | ||
| 192 | }; | ||
| 193 | |||
| 194 | |||
| 195 | uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) | ||
| 196 | { | ||
| 197 | return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); | ||
| 198 | } | ||
| 199 | |||
| 200 | uint8_t keymap_fn_layer(uint8_t index) | ||
| 201 | { | ||
| 202 | return pgm_read_byte(&fn_layer[index]); | ||
| 203 | } | ||
| 204 | |||
| 205 | uint8_t keymap_fn_keycode(uint8_t index) | ||
| 206 | { | ||
| 207 | return pgm_read_byte(&fn_keycode[index]); | ||
| 208 | } | ||
diff --git a/converter/terminal_usb/matrix.c b/converter/terminal_usb/matrix.c index a6eff8c1e..36901536f 100644 --- a/converter/terminal_usb/matrix.c +++ b/converter/terminal_usb/matrix.c | |||
| @@ -66,20 +66,12 @@ uint8_t matrix_cols(void) | |||
| 66 | 66 | ||
| 67 | void matrix_init(void) | 67 | void matrix_init(void) |
| 68 | { | 68 | { |
| 69 | print_enable = true; | ||
| 70 | debug_enable = true; | 69 | debug_enable = true; |
| 71 | //debug_matrix = true; | 70 | //debug_matrix = true; |
| 72 | //debug_keyboard = true; | 71 | //debug_keyboard = true; |
| 73 | //debug_mouse = false; | 72 | //debug_mouse = false; |
| 74 | 73 | ||
| 75 | ps2_host_init(); | 74 | ps2_host_init(); |
| 76 | // Make and Break code without Typematic | ||
| 77 | while (ps2_host_send(0xF8) != 0xFA) { | ||
| 78 | debug("send F8: failed\n"); | ||
| 79 | _delay_ms(500); | ||
| 80 | } | ||
| 81 | debug("send F8: OK\n"); | ||
| 82 | |||
| 83 | 75 | ||
| 84 | // initialize matrix state: all keys off | 76 | // initialize matrix state: all keys off |
| 85 | for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; | 77 | for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; |
| @@ -92,46 +84,90 @@ uint8_t matrix_scan(void) | |||
| 92 | 84 | ||
| 93 | // scan code reading states | 85 | // scan code reading states |
| 94 | static enum { | 86 | static enum { |
| 95 | INIT, | 87 | RESET, |
| 88 | RESET_RESPONSE, | ||
| 89 | KBD_ID0, | ||
| 90 | KBD_ID1, | ||
| 91 | CONFIG, | ||
| 92 | READY, | ||
| 96 | F0, | 93 | F0, |
| 97 | } state = INIT; | 94 | } state = RESET; |
| 98 | |||
| 99 | 95 | ||
| 100 | is_modified = false; | 96 | is_modified = false; |
| 101 | 97 | ||
| 102 | uint8_t code; | 98 | uint8_t code; |
| 103 | while ((code = ps2_host_recv())) { | 99 | if ((code = ps2_host_recv())) { |
| 104 | debug_hex(code); | 100 | debug("r"); debug_hex(code); debug(" "); |
| 105 | switch (state) { | 101 | } |
| 106 | case INIT: | 102 | |
| 107 | switch (code) { | 103 | switch (state) { |
| 108 | case 0xF0: | 104 | case RESET: |
| 109 | state = F0; | 105 | debug("wFF "); |
| 110 | debug(" "); | 106 | if (ps2_host_send(0xFF) == 0xFA) { |
| 111 | break; | 107 | debug("[ack]\nRESET_RESPONSE: "); |
| 112 | default: // normal key make | 108 | state = RESET_RESPONSE; |
| 113 | if (code < 0x88) { | 109 | } |
| 114 | matrix_make(code); | 110 | break; |
| 115 | } else { | 111 | case RESET_RESPONSE: |
| 116 | debug("unexpected scan code at INIT: "); debug_hex(code); debug("\n"); | 112 | if (code == 0xAA) { |
| 117 | } | 113 | debug("[ok]\nKBD_ID: "); |
| 118 | state = INIT; | 114 | state = KBD_ID0; |
| 119 | debug("\n"); | 115 | } else if (code) { |
| 120 | } | 116 | debug("err\nRESET: "); |
| 121 | break; | 117 | state = RESET; |
| 122 | case F0: // Break code | 118 | } |
| 123 | switch (code) { | 119 | break; |
| 124 | default: | 120 | // after reset receive keyboad ID(2 bytes) |
| 121 | case KBD_ID0: | ||
| 122 | if (code) { | ||
| 123 | state = KBD_ID1; | ||
| 124 | } | ||
| 125 | break; | ||
| 126 | case KBD_ID1: | ||
| 127 | if (code) { | ||
| 128 | debug("\nCONFIG: "); | ||
| 129 | state = CONFIG; | ||
| 130 | } | ||
| 131 | break; | ||
| 132 | case CONFIG: | ||
| 133 | debug("wF8 "); | ||
| 134 | if (ps2_host_send(0xF8) == 0xFA) { | ||
| 135 | debug("[ack]\nREADY\n"); | ||
| 136 | state = READY; | ||
| 137 | } | ||
| 138 | break; | ||
| 139 | case READY: | ||
| 140 | switch (code) { | ||
| 141 | case 0x00: | ||
| 142 | break; | ||
| 143 | case 0xF0: | ||
| 144 | state = F0; | ||
| 145 | debug(" "); | ||
| 146 | break; | ||
| 147 | default: // normal key make | ||
| 148 | if (code < 0x88) { | ||
| 149 | matrix_make(code); | ||
| 150 | } else { | ||
| 151 | debug("unexpected scan code at READY: "); debug_hex(code); debug("\n"); | ||
| 152 | } | ||
| 153 | state = READY; | ||
| 154 | debug("\n"); | ||
| 155 | } | ||
| 156 | break; | ||
| 157 | case F0: // Break code | ||
| 158 | switch (code) { | ||
| 159 | case 0x00: | ||
| 160 | break; | ||
| 161 | default: | ||
| 125 | if (code < 0x88) { | 162 | if (code < 0x88) { |
| 126 | matrix_break(code); | 163 | matrix_break(code); |
| 127 | } else { | 164 | } else { |
| 128 | debug("unexpected scan code at F0: "); debug_hex(code); debug("\n"); | 165 | debug("unexpected scan code at F0: "); debug_hex(code); debug("\n"); |
| 129 | } | 166 | } |
| 130 | state = INIT; | 167 | state = READY; |
| 131 | debug("\n"); | 168 | debug("\n"); |
| 132 | } | 169 | } |
| 133 | break; | 170 | break; |
| 134 | } | ||
| 135 | } | 171 | } |
| 136 | return 1; | 172 | return 1; |
| 137 | } | 173 | } |
diff --git a/doc/other_projects.md b/doc/other_projects.md index c6ab91dce..2d83c18a7 100644 --- a/doc/other_projects.md +++ b/doc/other_projects.md | |||
| @@ -56,3 +56,6 @@ Great resourse of vintage keyboard protocol information and code | |||
| 56 | A lots of vintage keyboard protocol supports | 56 | A lots of vintage keyboard protocol supports |
| 57 | 57 | ||
| 58 | - <http://gitorious.org/kiibohd-controller> | 58 | - <http://gitorious.org/kiibohd-controller> |
| 59 | |||
| 60 | ## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo] | ||
| 61 | - <https://github.com/chrisandreae/kinesis-firmware> | ||
diff --git a/protocol/ps2.c b/protocol/ps2.c index cf7b1f43c..ed4560910 100644 --- a/protocol/ps2.c +++ b/protocol/ps2.c | |||
| @@ -181,7 +181,7 @@ uint8_t ps2_host_recv(void) | |||
| 181 | } | 181 | } |
| 182 | #else | 182 | #else |
| 183 | /* ring buffer to store ps/2 key data */ | 183 | /* ring buffer to store ps/2 key data */ |
| 184 | #define PBUF_SIZE 8 | 184 | #define PBUF_SIZE 32 |
| 185 | static uint8_t pbuf[PBUF_SIZE]; | 185 | static uint8_t pbuf[PBUF_SIZE]; |
| 186 | static uint8_t pbuf_head = 0; | 186 | static uint8_t pbuf_head = 0; |
| 187 | static uint8_t pbuf_tail = 0; | 187 | static uint8_t pbuf_tail = 0; |
diff --git a/protocol/ps2_usart.c b/protocol/ps2_usart.c index 7d591c650..9ea6b7786 100644 --- a/protocol/ps2_usart.c +++ b/protocol/ps2_usart.c | |||
| @@ -287,7 +287,7 @@ static inline void inhibit(void) | |||
| 287 | /*-------------------------------------------------------------------- | 287 | /*-------------------------------------------------------------------- |
| 288 | * Ring buffer to store scan codes from keyboard | 288 | * Ring buffer to store scan codes from keyboard |
| 289 | *------------------------------------------------------------------*/ | 289 | *------------------------------------------------------------------*/ |
| 290 | #define PBUF_SIZE 8 | 290 | #define PBUF_SIZE 32 |
| 291 | static uint8_t pbuf[PBUF_SIZE]; | 291 | static uint8_t pbuf[PBUF_SIZE]; |
| 292 | static uint8_t pbuf_head = 0; | 292 | static uint8_t pbuf_head = 0; |
| 293 | static uint8_t pbuf_tail = 0; | 293 | static uint8_t pbuf_tail = 0; |
