diff options
| author | hathach <[email protected]> | 2026-06-01 10:05:17 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2026-06-01 10:05:17 +0700 |
| commit | 7e0fcaa41ee9330274808d88e5211bdbe37511a4 (patch) | |
| tree | 2dd325a811d906448baa370e57277f2b5f3eb439 | |
| parent | a64eb336c4a8d3f9c160aa30b81033e3ad7227d8 (diff) | |
ultrareview nits: keep xfer_result table in sync, hoist blinky loop
- src/tusb.c: extend tu_str_xfer_result[] with "ABORTED" and "INVALID"
to match the new enum size. Not reachable today (no HCD posts those
values through hcd_event_xfer_complete), but keeps the enum/table
invariant intact so future HCDs that surface ABORTED don't index OOB.
- examples/dual/dynamic_switch/src/main.c: apply the same while(1)
hoist already done for cdc_task / print_devinfo_task to
led_blinking_task. On OS_NONE the loop returned mid-iteration, which
on first call could fire multiple back-to-back toggles while
start_ms (initially 0) caught up to uptime.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
| -rw-r--r-- | examples/dual/dynamic_switch/src/main.c | 17 | ||||
| -rw-r--r-- | src/tusb.c | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/examples/dual/dynamic_switch/src/main.c b/examples/dual/dynamic_switch/src/main.c index ac5126e56..f67cd885c 100644 --- a/examples/dual/dynamic_switch/src/main.c +++ b/examples/dual/dynamic_switch/src/main.c @@ -483,16 +483,19 @@ void led_blinking_task(void *param) { (void) param; static uint32_t start_ms = 0; static bool led_state = false; - while (1) { #if CFG_TUSB_OS == OPT_OS_FREERTOS + while (1) { vTaskDelay(pdMS_TO_TICKS(blink_interval_ms)); -#else - if (tusb_time_millis_api() - start_ms < blink_interval_ms) { - return; // not enough time - } -#endif start_ms += blink_interval_ms; board_led_write(led_state); - led_state = 1 - led_state; // toggle + led_state = 1 - led_state; + } +#else + if (tusb_time_millis_api() - start_ms < blink_interval_ms) { + return; // not enough time } + start_ms += blink_interval_ms; + board_led_write(led_state); + led_state = 1 - led_state; +#endif } diff --git a/src/tusb.c b/src/tusb.c index 5d656fb8c..634cbc10b 100644 --- a/src/tusb.c +++ b/src/tusb.c @@ -497,7 +497,7 @@ char const* const tu_str_std_request[] = { }; char const* const tu_str_xfer_result[] = { - "OK", "FAILED", "STALLED", "TIMEOUT" + "OK", "FAILED", "STALLED", "TIMEOUT", "ABORTED", "INVALID" }; #endif |
