1
0

core: Change matrix_init and matrix_print

This commit is contained in:
tmk 2016-10-08 10:57:38 +09:00
parent cb9480877d
commit f57d834f13
2 changed files with 12 additions and 10 deletions

View File

@ -33,7 +33,6 @@ uint8_t matrix_cols(void)
__attribute__ ((weak)) __attribute__ ((weak))
void matrix_clear(void) void matrix_clear(void)
{ {
matrix_init();
} }
__attribute__ ((weak)) __attribute__ ((weak))
@ -55,23 +54,22 @@ void matrix_print(void)
#elif (MATRIX_COLS <= 32) #elif (MATRIX_COLS <= 32)
print("r/c 0123456789ABCDEF0123456789ABCDEF\n"); print("r/c 0123456789ABCDEF0123456789ABCDEF\n");
#endif #endif
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
xprintf("%02X:", row);
#if (MATRIX_COLS <= 8) #if (MATRIX_COLS <= 8)
print_bin_reverse8(matrix_get_row(row)); xprintf("%02X: %08b%s\n", row, bitrev(matrix_get_row(row)),
#elif (MATRIX_COLS <= 16) #elif (MATRIX_COLS <= 16)
print_bin_reverse16(matrix_get_row(row)); xprintf("%02X: %016b%s\n", row, bitrev16(matrix_get_row(row)),
#elif (MATRIX_COLS <= 32) #elif (MATRIX_COLS <= 32)
print_bin_reverse32(matrix_get_row(row)); xprintf("%02X: %032b%s\n", row, bitrev32(matrix_get_row(row)),
#endif #endif
#ifdef MATRIX_HAS_GHOST #ifdef MATRIX_HAS_GHOST
if (matrix_has_ghost_in_row(row)) { matrix_has_ghost_in_row(row) ? " <ghost" : ""
print(" <ghost"); #else
} ""
#endif #endif
print("\n"); );
} }
} }

View File

@ -32,6 +32,10 @@ typedef uint32_t matrix_row_t;
#error "MATRIX_COLS: invalid value" #error "MATRIX_COLS: invalid value"
#endif #endif
#if (MATRIX_ROWS > 255)
#error "MATRIX_ROWS must not exceed 255"
#endif
#define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col)) #define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col))