/** * @brief Waits for given number of milliseconds * @param n : Number of milliseconds * @return Nothing */ void ms_timerDelay(uint32_t n) { ms_timer_t timer; ms_timerInit(&timer, n); while (ms_timerExpired(&timer) == false) { __NOP(); __WFI();/* conserve power */ } }
/* Keyboard tasks */ void Keyboard_Tasks(void) { /* check if moue report timer expired */ if (ms_timerExpired(&g_keyBoard.tmo)) { /* reset timer */ ms_timerStart(&g_keyBoard.tmo); /* check device is configured before sending report. */ if ( USB_IsConfigured(g_keyBoard.hUsb)) { /* update report based on board state */ Keyboard_UpdateReport(); /* send report data */ if (g_keyBoard.tx_busy == 0) { g_keyBoard.tx_busy = 1; USBD_API->hw->WriteEP(g_keyBoard.hUsb, HID_EP_IN, &g_keyBoard.report[0], KEYBOARD_REPORT_SIZE); } } } }