add vs cmake files; fix knxPython

This commit is contained in:
Thomas Kunze 2019-06-29 00:48:57 +02:00
parent 3a916905d6
commit 4ab96db96e
4 changed files with 59 additions and 16 deletions

2
.gitignore vendored
View File

@ -21,6 +21,8 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
out
flash.bin
# Visual Studio 2015 cache/options directory
.vs/

View File

@ -0,0 +1,19 @@
{
"configurations": [
{
"name": "WSL-Debug",
"generator": "Unix Makefiles",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeExecutable": "/usr/bin/cmake",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
}
]
}

View File

@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "WSL-Debug",
"generator": "Unix Makefiles",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeExecutable": "/usr/bin/cmake",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerEnabled": true,
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
}
]
}

View File

@ -16,8 +16,8 @@ namespace py = pybind11;
#include "knx/bau57B0.h"
#include "knx/group_object_table_object.h"
LinuxPlatform platform;
Bau57B0 bau(platform);
LinuxPlatform* platform = 0;
Bau57B0* bau = 0;
bool running = false;
@ -25,8 +25,8 @@ static void loop()
{
while (running)
{
bau.loop();
platform.mdelay(100);
bau->loop();
platform->mdelay(100);
}
}
@ -38,10 +38,13 @@ static void Start()
if (running)
return;
if (!bau)
return;
running = true;
bau.readMemory();
bau.enabled(true);
bau->readMemory();
bau->enabled(true);
workerThread = std::thread(loop);
workerThread.detach();
@ -53,26 +56,26 @@ static void Stop()
return;
running = false;
bau.writeMemory();
bau.enabled(false);
bau->writeMemory();
bau->enabled(false);
workerThread.join();
}
static bool ProgramMode(bool value)
{
bau.deviceObject().progMode(value);
return bau.deviceObject().progMode();
bau->deviceObject().progMode(value);
return bau->deviceObject().progMode();
}
static bool ProgramMode()
{
return bau.deviceObject().progMode();
return bau->deviceObject().progMode();
}
static bool Configured()
{
return bau.configured();
return bau->configured();
}
PYBIND11_MAKE_OPAQUE(std::vector<GroupObject>);
@ -88,13 +91,12 @@ PYBIND11_MODULE(knx, m)
m.def("ProgramMode", (bool(*)())&ProgramMode, "get programing mode active.");
m.def("ProgramMode", (bool(*)(bool))&ProgramMode, "Activate / deactivate programing mode.");
m.def("Configured", (bool(*)())&Configured, "get configured status.");
m.def("FlashFilePath", []() { return platform.flashFilePath(); });
m.def("FlashFilePath", [](std::string path) { platform.flashFilePath(path); });
m.def("GetGroupObject", [](uint16_t goNr) { return bau.groupObjectTable().get(goNr); });
m.def("FlashFilePath", []() { return platform->flashFilePath(); });
m.def("FlashFilePath", [](std::string path) { platform->flashFilePath(path); });
m.def("GetGroupObject", [](uint16_t goNr) { return bau->groupObjectTable().get(goNr); });
py::class_<GroupObject>(m, "GroupObject", py::dynamic_attr())
.def(py::init())
.def("objectWrite", (void(GroupObject::*)(float))&GroupObject::objectWrite)
.def("asap", &GroupObject::asap)
.def("size", &GroupObject::valueSize)
.def_property("value",