summaryrefslogtreecommitdiff
path: root/src/input/lvgl_input_driver.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-04-24 16:06:10 +1000
committerjacqueline <me@jacqueline.id.au>2024-04-24 16:06:10 +1000
commit920345b940bb3993c389d9e9be1a75a8041d431d (patch)
tree562e53906a14c31ba8a21b3c2ae64c652a16acb4 /src/input/lvgl_input_driver.cpp
parent531475e3511e9c722677d3a351b51d4a579876df (diff)
downloadtangara-fw-920345b940bb3993c389d9e9be1a75a8041d431d.tar.gz
Support getting a tree of controls + hooks via lua
Diffstat (limited to 'src/input/lvgl_input_driver.cpp')
-rw-r--r--src/input/lvgl_input_driver.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/input/lvgl_input_driver.cpp b/src/input/lvgl_input_driver.cpp
index 9698aa79..61a85fa5 100644
--- a/src/input/lvgl_input_driver.cpp
+++ b/src/input/lvgl_input_driver.cpp
@@ -16,6 +16,8 @@
#include "input_touch_wheel.hpp"
#include "input_trigger.hpp"
#include "input_volume_buttons.hpp"
+#include "lauxlib.h"
+#include "lua.h"
#include "lvgl.h"
#include "nvs.hpp"
#include "property.hpp"
@@ -104,4 +106,22 @@ auto LvglInputDriver::feedback(uint8_t event) -> void {
}
}
+auto LvglInputDriver::pushHooks(lua_State* L) -> int {
+ lua_newtable(L);
+
+ for (auto& dev : inputs_) {
+ lua_pushlstring(L, dev->name().data(), dev->name().size());
+ lua_newtable(L);
+
+ for (auto& hook : dev->hooks()) {
+ lua_pushlstring(L, hook.name().data(), hook.name().size());
+ hook.pushHooks(L);
+ lua_rawset(L, -3);
+ }
+
+ lua_rawset(L, -3);
+ }
+ return 1;
+}
+
} // namespace input