diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
index 6190c71a..8f6a0dc9 100644
--- a/converter/adb_usb/matrix.c
+++ b/converter/adb_usb/matrix.c
@@ -31,44 +31,18 @@ along with this program. If not, see .
#include "host.h"
-#if (MATRIX_COLS > 16)
-# error "MATRIX_COLS must not exceed 16"
-#endif
-#if (MATRIX_ROWS > 255)
-# error "MATRIX_ROWS must not exceed 255"
-#endif
static bool has_media_keys = false;
static bool is_iso_layout = false;
-static bool is_modified = false;
static report_mouse_t mouse_report = {};
// matrix state buffer(1:on, 0:off)
-#if (MATRIX_COLS <= 8)
-static uint8_t matrix[MATRIX_ROWS];
-#else
-static uint16_t matrix[MATRIX_ROWS];
-#endif
+static matrix_row_t matrix[MATRIX_ROWS];
-#ifdef MATRIX_HAS_GHOST
-static bool matrix_has_ghost_in_row(uint8_t row);
-#endif
static void register_key(uint8_t key);
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
void matrix_init(void)
{
// LED on
@@ -208,8 +182,6 @@ uint8_t matrix_scan(void)
uint16_t codes;
uint8_t key0, key1;
- is_modified = false;
-
codes = extra_key;
extra_key = 0xFFFF;
@@ -328,93 +300,12 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void)
-{
- return is_modified;
-}
-
inline
-bool matrix_has_ghost(void)
-{
-#ifdef MATRIX_HAS_GHOST
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- if (matrix_has_ghost_in_row(i))
- return true;
- }
-#endif
- return false;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & (1<
>3)&0xF)
#define COL(code) (code&0x07)
-static bool is_modified = false;
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
void matrix_init(void)
{
@@ -74,8 +60,6 @@ void matrix_init(void)
uint8_t matrix_scan(void)
{
- is_modified = false;
-
uint8_t code;
code = news_recv();
if (code == 0) {
@@ -87,56 +71,18 @@ uint8_t matrix_scan(void)
// break code
if (matrix_is_on(ROW(code), COL(code))) {
matrix[ROW(code)] &= ~(1<>3)&0xF)
#define COL(code) (code&0x07)
-static bool is_modified = false;
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
static void pc98_inhibit_repeat(void)
{
@@ -128,8 +114,6 @@ void matrix_init(void)
uint8_t matrix_scan(void)
{
- is_modified = false;
-
uint16_t code;
PC98_RDY_PORT |= (1<.
#include "matrix.h"
#include "debug.h"
#include "protocol/serial.h"
+#include "led.h"
+#include "host.h"
/*
@@ -46,20 +48,6 @@ static uint8_t matrix[MATRIX_ROWS];
#define ROW(code) ((code>>3)&0xF)
#define COL(code) (code&0x07)
-static bool is_modified = false;
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
void matrix_init(void)
{
@@ -92,8 +80,6 @@ void matrix_init(void)
uint8_t matrix_scan(void)
{
- is_modified = false;
-
uint8_t code;
code = serial_recv();
if (!code) return 0;
@@ -131,56 +117,18 @@ uint8_t matrix_scan(void)
// break code
if (matrix_is_on(ROW(code), COL(code))) {
matrix[ROW(code)] &= ~(1<.
static void matrix_make(uint8_t code);
static void matrix_break(uint8_t code);
-#ifdef MATRIX_HAS_GHOST
-static bool matrix_has_ghost_in_row(uint8_t row);
-#endif
/*
@@ -49,20 +46,6 @@ static uint8_t matrix[MATRIX_ROWS];
#define ROW(code) (code>>3)
#define COL(code) (code&0x07)
-static bool is_modified = false;
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
void matrix_init(void)
{
@@ -93,8 +76,6 @@ uint8_t matrix_scan(void)
F0,
} state = RESET;
- is_modified = false;
-
uint8_t code;
if ((code = ps2_host_recv())) {
debug("r"); debug_hex(code); debug(" ");
@@ -172,83 +153,17 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void)
-{
- return is_modified;
-}
-
-inline
-bool matrix_has_ghost(void)
-{
-#ifdef MATRIX_HAS_GHOST
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- if (matrix_has_ghost_in_row(i))
- return true;
- }
-#endif
- return false;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & (1<.
static void matrix_make(uint8_t code);
static void matrix_break(uint8_t code);
-#ifdef MATRIX_HAS_GHOST
-static bool matrix_has_ghost_in_row(uint8_t row);
-#endif
static uint8_t matrix[MATRIX_ROWS];
#define ROW(code) (code>>3)
@@ -40,20 +37,6 @@ static uint8_t matrix[MATRIX_ROWS];
#define PRINT_SCREEN (0x7C)
#define PAUSE (0x7D)
-static bool is_modified = false;
-
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
void matrix_init(void)
{
@@ -131,8 +114,6 @@ uint8_t matrix_scan(void)
} state = INIT;
- is_modified = false;
-
// 'pseudo break code' hack
if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) {
matrix_break(PAUSE);
@@ -236,83 +217,17 @@ uint8_t matrix_scan(void)
return 1;
}
-bool matrix_is_modified(void)
-{
- return is_modified;
-}
-
-inline
-bool matrix_has_ghost(void)
-{
-#ifdef MATRIX_HAS_GHOST
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- if (matrix_has_ghost_in_row(i))
- return true;
- }
-#endif
- return false;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & (1<