X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=converter%2Fpc98_usb%2Fmatrix.c;h=39afb43c727d513ff84c314e054fa6ea05dd0c46;hb=e3d7b50f63dfc71b5488928093f2d641589518b0;hp=54bb30414d7b458859ecf21f7d137386f0c2815a;hpb=9977fd514076651400b088268c1c0b57e6b00772;p=max%2Ftmk_keyboard.git diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c index 54bb3041..39afb43c 100644 --- a/converter/pc98_usb/matrix.c +++ b/converter/pc98_usb/matrix.c @@ -68,23 +68,34 @@ static int16_t pc98_wait_response(void) static void pc98_inhibit_repeat(void) { uint16_t code; - - // clear recv buffer - while (serial_recv()) ; RETRY: - _delay_ms(100); pc98_send(0x9C); code = pc98_wait_response(); if (code != -1) xprintf("PC98: send 9C: %02X\n", code); if (code != 0xFA) goto RETRY; - _delay_ms(100); pc98_send(0x70); code = pc98_wait_response(); if (code != -1) xprintf("PC98: send 70: %02X\n", code); if (code != 0xFA) goto RETRY; } +static uint8_t pc98_led = 0; +static void pc98_led_set(void) +{ + uint16_t code; +RETRY: + pc98_send(0x9D); + code = pc98_wait_response(); + if (code != -1) xprintf("PC98: send 9D: %02X\n", code); + if (code != 0xFA) goto RETRY; + + pc98_send(pc98_led); + code = pc98_wait_response(); + if (code != -1) xprintf("PC98: send %02X: %02X\n", pc98_led, code); + if (code != 0xFA) goto RETRY; +} + void matrix_init(void) { debug_keyboard = true; @@ -99,36 +110,40 @@ void matrix_init(void) serial_init(); // PC98 reset -/* - PC98_RST_PORT &= ~(1< 13us + PC98_RST_PORT |= (1<