diff options
| author | hathach <[email protected]> | 2019-03-23 17:15:00 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-23 21:46:51 +0700 |
| commit | d866999bf0f41b0d3db0354c599d014c66dc6870 (patch) | |
| tree | 3284143de4df8708ba53d56dfed78d77ada6a5d9 /examples | |
| parent | df1aac44b839f65bf8b5961d4d184c515ad18f5c (diff) | |
remove idle rate enforcement, should be done in application level
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/main.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c index be0b14933..06a99711f 100644 --- a/examples/device/cdc_msc_hid/src/main.c +++ b/examples/device/cdc_msc_hid/src/main.c @@ -121,10 +121,11 @@ void tud_cdc_rx_cb(uint8_t itf) void usb_hid_task(void) { // Poll every 10ms - static tu_timeout_t tm = { .start = 0, .interval = 10 }; + const uint32_t interval_ms = 10; + static uint32_t start_ms = 0; - if ( !tu_timeout_expired(&tm) ) return; // not enough time - tu_timeout_reset(&tm); + if ( board_noos_millis() < start_ms + interval_ms) return; // not enough time + start_ms += interval_ms; uint32_t const btn = board_buttons(); @@ -193,12 +194,14 @@ void tud_umount_cb(void) //--------------------------------------------------------------------+ void led_blinking_task(void) { + const uint32_t interval_ms = 1000; static uint32_t start_ms = 0; + static bool led_state = false; // Blink every 1000 ms - if ( board_noos_millis() < start_ms + 1000) return; // not enough time - start_ms += 1000; + if ( board_noos_millis() < start_ms + interval_ms) return; // not enough time + start_ms += interval_ms; board_led_control(led_state); led_state = 1 - led_state; // toggle |
