From e7c6839d2d17dd084c8bea1dd43208b3144979d2 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 26 Sep 2010 22:42:37 +0900 Subject: some fixes. LED flush for debug. --- jump_bootloader.c | 2 +- keymap.c | 2 +- keymap.h | 2 +- matrix.c | 1 - mykey.c | 62 ++++++++++++++++++++++++++++++++++++++++--------------- 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/jump_bootloader.c b/jump_bootloader.c index f60c3596a5..e4c0b967f4 100644 --- a/jump_bootloader.c +++ b/jump_bootloader.c @@ -4,7 +4,7 @@ #include #include -void jump_bootloader() { +void jump_bootloader(void) { cli(); // disable watchdog, if enabled // disable all peripherals diff --git a/keymap.c b/keymap.c index 6fca9a003a..f81f3a1367 100644 --- a/keymap.c +++ b/keymap.c @@ -59,7 +59,7 @@ static const uint8_t PROGMEM Keymap[][MATRIX_ROWS][MATRIX_COLS] = { }; -uint8_t get_keycode(int layer, uint8_t row, uint8_t col) +uint8_t get_keycode(int layer, int row, int col) { if (row >= MATRIX_ROWS) return KB_NO; diff --git a/keymap.h b/keymap.h index a85b626c65..ac0cc5fea6 100644 --- a/keymap.h +++ b/keymap.h @@ -5,7 +5,7 @@ #include "usbkeycodes.h" int get_layer(void); -uint8_t get_keycode(int layer, uint8_t row, uint8_t col); +uint8_t get_keycode(int layer, int row, int col); #define MATRIX_ROWS 9 #define MATRIX_COLS 8 diff --git a/matrix.c b/matrix.c index 6129f52c68..b50427ac04 100644 --- a/matrix.c +++ b/matrix.c @@ -5,7 +5,6 @@ #include #include "keymap.h" #include "matrix.h" -#include "print.h" // matrix is active low. (key on: 0/key off: 1) // row: Hi-Z(unselected)/low output(selected) diff --git a/mykey.c b/mykey.c index 337089c942..94cbbfb5a1 100644 --- a/mykey.c +++ b/mykey.c @@ -41,6 +41,8 @@ #define LED_OFF (PORTD |= (1<<6)) #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) +static void print_matrix(void); + uint16_t idle_count=0; @@ -78,9 +80,9 @@ int main(void) print("firmware 0.2 for t.m.k.\n"); + int loop_count = 0; while (1) { int layer = 0; - uint8_t row, col, code; matrix_scan(); layer = get_layer(); @@ -94,11 +96,11 @@ int main(void) keyboard_modifier_keys = 0; for (int i = 0; i < 6; i++) keyboard_keys[i] = KB_NO; - for (row = 0; row < MATRIX_ROWS; row++) { - for (col = 0; col < MATRIX_COLS; col++) { + for (int row = 0; row < MATRIX_ROWS; row++) { + for (int col = 0; col < MATRIX_COLS; col++) { if (matrix[row] & 1<> 8); phex(idle_count & 0xFF); print("\n"); + print("loop_count: "); phex((loop_count & 0xFF00) >> 8); phex(loop_count & 0xFF); print("\n"); + print_matrix(); + } + + // teensy LED flush for debug + if ((loop_count & 0x100) == 0) { + DDRD |= 1< 61 * 8) { - idle_count = 0; - print("."); - } } -- cgit v1.2.3