1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Emulation on host: updates (#8409)

* mock: +Hash, +scheduled functions
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
This commit is contained in:
david gauchard 2022-01-03 14:23:45 +01:00 committed by GitHub
parent d0cc3a80f8
commit 2f58f679ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View File

@ -345,6 +345,7 @@ OPT_ARDUINO_LIBS ?= \
DNSServer/src/DNSServer.cpp \ DNSServer/src/DNSServer.cpp \
ESP8266AVRISP/src/ESP8266AVRISP.cpp \ ESP8266AVRISP/src/ESP8266AVRISP.cpp \
ESP8266HTTPClient/src/ESP8266HTTPClient.cpp \ ESP8266HTTPClient/src/ESP8266HTTPClient.cpp \
Hash/src/Hash.cpp \
) )
MOCK_ARDUINO_LIBS := \ MOCK_ARDUINO_LIBS := \

View File

@ -14,10 +14,12 @@
*/ */
#include <sys/time.h> #include <sys/time.h>
#include "Arduino.h" #include <unistd.h>
#include <functional> #include <functional>
#include <unistd.h> #include <Arduino.h>
#include <Schedule.h>
static struct timeval gtod0 = { 0, 0 }; static struct timeval gtod0 = { 0, 0 };
@ -42,6 +44,13 @@ extern "C" unsigned long micros()
extern "C" void yield() extern "C" void yield()
{ {
run_scheduled_recurrent_functions();
}
extern "C" void loop_end()
{
run_scheduled_functions();
run_scheduled_recurrent_functions();
} }
extern "C" bool can_yield() extern "C" bool can_yield()

View File

@ -308,6 +308,7 @@ int main (int argc, char* const argv [])
if (!fast) if (!fast)
usleep(1000); // not 100% cpu, ~1000 loops per second usleep(1000); // not 100% cpu, ~1000 loops per second
loop(); loop();
loop_end();
check_incoming_udp(); check_incoming_udp();
if (run_once) if (run_once)

View File

@ -116,6 +116,8 @@ extern uint32_t global_source_address; // 0 = INADDR_ANY by default
#define NO_GLOBAL_BINDING 0xffffffff #define NO_GLOBAL_BINDING 0xffffffff
extern uint32_t global_ipv4_netfmt; // selected interface addresse to bind to extern uint32_t global_ipv4_netfmt; // selected interface addresse to bind to
void loop_end();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif