mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
WiFi: ARP gratuitous API for wifi station mode (#6889)
* wifi: ARP gratuitous API for wifi station mode * fix with lwip1 * update comment * update API to allow changing interval on the fly * update API * remove debug lines * mock lwIP's etharp_request() * unsigned interval * use scheduled ticker * ticker: +attach_ms_scheduled_accurate ticker: +comment gratuitous: use attach_ms_scheduled_accurate * move to experimental namespace * fix for lwIP-v1.4 * attempt to make pio happy * use directly ETSTimer instead of Ticker
This commit is contained in:
@ -35,30 +35,42 @@ public:
|
||||
typedef void (*callback_with_arg_t)(void*);
|
||||
typedef std::function<void(void)> callback_function_t;
|
||||
|
||||
// callback will be called at following loop() after ticker fires
|
||||
void attach_scheduled(float seconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = [callback]() { schedule_function(callback); };
|
||||
_attach_ms(1000UL * seconds, true);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
void attach(float seconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = std::move(callback);
|
||||
_attach_ms(1000UL * seconds, true);
|
||||
}
|
||||
|
||||
// callback will be called at following loop() after ticker fires
|
||||
void attach_ms_scheduled(uint32_t milliseconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = [callback]() { schedule_function(callback); };
|
||||
_attach_ms(milliseconds, true);
|
||||
}
|
||||
|
||||
// callback will be called at following yield() after ticker fires
|
||||
void attach_ms_scheduled_accurate(uint32_t milliseconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = [callback]() { schedule_recurrent_function_us([callback]() { callback(); return false; }, 0); };
|
||||
_attach_ms(milliseconds, true);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
void attach_ms(uint32_t milliseconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = std::move(callback);
|
||||
_attach_ms(milliseconds, true);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
template<typename TArg>
|
||||
void attach(float seconds, void (*callback)(TArg), TArg arg)
|
||||
{
|
||||
@ -66,6 +78,7 @@ public:
|
||||
_attach_ms(1000UL * seconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
template<typename TArg>
|
||||
void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
|
||||
{
|
||||
@ -73,30 +86,35 @@ public:
|
||||
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
|
||||
}
|
||||
|
||||
// callback will be called at following loop() after ticker fires
|
||||
void once_scheduled(float seconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = [callback]() { schedule_function(callback); };
|
||||
_attach_ms(1000UL * seconds, false);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
void once(float seconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = std::move(callback);
|
||||
_attach_ms(1000UL * seconds, false);
|
||||
}
|
||||
|
||||
// callback will be called at following loop() after ticker fires
|
||||
void once_ms_scheduled(uint32_t milliseconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = [callback]() { schedule_function(callback); };
|
||||
_attach_ms(milliseconds, false);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
void once_ms(uint32_t milliseconds, callback_function_t callback)
|
||||
{
|
||||
_callback_function = std::move(callback);
|
||||
_attach_ms(milliseconds, false);
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
template<typename TArg>
|
||||
void once(float seconds, void (*callback)(TArg), TArg arg)
|
||||
{
|
||||
@ -104,6 +122,7 @@ public:
|
||||
_attach_ms(1000UL * seconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
|
||||
}
|
||||
|
||||
// callback will be called in SYS ctx when ticker fires
|
||||
template<typename TArg>
|
||||
void once_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user