X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk.c;h=00b571d54de8aff3c7fc6d4c49ae24ab35def13f;hb=2b8cd88ab142068eed0a3f230a3de79deb567536;hp=1d4b8fb01c27344e921a418a0874598c2c949372;hpb=461e0d3d8c82cc78d29d3115af3c417bb51bb50f;p=max%2Ftmk_keyboard.git diff --git a/tmk.c b/tmk.c index 1d4b8fb0..00b571d5 100644 --- a/tmk.c +++ b/tmk.c @@ -28,27 +28,32 @@ #include #include #include +#include "keyboard.h" #include "usb.h" #include "matrix_skel.h" -#include "key_process.h" #include "print.h" #include "debug.h" #include "util.h" -#include "controller.h" +#include "jump_bootloader.h" +#ifdef PS2_MOUSE_ENABLE +# include "ps2_mouse.h" +#endif #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) + bool debug_enable = false; bool debug_matrix = false; bool debug_keyboard = false; bool debug_mouse = false; -uint16_t idle_count=0; - int main(void) { + DEBUG_LED_CONFIG; + DEBUG_LED_OFF; + // set for 16 MHz clock CPU_PRESCALE(0); @@ -58,22 +63,9 @@ int main(void) usb_init(); while (!usb_configured()) /* wait */ ; - // Configure timer 0 to generate a timer overflow interrupt every - // 256*1024 clock cycles, or approx 61 Hz when using 16 MHz clock - // This demonstrates how to use interrupts to implement a simple - // inactivity timeout. - TCCR0A = 0x00; - TCCR0B = 0x05; - TIMSK0 = (1<= 3) { #ifdef DEBUG_LED for (int i = 0; i < 6; i++) { DEBUG_LED_CONFIG; @@ -83,24 +75,23 @@ int main(void) _delay_ms(500); } #else - _delay_ms(6000); + _delay_ms(5000); #endif + print_enable = true; + debug_enable = true; + debug_matrix = true; + debug_keyboard = true; + debug_mouse = true; + print("debug enabled.\n"); } - // print description - print(XSTR(DESCRIPTION)); - - while (1) { - proc_matrix(); - _delay_ms(2); + if (matrix_key_count() >= 4) { + print("jump to bootloader...\n"); + _delay_ms(1000); + jump_bootloader(); // not return } -} -// This interrupt routine is run approx 61 times per second. -// A very simple inactivity timeout is implemented, where we -// will send a space character and print a message to the -// hid_listen debug message window. -ISR(TIMER0_OVF_vect) -{ - idle_count++; + while (1) { + keyboard_proc(); + } }