Wait for USB starting up to make debug print available

This commit is contained in:
tmk 2013-11-19 03:20:25 +09:00
parent 676d94d137
commit 9d40be1990
2 changed files with 9 additions and 1 deletions

View file

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ACTION_UTIL_H #define ACTION_UTIL_H
#include <stdint.h> #include <stdint.h>
#include "report.h"
extern report_keyboard_t *keyboard_report; extern report_keyboard_t *keyboard_report;

View file

@ -539,11 +539,18 @@ int main(void)
{ {
SetupHardware(); SetupHardware();
sei(); sei();
/* wait for USB startup & debug output */
while (USB_DeviceState != DEVICE_STATE_Configured) {
#if defined(INTERRUPT_CONTROL_ENDPOINT) #if defined(INTERRUPT_CONTROL_ENDPOINT)
while (USB_DeviceState != DEVICE_STATE_Configured) ; ;
#else
USB_USBTask();
#endif #endif
}
print("USB configured.\n"); print("USB configured.\n");
/* init modules */
keyboard_init(); keyboard_init();
host_set_driver(&lufa_driver); host_set_driver(&lufa_driver);
#ifdef SLEEP_LED_ENABLE #ifdef SLEEP_LED_ENABLE