aboutsummaryrefslogtreecommitdiff
path: root/converter
diff options
context:
space:
mode:
Diffstat (limited to 'converter')
-rw-r--r--converter/x68k_usb/Makefile19
-rw-r--r--converter/x68k_usb/README22
-rw-r--r--converter/x68k_usb/config_pjrc.h29
-rw-r--r--converter/x68k_usb/keymap.c20
-rw-r--r--converter/x68k_usb/led.c21
-rw-r--r--converter/x68k_usb/matrix.c13
6 files changed, 93 insertions, 31 deletions
diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile
index 62b976c56..948622c7c 100644
--- a/converter/x68k_usb/Makefile
+++ b/converter/x68k_usb/Makefile
@@ -16,7 +16,7 @@ TARGET_DIR = .
16SRC = keymap.c \ 16SRC = keymap.c \
17 matrix.c \ 17 matrix.c \
18 led.c \ 18 led.c \
19 x68k.c 19 protocol/serial_uart.c
20 20
21CONFIG_H = config_pjrc.h 21CONFIG_H = config_pjrc.h
22 22
@@ -37,12 +37,23 @@ MCU = atmega32u4 # Teensy 2.0
37F_CPU = 16000000 37F_CPU = 16000000
38 38
39 39
40# Boot Section Size in bytes
41# Teensy halfKay 512
42# Atmel DFU loader 4096
43# LUFA bootloader 4096
44OPT_DEFS += -DBOOTLOADER_SIZE=4096
45
46
40# Build Options 47# Build Options
41# *Comment out* to disable the options. 48# *Comment out* to disable the options.
42# 49#
43MOUSEKEY_ENABLE = yes # Mouse keys 50BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
44EXTRAKEY_ENABLE = yes # Audio control and System control 51MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
45NKRO_ENABLE = yes # USB Nkey Rollover 52EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
53CONSOLE_ENABLE = yes # Console for debug(+400)
54COMMAND_ENABLE = yes # Commands for debug and configuration
55#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
56#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
46 57
47 58
48 59
diff --git a/converter/x68k_usb/README b/converter/x68k_usb/README
index 0b61b2c4b..5f1c2072c 100644
--- a/converter/x68k_usb/README
+++ b/converter/x68k_usb/README
@@ -5,6 +5,7 @@ http://en.wikipedia.org/wiki/Sharp_X68000
5 5
6X68000 keyboard has ALPS linear switches. 6X68000 keyboard has ALPS linear switches.
7- DSETK0016CE01 green linear 7- DSETK0016CE01 green linear
8- DSETK0022CE02 yellow linear
8- DSETK0023CE03 yellow linear 9- DSETK0023CE03 yellow linear
9 10
10 11
@@ -127,3 +128,24 @@ Scan Codes
127`-----------------------------------------------------------| .---=====---. |-----------| 4E| 128`-----------------------------------------------------------| .---=====---. |-----------| 4E|
128 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| | 129 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
129 `---------------------------------------------' `-----------' `---------------' 130 `---------------------------------------------' `-----------' `---------------'
131
132
133
134LED Special Functions
135---------------------
136http://homepage2.nifty.com/m_kamada/docs/unlistedx68k.htm#keyboard
137
1381. Random Illumination
139 Plug in with pressing F1, F2 and F3.
140
1412. Sequential Illumination
142 Plug in with pressing 記号入力(52), 登録(53) and HELP.
143
1443. Scan code Display
145 Plug in with pressing かな(5A), ローマ字(5B) and コード入力(5C).
146 You can see its scan code on LEDs by pressing a key.
147 +---------------------------------------------------+
148 |bit|6 |5 |4 |3 |2 |1 |0 |
149 |---+----+--------+---+----+----------+--------+----|
150 |LED|全角|ひらがな|INS|CAPS|コード入力|ローマ字|かな|
151 +---------------------------------------------------+
diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h
index 2df83a2cb..c49b4a73e 100644
--- a/converter/x68k_usb/config_pjrc.h
+++ b/converter/x68k_usb/config_pjrc.h
@@ -34,30 +34,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34/* key combination for command */ 34/* key combination for command */
35#define IS_COMMAND() ( \ 35#define IS_COMMAND() ( \
36 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \ 36 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
37 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \ 37 keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
38 keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \
38) 39)
39 40
40/* legacy keymap support */ 41/* legacy keymap support */
41#define USE_LEGACY_KEYMAP 42#define USE_LEGACY_KEYMAP
42 43
43/* mouse keys */
44#ifdef MOUSEKEY_ENABLE
45# define MOUSEKEY_DELAY_TIME 255
46#endif
47
48 44
49/* USART configuration 45/* USART configuration
50 * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control 46 * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control
51 */ 47 */
52#ifdef __AVR_ATmega32U4__ 48#ifdef __AVR_ATmega32U4__
53# define KBD_RX_VECT USART1_RX_vect 49 #define SERIAL_UART_BAUD 2400
54# define KBD_RX_DATA UDR1 50 #define SERIAL_UART_DATA UDR1
55# define KBD_RX_BAUD 2400 51 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
56# define KBD_RX_UBBR ((F_CPU/(16UL*KBD_RX_BAUD))-1) 52 #define SERIAL_UART_RXD_VECT USART1_RX_vect
57# define KBD_RX_INIT() do { \ 53 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
58 UBRR1L = (uint8_t) KBD_RX_UBBR; \ 54 #define SERIAL_UART_INIT() do { \
59 UBRR1H = (uint8_t) (KBD_RX_UBBR>>8); \ 55 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
60 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); \ 56 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
57 UCSR1B = (1<<RXCIE1) | (1<<RXEN1) | /* RX: interrupt, RX: enable */ \
58 (1<<TXEN1); /* TX: enable */ \
59 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
60 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
61 sei(); \
61 } while(0) 62 } while(0)
62#else 63#else
63# error "USART configuration is needed." 64# error "USART configuration is needed."
diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c
index 90abb3966..5e09f55d2 100644
--- a/converter/x68k_usb/keymap.c
+++ b/converter/x68k_usb/keymap.c
@@ -113,13 +113,23 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
113 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| | 113 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
114 `---------------------------------------------' `-----------' `---------------' 114 `---------------------------------------------' `-----------' `---------------'
115*/ 115*/
116 /* ANSI */
116 KEYMAP( 117 KEYMAP(
117 NO, NO, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,NO, NO, NO, 118 F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
118 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, 119 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
119 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, DEL, END, PGDN, P7, P8, P9, PPLS, 120 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
120 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, UP, P4, P5, P6, PEQL, 121 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,F18, UP, P4, P5, P6, PEQL,
121 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,GRV, LEFT,DOWN,RGHT, P1, P2, P3, PENT, 122 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,GRV, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
122 LGUI,LALT,NO, SPC, RALT,RGUI,RCTL,APP, NO, NO, P0, PCMM,PDOT 123 F19, LGUI,LALT, SPC, RALT,RGUI,RCTL,APP, F14, F15, P0, PCMM,PDOT
124 ),
125 /* JIS */
126 KEYMAP(
127 F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
128 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
129 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
130 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, UP, P4, P5, P6, PEQL,
131 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
132 LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT
123 ), 133 ),
124}; 134};
125 135
diff --git a/converter/x68k_usb/led.c b/converter/x68k_usb/led.c
index 40156cf4a..ccc38699c 100644
--- a/converter/x68k_usb/led.c
+++ b/converter/x68k_usb/led.c
@@ -16,11 +16,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include "stdint.h" 18#include "stdint.h"
19#include "x68k.h" 19#include "serial.h"
20#include "led.h" 20#include "led.h"
21#include "debug.h"
21 22
22 23
23void led_set(uint8_t usb_led) 24void led_set(uint8_t usb_led)
24{ 25{
25 // not supported now 26 /* X68000 LED bits 0: on, 1: off
27 * bit 7 1(fixed)
28 * bit 6 全角
29 * bit 5 ひらがな
30 * bit 4 INS
31 * bit 3 CAPS
32 * bit 2 コード入力
33 * bit 1 ローマ字
34 * bit 0 かな
35 */
36 uint8_t led = 0xFF;
37 if (usb_led&(1<<USB_LED_NUM_LOCK)) led &= ~(1<<2);
38 if (usb_led&(1<<USB_LED_CAPS_LOCK)) led &= ~(1<<3);
39 if (usb_led&(1<<USB_LED_SCROLL_LOCK)) led &= ~(1<<1);
40 if (usb_led&(1<<USB_LED_COMPOSE)) led &= ~(1<<4);
41 if (usb_led&(1<<USB_LED_KANA)) led &= ~(1<<0);
42 serial_send(led);
26} 43}
diff --git a/converter/x68k_usb/matrix.c b/converter/x68k_usb/matrix.c
index 954e7ef12..2d5a1e116 100644
--- a/converter/x68k_usb/matrix.c
+++ b/converter/x68k_usb/matrix.c
@@ -21,8 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21#include <util/delay.h> 21#include <util/delay.h>
22#include "print.h" 22#include "print.h"
23#include "util.h" 23#include "util.h"
24#include "x68k.h" 24#include "serial.h"
25#include "matrix.h" 25#include "matrix.h"
26#include "debug.h"
26 27
27 28
28/* 29/*
@@ -63,7 +64,7 @@ uint8_t matrix_cols(void)
63 64
64void matrix_init(void) 65void matrix_init(void)
65{ 66{
66 x68k_init(); 67 serial_init();
67 68
68 // initialize matrix state: all keys off 69 // initialize matrix state: all keys off
69 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; 70 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
@@ -75,13 +76,13 @@ uint8_t matrix_scan(void)
75{ 76{
76 is_modified = false; 77 is_modified = false;
77 78
78 uint8_t code; 79 uint16_t code;
79 code = x68k_recv(); 80 code = serial_recv2();
80 if (code == 0) { 81 if (code == -1) {
81 return 0; 82 return 0;
82 } 83 }
83 84
84 phex(code); print(" "); 85 dprintf("%02X\n", code);
85 if (code&0x80) { 86 if (code&0x80) {
86 // break code 87 // break code
87 if (matrix_is_on(ROW(code), COL(code))) { 88 if (matrix_is_on(ROW(code), COL(code))) {