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

New native functions nn.* in playground #1022

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
[submodule "third_party/quazip"]
path = third_party/quazip
url = https://github.com/mobsya/quazip
[submodule "third_party/thymio-nn"]
path = third_party/thymio-nn
url = https://github.com/Mobsya/thymio-nn.git
11 changes: 9 additions & 2 deletions aseba/targets/playground/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(CMAKE_AUTOMOC on)

set(NN_ROOT ${CMAKE_SOURCE_DIR}/third_party/thymio-nn)

set (ASEBASIM_SRC
EnkiGlue.cpp
AsebaGlue.cpp
Expand All @@ -9,10 +11,15 @@ set (ASEBASIM_SRC
robots/e-puck/EPuck-descriptions.c
robots/thymio2/Thymio2.cpp
robots/thymio2/Thymio2-natives.cpp
robots/thymio2/Thymio2-descriptions.c
robots/thymio2/Thymio2-descriptions.c
${NN_ROOT}/thymio/nn-natives.c
${NN_ROOT}/thymio/nn-descriptions.c
${NN_ROOT}/nn/nn.c
${NN_ROOT}/nn/nn-alloc-stdlib.c
)

add_library(asebasim STATIC ${ASEBASIM_SRC})
target_include_directories(asebasim PUBLIC ${CMAKE_SOURCE_DIR}/third_party/thymio-nn)
set_target_properties(asebasim PROPERTIES VERSION ${LIB_VERSION_STRING}
SOVERSION ${LIB_VERSION_MAJOR})

Expand Down Expand Up @@ -69,4 +76,4 @@ if(APPLE)
set(playground_icon ${PROJECT_SOURCE_DIR}/menu/osx/asebaplayground.icns)
set_source_files_properties(${playground_icon} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
target_sources(${PLAYGROUND_EXECUTABLE_NAME} PRIVATE ${playground_icon})
endif()
endif()
14 changes: 11 additions & 3 deletions aseba/targets/playground/robots/thymio2/Thymio2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "Thymio2.h"
#include "Thymio2-natives.h"
#include "thymio/nn-natives.h"
#include "../../Parameters.h"
#include "../../EnkiGlue.h"
#include "common/productids.h"
Expand Down Expand Up @@ -210,16 +211,23 @@ const AsebaLocalEventDescription* AsebaThymio2::getLocalEventsDescriptions() con
// array of descriptions of native functions, static so only visible in this file

static const AsebaNativeFunctionDescription* nativeFunctionsDescriptions[] = {
ASEBA_NATIVES_STD_DESCRIPTIONS, PLAYGROUND_THYMIO2_NATIVES_DESCRIPTIONS, nullptr};
ASEBA_NATIVES_STD_DESCRIPTIONS,
PLAYGROUND_THYMIO2_NATIVES_DESCRIPTIONS,
NN_NATIVES_DESCRIPTIONS,
nullptr
};

const AsebaNativeFunctionDescription* const* AsebaThymio2::getNativeFunctionsDescriptions() const {
return nativeFunctionsDescriptions;
}

// array of native functions, static so only visible in this file

static AsebaNativeFunctionPointer nativeFunctions[] = {ASEBA_NATIVES_STD_FUNCTIONS,
PLAYGROUND_THYMIO2_NATIVES_FUNCTIONS};
static AsebaNativeFunctionPointer nativeFunctions[] = {
ASEBA_NATIVES_STD_FUNCTIONS,
PLAYGROUND_THYMIO2_NATIVES_FUNCTIONS,
NN_NATIVES_FUNCTIONS
};

void AsebaThymio2::callNativeFunction(uint16_t id) {
nativeFunctions[id](&vm);
Expand Down
1 change: 1 addition & 0 deletions third_party/thymio-nn
Submodule thymio-nn added at 41badb