diff options
| author | tmk <nobody@nowhere> | 2013-02-24 20:38:43 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-02-24 20:38:43 +0900 |
| commit | 504a9f42ff7cfecb94eb954124e48ff65d345008 (patch) | |
| tree | 853e827db781a93f7ef966ff8c29e5e7f9cef95d | |
| parent | fea6792f1636a716e799539b072930461bfcba67 (diff) | |
| download | qmk_firmware-504a9f42ff7cfecb94eb954124e48ff65d345008.tar.gz qmk_firmware-504a9f42ff7cfecb94eb954124e48ff65d345008.zip | |
Inhibit repeating key of PC98
| -rw-r--r-- | converter/pc98_usb/matrix.c | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c index 2f1e821c5..18ad5bfe7 100644 --- a/converter/pc98_usb/matrix.c +++ b/converter/pc98_usb/matrix.c | |||
| @@ -61,11 +61,42 @@ uint8_t matrix_cols(void) | |||
| 61 | return MATRIX_COLS; | 61 | return MATRIX_COLS; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static void pc98_inhibit_repeat(void) | ||
| 65 | { | ||
| 66 | uint8_t code; | ||
| 67 | |||
| 68 | while (serial_recv()) ; | ||
| 69 | RETRY: | ||
| 70 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); | ||
| 71 | _delay_ms(500); | ||
| 72 | serial_send(0x9C); | ||
| 73 | |||
| 74 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); | ||
| 75 | _delay_ms(100); | ||
| 76 | while (!(code = serial_recv())) ; | ||
| 77 | print("PC98: send 9C: "); print_hex8(code); print("\n"); | ||
| 78 | if (code != 0xFA) goto RETRY; | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); | ||
| 83 | _delay_ms(100); | ||
| 84 | serial_send(0x70); | ||
| 85 | |||
| 86 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); | ||
| 87 | _delay_ms(100); | ||
| 88 | //code = serial_recv(); | ||
| 89 | while (!(code = serial_recv())) ; | ||
| 90 | print("PC98: send 70: "); print_hex8(code); print("\n"); | ||
| 91 | if (code != 0xFA) goto RETRY; | ||
| 92 | |||
| 93 | } | ||
| 94 | |||
| 64 | void matrix_init(void) | 95 | void matrix_init(void) |
| 65 | { | 96 | { |
| 66 | print_enable = true; | 97 | print_enable = true; |
| 67 | debug_enable = true; | 98 | // debug_enable = true; |
| 68 | //debug_matrix = true; | 99 | // debug_matrix = true; |
| 69 | 100 | ||
| 70 | PC98_RST_DDR |= (1<<PC98_RST_BIT); | 101 | PC98_RST_DDR |= (1<<PC98_RST_BIT); |
| 71 | PC98_RDY_DDR |= (1<<PC98_RDY_BIT); | 102 | PC98_RDY_DDR |= (1<<PC98_RDY_BIT); |
| @@ -74,17 +105,21 @@ void matrix_init(void) | |||
| 74 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); | 105 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); |
| 75 | PC98_RTY_PORT |= (1<<PC98_RTY_BIT); | 106 | PC98_RTY_PORT |= (1<<PC98_RTY_BIT); |
| 76 | 107 | ||
| 77 | DDRD |= 1<<7; | ||
| 78 | |||
| 79 | 108 | ||
| 80 | serial_init(); | 109 | serial_init(); |
| 81 | 110 | ||
| 82 | // PC98 reset | 111 | // PC98 reset |
| 112 | /* | ||
| 83 | PC98_RST_PORT &= ~(1<<PC98_RST_BIT); | 113 | PC98_RST_PORT &= ~(1<<PC98_RST_BIT); |
| 84 | _delay_us(15); | 114 | _delay_us(15); |
| 85 | PC98_RST_PORT |= (1<<PC98_RST_BIT); | 115 | PC98_RST_PORT |= (1<<PC98_RST_BIT); |
| 86 | _delay_us(13); | 116 | _delay_us(13); |
| 87 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); | 117 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); |
| 118 | */ | ||
| 119 | |||
| 120 | _delay_ms(500); | ||
| 121 | pc98_inhibit_repeat(); | ||
| 122 | |||
| 88 | 123 | ||
| 89 | // PC98 ready | 124 | // PC98 ready |
| 90 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); | 125 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); |
| @@ -107,7 +142,20 @@ uint8_t matrix_scan(void) | |||
| 107 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); | 142 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); |
| 108 | if (code == -1) return 0; | 143 | if (code == -1) return 0; |
| 109 | 144 | ||
| 110 | debug_hex(code); debug(" "); | 145 | if (code == 0x60) { |
| 146 | pc98_inhibit_repeat(); | ||
| 147 | |||
| 148 | /* | ||
| 149 | PC98_RDY_PORT |= (1<<PC98_RDY_BIT); | ||
| 150 | _delay_ms(100); | ||
| 151 | serial_send(0x96); | ||
| 152 | PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT); | ||
| 153 | */ | ||
| 154 | |||
| 155 | return 0; | ||
| 156 | } | ||
| 157 | |||
| 158 | print_hex8(code); print(" "); | ||
| 111 | 159 | ||
| 112 | if (code&0x80) { | 160 | if (code&0x80) { |
| 113 | // break code | 161 | // break code |
