summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-03-23 16:51:07 +0700
committerhathach <[email protected]>2019-03-23 16:51:07 +0700
commitdf1aac44b839f65bf8b5961d4d184c515ad18f5c (patch)
treea01d718b7ee77bf1363b521f2dd66e3dc2510c20 /examples
parent43eb1a8b1631ed4b460db123717a7226c10c701f (diff)
add board_noos_millis() for blinky
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_hid/src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c
index b2a902835..be0b14933 100644
--- a/examples/device/cdc_msc_hid/src/main.c
+++ b/examples/device/cdc_msc_hid/src/main.c
@@ -193,11 +193,12 @@ void tud_umount_cb(void)
//--------------------------------------------------------------------+
void led_blinking_task(void)
{
- static tu_timeout_t tm = { .start = 0, .interval = 1000 }; // Blink every 1000 ms
+ static uint32_t start_ms = 0;
static bool led_state = false;
- if ( !tu_timeout_expired(&tm) ) return; // not enough time
- tu_timeout_reset(&tm);
+ // Blink every 1000 ms
+ if ( board_noos_millis() < start_ms + 1000) return; // not enough time
+ start_ms += 1000;
board_led_control(led_state);
led_state = 1 - led_state; // toggle