diff options
| author | hathach <[email protected]> | 2019-03-24 01:19:32 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-24 01:19:32 +0700 |
| commit | 18f248b142a477b2134d23a2902d8d7de6e4c195 (patch) | |
| tree | 6dff75edadb85d400198659fdaf118edd5addca9 /examples/host | |
| parent | 29e075b8b968806c4a9ebffdbdfacbd9b01cf029 (diff) | |
remove tusb_hal_millis() usage, less work for porting
Diffstat (limited to 'examples/host')
| -rw-r--r-- | examples/host/cdc_msc_hid/src/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c index b38e44017..86ddb55e1 100644 --- a/examples/host/cdc_msc_hid/src/main.c +++ b/examples/host/cdc_msc_hid/src/main.c @@ -164,11 +164,14 @@ void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event) //--------------------------------------------------------------------+ void led_blinking_task(void) { - static tu_timeout_t tm = { .start = 0, .interval = 1000 }; // Blink every 1000 ms + const uint32_t interval_ms = 1000; + 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_millis() < start_ms + interval_ms) return; // not enough time + start_ms += interval_ms; board_led_control(led_state); led_state = 1 - led_state; // toggle |
