Repository navigation
Restore UART write timeout - #348
Conversation
|
No findings: the write timeout mirrors |
| TickType_t timeoutTicks = (timeout_ms == portMAX_DELAY) | ||
| ? portMAX_DELAY | ||
| : pdMS_TO_TICKS(timeout_ms); |
There was a problem hiding this comment.
Unrelated reformat of the existing read() ternary. It is outside #194 and adds diff noise. Please revert it. The new write() copy can keep the original layout from read() (the layout this hunk replaces) so the two match:
TickType_t timeoutTicks =
(timeout_ms == portMAX_DELAY)
? portMAX_DELAY
: pdMS_TO_TICKS(timeout_ms);
| // Discard a late completion so it cannot satisfy the next write's wait. | ||
| // NOTE: this clears the task's whole default notification value, so a | ||
| // task must not use notification index 0 for anything but this driver. |
There was a problem hiding this comment.
Check how this compares to read()'s timeout branch (line ~99). Does it also drain a late notification? If not, the extra ulTaskNotifyTake(pdTRUE, 0) is a hardware-race fix that deserves its why in one line, which the first comment line already gives. The second "NOTE" about notification index 0 is a fair constraint, but please make sure it's true for this repo (grep other ulTaskNotifyTake users) rather than a speculative warning. If it's speculative, drop it.
Summary
Adds a 500 ms default UART write timeout, aborts timed-out transfers, and clears late completion notifications.
Testing
Related Issue
Closes #194
Notes