/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
+Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define CAPS 0x39
-#define CAPS_UP (CAPS | 0x80)
+#define CAPS_BREAK (CAPS | 0x80)
#define ROW(key) ((key)>>3&0x0F)
#define COL(key) ((key)&0x07)
static uint8_t *matrix;
static uint8_t _matrix0[MATRIX_ROWS];
-#ifdef MATRIX_HAS_GHOST
-static bool matrix_has_ghost_in_row(uint8_t row);
-#endif
static void register_key(uint8_t key);
// Send Caps key up event
if (matrix_is_on(ROW(CAPS), COL(CAPS))) {
is_modified = true;
- register_key(CAPS_UP);
+ register_key(CAPS_BREAK);
}
#endif
if (key == M0110_NULL) {
return 0;
+ } else if (key == M0110_ERROR) {
+ return 0;
} else {
#ifdef MATRIX_HAS_LOCKING_CAPS
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
// Ignore LockingCaps key down event
if (key == CAPS) return 0;
// Convert LockingCaps key up event into down event
- if (key == CAPS_UP) key = CAPS;
+ if (key == CAPS_BREAK) key = CAPS;
} else {
// CAPS LOCK off:
// Ignore LockingCaps key up event
- if (key == CAPS_UP) return 0;
+ if (key == CAPS_BREAK) return 0;
}
#endif
is_modified = true;
}
if (debug_enable) {
- print("key: "); phex(key); print("\n");
+ print("["); phex(key); print("]\n");
}
return 1;
}
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;
}
return count;
}
-#ifdef MATRIX_HAS_GHOST
-inline
-static bool matrix_has_ghost_in_row(uint8_t row)
-{
- // no ghost exists in case less than 2 keys on
- if (((matrix[row] - 1) & matrix[row]) == 0)
- return false;
-
- // ghost exists in case same state as other row
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- if (i != row && (matrix[i] & matrix[row]) == matrix[row])
- return true;
- }
- return false;
-}
-#endif
-
inline
static void register_key(uint8_t key)
{