X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=protocol%2Fpjrc%2Fmain.c;h=1ef87f8651c8a2ee415e7d72590156b20db8c5b8;hb=ed52ebb9870a26496b13a0565c1aaca8ded3465b;hp=e0f600fe7c66f77faf40c47484151e4166d48224;hpb=3c822b511e7af60332a7e5a938c08bafb2516ba3;p=tmk_firmware.git diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c index e0f600f..1ef87f8 100644 --- a/protocol/pjrc/main.c +++ b/protocol/pjrc/main.c @@ -30,11 +30,9 @@ #include "matrix.h" #include "print.h" #include "debug.h" +#include "sendchar.h" #include "util.h" -#include "bootloader.h" -#ifdef PS2_MOUSE_ENABLE -# include "ps2_mouse.h" -#endif +#include "suspend.h" #include "host.h" #include "pjrc.h" @@ -44,9 +42,6 @@ int main(void) { - DEBUG_LED_CONFIG; - DEBUG_LED_OFF; - // set for 16 MHz clock CPU_PRESCALE(0); @@ -56,36 +51,21 @@ int main(void) usb_init(); while (!usb_configured()) /* wait */ ; - keyboard_init(); - matrix_scan(); - if (matrix_key_count() >= 3) { -#ifdef DEBUG_LED - for (int i = 0; i < 6; i++) { - DEBUG_LED_CONFIG; - DEBUG_LED_ON; - _delay_ms(500); - DEBUG_LED_OFF; - _delay_ms(500); - } -#else - _delay_ms(5000); -#endif - print_enable = true; - debug_enable = true; - debug_matrix = true; - debug_keyboard = true; - debug_mouse = true; - print("debug enabled.\n"); - } - if (matrix_key_count() >= 4) { - print("jump to bootloader...\n"); - _delay_ms(1000); - bootloader_jump(); // not return - } - + print_set_sendchar(sendchar); + keyboard_init(); host_set_driver(pjrc_driver()); +#ifdef SLEEP_LED_ENABLE + sleep_led_init(); +#endif while (1) { - keyboard_task(); + while (suspend) { + suspend_power_down(); + if (remote_wakeup && suspend_wakeup_condition()) { + usb_remote_wakeup(); + } + } + + keyboard_task(); } }