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

Emulation on host: updates #8409

Merged
merged 6 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions tests/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ OPT_ARDUINO_LIBS ?= \
DNSServer/src/DNSServer.cpp \
ESP8266AVRISP/src/ESP8266AVRISP.cpp \
ESP8266HTTPClient/src/ESP8266HTTPClient.cpp \
Hash/src/Hash.cpp \
)

MOCK_ARDUINO_LIBS := \
Expand Down
13 changes: 11 additions & 2 deletions tests/host/common/Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
*/

#include <sys/time.h>
#include "Arduino.h"
#include <unistd.h>

#include <functional>

#include <unistd.h>
#include <Arduino.h>
#include <Schedule.h>

static struct timeval gtod0 = { 0, 0 };

Expand All @@ -42,6 +44,13 @@ extern "C" unsigned long micros()

extern "C" void yield()
{
run_scheduled_recurrent_functions();
}

extern "C" void loop_end()
{
run_scheduled_functions();
run_scheduled_recurrent_functions();
mcspr marked this conversation as resolved.
Show resolved Hide resolved
}

extern "C" bool can_yield()
Expand Down
1 change: 1 addition & 0 deletions tests/host/common/ArduinoMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ int main (int argc, char* const argv [])
if (!fast)
usleep(1000); // not 100% cpu, ~1000 loops per second
loop();
loop_end();
check_incoming_udp();

if (run_once)
Expand Down
2 changes: 2 additions & 0 deletions tests/host/common/mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ extern uint32_t global_source_address; // 0 = INADDR_ANY by default
#define NO_GLOBAL_BINDING 0xffffffff
extern uint32_t global_ipv4_netfmt; // selected interface addresse to bind to

void loop_end();

#ifdef __cplusplus
}
#endif
Expand Down