Esempio n. 1
0
uint8_t matrix_scan(void)
{
    uint16_t code;
    code = serial_recv2();
    if (code == -1) {
#ifdef PC98_LED_CONTROL
        // Before sending command  we have to make sure that there is no unprocessed key in queue
        // otherwise keys will be missed during sending command
        if (pc98_led) {
            pc98_led_set();
            pc98_led = 0;
        }
#endif
        return 0;
    }

    print_hex8(code); print(" ");

    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
        }
    }
    return code;
}
Esempio n. 2
0
static int16_t pc98_wait_response(void)
{
    int16_t code = -1;
    uint8_t timeout = 255;
    while (timeout-- && (code = serial_recv2()) == -1) _delay_ms(1);
    return code;
}
Esempio n. 3
0
uint8_t matrix_scan(void)
{
    is_modified = false;

    uint16_t code;
    code = serial_recv2();
    if (code == -1) {
        return 0;
    }

    dprintf("%02X\n", code);
    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
            is_modified = true;
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
            is_modified = true;
        }
    }
    return code;
}
Esempio n. 4
0
uint8_t matrix_scan(void)
{
    uint16_t code;
    PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
    _delay_us(30);
    code = serial_recv2();
    PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
    if (code == -1) return 0;

if (code == 0x60) {
    pc98_inhibit_repeat();

/*
    PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
    _delay_ms(100);
    serial_send(0x96);
    PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
*/

    return 0;
}

    print_hex8(code); print(" ");

    if (code&0x80) {
        // break code
        if (matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] &= ~(1<<COL(code));
        }
    } else {
        // make code
        if (!matrix_is_on(ROW(code), COL(code))) {
            matrix[ROW(code)] |=  (1<<COL(code));
        }
    }
    return code;
}
Esempio n. 5
0
int16_t rn42_getc(void)
{
    return serial_recv2();
}