You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
392 B
15 lines
392 B
#ifndef TIMEOUT_H
|
|
#define TIMEOUT_H
|
|
|
|
#include <esp8266.h>
|
|
|
|
#define until_timeout(to_ms) for(uint32_t _utmeo = system_get_time(); system_get_time() - _utmeo < ((to_ms)*1000);)
|
|
|
|
/** Retry a call until a timeout. Variable 'suc' is set to the return value. Must be defined. */
|
|
#define retry_TO(to_ms, call) \
|
|
until_timeout(to_ms) { \
|
|
suc = call; \
|
|
if (suc) break; \
|
|
}
|
|
|
|
#endif // TIMEOUT_H
|
|
|