Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #7148 w/ lwIP Ethernet merged #8332

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add clarifying comments to esp_suspend and esp_delay overloads.
  • Loading branch information
dok-net committed Oct 6, 2021
commit 070eb482748386274cf63b21d8db613054959664
9 changes: 9 additions & 0 deletions cores/esp8266/coredecls.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,23 @@ void settimeofday_cb (const TrivialCB& cb);

using IsBlockedCB = std::function<bool()>;

// This overload of esp_suspend() performs the blocked callback whenever it is resumed,
// and if that returns true, it immediately suspends again.
inline void esp_suspend(const IsBlockedCB& blocked) {
do {
esp_suspend();
} while (blocked());
}

// This overload of esp_delay() delays for a duration of at most timeout_ms milliseconds.
// Whenever it is resumed, as well as every intvl_ms millisconds, it performs
// the blocked callback, and if that returns true, it keeps delaying for the remainder
// of the original timeout_ms period.
void esp_delay(const uint32_t timeout_ms, const IsBlockedCB& blocked, const uint32_t intvl_ms);

// This overload of esp_delay() delays for a duration of at most timeout_ms milliseconds.
// Whenever it is resumed, it performs the blocked callback, and if that returns true,
// it keeps delaying for the remainder of the original timeout_ms period.
inline void esp_delay(const uint32_t timeout_ms, const IsBlockedCB& blocked) {
esp_delay(timeout_ms, blocked, timeout_ms);
}
Expand Down