summaryrefslogtreecommitdiff
path: root/converter
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-02-22 15:48:35 +0900
committertmk <nobody@nowhere>2013-02-22 15:48:35 +0900
commiteb776c1b7918f320b717cedfd8957f55e53c5adf (patch)
tree3eb6f3bbe629008b8286960894400b5caefc59b6 /converter
parentf68c5bf0d30dc1300c71dabc63d2c2970f7337c9 (diff)
downloadqmk_firmware-eb776c1b7918f320b717cedfd8957f55e53c5adf.tar.gz
qmk_firmware-eb776c1b7918f320b717cedfd8957f55e53c5adf.zip
Quick Fix: read scan code from PC98
Diffstat (limited to 'converter')
-rw-r--r--converter/pc98_usb/config.h9
-rw-r--r--converter/pc98_usb/matrix.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h
index 8bcaa26db9..6f9f8fc3cf 100644
--- a/converter/pc98_usb/config.h
+++ b/converter/pc98_usb/config.h
@@ -55,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define SERIAL_BAUD 19200
#define SERIAL_PARITY_ODD
-#define SERIAL_BIT_ORDER_MSB
+#define SERIAL_BIT_ORDER_LSB
#define SERIAL_RXD_DDR DDRD
#define SERIAL_RXD_PORT PORTD
@@ -67,7 +67,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
SERIAL_RXD_DDR &= ~(1<<SERIAL_RXD_BIT); \
SERIAL_RXD_PORT |= (1<<SERIAL_RXD_BIT); \
/* enable interrupt: INT2(rising edge) */ \
- EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+ /*EICRA |= ((1<<ISC21)|(1<<ISC20));*/ \
+ /* enable interrupt: INT2(falling edge) */ \
+ EICRA |= ((1<<ISC21)|(0<<ISC20)); \
EIMSK |= (1<<INT2); \
} while (0)
#define SERIAL_RXD_INT_ENTER()
@@ -75,7 +77,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* clear interrupt flag */ \
EIFR = (1<<INTF2); \
} while (0)
-#define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
+//#define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
+#define SERIAL_RXD_READ() ((SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT)))
#define SERIAL_TXD_DDR DDRD
#define SERIAL_TXD_PORT PORTD
diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c
index b3c11dc210..ef2bc38186 100644
--- a/converter/pc98_usb/matrix.c
+++ b/converter/pc98_usb/matrix.c
@@ -73,6 +73,8 @@ void matrix_init(void)
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
PC98_RTY_PORT |= (1<<PC98_RTY_BIT);
+ DDRD |= 1<<7;
+
serial_init();
@@ -83,6 +85,9 @@ void matrix_init(void)
_delay_us(13);
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ // PC98 ready
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
@@ -96,6 +101,7 @@ uint8_t matrix_scan(void)
uint8_t code;
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ _delay_us(30);
code = serial_recv();
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
if (!code) return 0;