From 3e209f9c20c9251e01af35da4d9e454fcc2f61dd Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 23 Jul 2018 17:46:07 +0700 Subject: enhance device hid - add CFG_TUD_HID_ASCII_TO_KEYCODE_LOOKUP - add tud_hid_keyboard_send_keycode(), tud_hid_keyboard_send_char(), tud_hid_keyboard_send_string() - add timeout_blocking_wait() --- src/common/timeout_timer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/common/timeout_timer.h') diff --git a/src/common/timeout_timer.h b/src/common/timeout_timer.h index aafc8cce2..5c62c6904 100644 --- a/src/common/timeout_timer.h +++ b/src/common/timeout_timer.h @@ -67,6 +67,15 @@ static inline bool timeout_expired(timeout_timer_t* tt) return ( tusb_hal_millis() - tt->start ) >= tt->interval; } +static inline void timeout_blocking_wait(uint32_t msec) +{ + timeout_timer_t tt; + timeout_set(&tt, msec); + + // blocking delay + while ( !timeout_expired(&tt) ) { } +} + #ifdef __cplusplus } #endif -- cgit v1.3.1