From 560e76948524978e69a78236bc8859e063c4f68c Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 14 Dec 2021 09:37:15 +0100 Subject: [PATCH] Rename Berry to berry --- lib/libesp32/berry/LICENSE | 21 + lib/libesp32/berry/Makefile | 105 + lib/libesp32/berry/README.md | 163 ++ lib/libesp32/berry/berry-logo.png | Bin 0 -> 11325 bytes lib/libesp32/berry/default/be_animate_lib.c | 712 ++++++ lib/libesp32/berry/default/be_autoconf_lib.c | 1394 +++++++++++ lib/libesp32/berry/default/be_crypto_lib.c | 56 + lib/libesp32/berry/default/be_ctypes.c | 494 ++++ lib/libesp32/berry/default/be_display_lib.c | 29 + lib/libesp32/berry/default/be_driverlib.c | 153 ++ .../default/be_energy_ctypes_definitions.c | 117 + lib/libesp32/berry/default/be_energylib.c | 186 ++ lib/libesp32/berry/default/be_flash_lib.c | 21 + lib/libesp32/berry/default/be_gpio_lib.c | 34 + .../berry/default/be_i2c_axp192_lib.c | 899 +++++++ lib/libesp32/berry/default/be_i2c_driverlib.c | 425 ++++ lib/libesp32/berry/default/be_i2s_audio_lib.c | 113 + .../berry/default/be_leds_animator_lib.c | 381 +++ lib/libesp32/berry/default/be_leds_lib.c | 1815 ++++++++++++++ lib/libesp32/berry/default/be_leds_ntv_lib.c | 50 + lib/libesp32/berry/default/be_light_lib.c | 28 + .../berry/default/be_lvgl_clock_icon_lib.c | 313 +++ .../default/be_lvgl_ctypes_definitions.c | 531 +++++ lib/libesp32/berry/default/be_lvgl_glob_lib.c | 826 +++++++ lib/libesp32/berry/default/be_lvgl_module.c | 692 ++++++ .../berry/default/be_lvgl_signal_arcs_lib.c | 434 ++++ .../berry/default/be_lvgl_signal_bars_lib.c | 392 ++++ .../berry/default/be_lvgl_widgets_lib.c | 1564 +++++++++++++ .../default/be_lvgl_wifi_arcs_icon_lib.c | 140 ++ .../berry/default/be_lvgl_wifi_arcs_lib.c | 167 ++ .../default/be_lvgl_wifi_bars_icon_lib.c | 136 ++ .../berry/default/be_lvgl_wifi_bars_lib.c | 167 ++ lib/libesp32/berry/default/be_md5_lib.c | 30 + lib/libesp32/berry/default/be_modtab.c | 230 ++ lib/libesp32/berry/default/be_onewire_lib.c | 57 + .../berry/default/be_path_tasmota_lib.c | 70 + lib/libesp32/berry/default/be_persist_lib.c | 703 ++++++ lib/libesp32/berry/default/be_port.cpp | 574 +++++ lib/libesp32/berry/default/be_python_compat.c | 58 + lib/libesp32/berry/default/be_re_lib.c | 254 ++ lib/libesp32/berry/default/be_serial_lib.c | 66 + lib/libesp32/berry/default/be_tapp_lib.c | 168 ++ lib/libesp32/berry/default/be_tasmotalib.c | 2079 +++++++++++++++++ lib/libesp32/berry/default/be_tcpclient_lib.c | 48 + lib/libesp32/berry/default/be_timer_class.c | 110 + lib/libesp32/berry/default/be_unishox_lib.c | 28 + lib/libesp32/berry/default/be_webclient_lib.c | 57 + lib/libesp32/berry/default/be_webserver_lib.c | 55 + lib/libesp32/berry/default/be_wirelib.c | 151 ++ lib/libesp32/berry/default/berry_conf.h | 247 ++ .../berry/default/embedded/Animate.be | 189 ++ lib/libesp32/berry/default/embedded/Driver.be | 29 + .../berry/default/embedded/Tasmota.be | 577 +++++ lib/libesp32/berry/default/embedded/Wire.be | 25 + .../berry/default/embedded/autoconf.be | 389 +++ .../berry/default/embedded/i2c_axp192.be | 176 ++ .../berry/default/embedded/i2c_driver.be | 104 + lib/libesp32/berry/default/embedded/leds.be | 338 +++ .../berry/default/embedded/leds_animator.be | 70 + .../berry/default/embedded/lv_clock_icon.be | 54 + .../berry/default/embedded/lv_signal_arcs.be | 133 ++ .../berry/default/embedded/lv_signal_bars.be | 118 + .../berry/default/embedded/lvgl_glob.be | 256 ++ .../berry/default/embedded/openhasp.be | 764 ++++++ .../default/embedded/openhasp/demo-all.jsonl | 61 + .../default/embedded/openhasp/demo1.jsonl | 23 + .../default/embedded/openhasp/demo2.jsonl | 35 + .../default/embedded/openhasp/demo3.jsonl | 4 + .../berry/default/embedded/persist.be | 161 ++ lib/libesp32/berry/default/embedded/tapp.be | 35 + .../berry/default/embedded/test_crypto.be | 30 + lib/libesp32/berry/default/static_block.hpp | 80 + lib/libesp32/berry/examples/anon_func.be | 20 + lib/libesp32/berry/examples/bigloop.be | 15 + lib/libesp32/berry/examples/bintree.be | 60 + lib/libesp32/berry/examples/calcpi.be | 16 + lib/libesp32/berry/examples/exception.be | 12 + lib/libesp32/berry/examples/fib_rec.be | 12 + lib/libesp32/berry/examples/guess_number.be | 26 + lib/libesp32/berry/examples/json.be | 4 + lib/libesp32/berry/examples/lambda.be | 8 + lib/libesp32/berry/examples/listdir.be | 16 + lib/libesp32/berry/examples/qsort.be | 42 + lib/libesp32/berry/examples/repl.be | 61 + lib/libesp32/berry/examples/string.be | 32 + lib/libesp32/berry/examples/strmod.be | 7 + lib/libesp32/berry/gen.sh | 2 + lib/libesp32/berry/generate/be_const_strtab.h | 741 ++++++ .../berry/generate/be_const_strtab_def.h | 1109 +++++++++ .../generate/be_fixed_be_class_aes_gcm.h | 22 + .../be_fixed_be_class_audio_file_source.h | 17 + .../be_fixed_be_class_audio_file_source_fs.h | 18 + .../be_fixed_be_class_audio_generator.h | 17 + .../be_fixed_be_class_audio_generator_mp3.h | 22 + .../be_fixed_be_class_audio_generator_wav.h | 22 + .../generate/be_fixed_be_class_audio_output.h | 17 + .../be_fixed_be_class_audio_output_i2s.h | 19 + .../berry/generate/be_fixed_be_class_bytes.h | 44 + .../berry/generate/be_fixed_be_class_ctypes.h | 22 + .../generate/be_fixed_be_class_ctypes_dyn.h | 18 + .../generate/be_fixed_be_class_ec_c25519.h | 18 + .../berry/generate/be_fixed_be_class_list.h | 38 + .../berry/generate/be_fixed_be_class_map.h | 30 + .../berry/generate/be_fixed_be_class_md5.h | 20 + .../berry/generate/be_fixed_be_class_range.h | 24 + .../generate/be_fixed_be_class_tasmota.h | 93 + .../be_fixed_be_class_tasmota_onewire.h | 28 + .../be_fixed_be_class_tasmota_serial.h | 47 + .../generate/be_fixed_be_class_tasmota_wire.h | 31 + .../generate/be_fixed_be_class_tcpclient.h | 26 + .../generate/be_fixed_be_class_webclient.h | 32 + lib/libesp32/berry/generate/be_fixed_cb.h | 18 + lib/libesp32/berry/generate/be_fixed_debug.h | 22 + lib/libesp32/berry/generate/be_fixed_flash.h | 19 + lib/libesp32/berry/generate/be_fixed_gc.h | 18 + lib/libesp32/berry/generate/be_fixed_global.h | 19 + lib/libesp32/berry/generate/be_fixed_gpio.h | 23 + .../berry/generate/be_fixed_introspect.h | 21 + lib/libesp32/berry/generate/be_fixed_json.h | 18 + lib/libesp32/berry/generate/be_fixed_light.h | 21 + .../berry/generate/be_fixed_m_builtin.h | 66 + lib/libesp32/berry/generate/be_fixed_math.h | 43 + lib/libesp32/berry/generate/be_fixed_os.h | 2 + lib/libesp32/berry/generate/be_fixed_path.h | 2 + .../berry/generate/be_fixed_solidify.h | 17 + lib/libesp32/berry/generate/be_fixed_strict.h | 17 + lib/libesp32/berry/generate/be_fixed_string.h | 27 + lib/libesp32/berry/generate/be_fixed_sys.h | 17 + .../berry/generate/be_fixed_tasmota_path.h | 20 + lib/libesp32/berry/generate/be_fixed_time.h | 2 + .../berry/generate/be_fixed_webserver.h | 31 + lib/libesp32/berry/include/be_ctypes.h | 89 + lib/libesp32/berry/include/be_lvgl.h | 40 + lib/libesp32/berry/library.json | 30 + lib/libesp32/berry/src/be_api.c | 1173 ++++++++++ lib/libesp32/berry/src/be_baselib.c | 520 +++++ lib/libesp32/berry/src/be_bytecode.c | 590 +++++ lib/libesp32/berry/src/be_bytecode.h | 17 + lib/libesp32/berry/src/be_byteslib.c | 1447 ++++++++++++ lib/libesp32/berry/src/be_class.c | 360 +++ lib/libesp32/berry/src/be_class.h | 68 + lib/libesp32/berry/src/be_code.c | 930 ++++++++ lib/libesp32/berry/src/be_code.h | 43 + lib/libesp32/berry/src/be_constobj.h | 384 +++ lib/libesp32/berry/src/be_debug.c | 402 ++++ lib/libesp32/berry/src/be_debug.h | 28 + lib/libesp32/berry/src/be_debuglib.c | 215 ++ lib/libesp32/berry/src/be_decoder.h | 74 + lib/libesp32/berry/src/be_exec.c | 497 ++++ lib/libesp32/berry/src/be_exec.h | 62 + lib/libesp32/berry/src/be_filelib.c | 224 ++ lib/libesp32/berry/src/be_func.c | 181 ++ lib/libesp32/berry/src/be_func.h | 27 + lib/libesp32/berry/src/be_gc.c | 565 +++++ lib/libesp32/berry/src/be_gc.h | 80 + lib/libesp32/berry/src/be_gclib.c | 47 + lib/libesp32/berry/src/be_globallib.c | 86 + lib/libesp32/berry/src/be_introspectlib.c | 157 ++ lib/libesp32/berry/src/be_jsonlib.c | 448 ++++ lib/libesp32/berry/src/be_lexer.c | 621 +++++ lib/libesp32/berry/src/be_lexer.h | 138 ++ lib/libesp32/berry/src/be_libs.c | 29 + lib/libesp32/berry/src/be_libs.h | 15 + lib/libesp32/berry/src/be_list.c | 207 ++ lib/libesp32/berry/src/be_list.h | 39 + lib/libesp32/berry/src/be_listlib.c | 546 +++++ lib/libesp32/berry/src/be_map.c | 352 +++ lib/libesp32/berry/src/be_map.h | 61 + lib/libesp32/berry/src/be_maplib.c | 313 +++ lib/libesp32/berry/src/be_mathlib.c | 351 +++ lib/libesp32/berry/src/be_mem.c | 79 + lib/libesp32/berry/src/be_mem.h | 29 + lib/libesp32/berry/src/be_module.c | 467 ++++ lib/libesp32/berry/src/be_module.h | 42 + lib/libesp32/berry/src/be_object.c | 73 + lib/libesp32/berry/src/be_object.h | 254 ++ lib/libesp32/berry/src/be_opcodes.h | 57 + lib/libesp32/berry/src/be_oslib.c | 271 +++ lib/libesp32/berry/src/be_parser.c | 1743 ++++++++++++++ lib/libesp32/berry/src/be_parser.h | 89 + lib/libesp32/berry/src/be_rangelib.c | 123 + lib/libesp32/berry/src/be_repl.c | 106 + lib/libesp32/berry/src/be_repl.h | 26 + lib/libesp32/berry/src/be_solidifylib.c | 517 ++++ lib/libesp32/berry/src/be_strictlib.c | 40 + lib/libesp32/berry/src/be_string.c | 302 +++ lib/libesp32/berry/src/be_string.h | 57 + lib/libesp32/berry/src/be_strlib.c | 876 +++++++ lib/libesp32/berry/src/be_strlib.h | 32 + lib/libesp32/berry/src/be_sys.h | 48 + lib/libesp32/berry/src/be_syslib.c | 36 + lib/libesp32/berry/src/be_timelib.c | 71 + lib/libesp32/berry/src/be_var.c | 142 ++ lib/libesp32/berry/src/be_var.h | 31 + lib/libesp32/berry/src/be_vector.c | 153 ++ lib/libesp32/berry/src/be_vector.h | 43 + lib/libesp32/berry/src/be_vm.c | 1277 ++++++++++ lib/libesp32/berry/src/be_vm.h | 135 ++ lib/libesp32/berry/src/berry.h | 586 +++++ lib/libesp32/berry/src/berry_conf.h | 1 + lib/libesp32/berry/testall.be | 44 + lib/libesp32/berry/tests/assignment.be | 34 + lib/libesp32/berry/tests/bool.be | 39 + lib/libesp32/berry/tests/bytes.be | 185 ++ lib/libesp32/berry/tests/bytes_b64.be | 15 + lib/libesp32/berry/tests/bytes_fixed.be | 67 + lib/libesp32/berry/tests/checkspace.be | 35 + lib/libesp32/berry/tests/class.be | 47 + lib/libesp32/berry/tests/class_const.be | 122 + lib/libesp32/berry/tests/closure.be | 13 + lib/libesp32/berry/tests/compiler.be | 28 + lib/libesp32/berry/tests/compound.be | 19 + lib/libesp32/berry/tests/cond_expr.be | 10 + lib/libesp32/berry/tests/debug.be | 4 + lib/libesp32/berry/tests/exceptions.be | 7 + lib/libesp32/berry/tests/for.be | 44 + lib/libesp32/berry/tests/function.be | 12 + lib/libesp32/berry/tests/global.be | 52 + lib/libesp32/berry/tests/introspect.be | 28 + lib/libesp32/berry/tests/json.be | 53 + lib/libesp32/berry/tests/lexer.be | 62 + lib/libesp32/berry/tests/lexergc.be | 12 + lib/libesp32/berry/tests/list.be | 140 ++ lib/libesp32/berry/tests/member_indirect.be | 75 + lib/libesp32/berry/tests/os.be | 51 + lib/libesp32/berry/tests/overload.be | 14 + lib/libesp32/berry/tests/relop.be | 40 + lib/libesp32/berry/tests/string.be | 41 + lib/libesp32/berry/tests/subobject.be | 29 + lib/libesp32/berry/tests/suffix.be | 28 + lib/libesp32/berry/tests/super_auto.be | 132 ++ lib/libesp32/berry/tests/super_leveled.be | 43 + lib/libesp32/berry/tests/vararg.be | 14 + lib/libesp32/berry/tests/virtual_methods.be | 66 + lib/libesp32/berry/tests/virtual_methods2.be | 28 + lib/libesp32/berry/tools/coc/.gitignore | 1 + lib/libesp32/berry/tools/coc/Makefile | 26 + lib/libesp32/berry/tools/coc/REEADME.md | 3 + .../berry/tools/coc/block_builder.cpp | 197 ++ lib/libesp32/berry/tools/coc/block_builder.h | 49 + lib/libesp32/berry/tools/coc/coc_parser.cpp | 190 ++ lib/libesp32/berry/tools/coc/coc_parser.h | 46 + lib/libesp32/berry/tools/coc/coc_string.cpp | 48 + lib/libesp32/berry/tools/coc/coc_string.h | 18 + lib/libesp32/berry/tools/coc/hash_map.cpp | 161 ++ lib/libesp32/berry/tools/coc/hash_map.h | 47 + lib/libesp32/berry/tools/coc/macro_table.cpp | 59 + lib/libesp32/berry/tools/coc/macro_table.h | 30 + lib/libesp32/berry/tools/coc/main.cpp | 141 ++ lib/libesp32/berry/tools/coc/main.h | 45 + lib/libesp32/berry/tools/coc/object_block.h | 26 + lib/libesp32/berry/tools/coc/str_build.cpp | 129 + lib/libesp32/berry/tools/coc/str_build.h | 39 + .../berry/tools/grammar/berry.bytecode | 92 + lib/libesp32/berry/tools/grammar/berry.ebnf | 45 + .../berry/tools/grammar/const_obj.ebnf | 11 + lib/libesp32/berry/tools/grammar/json.ebnf | 5 + .../vscode/skiars.berry-0.1.0/.vsixmanifest | 34 + .../vscode/skiars.berry-0.1.0/CHANGELOG.md | 7 + .../vscode/skiars.berry-0.1.0/README.md | 0 .../berry-configuration.json | 32 + .../vscode/skiars.berry-0.1.0/berry-icon.png | Bin 0 -> 5429 bytes .../vscode/skiars.berry-0.1.0/package.json | 52 + .../skiars.berry-0.1.0/syntaxes/berry.json | 109 + .../skiars.berry-0.1.0/syntaxes/bytecode.json | 58 + .../berry/tools/pycoc/block_builder.py | 152 ++ lib/libesp32/berry/tools/pycoc/coc_parser.py | 146 ++ lib/libesp32/berry/tools/pycoc/coc_string.py | 40 + .../berry/tools/pycoc/coc_string_test.py | 18 + lib/libesp32/berry/tools/pycoc/hash_map.py | 162 ++ lib/libesp32/berry/tools/pycoc/macro_table.py | 50 + lib/libesp32/berry/tools/pycoc/main.py | 64 + lib/libesp32/berry/tools/pycoc/str_build.py | 123 + lib/libesp32/berry_mapping/src/be_cb_module.c | 2 +- 274 files changed, 47676 insertions(+), 1 deletion(-) create mode 100644 lib/libesp32/berry/LICENSE create mode 100644 lib/libesp32/berry/Makefile create mode 100644 lib/libesp32/berry/README.md create mode 100644 lib/libesp32/berry/berry-logo.png create mode 100644 lib/libesp32/berry/default/be_animate_lib.c create mode 100644 lib/libesp32/berry/default/be_autoconf_lib.c create mode 100644 lib/libesp32/berry/default/be_crypto_lib.c create mode 100644 lib/libesp32/berry/default/be_ctypes.c create mode 100644 lib/libesp32/berry/default/be_display_lib.c create mode 100644 lib/libesp32/berry/default/be_driverlib.c create mode 100644 lib/libesp32/berry/default/be_energy_ctypes_definitions.c create mode 100644 lib/libesp32/berry/default/be_energylib.c create mode 100644 lib/libesp32/berry/default/be_flash_lib.c create mode 100644 lib/libesp32/berry/default/be_gpio_lib.c create mode 100644 lib/libesp32/berry/default/be_i2c_axp192_lib.c create mode 100644 lib/libesp32/berry/default/be_i2c_driverlib.c create mode 100644 lib/libesp32/berry/default/be_i2s_audio_lib.c create mode 100644 lib/libesp32/berry/default/be_leds_animator_lib.c create mode 100644 lib/libesp32/berry/default/be_leds_lib.c create mode 100644 lib/libesp32/berry/default/be_leds_ntv_lib.c create mode 100644 lib/libesp32/berry/default/be_light_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_clock_icon_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_ctypes_definitions.c create mode 100644 lib/libesp32/berry/default/be_lvgl_glob_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_module.c create mode 100644 lib/libesp32/berry/default/be_lvgl_signal_arcs_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_signal_bars_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_widgets_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_wifi_arcs_icon_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_wifi_arcs_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_wifi_bars_icon_lib.c create mode 100644 lib/libesp32/berry/default/be_lvgl_wifi_bars_lib.c create mode 100644 lib/libesp32/berry/default/be_md5_lib.c create mode 100644 lib/libesp32/berry/default/be_modtab.c create mode 100644 lib/libesp32/berry/default/be_onewire_lib.c create mode 100644 lib/libesp32/berry/default/be_path_tasmota_lib.c create mode 100644 lib/libesp32/berry/default/be_persist_lib.c create mode 100644 lib/libesp32/berry/default/be_port.cpp create mode 100644 lib/libesp32/berry/default/be_python_compat.c create mode 100644 lib/libesp32/berry/default/be_re_lib.c create mode 100644 lib/libesp32/berry/default/be_serial_lib.c create mode 100644 lib/libesp32/berry/default/be_tapp_lib.c create mode 100644 lib/libesp32/berry/default/be_tasmotalib.c create mode 100644 lib/libesp32/berry/default/be_tcpclient_lib.c create mode 100644 lib/libesp32/berry/default/be_timer_class.c create mode 100644 lib/libesp32/berry/default/be_unishox_lib.c create mode 100644 lib/libesp32/berry/default/be_webclient_lib.c create mode 100644 lib/libesp32/berry/default/be_webserver_lib.c create mode 100644 lib/libesp32/berry/default/be_wirelib.c create mode 100644 lib/libesp32/berry/default/berry_conf.h create mode 100644 lib/libesp32/berry/default/embedded/Animate.be create mode 100644 lib/libesp32/berry/default/embedded/Driver.be create mode 100644 lib/libesp32/berry/default/embedded/Tasmota.be create mode 100644 lib/libesp32/berry/default/embedded/Wire.be create mode 100644 lib/libesp32/berry/default/embedded/autoconf.be create mode 100644 lib/libesp32/berry/default/embedded/i2c_axp192.be create mode 100644 lib/libesp32/berry/default/embedded/i2c_driver.be create mode 100644 lib/libesp32/berry/default/embedded/leds.be create mode 100644 lib/libesp32/berry/default/embedded/leds_animator.be create mode 100644 lib/libesp32/berry/default/embedded/lv_clock_icon.be create mode 100644 lib/libesp32/berry/default/embedded/lv_signal_arcs.be create mode 100644 lib/libesp32/berry/default/embedded/lv_signal_bars.be create mode 100644 lib/libesp32/berry/default/embedded/lvgl_glob.be create mode 100644 lib/libesp32/berry/default/embedded/openhasp.be create mode 100644 lib/libesp32/berry/default/embedded/openhasp/demo-all.jsonl create mode 100644 lib/libesp32/berry/default/embedded/openhasp/demo1.jsonl create mode 100644 lib/libesp32/berry/default/embedded/openhasp/demo2.jsonl create mode 100644 lib/libesp32/berry/default/embedded/openhasp/demo3.jsonl create mode 100644 lib/libesp32/berry/default/embedded/persist.be create mode 100644 lib/libesp32/berry/default/embedded/tapp.be create mode 100644 lib/libesp32/berry/default/embedded/test_crypto.be create mode 100644 lib/libesp32/berry/default/static_block.hpp create mode 100644 lib/libesp32/berry/examples/anon_func.be create mode 100644 lib/libesp32/berry/examples/bigloop.be create mode 100644 lib/libesp32/berry/examples/bintree.be create mode 100644 lib/libesp32/berry/examples/calcpi.be create mode 100644 lib/libesp32/berry/examples/exception.be create mode 100644 lib/libesp32/berry/examples/fib_rec.be create mode 100644 lib/libesp32/berry/examples/guess_number.be create mode 100644 lib/libesp32/berry/examples/json.be create mode 100644 lib/libesp32/berry/examples/lambda.be create mode 100644 lib/libesp32/berry/examples/listdir.be create mode 100644 lib/libesp32/berry/examples/qsort.be create mode 100644 lib/libesp32/berry/examples/repl.be create mode 100644 lib/libesp32/berry/examples/string.be create mode 100644 lib/libesp32/berry/examples/strmod.be create mode 100755 lib/libesp32/berry/gen.sh create mode 100644 lib/libesp32/berry/generate/be_const_strtab.h create mode 100644 lib/libesp32/berry/generate/be_const_strtab_def.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_aes_gcm.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source_fs.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_generator.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_mp3.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_wav.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_output.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_audio_output_i2s.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_bytes.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_ctypes.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_ctypes_dyn.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_ec_c25519.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_list.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_map.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_md5.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_range.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_tasmota.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_tasmota_onewire.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_tasmota_serial.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_tasmota_wire.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_tcpclient.h create mode 100644 lib/libesp32/berry/generate/be_fixed_be_class_webclient.h create mode 100644 lib/libesp32/berry/generate/be_fixed_cb.h create mode 100644 lib/libesp32/berry/generate/be_fixed_debug.h create mode 100644 lib/libesp32/berry/generate/be_fixed_flash.h create mode 100644 lib/libesp32/berry/generate/be_fixed_gc.h create mode 100644 lib/libesp32/berry/generate/be_fixed_global.h create mode 100644 lib/libesp32/berry/generate/be_fixed_gpio.h create mode 100644 lib/libesp32/berry/generate/be_fixed_introspect.h create mode 100644 lib/libesp32/berry/generate/be_fixed_json.h create mode 100644 lib/libesp32/berry/generate/be_fixed_light.h create mode 100644 lib/libesp32/berry/generate/be_fixed_m_builtin.h create mode 100644 lib/libesp32/berry/generate/be_fixed_math.h create mode 100644 lib/libesp32/berry/generate/be_fixed_os.h create mode 100644 lib/libesp32/berry/generate/be_fixed_path.h create mode 100644 lib/libesp32/berry/generate/be_fixed_solidify.h create mode 100644 lib/libesp32/berry/generate/be_fixed_strict.h create mode 100644 lib/libesp32/berry/generate/be_fixed_string.h create mode 100644 lib/libesp32/berry/generate/be_fixed_sys.h create mode 100644 lib/libesp32/berry/generate/be_fixed_tasmota_path.h create mode 100644 lib/libesp32/berry/generate/be_fixed_time.h create mode 100644 lib/libesp32/berry/generate/be_fixed_webserver.h create mode 100644 lib/libesp32/berry/include/be_ctypes.h create mode 100644 lib/libesp32/berry/include/be_lvgl.h create mode 100644 lib/libesp32/berry/library.json create mode 100644 lib/libesp32/berry/src/be_api.c create mode 100644 lib/libesp32/berry/src/be_baselib.c create mode 100644 lib/libesp32/berry/src/be_bytecode.c create mode 100644 lib/libesp32/berry/src/be_bytecode.h create mode 100644 lib/libesp32/berry/src/be_byteslib.c create mode 100644 lib/libesp32/berry/src/be_class.c create mode 100644 lib/libesp32/berry/src/be_class.h create mode 100644 lib/libesp32/berry/src/be_code.c create mode 100644 lib/libesp32/berry/src/be_code.h create mode 100644 lib/libesp32/berry/src/be_constobj.h create mode 100644 lib/libesp32/berry/src/be_debug.c create mode 100644 lib/libesp32/berry/src/be_debug.h create mode 100644 lib/libesp32/berry/src/be_debuglib.c create mode 100644 lib/libesp32/berry/src/be_decoder.h create mode 100644 lib/libesp32/berry/src/be_exec.c create mode 100644 lib/libesp32/berry/src/be_exec.h create mode 100644 lib/libesp32/berry/src/be_filelib.c create mode 100644 lib/libesp32/berry/src/be_func.c create mode 100644 lib/libesp32/berry/src/be_func.h create mode 100644 lib/libesp32/berry/src/be_gc.c create mode 100644 lib/libesp32/berry/src/be_gc.h create mode 100644 lib/libesp32/berry/src/be_gclib.c create mode 100644 lib/libesp32/berry/src/be_globallib.c create mode 100644 lib/libesp32/berry/src/be_introspectlib.c create mode 100644 lib/libesp32/berry/src/be_jsonlib.c create mode 100644 lib/libesp32/berry/src/be_lexer.c create mode 100644 lib/libesp32/berry/src/be_lexer.h create mode 100644 lib/libesp32/berry/src/be_libs.c create mode 100644 lib/libesp32/berry/src/be_libs.h create mode 100644 lib/libesp32/berry/src/be_list.c create mode 100644 lib/libesp32/berry/src/be_list.h create mode 100644 lib/libesp32/berry/src/be_listlib.c create mode 100644 lib/libesp32/berry/src/be_map.c create mode 100644 lib/libesp32/berry/src/be_map.h create mode 100644 lib/libesp32/berry/src/be_maplib.c create mode 100644 lib/libesp32/berry/src/be_mathlib.c create mode 100644 lib/libesp32/berry/src/be_mem.c create mode 100644 lib/libesp32/berry/src/be_mem.h create mode 100644 lib/libesp32/berry/src/be_module.c create mode 100644 lib/libesp32/berry/src/be_module.h create mode 100644 lib/libesp32/berry/src/be_object.c create mode 100644 lib/libesp32/berry/src/be_object.h create mode 100644 lib/libesp32/berry/src/be_opcodes.h create mode 100644 lib/libesp32/berry/src/be_oslib.c create mode 100644 lib/libesp32/berry/src/be_parser.c create mode 100644 lib/libesp32/berry/src/be_parser.h create mode 100644 lib/libesp32/berry/src/be_rangelib.c create mode 100644 lib/libesp32/berry/src/be_repl.c create mode 100644 lib/libesp32/berry/src/be_repl.h create mode 100644 lib/libesp32/berry/src/be_solidifylib.c create mode 100644 lib/libesp32/berry/src/be_strictlib.c create mode 100644 lib/libesp32/berry/src/be_string.c create mode 100644 lib/libesp32/berry/src/be_string.h create mode 100644 lib/libesp32/berry/src/be_strlib.c create mode 100644 lib/libesp32/berry/src/be_strlib.h create mode 100644 lib/libesp32/berry/src/be_sys.h create mode 100644 lib/libesp32/berry/src/be_syslib.c create mode 100644 lib/libesp32/berry/src/be_timelib.c create mode 100644 lib/libesp32/berry/src/be_var.c create mode 100644 lib/libesp32/berry/src/be_var.h create mode 100644 lib/libesp32/berry/src/be_vector.c create mode 100644 lib/libesp32/berry/src/be_vector.h create mode 100644 lib/libesp32/berry/src/be_vm.c create mode 100644 lib/libesp32/berry/src/be_vm.h create mode 100644 lib/libesp32/berry/src/berry.h create mode 100644 lib/libesp32/berry/src/berry_conf.h create mode 100755 lib/libesp32/berry/testall.be create mode 100644 lib/libesp32/berry/tests/assignment.be create mode 100644 lib/libesp32/berry/tests/bool.be create mode 100644 lib/libesp32/berry/tests/bytes.be create mode 100644 lib/libesp32/berry/tests/bytes_b64.be create mode 100644 lib/libesp32/berry/tests/bytes_fixed.be create mode 100644 lib/libesp32/berry/tests/checkspace.be create mode 100644 lib/libesp32/berry/tests/class.be create mode 100644 lib/libesp32/berry/tests/class_const.be create mode 100644 lib/libesp32/berry/tests/closure.be create mode 100644 lib/libesp32/berry/tests/compiler.be create mode 100644 lib/libesp32/berry/tests/compound.be create mode 100644 lib/libesp32/berry/tests/cond_expr.be create mode 100644 lib/libesp32/berry/tests/debug.be create mode 100644 lib/libesp32/berry/tests/exceptions.be create mode 100644 lib/libesp32/berry/tests/for.be create mode 100644 lib/libesp32/berry/tests/function.be create mode 100644 lib/libesp32/berry/tests/global.be create mode 100644 lib/libesp32/berry/tests/introspect.be create mode 100644 lib/libesp32/berry/tests/json.be create mode 100644 lib/libesp32/berry/tests/lexer.be create mode 100644 lib/libesp32/berry/tests/lexergc.be create mode 100644 lib/libesp32/berry/tests/list.be create mode 100644 lib/libesp32/berry/tests/member_indirect.be create mode 100644 lib/libesp32/berry/tests/os.be create mode 100644 lib/libesp32/berry/tests/overload.be create mode 100644 lib/libesp32/berry/tests/relop.be create mode 100644 lib/libesp32/berry/tests/string.be create mode 100644 lib/libesp32/berry/tests/subobject.be create mode 100644 lib/libesp32/berry/tests/suffix.be create mode 100644 lib/libesp32/berry/tests/super_auto.be create mode 100644 lib/libesp32/berry/tests/super_leveled.be create mode 100644 lib/libesp32/berry/tests/vararg.be create mode 100644 lib/libesp32/berry/tests/virtual_methods.be create mode 100644 lib/libesp32/berry/tests/virtual_methods2.be create mode 100644 lib/libesp32/berry/tools/coc/.gitignore create mode 100644 lib/libesp32/berry/tools/coc/Makefile create mode 100644 lib/libesp32/berry/tools/coc/REEADME.md create mode 100755 lib/libesp32/berry/tools/coc/block_builder.cpp create mode 100755 lib/libesp32/berry/tools/coc/block_builder.h create mode 100644 lib/libesp32/berry/tools/coc/coc_parser.cpp create mode 100644 lib/libesp32/berry/tools/coc/coc_parser.h create mode 100644 lib/libesp32/berry/tools/coc/coc_string.cpp create mode 100644 lib/libesp32/berry/tools/coc/coc_string.h create mode 100755 lib/libesp32/berry/tools/coc/hash_map.cpp create mode 100755 lib/libesp32/berry/tools/coc/hash_map.h create mode 100644 lib/libesp32/berry/tools/coc/macro_table.cpp create mode 100644 lib/libesp32/berry/tools/coc/macro_table.h create mode 100755 lib/libesp32/berry/tools/coc/main.cpp create mode 100644 lib/libesp32/berry/tools/coc/main.h create mode 100644 lib/libesp32/berry/tools/coc/object_block.h create mode 100644 lib/libesp32/berry/tools/coc/str_build.cpp create mode 100644 lib/libesp32/berry/tools/coc/str_build.h create mode 100755 lib/libesp32/berry/tools/grammar/berry.bytecode create mode 100644 lib/libesp32/berry/tools/grammar/berry.ebnf create mode 100755 lib/libesp32/berry/tools/grammar/const_obj.ebnf create mode 100644 lib/libesp32/berry/tools/grammar/json.ebnf create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/.vsixmanifest create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/CHANGELOG.md create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/README.md create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/berry-configuration.json create mode 100644 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/berry-icon.png create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/package.json create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/syntaxes/berry.json create mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-0.1.0/syntaxes/bytecode.json create mode 100644 lib/libesp32/berry/tools/pycoc/block_builder.py create mode 100644 lib/libesp32/berry/tools/pycoc/coc_parser.py create mode 100644 lib/libesp32/berry/tools/pycoc/coc_string.py create mode 100644 lib/libesp32/berry/tools/pycoc/coc_string_test.py create mode 100644 lib/libesp32/berry/tools/pycoc/hash_map.py create mode 100644 lib/libesp32/berry/tools/pycoc/macro_table.py create mode 100644 lib/libesp32/berry/tools/pycoc/main.py create mode 100644 lib/libesp32/berry/tools/pycoc/str_build.py diff --git a/lib/libesp32/berry/LICENSE b/lib/libesp32/berry/LICENSE new file mode 100644 index 000000000..609969272 --- /dev/null +++ b/lib/libesp32/berry/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-2020 Guan Wenliang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/libesp32/berry/Makefile b/lib/libesp32/berry/Makefile new file mode 100644 index 000000000..f9d61125d --- /dev/null +++ b/lib/libesp32/berry/Makefile @@ -0,0 +1,105 @@ +CFLAGS = -Wall -Wextra -std=c99 -pedantic-errors -O2 +LIBS = -lm +TARGET = berry +CC ?= gcc +MKDIR = mkdir +LFLAGS = + +INCPATH = src default +SRCPATH = src default +GENERATE = generate +CONFIG = default/berry_conf.h +COC = tools/coc/coc +PY = python3 +PYCOC = tools/pycoc/main.py +CONST_TAB = $(GENERATE)/be_const_strtab.h +MAKE_COC = $(MAKE) -C tools/coc + +ifeq ($(OS), Windows_NT) # Windows + CFLAGS += -Wno-format # for "%I64d" warning + LFLAGS += -Wl,--out-implib,berry.lib # export symbols lib for dll linked + TARGET := $(TARGET).exe + COC := $(COC).exe + PY := $(PY).exe +else + CFLAGS += -DUSE_READLINE_LIB + LIBS += -lreadline -ldl + OS := $(shell uname) + ifeq ($(OS), Linux) + LFLAGS += -Wl,--export-dynamic + endif +endif + +ifneq ($(V), 1) + Q=@ + MSG=@echo + MAKE_COC += -s Q=$(Q) +else + MSG=@true +endif + +ifeq ($(TEST), 1) + CFLAGS += -fprofile-arcs -ftest-coverage + LFLAGS += -fprofile-arcs -ftest-coverage +endif + +SRCS = $(foreach dir, $(SRCPATH), $(wildcard $(dir)/*.c)) +OBJS = $(patsubst %.c, %.o, $(SRCS)) +DEPS = $(patsubst %.c, %.d, $(SRCS)) +INCFLAGS = $(foreach dir, $(INCPATH), -I"$(dir)") + +.PHONY : clean + +all: $(TARGET) + +debug: CFLAGS += -O0 -g -DBE_DEBUG +debug: all + +test: CFLAGS += --coverage +test: LFLAGS += --coverage +test: all + $(MSG) [Run Testcases...] + $(Q) ./testall.be + $(Q) $(RM) */*.gcno */*.gcda + +$(TARGET): $(OBJS) + $(MSG) [Linking...] + $(Q) $(CC) $(OBJS) $(LFLAGS) $(LIBS) -o $@ + $(MSG) done + +$(OBJS): %.o: %.c + $(MSG) [Compile] $< + $(Q) $(CC) -MM $(CFLAGS) $(INCFLAGS) -MT"$*.d" -MT"$(<:.c=.o)" $< > $*.d + $(Q) $(CC) $(CFLAGS) $(INCFLAGS) -c $< -o $@ + +sinclude $(DEPS) + +$(OBJS): $(CONST_TAB) + +$(CONST_TAB): $(COC) $(GENERATE) $(SRCS) $(CONFIG) + $(MSG) [Prebuild] generate resources + $(Q) $(COC) -i $(SRCPATH) -c $(CONFIG) -o $(GENERATE) + +$(GENERATE): + $(Q) $(MKDIR) $(GENERATE) + +$(COC): + $(MSG) [Make] coc + $(Q) $(MAKE_COC) + +install: + cp $(TARGET) /usr/local/bin + +uninstall: + $(RM) /usr/local/bin/$(TARGET) + +prebuild: $(COC) $(GENERATE) + $(MSG) [Prebuild] generate resources + $(Q) $(PY) $(PYCOC) -o $(GENERATE) $(SRCPATH) -c $(CONFIG) + $(MSG) done + +clean: + $(MSG) [Clean...] + $(Q) $(RM) $(OBJS) $(DEPS) $(GENERATE)/* berry.lib + $(Q) $(MAKE_COC) clean + $(MSG) done diff --git a/lib/libesp32/berry/README.md b/lib/libesp32/berry/README.md new file mode 100644 index 000000000..6d02dcd38 --- /dev/null +++ b/lib/libesp32/berry/README.md @@ -0,0 +1,163 @@ +

+

+ Berry +

+

The Berry Script Language.

+

+ +## Introduction + +Berry is a ultra-lightweight dynamically typed embedded scripting language. It is designed for lower-performance embedded devices. The Berry interpreter-core's code size is less than 40KiB and can run on less than 4KiB heap (on ARM Cortex M4 CPU, Thumb ISA and ARMCC compiler). + +The interpreter of Berry include a one-pass compiler and register-based VM, all the code is written in ANSI C99. In Berry not every type is a class object. Some simple value types, such as int, real, boolean and string are not class object, but list, map and range are class object. This is a consideration about performance. +Register-based VM is the same meaning as above. + +Berry has the following advantages: + +* Lightweight: A well-optimized interpreter with very little resources. Ideal for use in microprocessors. +* Fast: optimized one-pass bytecode compiler and register-based virtual machine. +* Powerful: supports imperative programming, object-oriented programming, functional programming. +* Flexible: Berry is a dynamic type script, and it's intended for embedding in applications. It can provide good dynamic scalability for the host system. +* Simple: simple and natural syntax, support garbage collection, and easy to use FFI (foreign function interface). +* RAM saving: With compile-time object construction, most of the constant objects are stored in read-only code data segments, so the RAM usage of the interpreter is very low when it starts. + +## Documents + +LaTeX documents repository: [https://github.com/Skiars/berry_doc](https://github.com/Skiars/berry_doc) + +Short Manual: [berry_short_manual.pdf](https://github.com/Skiars/berry_doc/releases/download/latest/berry_short_manual.pdf). + +Reference Manual: [berry_rm_en_us.pdf](https://github.com/Skiars/berry_doc/releases/download/latest/berry_rm_en_us.pdf), [berry_rm_zh_cn.pdf](https://github.com/Skiars/berry_doc/releases/download/latest/berry_rm_zh_cn.pdf). + +Berry's EBNF grammar definition: [tools/grammar/berry.ebnf](./tools/grammar/berry.ebnf) + +## Features + +* Base Type + * Nil: `nil` + * Boolean: `true` and `false` + * Numerical: Integer (`int`) and Real (`real`) + * String: Single quotation-mark string and double quotation-mark string + * Class: Instance template, read only + * Instance: Object constructed by class + * Module: Read-write key-value pair table + * List: Ordered container, like `[1, 2, 3]` + * Map: Hash Map container, like `{ 'a': 1, 2: 3, 'map': {} }` + * Range: include a lower and a upper integer value, like `0..5` +* Operator and Expression + * Assign operator: `=`, `+=`, `-=`, `*=`, `/=`, `%=`, `&=`, `|=`, `^=`, `<<=`, `>>=` + * Relational operator: `<`, `<=`, `==`, `!=`, `>`, `>=` + * Logic operator: `&&`, `||`, `!` + * Arithmetic operator: `+`, `-`, `*`, `/`, `%` + * Bitwise operator: `&`, `|`, `~`, `^`, `<<`, `>>` + * Field operator: `.` + * Subscript operator: `[]` + * Connect string operator: `+` + * Conditional operator: `? :` + * Brackets: `()` +* Control Structure + * Conditional statement: `if-else` + * Iteration statement: `while` and `for` + * Jump statement: `break` and `continue` +* Function + * Local variable and block scope + * Return statement + * Nested functions definition + * Closure based on Upvalue + * Anonymous function + * Lambda expression +* Class + * Inheritance (only public single inheritance) + * Method and Operator Overload + * Constructor method + * Destructive method +* Module Management + * Built-in module that takes almost no RAM + * Extension module support: script module, bytecode file module and shared library (like *.so, *.dll) module +* GC (Garbage collection) + * Mark-Sweep GC +* Exceptional Handling + * Throw any exception value using the `raise` statement + * Multiple catch mode +* Bytecode file support + * Export function to bytecode file + * Load the bytecode file and execute + +## Build and Run + +1. Install the readline library (Windows does not need): + + ``` bash + sudo apt install libreadline-dev # Ubuntu + brew install readline # MacOS + ``` + +2. Build (The default compiler is GCC): + + ``` + make + ``` + +3. Run: + + ``` bash + ./berry # Bash or PowerShell + berry # Windows CMD + ``` + +4. Install (Only Unix-like): + + ``` bash + make install + ``` + +## Editor pulgins + +[Visual Studio Code](https://code.visualstudio.com/) pulgin are in this directory: [./tools/pulgins/vscode](./tools/pulgins/vscode). + +## Examples + +After compiling successfully, use the `berry` command with no parameters to enter the REPL environment: +``` +Berry 0.0.1 (build in Dec 24 2018, 18:12:49) +[GCC 8.2.0] on Linux (default) +> +``` + +Now enter this code: + +``` lua +print("Hello world!") +``` + +You will see this output: + +``` +Hello world! +``` + +You can copy this code to the REPL: + +``` ruby +def fib(x) + if x <= 1 + return x + end + return fib(x - 1) + fib(x - 2) +end +fib(10) +``` + +This example code will output the result `55` and you can save the above code to a plain text file (eg test.be) and run this command: + +``` bash +./berry test.be +``` + +This will also get the correct output. + +## License + +Berry is free software distributed under the [MIT license](./LICENSE). + +The Berry interpreter partly referred to [Lua](http://www.lua.org/)'s design. View Lua's license here: http://www.lua.org/license.html. diff --git a/lib/libesp32/berry/berry-logo.png b/lib/libesp32/berry/berry-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb41908963a04e02ea5aa91d264903b1c0895e2 GIT binary patch literal 11325 zcmX9^cRbYpAOD~TDI+6Mvd5jBz2|X8WS$i{oEaINnX=CwciG`iR!C=NWn`Sl6&kX) zvSo$e`TqX!IFI-H^?tqI@7MgiU$1BUeIs2u8g?200O<4}TBZO%4h8@+$}5zlk#ct& zJL!k|F~s@_0I)J%{E@j95=m6RO@D1G{|7!U{y~m@a6sMJ#|h4*=jG@MH-$SoBYg+p zN&p}-sHdfF_VmZ^{AnMKf&6bCI+=LlhF?>I-_Fg(+28UiJx13w9m2m^Q9V3ad^YoJ z{x>&u>YZmgKBJmkG*rA|WYQXEKvF@bEL~)X99O6Njh;BMVPtOYM6-74(p*1F&26Ixs+mM}%7_X{AYe-ZHKSUsA$MZIHrv z8Bl`(#MG=(1(jk+T947U>;nV}eKr683^sOKV5!(vrwy7EM%nnZ8=zx_eEc>=A!`*)t=nB4N4aE6w9(x?&IjWN2b9dorS965e&Os9Sk! zcQKl-1Hc1369`F3>#S`-RbTQ5$AxKSpe8WhyAFtRYQeaC9Mc9G+Q_LA zEBbGqVMdf#fM-$SN|&tr_04;kyfCz|OOh#kGe!VOS)Jb22w_!O`8<8A{=WYVsLn~T zGOgBMh-50*%c;z{Y4MF-31mR$eZ_7qTX8NC^}SIw3;Ty)Ml@wF06e_L4HmB~gRt1> zrSlUo9+~~Lo-2N27i;}8v-o~-p=!+p)6%-SdTfAa(m%LjVjq&5lvga9WNGU!SUKZ9 zGv4$e1Bj6jS`GnWMiXi?CClj9!htA0HLDAYhd7wB;IaL8O_;fbztGY`b1xJM(KAKI zXu-2h)&HZZ)xIBdJtmZ%<-bjtGfE2mY6qztFHDgu&F$)flbZO46!U!vK1t+^m>kNlq50$%O|T&edCGF1qU@4C^NGqxcxXLOZLit);10qRJ*?h(VtEI`j0N^ z!V2D^eL|NB5u2yF4yRNJ&K}yVEPolvfm-12ZH2C^S~K$z*-J_{vZ$zP{%sa+I^?bY zacDgpJ-bX(E;sqWH|p|#N2_AUy1XB%+4+{qE$yX7Ez5xZ3#W_iJ=3z>_eQ^VNj|C0 zNGWXn>*%vdTNB!J?osngl?$FgWt$v@GnBY+1DSsPSMc7$s2^=-s}85r0)-)mU;0or z5%_cDep5uw`yo!}==;iy=+xp1zB}lw7WzLCx17H?TND-D`1VjGQ^NXgTRLB)vXbIT2aIFTyEVa8}E77P~g zN+2f*WB_VGo<+=KzVz`HgpG>i77M~6V=E=hoFdis6yzDySEw9cVM*?iHt%%2WEdY!^Lf_yCBh_4mD@gIMFkYog(*;OiB%)F+q z2h1Y)D=#T}rN6F~E>2N2Gn9dh|0>)({qZ*>o^w96qr4Kp+hc^ zxV?S*!B&vylxn|nn#A12ATJ|}9%Wz__d(&*6st-DSNBE|#5U(EDe@2{-_$~CFkk;& zp4WXJ;U%)%mL#e>M=a&PIN-p_5S7j1*`2VbYY#U^j5%9(=D!%*pAa4x3mrY@3c1yG zz9NE4`X$zu`9&yHgb|aPbKw9VsR{kRata0OcV{O*oF+93Kn&DV;l%Yq(fl)1o5M)( zkei4C`Wpl3vj!orXT?9 zr$2&DNWN5Bv8c_y&ivD7=&HrdHs*L}EXiBdMzM=8LqSL`O_5}qH^kRKql zptEWPWn<8ohBx~ja%+Af>1cC%DgbELCoNwhpA6XVx}F)lC*XSUx35Yj-Tu&>SL9Fe z6j$&t%C;kbDUeRr?i(FD&bT^@<2GUa?*F+Zz9oHPk(AsF8q*@RhGF6T1=3?>H6y1uYqa!Pw}emFaw9dNzmRvKO! zW!qT)BbU2W()CTwZn@G=HUCHRv3HF*0RsWBZ{{M!$l%OlIYCAi`-Cqj)V=J~6z&kV zu#*g*)*IAApaV@ujGAs2w`6c1@k<88%6R(8U2ckJ_{0o!!;Z)x_sOMu+>Wb$B10fi z+7^blewsSp|< zthTF;t(M!H$vEE_y_V?21}!4@PV?`TRcQXeV>m66Yzwn<<9z&e!LmY^)3xj-4o*ob zr%xYuL+V?1nZ9`Z;|n)f(AAzUkb|24bH?YH*M*wSM3FvueLuuw1`uBw=e-=7uWK)D*b8>#%m~ma6j#YbOtX5?)%lc`D=zv}N+z zF&!MyqkXvU8WBEQC>nZzsX_Nq+F_UNu_3s%@B0wZqWi`m%4b~=CJ27<@6$O|i_(FU$9Ik%{A4{F=!%$XdF;M`5XDScm$STTaW8Nv zZ0+lRN;gxFZ@L3-HkfOg?8Q}b#98El|5#2{hn|mG4tsArJ>2M2Kd} zLW**WYVO*y-=2Whs~tSVS%fh8l0D9BPCKuc61!es$@JJqJf+vjo9c9mq{PIt;4jg; zVYt>OvwsE;g3h`HrsWPs&!V$P;-oEb>A!auY~$V_sAGPou1+@w`|g{*TDWnn0AnXB z!dEt`F;62GQt{Ubg zCPzt|1>bs1sT2=*oBlO`v741M$;nPb_*c%RDkF|Z!YZ%izwgm98?*A4N-s3>?^j&$ z5Y9*5U+^H?(t%BKvZs$}+%#l%BMPrb zSM`_d*@za*_P2IJ|G=EIVc&40A0Ox_lcwE$MsfU$iXNwz#D2&)@;5N)JiKksYr@jk z%(?edAqWL!P(d1n4qSFFo(xI0dzY2Z(I!SrXVE+2FgUiq&EudP*022i6W1EtCVMO( z)@HC$=Bo?@35lwHgPR!lV9PsywLvwqP}&|dj$OUvk4&@yeXcK8;+I=y9X=?-gA@Zt z8sh7osw*l~EBd!b>WYOjHH||8!NTWivMujgLom8+jU}5|AC1`Mtre!;{w}Dj7#(dZ zXD6S-7JQO@7H|`O@Qt_w3vm$_Z4XK{dA-&>M*dY5#@{%S&cAhgRC%)=!?W3m>~y zz+*#F4y+^=sDk-MbD+z=2U=MsNZRvTcsV$!xQJ4SyM~Zc{rtRO?6I5ndAt4IN$yR% zb>ipxsjo?fUe9-bCmz|S)dabM-v5veF&gMdy4GA1fhG7LpHJH;mh*tq890kXGpzlJ z?8b^EJEIQmKOM@Kjc|d){PDJEw9KbA%O;D$NGiBDFHy2O$a4kW_-cqZ`aNbF8muR4 zM*LR2U^NlD!aI$2<^4hJ%o-mT9dCbG`?tWU9p9o{no_xM&Ui3{i{putFrswdb`=Q zy!QU`xH!(?<($!kVHT()SX{$GGs}x*ew}}s4rZkRSNRg^_Fx(Q+_ktUT{i|#3R0DW zZ@!*hK^5XT6)f*yd$k_@AgtILCcgJ^k&rMyur<`8Bx+3U2LO1{qpXIG-z&6DZ%A*bj=nWeiN-gn^xn_+A3|z#Zst|~OSWFNb2b$DRK!hj z@EYNW6#uaKhP^dLI%+YyY-Q{|e?z0y;476|lm+pn27ZAiu!e7JqsF9gRp93qx1w)F z!y)R8;h)V(rHik_^7jVILE5Kr=8t1D9O!7O;!oTi%P1bTJQCM?Z*ng{70U(6)2*vGk$Dl_2^90ltDz45!QO^QRA%=^z;BT00@) zg8~Di>4<+>$t`8@l?t{W`G?zFkFhaJF_RK|S?aLthx^EJCFBzOpu@P*x0G`EI(2E; zh5F1zq_L34A68uN8~Pwib%raP@*~=@gr}no%O(ed3yOxH=$iA!l_>KQlt0OXY+zH1 zO}M$l(RJarR=KRijKsyMnL96%{>*-SskgwdfP@Mu@zBBL2DyiX8u^*H!M&Z?!R?Ib zir}#fDK^i%V9H^*-oeg#4BwU?tTK8}e%heK*K}K4=V`jV!N!#br z(b`j((&aHd<7W9)tc&s_-^9fDqL2Grg$U<2Fxc`}QBd#02Onq6b=OU-?}6K5J{V0Z zpIVRgjsD81F?{UcPxtF*WO@94OfiTD?q$?0EovN&*5FD*i8#hTuXTWV+RlZ@e+mU1 zYr9uiw&39KrBf@c3Hnz=R(Ai$bH0NyJ-Rjs#I;8Wm+TFqqU$hyXV`9NGpTjoMxe^Y z5p&Nx~A~S`uDtG(LYcMm)jd~s$r@78{lq-ovrY+15M>mwj3?$ z(#&J@j?@NuHIS4ksNm)@-=~HJG)pVhqd^UBRy~Pl_4;mc4Mm$0{2<-oPnHNh#b9*9=hvcNV-%33)os~( zFeCO-KOtgQDB9`new&5_mPvYRK|!XzDyp3IW%FqYk)Gu){*{VBBOfAbOz&mEqxvFK z+rS9ygTlQtTbZpqX|n_qmZGXj>ju4%_f}1&(~%DvoGh2V@YZp+ZMw5`Ih7sAy-L&J z@zlG`_{Aha2i=w4wUlOalN$Bbs4en9lep|0HYxRoxJ6Gi1;tf0kKP*2X(Z|oM0BB) z?zf*nX*v0Dn?l$-iyT!Xi#+!+9{6a5Wx~AJy z1_GLR!N5aHA4xH1qh##SCSO03l;NchJ;V)*!8UIujj#1H?fNzwb*bo9EJ3Sb;o-++ ztu@fTAT5zxru#7$QS#c&fA zP8#eJPhR#(CdMP7Z#V?BbDz438Y%wHartY5z5J>ZD{f7csb0^=7-nJi6bwPveQ;)l zFRqsIuSu7K%;@qorTSdEdyagTTD{cl6;%Y_?=Nz%bn z3Ke@inq74WuC6rv>$ZZ~oqasEGJiR#u+MoCv|LB3==YYuQrD&VL?gZEvhDBjG5Y_S znP^}vcrYb`$>a<0>P~HlA87jW)m3VC6P9bSW;ghS{PG+rL#wf2O;|{GvwBJY0j#M!2>LtF ze6!6;@!i!CHdqo~{?F!kN09nKAjN6+k`mUOA|uLB3$~MN%G(~37uy&^@Z~FUeV4s; zQ1xlYvxOH-O9Sj|FvO0cKK9tAd|2pHpSQJK^%No&n2Z}h2paxLvr+r$eSyNIl6yH# zH5Yuc&|qkRZ}W8Zt*0^=BN%z1WoGX^L|Se|$tyvw@+FB;arSkFb$bhA)rrbu?QhbP z&%~g6PBHei@hj@uiygZ=Z+mNo_q~up~^g;vz_k8%+}cNAD-pj6MiTe|FbS~cVPGXl~CmM6@_00yQdyp zgLPS2!GnWCo{!ii1cjA#hu^IY?yuRhV(7vb2d|#o00#$mT$9<6su!t^k8_)N;o4n# z@GO4ER&tV>jo*Y^C5^?Bh?BCt4E2<5VIuzOhY@(CSX+rKksHB*c^0iW$40wNpqX-Zy{lr z5U%L_*nv@}>5xvXzPYBms-#q^1vhUPqBkxsR@l|DNznY1w(GxmwL5)rxE%f3{!e52mc7A0rT5ZG&Vy?o{2(9<4Zp?Ph0&%c zdD{*#VqGbzk}1+VJ*$c3Lr@_IrTVh>ZU*%%oazv-#Zmi;iUjd9(n!0IQjiX*_;cM$ zRaZ0j!y>T>E1qX^3Bh2E@rx`rLevH z?))yGwZ1HyJ&8$9goC{~$_-(}ikH_KKe?7=YTH5nV-V72_ za19PEAUzYzvlQheZL_ai+#_nZ{CsgoIuU8mF8g+3B&S`Kl04JdX!K#n>jD)GD1Uf* z2_HXxD|?eYlydR5k>uuUgdgMKs^LlMZ3VUk-JMyu#cR#}{8H2AKg6ZTcybBN}&gC3UFhA|fs?A&=8_4^q zK7AbX`Jw)?5`VCMNz>fQktOX`Kfe)>y}O0E-fe@J+T9T~l9c{xFkd{F{8uBDMb)?5 z-p*Ryxng^0esQvP<#IAU)IyL+5ju=<)PQ+zY~?mByE1<q*j5WG8u^z%b)cL|yP_Q$ED`gi79`rMVY4qLB zF~6)b3kz%6X_cGEts0xk9E&8#k7vcNztNhQ-4$=Rp6y(Dnba1TdhkiQV-k+AHp@R! zi`=!PhU#Uo!at4wc{TlH!PYR-!(}t3tcVra=3ZCrva+A;9v8Y{btE2t&zF&q88|GX zH*Q*==90Onjfj6Y=29YT*7{$Gsn@+e`Q;Qo2E9ypwC@6(MSnx}CnW57P4Y?&)qR zp41qsR^QzO8B&dWXGTbH?;%>_{JSSUkNChs4Bvd(A)>Q%C{16fzBglb-7-4myqDRA zFDL%$AjB5koqmFEg;|LeLXpxkSpTqVZdUAroC z!_O#EKjPXKi!O{?-%J})@4D_K#84y~?DiBJ56lj=A+r4CK=CV5FK;-4QDV@&X_F+a zpwKC^jo)>OuWhHoqzkUHM_#|o5KX>YECB3p6d0HnBH4_E_UPV z)A;1=E<1LB6-v?qLamM?ZUlH({} zvg=6QWEN+@ttgy%dN%E-t;oZsS_y>0BeCsCdW`Au_0(3ds7zG!yuKAIK$_-$Pto0p zsNRLvH1wb-otCyLQ+MnDQk5V6vqvZXI!A;|aI*3(1bD=LBzQIW`wPsjcx77Cjr!Qt zgj$eb(C&KEp6v|@=FWwy$1}vltx$Idk}K zc1o~%Xvty(O`!}^}lY6fUMoPCD+Bn0bTK)Ys z!@C)gdW!7u;!#3~WH>QIkK4*lXUv8S5i#q z&o4q;PDv@*R%sjd#}Mga_wCT%PBz9bs)1%O3O;pzduIiN+4or)R#!whN`)o8(=ir% zod$J{@ko9065bzN+uFXqa+-|?cQD(9Y^-X1ghD~0?<^$eOr;fep+9kFjpyczv#iQZ zIX=yG6Q3o-%1Y~8%gSD-P{Hm8i_#8Wg5SBy$uCfJomcE@`TYaNCO`o)>-I2WpoLe{nI2Btn|NIb`I<{qhz1p|Zhp4)Z(}&b z_3wy$=)GYb>&`(+%?(`i-FS{5A9+5cuEnCioyTNsATimH@Ky=LWba`7={CGM&3}2% z6UXPB`eQJ~jdm`*uD1U?)NIY?RDH3C(5;E#K_DKy1!f}gyoioB@pV@gh0eUblqghj z$kgT^DKx$#)%U-q$%B?paD%c3Mw@cM+PS1A{!?z!=L2ZwbDfZ%Of$Y`U};>53G*Hl zYXkzBhHq9dIQBIL4R6Q?oBy`E478_WDfmrTDjOVxjE^>RZ(FQzD(_wXLJNiF*QR%l zx)E9)y_Y9}L$pTj>8JNL!GHe4u44I;8z#4Ey~VWY9$OmA#cbEr(Q`WPHCE1_mA@E8 z^D|!s3Q`xsT2PWXMBD9#Yb@6*G3D|vMwug_*)t_dkz=5L0=?L0>%)c5j18Qoy2Nhu=;xK zCwTF!Kuh4QADbc9nk1BlBdIiWJBtpeE@2wr8;JXbzc*nd z|6$~KN`zC(uB&S}AZ;C8_MlZk&_w@mdRqD9Z7=C9|B^rsgkM1=GV)rJH6ywMX_rXf z44lFzjjpnhiPYhb<)lqB@0L6jEGwS__3QjKIhs>Hn)6YXhp#isa!d}~1RmZn%<`O; ztyFxR;o75I?YsL(suvNw@TQxm;OBf{RZmQNj!u5K|JrKb`O=uN7%XrMyG{j&eU4v9 z_iW}dL05d5urk{F5^g-m87;jqVXicdTm4i!y4$aB?BF2GC_IWDQ3e0>U*s;Lvkw4f zs6XXJs05^I!wO`Bi}V}tgK%ExW1H)kW`2=6hg2&5O_yswb!*6Ox3_4RA{!1y-VsLQpotl!XjqOR`c(TjT3 zpl#a@Y@q&WE7XaT1n5X{Tl%+~{g9u?C>ukhpIU5>r=THKD`^eR6!rQTveXE0@aC5z zW7mU*je?N8*E55)pBbTfWSvy*^|Bca9Y$K#L;BE3IepExF7RG9rDSNJ^IeG%KKNF% z+k;3Y6Zd5YP^h11--D;9(`cZR2eHZ*I?}zbyL&q>J77D*Q;F&;|6ZfC~Ms5VPU9-z>^BDZF zL@Gl5_$Q}#d3M^Z&+B7W=|3FOKb?ARa6uV(<2issEn*&QU6dM?YD7#t4z%foMv^6W z7zU1nzg+C*q=sThxVJkbMOO>_%PIAk$ag6fljx-L2FoSO7UTshmpDJEyXln6NCl)o zggJ(_t%+G^IUDa+bG1sHkh8Om>=U8$gpjn_DpMjbLrZEnN_I#fOh1>RCJMY|S$!iV zLc=!q2twg)TF2~}lE70PV)Dxj6Z9UAj|C%2N5#>XXS&?p926`NUBhDHf};lxAQF6ZqTp& zAL6O!a^2kzQMUhqk<@Lu6kT4Xiez|CYg|mCLA{IY=42XMPv@>SzcAM@Xt_Y}NHVip zKi9s^`chg`l#p|QB(Uwpah@Kbxfdgfvbi*?u}cpBU*6iQt#L{=XX?p~koS&*qzmbh z`g}rUz>Sp99eiSmlvuo9*Gid*cJG42NJK@rNw~tlLhrXWQh?f9AseJcouYr3P2I`c zy0TaQ{d9ssW#5w*AWw0%+vwUC|d z$kv6CQgoJ#HVHZgA#Cpu6O${=?$wbmNRMZu3S_kg#jL?vdr|B@l*}a>d1F{ae>B&|DkT z2KSDo*c3t&x;!~(^g%+L!nZCsMDXcwONwecIrka|LCo0xUSQvF54ol2UsjxD@{Ht( zrz_%KFJglPh4=r6GXDn;&Eu7#g*j!O*|Hsy1NI67(0)(>Bto)_C~*e_#+`sQ>@~ literal 0 HcmV?d00001 diff --git a/lib/libesp32/berry/default/be_animate_lib.c b/lib/libesp32/berry/default/be_animate_lib.c new file mode 100644 index 000000000..398f87b66 --- /dev/null +++ b/lib/libesp32/berry/default/be_animate_lib.c @@ -0,0 +1,712 @@ +/******************************************************************** + * Berry module `animate` + * + * To use: `import animate` + * + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_rotate_init, /* name */ + be_nested_proto( + 12, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(closure), + /* K2 */ be_nested_str(code), + /* K3 */ be_nested_str(push), + /* K4 */ be_nested_str(animate), + /* K5 */ be_nested_str(ins_ramp), + /* K6 */ be_nested_str(ins_goto), + /* K7 */ be_const_int(0), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[25]) { /* code */ + 0x60140003, // 0000 GETGBL R5 G3 + 0x5C180000, // 0001 MOVE R6 R0 + 0x7C140200, // 0002 CALL R5 1 + 0x8C140B00, // 0003 GETMET R5 R5 K0 + 0x7C140200, // 0004 CALL R5 1 + 0x90020201, // 0005 SETMBR R0 K1 R1 + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0xB81E0800, // 0008 GETNGBL R7 K4 + 0x8C1C0F05, // 0009 GETMET R7 R7 K5 + 0x5C240400, // 000A MOVE R9 R2 + 0x5C280600, // 000B MOVE R10 R3 + 0x5C2C0800, // 000C MOVE R11 R4 + 0x7C1C0800, // 000D CALL R7 4 + 0x7C140400, // 000E CALL R5 2 + 0x88140102, // 000F GETMBR R5 R0 K2 + 0x8C140B03, // 0010 GETMET R5 R5 K3 + 0xB81E0800, // 0011 GETNGBL R7 K4 + 0x8C1C0F06, // 0012 GETMET R7 R7 K6 + 0x58240007, // 0013 LDCONST R9 K7 + 0x58280007, // 0014 LDCONST R10 K7 + 0x582C0007, // 0015 LDCONST R11 K7 + 0x7C1C0800, // 0016 CALL R7 4 + 0x7C140400, // 0017 CALL R5 2 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_rotate +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_rotate, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(Animate_rotate_init_closure) }, + })), + be_str_literal("Animate_rotate") +); + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_from_to_init, /* name */ + be_nested_proto( + 12, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(closure), + /* K2 */ be_nested_str(code), + /* K3 */ be_nested_str(push), + /* K4 */ be_nested_str(animate), + /* K5 */ be_nested_str(ins_ramp), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x60140003, // 0000 GETGBL R5 G3 + 0x5C180000, // 0001 MOVE R6 R0 + 0x7C140200, // 0002 CALL R5 1 + 0x8C140B00, // 0003 GETMET R5 R5 K0 + 0x7C140200, // 0004 CALL R5 1 + 0x90020201, // 0005 SETMBR R0 K1 R1 + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0xB81E0800, // 0008 GETNGBL R7 K4 + 0x8C1C0F05, // 0009 GETMET R7 R7 K5 + 0x5C240400, // 000A MOVE R9 R2 + 0x5C280600, // 000B MOVE R10 R3 + 0x5C2C0800, // 000C MOVE R11 R4 + 0x7C1C0800, // 000D CALL R7 4 + 0x7C140400, // 000E CALL R5 2 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_from_to +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_from_to, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(Animate_from_to_init_closure) }, + })), + be_str_literal("Animate_from_to") +); + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_back_forth_init, /* name */ + be_nested_proto( + 12, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(closure), + /* K2 */ be_nested_str(code), + /* K3 */ be_nested_str(push), + /* K4 */ be_nested_str(animate), + /* K5 */ be_nested_str(ins_ramp), + /* K6 */ be_const_int(2), + /* K7 */ be_nested_str(ins_goto), + /* K8 */ be_const_int(0), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[34]) { /* code */ + 0x60140003, // 0000 GETGBL R5 G3 + 0x5C180000, // 0001 MOVE R6 R0 + 0x7C140200, // 0002 CALL R5 1 + 0x8C140B00, // 0003 GETMET R5 R5 K0 + 0x7C140200, // 0004 CALL R5 1 + 0x90020201, // 0005 SETMBR R0 K1 R1 + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0xB81E0800, // 0008 GETNGBL R7 K4 + 0x8C1C0F05, // 0009 GETMET R7 R7 K5 + 0x5C240400, // 000A MOVE R9 R2 + 0x5C280600, // 000B MOVE R10 R3 + 0x0C2C0906, // 000C DIV R11 R4 K6 + 0x7C1C0800, // 000D CALL R7 4 + 0x7C140400, // 000E CALL R5 2 + 0x88140102, // 000F GETMBR R5 R0 K2 + 0x8C140B03, // 0010 GETMET R5 R5 K3 + 0xB81E0800, // 0011 GETNGBL R7 K4 + 0x8C1C0F05, // 0012 GETMET R7 R7 K5 + 0x5C240600, // 0013 MOVE R9 R3 + 0x5C280400, // 0014 MOVE R10 R2 + 0x0C2C0906, // 0015 DIV R11 R4 K6 + 0x7C1C0800, // 0016 CALL R7 4 + 0x7C140400, // 0017 CALL R5 2 + 0x88140102, // 0018 GETMBR R5 R0 K2 + 0x8C140B03, // 0019 GETMET R5 R5 K3 + 0xB81E0800, // 001A GETNGBL R7 K4 + 0x8C1C0F07, // 001B GETMET R7 R7 K7 + 0x58240008, // 001C LDCONST R9 K8 + 0x58280008, // 001D LDCONST R10 K8 + 0x582C0008, // 001E LDCONST R11 K8 + 0x7C1C0800, // 001F CALL R7 4 + 0x7C140400, // 0020 CALL R5 2 + 0x80000000, // 0021 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_back_forth +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_back_forth, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(Animate_back_forth_init_closure) }, + })), + be_str_literal("Animate_back_forth") +); + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_ins_goto_init, /* name */ + be_nested_proto( + 4, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(pc_rel), + /* K1 */ be_nested_str(pc_abs), + /* K2 */ be_nested_str(duration), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_ins_goto +********************************************************************/ +be_local_class(Animate_ins_goto, + 3, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(pc_rel, -1), be_const_var(0) }, + { be_const_key(duration, -1), be_const_var(2) }, + { be_const_key(pc_abs, -1), be_const_var(1) }, + { be_const_key(init, 2), be_const_closure(Animate_ins_goto_init_closure) }, + })), + be_str_literal("Animate_ins_goto") +); + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_ins_ramp_init, /* name */ + be_nested_proto( + 4, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(a), + /* K1 */ be_nested_str(b), + /* K2 */ be_nested_str(duration), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_ins_ramp +********************************************************************/ +be_local_class(Animate_ins_ramp, + 3, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(a, -1), be_const_var(0) }, + { be_const_key(b, 2), be_const_var(1) }, + { be_const_key(duration, -1), be_const_var(2) }, + { be_const_key(init, -1), be_const_closure(Animate_ins_ramp_init_closure) }, + })), + be_str_literal("Animate_ins_ramp") +); + +/******************************************************************** +** Solidified function: run +********************************************************************/ +be_local_closure(Animate_engine_run, /* name */ + be_nested_proto( + 6, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(millis), + /* K2 */ be_nested_str(value), + /* K3 */ be_nested_str(ins_time), + /* K4 */ be_nested_str(running), + /* K5 */ be_nested_str(add_driver), + }), + &be_const_str_run, + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0203, // 0001 EQ R3 R1 R3 + 0x780E0003, // 0002 JMPF R3 #0007 + 0xB80E0000, // 0003 GETNGBL R3 K0 + 0x8C0C0701, // 0004 GETMET R3 R3 K1 + 0x7C0C0200, // 0005 CALL R3 1 + 0x5C040600, // 0006 MOVE R1 R3 + 0x4C0C0000, // 0007 LDNIL R3 + 0x200C0403, // 0008 NE R3 R2 R3 + 0x780E0000, // 0009 JMPF R3 #000B + 0x90020402, // 000A SETMBR R0 K2 R2 + 0x90020601, // 000B SETMBR R0 K3 R1 + 0x500C0200, // 000C LDBOOL R3 1 0 + 0x90020803, // 000D SETMBR R0 K4 R3 + 0xB80E0000, // 000E GETNGBL R3 K0 + 0x8C0C0705, // 000F GETMET R3 R3 K5 + 0x5C140000, // 0010 MOVE R5 R0 + 0x7C0C0400, // 0011 CALL R3 2 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_engine_init, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(code), + /* K1 */ be_nested_str(pc), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str(ins_time), + /* K4 */ be_nested_str(running), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x60040012, // 0000 GETGBL R1 G18 + 0x7C040000, // 0001 CALL R1 0 + 0x90020001, // 0002 SETMBR R0 K0 R1 + 0x90020302, // 0003 SETMBR R0 K1 K2 + 0x90020702, // 0004 SETMBR R0 K3 K2 + 0x50040000, // 0005 LDBOOL R1 0 0 + 0x90020801, // 0006 SETMBR R0 K4 R1 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: autorun +********************************************************************/ +be_local_closure(Animate_engine_autorun, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(run), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(add_driver), + }), + &be_const_str_autorun, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x5C140200, // 0001 MOVE R5 R1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x7C0C0600, // 0003 CALL R3 3 + 0xB80E0200, // 0004 GETNGBL R3 K1 + 0x8C0C0702, // 0005 GETMET R3 R3 K2 + 0x5C140000, // 0006 MOVE R5 R0 + 0x7C0C0400, // 0007 CALL R3 2 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Animate_engine_stop, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(running), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(remove_driver), + }), + &be_const_str_stop, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x50040000, // 0000 LDBOOL R1 0 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x5C0C0000, // 0004 MOVE R3 R0 + 0x7C040400, // 0005 CALL R1 2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_running +********************************************************************/ +be_local_closure(Animate_engine_is_running, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(running), + }), + &be_const_str_is_running, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: every_50ms +********************************************************************/ +be_local_closure(Animate_engine_every_50ms, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(animate), + }), + &be_const_str_every_50ms, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Animate_engine_animate, /* name */ + be_nested_proto( + 12, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[22]) { /* constants */ + /* K0 */ be_nested_str(running), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(millis), + /* K3 */ be_nested_str(ins_time), + /* K4 */ be_nested_str(pc), + /* K5 */ be_nested_str(code), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str(internal_error), + /* K8 */ be_nested_str(Animate_X20pc_X20is_X20out_X20of_X20range), + /* K9 */ be_nested_str(animate), + /* K10 */ be_nested_str(ins_ramp), + /* K11 */ be_nested_str(closure), + /* K12 */ be_nested_str(duration), + /* K13 */ be_nested_str(value), + /* K14 */ be_nested_str(scale_uint), + /* K15 */ be_nested_str(a), + /* K16 */ be_nested_str(b), + /* K17 */ be_const_int(1), + /* K18 */ be_nested_str(ins_goto), + /* K19 */ be_nested_str(pc_rel), + /* K20 */ be_nested_str(pc_abs), + /* K21 */ be_nested_str(unknown_X20instruction), + }), + &be_const_str_animate, + &be_const_str_solidified, + ( &(const binstruction[99]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0000, // 0001 JMPT R2 #0003 + 0x80000400, // 0002 RET 0 + 0x4C080000, // 0003 LDNIL R2 + 0x1C080202, // 0004 EQ R2 R1 R2 + 0x780A0003, // 0005 JMPF R2 #000A + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x7C080200, // 0008 CALL R2 1 + 0x5C040400, // 0009 MOVE R1 R2 + 0x50080200, // 000A LDBOOL R2 1 0 + 0x780A0054, // 000B JMPF R2 #0061 + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x04080202, // 000D SUB R2 R1 R2 + 0x880C0104, // 000E GETMBR R3 R0 K4 + 0x6010000C, // 000F GETGBL R4 G12 + 0x88140105, // 0010 GETMBR R5 R0 K5 + 0x7C100200, // 0011 CALL R4 1 + 0x280C0604, // 0012 GE R3 R3 R4 + 0x780E0002, // 0013 JMPF R3 #0017 + 0x500C0000, // 0014 LDBOOL R3 0 0 + 0x90020003, // 0015 SETMBR R0 K0 R3 + 0x70020049, // 0016 JMP #0061 + 0x880C0104, // 0017 GETMBR R3 R0 K4 + 0x140C0706, // 0018 LT R3 R3 K6 + 0x780E0000, // 0019 JMPF R3 #001B + 0xB0060F08, // 001A RAISE 1 K7 K8 + 0x880C0104, // 001B GETMBR R3 R0 K4 + 0x88100105, // 001C GETMBR R4 R0 K5 + 0x940C0803, // 001D GETIDX R3 R4 R3 + 0x6014000F, // 001E GETGBL R5 G15 + 0x5C180600, // 001F MOVE R6 R3 + 0xB81E1200, // 0020 GETNGBL R7 K9 + 0x881C0F0A, // 0021 GETMBR R7 R7 K10 + 0x7C140400, // 0022 CALL R5 2 + 0x78160020, // 0023 JMPF R5 #0045 + 0x8810010B, // 0024 GETMBR R4 R0 K11 + 0x8814070C, // 0025 GETMBR R5 R3 K12 + 0x14140405, // 0026 LT R5 R2 R5 + 0x7816000E, // 0027 JMPF R5 #0037 + 0xB8160200, // 0028 GETNGBL R5 K1 + 0x8C140B0E, // 0029 GETMET R5 R5 K14 + 0x5C1C0400, // 002A MOVE R7 R2 + 0x58200006, // 002B LDCONST R8 K6 + 0x8824070C, // 002C GETMBR R9 R3 K12 + 0x8828070F, // 002D GETMBR R10 R3 K15 + 0x882C0710, // 002E GETMBR R11 R3 K16 + 0x7C140C00, // 002F CALL R5 6 + 0x90021A05, // 0030 SETMBR R0 K13 R5 + 0x78120002, // 0031 JMPF R4 #0035 + 0x5C140800, // 0032 MOVE R5 R4 + 0x8818010D, // 0033 GETMBR R6 R0 K13 + 0x7C140200, // 0034 CALL R5 1 + 0x7002002A, // 0035 JMP #0061 + 0x7002000C, // 0036 JMP #0044 + 0x88140710, // 0037 GETMBR R5 R3 K16 + 0x90021A05, // 0038 SETMBR R0 K13 R5 + 0x78120002, // 0039 JMPF R4 #003D + 0x5C140800, // 003A MOVE R5 R4 + 0x8818010D, // 003B GETMBR R6 R0 K13 + 0x7C140200, // 003C CALL R5 1 + 0x88140104, // 003D GETMBR R5 R0 K4 + 0x00140B11, // 003E ADD R5 R5 K17 + 0x90020805, // 003F SETMBR R0 K4 R5 + 0x8814070C, // 0040 GETMBR R5 R3 K12 + 0x04140405, // 0041 SUB R5 R2 R5 + 0x04140205, // 0042 SUB R5 R1 R5 + 0x90020605, // 0043 SETMBR R0 K3 R5 + 0x7002001A, // 0044 JMP #0060 + 0x6010000F, // 0045 GETGBL R4 G15 + 0x5C140600, // 0046 MOVE R5 R3 + 0xB81A1200, // 0047 GETNGBL R6 K9 + 0x88180D12, // 0048 GETMBR R6 R6 K18 + 0x7C100400, // 0049 CALL R4 2 + 0x78120013, // 004A JMPF R4 #005F + 0x8810070C, // 004B GETMBR R4 R3 K12 + 0x14100404, // 004C LT R4 R2 R4 + 0x78120001, // 004D JMPF R4 #0050 + 0x70020011, // 004E JMP #0061 + 0x7002000D, // 004F JMP #005E + 0x88100713, // 0050 GETMBR R4 R3 K19 + 0x20100906, // 0051 NE R4 R4 K6 + 0x78120004, // 0052 JMPF R4 #0058 + 0x88100104, // 0053 GETMBR R4 R0 K4 + 0x88140713, // 0054 GETMBR R5 R3 K19 + 0x00100805, // 0055 ADD R4 R4 R5 + 0x90020804, // 0056 SETMBR R0 K4 R4 + 0x70020001, // 0057 JMP #005A + 0x88100714, // 0058 GETMBR R4 R3 K20 + 0x90020804, // 0059 SETMBR R0 K4 R4 + 0x8810070C, // 005A GETMBR R4 R3 K12 + 0x04100404, // 005B SUB R4 R2 R4 + 0x04100204, // 005C SUB R4 R1 R4 + 0x90020604, // 005D SETMBR R0 K3 R4 + 0x70020000, // 005E JMP #0060 + 0xB0060F15, // 005F RAISE 1 K7 K21 + 0x7001FFA8, // 0060 JMP #000A + 0x8808010D, // 0061 GETMBR R2 R0 K13 + 0x80040400, // 0062 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_engine +********************************************************************/ +be_local_class(Animate_engine, + 6, + NULL, + be_nested_map(13, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(code, -1), be_const_var(0) }, + { be_const_key(run, 4), be_const_closure(Animate_engine_run_closure) }, + { be_const_key(running, 8), be_const_var(4) }, + { be_const_key(init, -1), be_const_closure(Animate_engine_init_closure) }, + { be_const_key(autorun, -1), be_const_closure(Animate_engine_autorun_closure) }, + { be_const_key(value, -1), be_const_var(5) }, + { be_const_key(stop, 3), be_const_closure(Animate_engine_stop_closure) }, + { be_const_key(pc, -1), be_const_var(2) }, + { be_const_key(is_running, 11), be_const_closure(Animate_engine_is_running_closure) }, + { be_const_key(every_50ms, 10), be_const_closure(Animate_engine_every_50ms_closure) }, + { be_const_key(animate, -1), be_const_closure(Animate_engine_animate_closure) }, + { be_const_key(closure, -1), be_const_var(1) }, + { be_const_key(ins_time, 9), be_const_var(3) }, + })), + be_str_literal("Animate_engine") +); + +/******************************************************************** +** Solidified module: animate +********************************************************************/ +be_local_module(animate, + "animate", + be_nested_map(6, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(rotate, 2), be_const_class(be_class_Animate_rotate) }, + { be_const_key(from_to, 3), be_const_class(be_class_Animate_from_to) }, + { be_const_key(back_forth, -1), be_const_class(be_class_Animate_back_forth) }, + { be_const_key(ins_goto, -1), be_const_class(be_class_Animate_ins_goto) }, + { be_const_key(ins_ramp, -1), be_const_class(be_class_Animate_ins_ramp) }, + { be_const_key(engine, -1), be_const_class(be_class_Animate_engine) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(animate); +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_autoconf_lib.c b/lib/libesp32/berry/default/be_autoconf_lib.c new file mode 100644 index 000000000..da41707c7 --- /dev/null +++ b/lib/libesp32/berry/default/be_autoconf_lib.c @@ -0,0 +1,1394 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import autoconf` + * + *******************************************************************/ +#include "be_constobj.h" + + +/******************************************************************** +** Solidified function: page_autoconf_ctl +********************************************************************/ +be_local_closure(Autoconf_page_autoconf_ctl, /* name */ + be_nested_proto( + 13, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[41]) { /* constants */ + /* K0 */ be_nested_str(webserver), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(path), + /* K3 */ be_nested_str(check_privileged_access), + /* K4 */ be_nested_str(has_arg), + /* K5 */ be_nested_str(reapply), + /* K6 */ be_nested_str(tasmota), + /* K7 */ be_nested_str(log), + /* K8 */ be_nested_str(CFG_X3A_X20removing_X20first_X20time_X20marker), + /* K9 */ be_const_int(2), + /* K10 */ be_nested_str(clear_first_time), + /* K11 */ be_nested_str(redirect), + /* K12 */ be_nested_str(_X2F_X3Frst_X3D), + /* K13 */ be_nested_str(zip), + /* K14 */ be_nested_str(CFG_X3A_X20removing_X20autoconf_X20files), + /* K15 */ be_nested_str(delete_all_configs), + /* K16 */ be_nested_str(arg), + /* K17 */ be_nested_str(reset), + /* K18 */ be_nested_str(format), + /* K19 */ be_nested_str(https_X3A_X2F_X2Fraw_X2Egithubusercontent_X2Ecom_X2Ftasmota_X2Fautoconf_X2Fmain_X2F_X25s_X2F_X25s_X2Eautoconf), + /* K20 */ be_nested_str(arch), + /* K21 */ be_nested_str(CFG_X3A_X20downloading_X20_X27_X25s_X27), + /* K22 */ be_nested_str(_X25s_X2Eautoconf), + /* K23 */ be_nested_str(webclient), + /* K24 */ be_nested_str(begin), + /* K25 */ be_nested_str(GET), + /* K26 */ be_nested_str(return_X20code_X3D_X25i), + /* K27 */ be_nested_str(connection_error), + /* K28 */ be_nested_str(write_file), + /* K29 */ be_nested_str(close), + /* K30 */ be_nested_str(value_error), + /* K31 */ be_nested_str(Unknown_X20command), + /* K32 */ be_nested_str(CFG_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s), + /* K33 */ be_nested_str(content_start), + /* K34 */ be_nested_str(Parameter_X20error), + /* K35 */ be_nested_str(content_send_style), + /* K36 */ be_nested_str(content_send), + /* K37 */ be_nested_str(_X3Cp_X20style_X3D_X27width_X3A340px_X3B_X27_X3E_X3Cb_X3EException_X3A_X3C_X2Fb_X3E_X3Cbr_X3E_X27_X25s_X27_X3Cbr_X3E_X25s_X3C_X2Fp_X3E), + /* K38 */ be_nested_str(content_button), + /* K39 */ be_nested_str(BUTTON_CONFIGURATION), + /* K40 */ be_nested_str(content_stop), + }), + &be_const_str_page_autoconf_ctl, + &be_const_str_solidified, + ( &(const binstruction[117]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0xA40E0400, // 0002 IMPORT R3 K2 + 0x8C100303, // 0003 GETMET R4 R1 K3 + 0x7C100200, // 0004 CALL R4 1 + 0x74120001, // 0005 JMPT R4 #0008 + 0x4C100000, // 0006 LDNIL R4 + 0x80040800, // 0007 RET 1 R4 + 0xA802004E, // 0008 EXBLK 0 #0058 + 0x8C100304, // 0009 GETMET R4 R1 K4 + 0x58180005, // 000A LDCONST R6 K5 + 0x7C100400, // 000B CALL R4 2 + 0x7812000A, // 000C JMPF R4 #0018 + 0xB8120C00, // 000D GETNGBL R4 K6 + 0x8C100907, // 000E GETMET R4 R4 K7 + 0x58180008, // 000F LDCONST R6 K8 + 0x581C0009, // 0010 LDCONST R7 K9 + 0x7C100600, // 0011 CALL R4 3 + 0x8C10010A, // 0012 GETMET R4 R0 K10 + 0x7C100200, // 0013 CALL R4 1 + 0x8C10030B, // 0014 GETMET R4 R1 K11 + 0x5818000C, // 0015 LDCONST R6 K12 + 0x7C100400, // 0016 CALL R4 2 + 0x7002003D, // 0017 JMP #0056 + 0x8C100304, // 0018 GETMET R4 R1 K4 + 0x5818000D, // 0019 LDCONST R6 K13 + 0x7C100400, // 001A CALL R4 2 + 0x78120038, // 001B JMPF R4 #0055 + 0xB8120C00, // 001C GETNGBL R4 K6 + 0x8C100907, // 001D GETMET R4 R4 K7 + 0x5818000E, // 001E LDCONST R6 K14 + 0x581C0009, // 001F LDCONST R7 K9 + 0x7C100600, // 0020 CALL R4 3 + 0x8C10010F, // 0021 GETMET R4 R0 K15 + 0x7C100200, // 0022 CALL R4 1 + 0x8C100310, // 0023 GETMET R4 R1 K16 + 0x5818000D, // 0024 LDCONST R6 K13 + 0x7C100400, // 0025 CALL R4 2 + 0x20140911, // 0026 NE R5 R4 K17 + 0x78160026, // 0027 JMPF R5 #004F + 0x8C140512, // 0028 GETMET R5 R2 K18 + 0x581C0013, // 0029 LDCONST R7 K19 + 0xB8220C00, // 002A GETNGBL R8 K6 + 0x8C201114, // 002B GETMET R8 R8 K20 + 0x7C200200, // 002C CALL R8 1 + 0x5C240800, // 002D MOVE R9 R4 + 0x7C140800, // 002E CALL R5 4 + 0xB81A0C00, // 002F GETNGBL R6 K6 + 0x8C180D07, // 0030 GETMET R6 R6 K7 + 0x8C200512, // 0031 GETMET R8 R2 K18 + 0x58280015, // 0032 LDCONST R10 K21 + 0x5C2C0A00, // 0033 MOVE R11 R5 + 0x7C200600, // 0034 CALL R8 3 + 0x58240009, // 0035 LDCONST R9 K9 + 0x7C180600, // 0036 CALL R6 3 + 0x8C180512, // 0037 GETMET R6 R2 K18 + 0x58200016, // 0038 LDCONST R8 K22 + 0x5C240800, // 0039 MOVE R9 R4 + 0x7C180600, // 003A CALL R6 3 + 0xB81E2E00, // 003B GETNGBL R7 K23 + 0x7C1C0000, // 003C CALL R7 0 + 0x8C200F18, // 003D GETMET R8 R7 K24 + 0x5C280A00, // 003E MOVE R10 R5 + 0x7C200400, // 003F CALL R8 2 + 0x8C200F19, // 0040 GETMET R8 R7 K25 + 0x7C200200, // 0041 CALL R8 1 + 0x542600C7, // 0042 LDINT R9 200 + 0x20241009, // 0043 NE R9 R8 R9 + 0x78260004, // 0044 JMPF R9 #004A + 0x8C240512, // 0045 GETMET R9 R2 K18 + 0x582C001A, // 0046 LDCONST R11 K26 + 0x5C301000, // 0047 MOVE R12 R8 + 0x7C240600, // 0048 CALL R9 3 + 0xB0063609, // 0049 RAISE 1 K27 R9 + 0x8C240F1C, // 004A GETMET R9 R7 K28 + 0x5C2C0C00, // 004B MOVE R11 R6 + 0x7C240400, // 004C CALL R9 2 + 0x8C240F1D, // 004D GETMET R9 R7 K29 + 0x7C240200, // 004E CALL R9 1 + 0x8C14010A, // 004F GETMET R5 R0 K10 + 0x7C140200, // 0050 CALL R5 1 + 0x8C14030B, // 0051 GETMET R5 R1 K11 + 0x581C000C, // 0052 LDCONST R7 K12 + 0x7C140400, // 0053 CALL R5 2 + 0x70020000, // 0054 JMP #0056 + 0xB0063D1F, // 0055 RAISE 1 K30 K31 + 0xA8040001, // 0056 EXBLK 1 1 + 0x7002001B, // 0057 JMP #0074 + 0xAC100002, // 0058 CATCH R4 0 2 + 0x70020018, // 0059 JMP #0073 + 0x60180001, // 005A GETGBL R6 G1 + 0x8C1C0512, // 005B GETMET R7 R2 K18 + 0x58240020, // 005C LDCONST R9 K32 + 0x5C280800, // 005D MOVE R10 R4 + 0x5C2C0A00, // 005E MOVE R11 R5 + 0x7C1C0800, // 005F CALL R7 4 + 0x7C180200, // 0060 CALL R6 1 + 0x8C180321, // 0061 GETMET R6 R1 K33 + 0x58200022, // 0062 LDCONST R8 K34 + 0x7C180400, // 0063 CALL R6 2 + 0x8C180323, // 0064 GETMET R6 R1 K35 + 0x7C180200, // 0065 CALL R6 1 + 0x8C180324, // 0066 GETMET R6 R1 K36 + 0x8C200512, // 0067 GETMET R8 R2 K18 + 0x58280025, // 0068 LDCONST R10 K37 + 0x5C2C0800, // 0069 MOVE R11 R4 + 0x5C300A00, // 006A MOVE R12 R5 + 0x7C200800, // 006B CALL R8 4 + 0x7C180400, // 006C CALL R6 2 + 0x8C180326, // 006D GETMET R6 R1 K38 + 0x88200327, // 006E GETMBR R8 R1 K39 + 0x7C180400, // 006F CALL R6 2 + 0x8C180328, // 0070 GETMET R6 R1 K40 + 0x7C180200, // 0071 CALL R6 1 + 0x70020000, // 0072 JMP #0074 + 0xB0080000, // 0073 RAISE 2 R0 R0 + 0x80000000, // 0074 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: autoexec +********************************************************************/ +be_local_closure(Autoconf_autoexec, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[32]) { /* constants */ + /* K0 */ be_nested_str(_archive), + /* K1 */ be_nested_str(path), + /* K2 */ be_nested_str(_X23init_X2Ebat), + /* K3 */ be_nested_str(is_first_time), + /* K4 */ be_nested_str(exists), + /* K5 */ be_nested_str(set_first_time), + /* K6 */ be_nested_str(run_bat), + /* K7 */ be_nested_str(tasmota), + /* K8 */ be_nested_str(log), + /* K9 */ be_nested_str(CFG_X3A_X20_X27init_X2Ebat_X27_X20done_X2C_X20restarting), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str(cmd), + /* K12 */ be_nested_str(Restart_X201), + /* K13 */ be_nested_str(_X23display_X2Eini), + /* K14 */ be_nested_str(gpio), + /* K15 */ be_nested_str(pin_used), + /* K16 */ be_nested_str(OPTION_A), + /* K17 */ be_nested_str(display_X2Eini), + /* K18 */ be_nested_str(CFG_X3A_X20skipping_X20_X27display_X2Eini_X27_X20because_X20already_X20present_X20in_X20file_X2Dsystem), + /* K19 */ be_nested_str(display), + /* K20 */ be_nested_str(r), + /* K21 */ be_nested_str(read), + /* K22 */ be_nested_str(close), + /* K23 */ be_nested_str(start), + /* K24 */ be_nested_str(_X23autoexec_X2Ebat), + /* K25 */ be_nested_str(CFG_X3A_X20running_X20), + /* K26 */ be_const_int(3), + /* K27 */ be_nested_str(CFG_X3A_X20ran_X20_X20), + /* K28 */ be_nested_str(_X23autoexec_X2Ebe), + /* K29 */ be_nested_str(CFG_X3A_X20loading_X20), + /* K30 */ be_nested_str(load), + /* K31 */ be_nested_str(CFG_X3A_X20loaded_X20_X20), + }), + &be_const_str_autoexec, + &be_const_str_solidified, + ( &(const binstruction[107]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x78060000, // 0003 JMPF R1 #0005 + 0x80000200, // 0004 RET 0 + 0xA4060200, // 0005 IMPORT R1 K1 + 0x88080100, // 0006 GETMBR R2 R0 K0 + 0x00080502, // 0007 ADD R2 R2 K2 + 0x8C0C0103, // 0008 GETMET R3 R0 K3 + 0x7C0C0200, // 0009 CALL R3 1 + 0x780E0012, // 000A JMPF R3 #001E + 0x8C0C0304, // 000B GETMET R3 R1 K4 + 0x5C140400, // 000C MOVE R5 R2 + 0x7C0C0400, // 000D CALL R3 2 + 0x780E000E, // 000E JMPF R3 #001E + 0x8C0C0105, // 000F GETMET R3 R0 K5 + 0x7C0C0200, // 0010 CALL R3 1 + 0x8C0C0106, // 0011 GETMET R3 R0 K6 + 0x5C140400, // 0012 MOVE R5 R2 + 0x7C0C0400, // 0013 CALL R3 2 + 0xB80E0E00, // 0014 GETNGBL R3 K7 + 0x8C0C0708, // 0015 GETMET R3 R3 K8 + 0x58140009, // 0016 LDCONST R5 K9 + 0x5818000A, // 0017 LDCONST R6 K10 + 0x7C0C0600, // 0018 CALL R3 3 + 0xB80E0E00, // 0019 GETNGBL R3 K7 + 0x8C0C070B, // 001A GETMET R3 R3 K11 + 0x5814000C, // 001B LDCONST R5 K12 + 0x7C0C0400, // 001C CALL R3 2 + 0x80000600, // 001D RET 0 + 0x880C0100, // 001E GETMBR R3 R0 K0 + 0x000C070D, // 001F ADD R3 R3 K13 + 0x5C080600, // 0020 MOVE R2 R3 + 0xB80E1C00, // 0021 GETNGBL R3 K14 + 0x8C0C070F, // 0022 GETMET R3 R3 K15 + 0xB8161C00, // 0023 GETNGBL R5 K14 + 0x88140B10, // 0024 GETMBR R5 R5 K16 + 0x5818000A, // 0025 LDCONST R6 K10 + 0x7C0C0600, // 0026 CALL R3 3 + 0x780E0019, // 0027 JMPF R3 #0042 + 0x8C0C0304, // 0028 GETMET R3 R1 K4 + 0x5C140400, // 0029 MOVE R5 R2 + 0x7C0C0400, // 002A CALL R3 2 + 0x780E0015, // 002B JMPF R3 #0042 + 0x8C0C0304, // 002C GETMET R3 R1 K4 + 0x58140011, // 002D LDCONST R5 K17 + 0x7C0C0400, // 002E CALL R3 2 + 0x780E0005, // 002F JMPF R3 #0036 + 0xB80E0E00, // 0030 GETNGBL R3 K7 + 0x8C0C0708, // 0031 GETMET R3 R3 K8 + 0x58140012, // 0032 LDCONST R5 K18 + 0x5818000A, // 0033 LDCONST R6 K10 + 0x7C0C0600, // 0034 CALL R3 3 + 0x7002000B, // 0035 JMP #0042 + 0xA40E2600, // 0036 IMPORT R3 K19 + 0x60100011, // 0037 GETGBL R4 G17 + 0x5C140400, // 0038 MOVE R5 R2 + 0x58180014, // 0039 LDCONST R6 K20 + 0x7C100400, // 003A CALL R4 2 + 0x8C140915, // 003B GETMET R5 R4 K21 + 0x7C140200, // 003C CALL R5 1 + 0x8C180916, // 003D GETMET R6 R4 K22 + 0x7C180200, // 003E CALL R6 1 + 0x8C180717, // 003F GETMET R6 R3 K23 + 0x5C200A00, // 0040 MOVE R8 R5 + 0x7C180400, // 0041 CALL R6 2 + 0x880C0100, // 0042 GETMBR R3 R0 K0 + 0x000C0718, // 0043 ADD R3 R3 K24 + 0x5C080600, // 0044 MOVE R2 R3 + 0x8C0C0304, // 0045 GETMET R3 R1 K4 + 0x5C140400, // 0046 MOVE R5 R2 + 0x7C0C0400, // 0047 CALL R3 2 + 0x780E000C, // 0048 JMPF R3 #0056 + 0xB80E0E00, // 0049 GETNGBL R3 K7 + 0x8C0C0708, // 004A GETMET R3 R3 K8 + 0x00163202, // 004B ADD R5 K25 R2 + 0x5818001A, // 004C LDCONST R6 K26 + 0x7C0C0600, // 004D CALL R3 3 + 0x8C0C0106, // 004E GETMET R3 R0 K6 + 0x5C140400, // 004F MOVE R5 R2 + 0x7C0C0400, // 0050 CALL R3 2 + 0xB80E0E00, // 0051 GETNGBL R3 K7 + 0x8C0C0708, // 0052 GETMET R3 R3 K8 + 0x00163602, // 0053 ADD R5 K27 R2 + 0x5818001A, // 0054 LDCONST R6 K26 + 0x7C0C0600, // 0055 CALL R3 3 + 0x880C0100, // 0056 GETMBR R3 R0 K0 + 0x000C071C, // 0057 ADD R3 R3 K28 + 0x5C080600, // 0058 MOVE R2 R3 + 0x8C0C0304, // 0059 GETMET R3 R1 K4 + 0x5C140400, // 005A MOVE R5 R2 + 0x7C0C0400, // 005B CALL R3 2 + 0x780E000C, // 005C JMPF R3 #006A + 0xB80E0E00, // 005D GETNGBL R3 K7 + 0x8C0C0708, // 005E GETMET R3 R3 K8 + 0x00163A02, // 005F ADD R5 K29 R2 + 0x5818001A, // 0060 LDCONST R6 K26 + 0x7C0C0600, // 0061 CALL R3 3 + 0xB80E3C00, // 0062 GETNGBL R3 K30 + 0x5C100400, // 0063 MOVE R4 R2 + 0x7C0C0200, // 0064 CALL R3 1 + 0xB80E0E00, // 0065 GETNGBL R3 K7 + 0x8C0C0708, // 0066 GETMET R3 R3 K8 + 0x00163E02, // 0067 ADD R5 K31 R2 + 0x5818001A, // 0068 LDCONST R6 K26 + 0x7C0C0600, // 0069 CALL R3 3 + 0x80000000, // 006A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: run_bat +********************************************************************/ +be_local_closure(Autoconf_run_bat, /* name */ + be_nested_proto( + 13, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(r), + /* K2 */ be_nested_str(readline), + /* K3 */ be_const_int(0), + /* K4 */ be_nested_str(_X0A), + /* K5 */ be_nested_str(tasmota), + /* K6 */ be_nested_str(cmd), + /* K7 */ be_nested_str(close), + /* K8 */ be_nested_str(format), + /* K9 */ be_nested_str(CFG_X3A_X20could_X20not_X20run_X20_X25s_X20_X28_X25s_X20_X2D_X20_X25s_X29), + }), + &be_const_str_run_bat, + &be_const_str_solidified, + ( &(const binstruction[54]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0xA8020023, // 0002 EXBLK 0 #0027 + 0x60100011, // 0003 GETGBL R4 G17 + 0x5C140200, // 0004 MOVE R5 R1 + 0x58180001, // 0005 LDCONST R6 K1 + 0x7C100400, // 0006 CALL R4 2 + 0x5C0C0800, // 0007 MOVE R3 R4 + 0x50100200, // 0008 LDBOOL R4 1 0 + 0x78120018, // 0009 JMPF R4 #0023 + 0x8C100702, // 000A GETMET R4 R3 K2 + 0x7C100200, // 000B CALL R4 1 + 0x6014000C, // 000C GETGBL R5 G12 + 0x5C180800, // 000D MOVE R6 R4 + 0x7C140200, // 000E CALL R5 1 + 0x1C140B03, // 000F EQ R5 R5 K3 + 0x78160000, // 0010 JMPF R5 #0012 + 0x70020010, // 0011 JMP #0023 + 0x5415FFFE, // 0012 LDINT R5 -1 + 0x94140805, // 0013 GETIDX R5 R4 R5 + 0x1C140B04, // 0014 EQ R5 R5 K4 + 0x78160002, // 0015 JMPF R5 #0019 + 0x5415FFFD, // 0016 LDINT R5 -2 + 0x40160605, // 0017 CONNECT R5 K3 R5 + 0x94100805, // 0018 GETIDX R4 R4 R5 + 0x6014000C, // 0019 GETGBL R5 G12 + 0x5C180800, // 001A MOVE R6 R4 + 0x7C140200, // 001B CALL R5 1 + 0x24140B03, // 001C GT R5 R5 K3 + 0x78160003, // 001D JMPF R5 #0022 + 0xB8160A00, // 001E GETNGBL R5 K5 + 0x8C140B06, // 001F GETMET R5 R5 K6 + 0x5C1C0800, // 0020 MOVE R7 R4 + 0x7C140400, // 0021 CALL R5 2 + 0x7001FFE4, // 0022 JMP #0008 + 0x8C100707, // 0023 GETMET R4 R3 K7 + 0x7C100200, // 0024 CALL R4 1 + 0xA8040001, // 0025 EXBLK 1 1 + 0x7002000D, // 0026 JMP #0035 + 0xAC100002, // 0027 CATCH R4 0 2 + 0x7002000A, // 0028 JMP #0034 + 0x60180001, // 0029 GETGBL R6 G1 + 0x8C1C0508, // 002A GETMET R7 R2 K8 + 0x58240009, // 002B LDCONST R9 K9 + 0x5C280200, // 002C MOVE R10 R1 + 0x5C2C0800, // 002D MOVE R11 R4 + 0x5C300A00, // 002E MOVE R12 R5 + 0x7C1C0A00, // 002F CALL R7 5 + 0x7C180200, // 0030 CALL R6 1 + 0x8C180707, // 0031 GETMET R6 R3 K7 + 0x7C180200, // 0032 CALL R6 1 + 0x70020000, // 0033 JMP #0035 + 0xB0080000, // 0034 RAISE 2 R0 R0 + 0x80000000, // 0035 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: page_autoconf_mgr +********************************************************************/ +be_local_closure(Autoconf_page_autoconf_mgr, /* name */ + be_nested_proto( + 19, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[39]) { /* constants */ + /* K0 */ be_nested_str(webserver), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(check_privileged_access), + /* K3 */ be_nested_str(content_start), + /* K4 */ be_nested_str(Auto_X2Dconfiguration), + /* K5 */ be_nested_str(content_send_style), + /* K6 */ be_nested_str(content_send), + /* K7 */ be_nested_str(_X3Cp_X3E_X3Csmall_X3E_X26nbsp_X3B_X28This_X20feature_X20requires_X20an_X20internet_X20connection_X29_X3C_X2Fsmall_X3E_X3C_X2Fp_X3E), + /* K8 */ be_nested_str(get_current_module_path), + /* K9 */ be_nested_str(tr), + /* K10 */ be_nested_str(get_current_module_name), + /* K11 */ be_nested_str(_), + /* K12 */ be_nested_str(_X20), + /* K13 */ be_nested_str(_error), + /* K14 */ be_nested_str(_X26lt_X3BError_X3A_X20apply_X20new_X20or_X20remove_X26gt_X3B), + /* K15 */ be_nested_str(_X26lt_X3BNone_X26gt_X3B), + /* K16 */ be_nested_str(_X3Cfieldset_X3E_X3Cstyle_X3E_X2Ebdis_X7Bbackground_X3A_X23888_X3B_X7D_X2Ebdis_X3Ahover_X7Bbackground_X3A_X23888_X3B_X7D_X3C_X2Fstyle_X3E), + /* K17 */ be_nested_str(format), + /* K18 */ be_nested_str(_X3Clegend_X3E_X3Cb_X20title_X3D_X27Autoconfiguration_X27_X3E_X26nbsp_X3BCurrent_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E), + /* K19 */ be_nested_str(_X3Cp_X3ECurrent_X20configuration_X3A_X20_X3C_X2Fp_X3E_X3Cp_X3E_X3Cb_X3E_X25s_X3C_X2Fb_X3E_X3C_X2Fp_X3E), + /* K20 */ be_nested_str(_X3Cp_X3E_X3Cform_X20id_X3Dreapply_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20), + /* K21 */ be_nested_str(onsubmit_X3D_X27return_X20confirm_X28_X22This_X20will_X20cause_X20a_X20restart_X2E_X22_X29_X3B_X27_X3E), + /* K22 */ be_nested_str(_X3Cbutton_X20name_X3D_X27reapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3ERe_X2Dapply_X20current_X20configuration_X3C_X2Fbutton_X3E), + /* K23 */ be_nested_str(_X3C_X2Fform_X3E_X3C_X2Fp_X3E), + /* K24 */ be_nested_str(_X3Cp_X3E_X3C_X2Fp_X3E_X3C_X2Ffieldset_X3E_X3Cp_X3E_X3C_X2Fp_X3E), + /* K25 */ be_nested_str(_X3Clegend_X3E_X3Cb_X20title_X3D_X27New_X20autoconf_X27_X3E_X26nbsp_X3BSelect_X20new_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E), + /* K26 */ be_nested_str(_X3Cp_X3E_X3Cform_X20id_X3Dzip_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20), + /* K27 */ be_nested_str(onsubmit_X3D_X27return_X20confirm_X28_X22This_X20will_X20change_X20the_X20current_X20configuration_X20and_X20cause_X20a_X20restart_X2E_X22_X29_X3B_X27_X3E), + /* K28 */ be_nested_str(_X3Clabel_X3EChoose_X20a_X20device_X20configuration_X3A_X3C_X2Flabel_X3E_X3Cbr_X3E), + /* K29 */ be_nested_str(_X3Cselect_X20name_X3D_X27zip_X27_X3E), + /* K30 */ be_nested_str(load_templates), + /* K31 */ be_nested_str(_X3Coption_X20value_X3D_X27reset_X27_X3E_X26lt_X3BRemove_X20autoconf_X26gt_X3B_X3C_X2Foption_X3E), + /* K32 */ be_nested_str(_X3Coption_X20value_X3D_X27_X25s_X27_X3E_X25s_X3C_X2Foption_X3E), + /* K33 */ be_nested_str(stop_iteration), + /* K34 */ be_nested_str(_X3C_X2Fselect_X3E_X3Cp_X3E_X3C_X2Fp_X3E), + /* K35 */ be_nested_str(_X3Cbutton_X20name_X3D_X27zipapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3EApply_X20configuration_X3C_X2Fbutton_X3E), + /* K36 */ be_nested_str(content_button), + /* K37 */ be_nested_str(BUTTON_CONFIGURATION), + /* K38 */ be_nested_str(content_stop), + }), + &be_const_str_page_autoconf_mgr, + &be_const_str_solidified, + ( &(const binstruction[124]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x7C0C0200, // 0003 CALL R3 1 + 0x740E0001, // 0004 JMPT R3 #0007 + 0x4C0C0000, // 0005 LDNIL R3 + 0x80040600, // 0006 RET 1 R3 + 0x8C0C0303, // 0007 GETMET R3 R1 K3 + 0x58140004, // 0008 LDCONST R5 K4 + 0x7C0C0400, // 0009 CALL R3 2 + 0x8C0C0305, // 000A GETMET R3 R1 K5 + 0x7C0C0200, // 000B CALL R3 1 + 0x8C0C0306, // 000C GETMET R3 R1 K6 + 0x58140007, // 000D LDCONST R5 K7 + 0x7C0C0400, // 000E CALL R3 2 + 0x8C0C0108, // 000F GETMET R3 R0 K8 + 0x7C0C0200, // 0010 CALL R3 1 + 0x780E0006, // 0011 JMPF R3 #0019 + 0x8C100509, // 0012 GETMET R4 R2 K9 + 0x8C18010A, // 0013 GETMET R6 R0 K10 + 0x7C180200, // 0014 CALL R6 1 + 0x581C000B, // 0015 LDCONST R7 K11 + 0x5820000C, // 0016 LDCONST R8 K12 + 0x7C100800, // 0017 CALL R4 4 + 0x70020004, // 0018 JMP #001E + 0x8810010D, // 0019 GETMBR R4 R0 K13 + 0x78120001, // 001A JMPF R4 #001D + 0x5810000E, // 001B LDCONST R4 K14 + 0x70020000, // 001C JMP #001E + 0x5810000F, // 001D LDCONST R4 K15 + 0x8C140306, // 001E GETMET R5 R1 K6 + 0x581C0010, // 001F LDCONST R7 K16 + 0x7C140400, // 0020 CALL R5 2 + 0x8C140306, // 0021 GETMET R5 R1 K6 + 0x8C1C0511, // 0022 GETMET R7 R2 K17 + 0x58240012, // 0023 LDCONST R9 K18 + 0x7C1C0400, // 0024 CALL R7 2 + 0x7C140400, // 0025 CALL R5 2 + 0x8C140306, // 0026 GETMET R5 R1 K6 + 0x8C1C0511, // 0027 GETMET R7 R2 K17 + 0x58240013, // 0028 LDCONST R9 K19 + 0x5C280800, // 0029 MOVE R10 R4 + 0x7C1C0600, // 002A CALL R7 3 + 0x7C140400, // 002B CALL R5 2 + 0x780E000B, // 002C JMPF R3 #0039 + 0x8C140306, // 002D GETMET R5 R1 K6 + 0x581C0014, // 002E LDCONST R7 K20 + 0x7C140400, // 002F CALL R5 2 + 0x8C140306, // 0030 GETMET R5 R1 K6 + 0x581C0015, // 0031 LDCONST R7 K21 + 0x7C140400, // 0032 CALL R5 2 + 0x8C140306, // 0033 GETMET R5 R1 K6 + 0x581C0016, // 0034 LDCONST R7 K22 + 0x7C140400, // 0035 CALL R5 2 + 0x8C140306, // 0036 GETMET R5 R1 K6 + 0x581C0017, // 0037 LDCONST R7 K23 + 0x7C140400, // 0038 CALL R5 2 + 0x8C140306, // 0039 GETMET R5 R1 K6 + 0x581C0018, // 003A LDCONST R7 K24 + 0x7C140400, // 003B CALL R5 2 + 0x8C140306, // 003C GETMET R5 R1 K6 + 0x581C0010, // 003D LDCONST R7 K16 + 0x7C140400, // 003E CALL R5 2 + 0x8C140306, // 003F GETMET R5 R1 K6 + 0x8C1C0511, // 0040 GETMET R7 R2 K17 + 0x58240019, // 0041 LDCONST R9 K25 + 0x7C1C0400, // 0042 CALL R7 2 + 0x7C140400, // 0043 CALL R5 2 + 0x8C140306, // 0044 GETMET R5 R1 K6 + 0x581C001A, // 0045 LDCONST R7 K26 + 0x7C140400, // 0046 CALL R5 2 + 0x8C140306, // 0047 GETMET R5 R1 K6 + 0x581C001B, // 0048 LDCONST R7 K27 + 0x7C140400, // 0049 CALL R5 2 + 0x8C140306, // 004A GETMET R5 R1 K6 + 0x581C001C, // 004B LDCONST R7 K28 + 0x7C140400, // 004C CALL R5 2 + 0x8C140306, // 004D GETMET R5 R1 K6 + 0x581C001D, // 004E LDCONST R7 K29 + 0x7C140400, // 004F CALL R5 2 + 0x8C14011E, // 0050 GETMET R5 R0 K30 + 0x7C140200, // 0051 CALL R5 1 + 0x8C180306, // 0052 GETMET R6 R1 K6 + 0x5820001F, // 0053 LDCONST R8 K31 + 0x7C180400, // 0054 CALL R6 2 + 0x60180010, // 0055 GETGBL R6 G16 + 0x5C1C0A00, // 0056 MOVE R7 R5 + 0x7C180200, // 0057 CALL R6 1 + 0xA802000D, // 0058 EXBLK 0 #0067 + 0x5C1C0C00, // 0059 MOVE R7 R6 + 0x7C1C0000, // 005A CALL R7 0 + 0x8C200306, // 005B GETMET R8 R1 K6 + 0x8C280511, // 005C GETMET R10 R2 K17 + 0x58300020, // 005D LDCONST R12 K32 + 0x5C340E00, // 005E MOVE R13 R7 + 0x8C380509, // 005F GETMET R14 R2 K9 + 0x5C400E00, // 0060 MOVE R16 R7 + 0x5844000B, // 0061 LDCONST R17 K11 + 0x5848000C, // 0062 LDCONST R18 K12 + 0x7C380800, // 0063 CALL R14 4 + 0x7C280800, // 0064 CALL R10 4 + 0x7C200400, // 0065 CALL R8 2 + 0x7001FFF1, // 0066 JMP #0059 + 0x58180021, // 0067 LDCONST R6 K33 + 0xAC180200, // 0068 CATCH R6 1 0 + 0xB0080000, // 0069 RAISE 2 R0 R0 + 0x8C180306, // 006A GETMET R6 R1 K6 + 0x58200022, // 006B LDCONST R8 K34 + 0x7C180400, // 006C CALL R6 2 + 0x8C180306, // 006D GETMET R6 R1 K6 + 0x58200023, // 006E LDCONST R8 K35 + 0x7C180400, // 006F CALL R6 2 + 0x8C180306, // 0070 GETMET R6 R1 K6 + 0x58200017, // 0071 LDCONST R8 K23 + 0x7C180400, // 0072 CALL R6 2 + 0x8C180306, // 0073 GETMET R6 R1 K6 + 0x58200018, // 0074 LDCONST R8 K24 + 0x7C180400, // 0075 CALL R6 2 + 0x8C180324, // 0076 GETMET R6 R1 K36 + 0x88200325, // 0077 GETMBR R8 R1 K37 + 0x7C180400, // 0078 CALL R6 2 + 0x8C180326, // 0079 GETMET R6 R1 K38 + 0x7C180200, // 007A CALL R6 1 + 0x80000000, // 007B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_current_module_name +********************************************************************/ +be_local_closure(Autoconf_get_current_module_name, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_archive), + /* K1 */ be_const_int(0), + }), + &be_const_str_get_current_module_name, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x5405FFF5, // 0000 LDINT R1 -10 + 0x40060201, // 0001 CONNECT R1 K1 R1 + 0x88080100, // 0002 GETMBR R2 R0 K0 + 0x94040401, // 0003 GETIDX R1 R2 R1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: delete_all_configs +********************************************************************/ +be_local_closure(Autoconf_delete_all_configs, /* name */ + be_nested_proto( + 10, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(listdir), + /* K3 */ be_nested_str(_X2F), + /* K4 */ be_nested_str(find), + /* K5 */ be_nested_str(_X2Eautoconf), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str(remove), + /* K8 */ be_nested_str(stop_iteration), + }), + &be_const_str_delete_all_configs, + &be_const_str_solidified, + ( &(const binstruction[25]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x58140003, // 0003 LDCONST R5 K3 + 0x7C0C0400, // 0004 CALL R3 2 + 0x60100010, // 0005 GETGBL R4 G16 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0xA802000B, // 0008 EXBLK 0 #0015 + 0x5C140800, // 0009 MOVE R5 R4 + 0x7C140000, // 000A CALL R5 0 + 0x8C180504, // 000B GETMET R6 R2 K4 + 0x5C200A00, // 000C MOVE R8 R5 + 0x58240005, // 000D LDCONST R9 K5 + 0x7C180600, // 000E CALL R6 3 + 0x24180D06, // 000F GT R6 R6 K6 + 0x781A0002, // 0010 JMPF R6 #0014 + 0x8C180307, // 0011 GETMET R6 R1 K7 + 0x5C200A00, // 0012 MOVE R8 R5 + 0x7C180400, // 0013 CALL R6 2 + 0x7001FFF3, // 0014 JMP #0009 + 0x58100008, // 0015 LDCONST R4 K8 + 0xAC100200, // 0016 CATCH R4 1 0 + 0xB0080000, // 0017 RAISE 2 R0 R0 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_first_time +********************************************************************/ +be_local_closure(Autoconf_set_first_time, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(_X2F_X2Eautoconf), + /* K1 */ be_nested_str(w), + /* K2 */ be_nested_str(close), + }), + &be_const_str_set_first_time, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x60040011, // 0000 GETGBL R1 G17 + 0x58080000, // 0001 LDCONST R2 K0 + 0x580C0001, // 0002 LDCONST R3 K1 + 0x7C040400, // 0003 CALL R1 2 + 0x8C080302, // 0004 GETMET R2 R1 K2 + 0x7C080200, // 0005 CALL R2 1 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: load_templates +********************************************************************/ +be_local_closure(Autoconf_load_templates, /* name */ + be_nested_proto( + 15, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[21]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(json), + /* K2 */ be_nested_str(format), + /* K3 */ be_nested_str(https_X3A_X2F_X2Fraw_X2Egithubusercontent_X2Ecom_X2Ftasmota_X2Fautoconf_X2Fmain_X2F_X25s_manifest_X2Ejson), + /* K4 */ be_nested_str(tasmota), + /* K5 */ be_nested_str(arch), + /* K6 */ be_nested_str(log), + /* K7 */ be_nested_str(CFG_X3A_X20loading_X20_X27_X25s_X27), + /* K8 */ be_const_int(3), + /* K9 */ be_nested_str(webclient), + /* K10 */ be_nested_str(begin), + /* K11 */ be_nested_str(GET), + /* K12 */ be_nested_str(CFG_X3A_X20return_code_X3D_X25i), + /* K13 */ be_const_int(2), + /* K14 */ be_nested_str(get_string), + /* K15 */ be_nested_str(close), + /* K16 */ be_nested_str(load), + /* K17 */ be_nested_str(CFG_X3A_X20loaded_X20_X27_X25s_X27), + /* K18 */ be_nested_str(find), + /* K19 */ be_nested_str(files), + /* K20 */ be_nested_str(CFG_X3A_X20exception_X20_X27_X25s_X27_X20_X2D_X20_X27_X25s_X27), + }), + &be_const_str_load_templates, + &be_const_str_solidified, + ( &(const binstruction[86]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0xA8020042, // 0002 EXBLK 0 #0046 + 0x8C0C0302, // 0003 GETMET R3 R1 K2 + 0x58140003, // 0004 LDCONST R5 K3 + 0xB81A0800, // 0005 GETNGBL R6 K4 + 0x8C180D05, // 0006 GETMET R6 R6 K5 + 0x7C180200, // 0007 CALL R6 1 + 0x7C0C0600, // 0008 CALL R3 3 + 0xB8120800, // 0009 GETNGBL R4 K4 + 0x8C100906, // 000A GETMET R4 R4 K6 + 0x8C180302, // 000B GETMET R6 R1 K2 + 0x58200007, // 000C LDCONST R8 K7 + 0x5C240600, // 000D MOVE R9 R3 + 0x7C180600, // 000E CALL R6 3 + 0x581C0008, // 000F LDCONST R7 K8 + 0x7C100600, // 0010 CALL R4 3 + 0xB8121200, // 0011 GETNGBL R4 K9 + 0x7C100000, // 0012 CALL R4 0 + 0x8C14090A, // 0013 GETMET R5 R4 K10 + 0x5C1C0600, // 0014 MOVE R7 R3 + 0x7C140400, // 0015 CALL R5 2 + 0x8C14090B, // 0016 GETMET R5 R4 K11 + 0x7C140200, // 0017 CALL R5 1 + 0x541A00C7, // 0018 LDINT R6 200 + 0x20180A06, // 0019 NE R6 R5 R6 + 0x781A000A, // 001A JMPF R6 #0026 + 0xB81A0800, // 001B GETNGBL R6 K4 + 0x8C180D06, // 001C GETMET R6 R6 K6 + 0x8C200302, // 001D GETMET R8 R1 K2 + 0x5828000C, // 001E LDCONST R10 K12 + 0x5C2C0A00, // 001F MOVE R11 R5 + 0x7C200600, // 0020 CALL R8 3 + 0x5824000D, // 0021 LDCONST R9 K13 + 0x7C180600, // 0022 CALL R6 3 + 0x4C180000, // 0023 LDNIL R6 + 0xA8040001, // 0024 EXBLK 1 1 + 0x80040C00, // 0025 RET 1 R6 + 0x8C18090E, // 0026 GETMET R6 R4 K14 + 0x7C180200, // 0027 CALL R6 1 + 0x8C1C090F, // 0028 GETMET R7 R4 K15 + 0x7C1C0200, // 0029 CALL R7 1 + 0x8C1C0510, // 002A GETMET R7 R2 K16 + 0x5C240C00, // 002B MOVE R9 R6 + 0x7C1C0400, // 002C CALL R7 2 + 0xB8220800, // 002D GETNGBL R8 K4 + 0x8C201106, // 002E GETMET R8 R8 K6 + 0x8C280302, // 002F GETMET R10 R1 K2 + 0x58300011, // 0030 LDCONST R12 K17 + 0x60340008, // 0031 GETGBL R13 G8 + 0x5C380E00, // 0032 MOVE R14 R7 + 0x7C340200, // 0033 CALL R13 1 + 0x7C280600, // 0034 CALL R10 3 + 0x582C0008, // 0035 LDCONST R11 K8 + 0x7C200600, // 0036 CALL R8 3 + 0x8C200F12, // 0037 GETMET R8 R7 K18 + 0x58280013, // 0038 LDCONST R10 K19 + 0x7C200400, // 0039 CALL R8 2 + 0x6024000F, // 003A GETGBL R9 G15 + 0x5C281000, // 003B MOVE R10 R8 + 0x602C0012, // 003C GETGBL R11 G18 + 0x7C240400, // 003D CALL R9 2 + 0x78260001, // 003E JMPF R9 #0041 + 0xA8040001, // 003F EXBLK 1 1 + 0x80041000, // 0040 RET 1 R8 + 0x4C240000, // 0041 LDNIL R9 + 0xA8040001, // 0042 EXBLK 1 1 + 0x80041200, // 0043 RET 1 R9 + 0xA8040001, // 0044 EXBLK 1 1 + 0x7002000E, // 0045 JMP #0055 + 0xAC0C0002, // 0046 CATCH R3 0 2 + 0x7002000B, // 0047 JMP #0054 + 0xB8160800, // 0048 GETNGBL R5 K4 + 0x8C140B06, // 0049 GETMET R5 R5 K6 + 0x8C1C0302, // 004A GETMET R7 R1 K2 + 0x58240014, // 004B LDCONST R9 K20 + 0x5C280600, // 004C MOVE R10 R3 + 0x5C2C0800, // 004D MOVE R11 R4 + 0x7C1C0800, // 004E CALL R7 4 + 0x5820000D, // 004F LDCONST R8 K13 + 0x7C140600, // 0050 CALL R5 3 + 0x4C140000, // 0051 LDNIL R5 + 0x80040A00, // 0052 RET 1 R5 + 0x70020000, // 0053 JMP #0055 + 0xB0080000, // 0054 RAISE 2 R0 R0 + 0x80000000, // 0055 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: web_add_config_button +********************************************************************/ +be_local_closure(Autoconf_web_add_config_button, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(webserver), + /* K1 */ be_nested_str(content_send), + /* K2 */ be_nested_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E), + }), + &be_const_str_web_add_config_button, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_first_time +********************************************************************/ +be_local_closure(Autoconf_is_first_time, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(exists), + /* K2 */ be_nested_str(_X2F_X2Eautoconf), + }), + &be_const_str_is_first_time, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x7C080400, // 0003 CALL R2 2 + 0x780A0000, // 0004 JMPF R2 #0006 + 0x50080001, // 0005 LDBOOL R2 0 1 + 0x50080200, // 0006 LDBOOL R2 1 0 + 0x80040400, // 0007 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Autoconf_init, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[17]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(listdir), + /* K3 */ be_nested_str(_X2F), + /* K4 */ be_nested_str(tasmota), + /* K5 */ be_nested_str(add_driver), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str(find), + /* K8 */ be_nested_str(_X2Eautoconf), + /* K9 */ be_nested_str(format), + /* K10 */ be_nested_str(CFG_X3A_X20multiple_X20autoconf_X20files_X20found_X2C_X20aborting_X20_X28_X27_X25s_X27_X20_X2B_X20_X27_X25s_X27_X29), + /* K11 */ be_nested_str(_error), + /* K12 */ be_const_int(1), + /* K13 */ be_nested_str(log), + /* K14 */ be_nested_str(CFG_X3A_X20no_X20_X27_X2A_X2Eautoconf_X27_X20file_X20found), + /* K15 */ be_const_int(2), + /* K16 */ be_nested_str(_archive), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[51]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x58140003, // 0003 LDCONST R5 K3 + 0x7C0C0400, // 0004 CALL R3 2 + 0x4C100000, // 0005 LDNIL R4 + 0xB8160800, // 0006 GETNGBL R5 K4 + 0x8C140B05, // 0007 GETMET R5 R5 K5 + 0x5C1C0000, // 0008 MOVE R7 R0 + 0x7C140400, // 0009 CALL R5 2 + 0x58140006, // 000A LDCONST R5 K6 + 0x6018000C, // 000B GETGBL R6 G12 + 0x5C1C0600, // 000C MOVE R7 R3 + 0x7C180200, // 000D CALL R6 1 + 0x14180A06, // 000E LT R6 R5 R6 + 0x781A0016, // 000F JMPF R6 #0027 + 0x8C180507, // 0010 GETMET R6 R2 K7 + 0x94200605, // 0011 GETIDX R8 R3 R5 + 0x58240008, // 0012 LDCONST R9 K8 + 0x7C180600, // 0013 CALL R6 3 + 0x24180D06, // 0014 GT R6 R6 K6 + 0x781A000E, // 0015 JMPF R6 #0025 + 0x4C180000, // 0016 LDNIL R6 + 0x20180806, // 0017 NE R6 R4 R6 + 0x781A000A, // 0018 JMPF R6 #0024 + 0x60180001, // 0019 GETGBL R6 G1 + 0x8C1C0509, // 001A GETMET R7 R2 K9 + 0x5824000A, // 001B LDCONST R9 K10 + 0x5C280800, // 001C MOVE R10 R4 + 0x942C0605, // 001D GETIDX R11 R3 R5 + 0x7C1C0800, // 001E CALL R7 4 + 0x7C180200, // 001F CALL R6 1 + 0x50180200, // 0020 LDBOOL R6 1 0 + 0x90021606, // 0021 SETMBR R0 K11 R6 + 0x4C180000, // 0022 LDNIL R6 + 0x80040C00, // 0023 RET 1 R6 + 0x94100605, // 0024 GETIDX R4 R3 R5 + 0x00140B0C, // 0025 ADD R5 R5 K12 + 0x7001FFE3, // 0026 JMP #000B + 0x4C180000, // 0027 LDNIL R6 + 0x1C180806, // 0028 EQ R6 R4 R6 + 0x781A0006, // 0029 JMPF R6 #0031 + 0xB81A0800, // 002A GETNGBL R6 K4 + 0x8C180D0D, // 002B GETMET R6 R6 K13 + 0x5820000E, // 002C LDCONST R8 K14 + 0x5824000F, // 002D LDCONST R9 K15 + 0x7C180600, // 002E CALL R6 3 + 0x4C180000, // 002F LDNIL R6 + 0x80040C00, // 0030 RET 1 R6 + 0x90022004, // 0031 SETMBR R0 K16 R4 + 0x80000000, // 0032 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: preinit +********************************************************************/ +be_local_closure(Autoconf_preinit, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(_archive), + /* K1 */ be_nested_str(path), + /* K2 */ be_nested_str(_X23preinit_X2Ebe), + /* K3 */ be_nested_str(exists), + /* K4 */ be_nested_str(tasmota), + /* K5 */ be_nested_str(log), + /* K6 */ be_nested_str(CFG_X3A_X20loading_X20), + /* K7 */ be_const_int(3), + /* K8 */ be_nested_str(load), + /* K9 */ be_nested_str(CFG_X3A_X20loaded_X20_X20), + }), + &be_const_str_preinit, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x78060000, // 0003 JMPF R1 #0005 + 0x80000200, // 0004 RET 0 + 0xA4060200, // 0005 IMPORT R1 K1 + 0x88080100, // 0006 GETMBR R2 R0 K0 + 0x00080502, // 0007 ADD R2 R2 K2 + 0x8C0C0303, // 0008 GETMET R3 R1 K3 + 0x5C140400, // 0009 MOVE R5 R2 + 0x7C0C0400, // 000A CALL R3 2 + 0x780E000C, // 000B JMPF R3 #0019 + 0xB80E0800, // 000C GETNGBL R3 K4 + 0x8C0C0705, // 000D GETMET R3 R3 K5 + 0x00160C02, // 000E ADD R5 K6 R2 + 0x58180007, // 000F LDCONST R6 K7 + 0x7C0C0600, // 0010 CALL R3 3 + 0xB80E1000, // 0011 GETNGBL R3 K8 + 0x5C100400, // 0012 MOVE R4 R2 + 0x7C0C0200, // 0013 CALL R3 1 + 0xB80E0800, // 0014 GETNGBL R3 K4 + 0x8C0C0705, // 0015 GETMET R3 R3 K5 + 0x00161202, // 0016 ADD R5 K9 R2 + 0x58180007, // 0017 LDCONST R6 K7 + 0x7C0C0600, // 0018 CALL R3 3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: reset +********************************************************************/ +be_local_closure(Autoconf_reset, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(listdir), + /* K3 */ be_nested_str(_X2F), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str(find), + /* K6 */ be_nested_str(_X2Eautoconf), + /* K7 */ be_nested_str(remove), + /* K8 */ be_nested_str(format), + /* K9 */ be_nested_str(CFG_X3A_X20removed_X20file_X20_X27_X25s_X27), + /* K10 */ be_const_int(1), + /* K11 */ be_nested_str(_archive), + /* K12 */ be_nested_str(_error), + }), + &be_const_str_reset, + &be_const_str_solidified, + ( &(const binstruction[35]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x58140003, // 0003 LDCONST R5 K3 + 0x7C0C0400, // 0004 CALL R3 2 + 0x4C100000, // 0005 LDNIL R4 + 0x58140004, // 0006 LDCONST R5 K4 + 0x6018000C, // 0007 GETGBL R6 G12 + 0x5C1C0600, // 0008 MOVE R7 R3 + 0x7C180200, // 0009 CALL R6 1 + 0x14180A06, // 000A LT R6 R5 R6 + 0x781A0011, // 000B JMPF R6 #001E + 0x94180605, // 000C GETIDX R6 R3 R5 + 0x8C1C0505, // 000D GETMET R7 R2 K5 + 0x5C240C00, // 000E MOVE R9 R6 + 0x58280006, // 000F LDCONST R10 K6 + 0x7C1C0600, // 0010 CALL R7 3 + 0x241C0F04, // 0011 GT R7 R7 K4 + 0x781E0008, // 0012 JMPF R7 #001C + 0x8C1C0307, // 0013 GETMET R7 R1 K7 + 0x5C240C00, // 0014 MOVE R9 R6 + 0x7C1C0400, // 0015 CALL R7 2 + 0x601C0001, // 0016 GETGBL R7 G1 + 0x8C200508, // 0017 GETMET R8 R2 K8 + 0x58280009, // 0018 LDCONST R10 K9 + 0x5C2C0C00, // 0019 MOVE R11 R6 + 0x7C200600, // 001A CALL R8 3 + 0x7C1C0200, // 001B CALL R7 1 + 0x00140B0A, // 001C ADD R5 R5 K10 + 0x7001FFE8, // 001D JMP #0007 + 0x4C180000, // 001E LDNIL R6 + 0x90021606, // 001F SETMBR R0 K11 R6 + 0x4C180000, // 0020 LDNIL R6 + 0x90021806, // 0021 SETMBR R0 K12 R6 + 0x80000000, // 0022 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: web_add_handler +********************************************************************/ +be_local_closure(Autoconf_web_add_handler, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(page_autoconf_mgr), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80040000, // 0003 RET 1 R0 + }) + ), + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(page_autoconf_ctl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80040000, // 0003 RET 1 R0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(webserver), + /* K1 */ be_nested_str(on), + /* K2 */ be_nested_str(_X2Fac), + /* K3 */ be_nested_str(HTTP_GET), + /* K4 */ be_nested_str(HTTP_POST), + }), + &be_const_str_web_add_handler, + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x84140000, // 0003 CLOSURE R5 P0 + 0x88180303, // 0004 GETMBR R6 R1 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x8C080301, // 0006 GETMET R2 R1 K1 + 0x58100002, // 0007 LDCONST R4 K2 + 0x84140001, // 0008 CLOSURE R5 P1 + 0x88180304, // 0009 GETMBR R6 R1 K4 + 0x7C080800, // 000A CALL R2 4 + 0xA0000000, // 000B CLOSE R0 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_first_time +********************************************************************/ +be_local_closure(Autoconf_clear_first_time, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(remove), + /* K2 */ be_nested_str(_X2F_X2Eautoconf), + }), + &be_const_str_clear_first_time, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_current_module_path +********************************************************************/ +be_local_closure(Autoconf_get_current_module_path, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(_archive), + }), + &be_const_str_get_current_module_path, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Autoconf +********************************************************************/ +be_local_class(Autoconf, + 2, + NULL, + be_nested_map(18, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(page_autoconf_ctl, -1), be_const_closure(Autoconf_page_autoconf_ctl_closure) }, + { be_const_key(autoexec, -1), be_const_closure(Autoconf_autoexec_closure) }, + { be_const_key(run_bat, 17), be_const_closure(Autoconf_run_bat_closure) }, + { be_const_key(page_autoconf_mgr, -1), be_const_closure(Autoconf_page_autoconf_mgr_closure) }, + { be_const_key(get_current_module_path, 13), be_const_closure(Autoconf_get_current_module_path_closure) }, + { be_const_key(preinit, -1), be_const_closure(Autoconf_preinit_closure) }, + { be_const_key(clear_first_time, -1), be_const_closure(Autoconf_clear_first_time_closure) }, + { be_const_key(load_templates, -1), be_const_closure(Autoconf_load_templates_closure) }, + { be_const_key(_archive, -1), be_const_var(0) }, + { be_const_key(web_add_config_button, -1), be_const_closure(Autoconf_web_add_config_button_closure) }, + { be_const_key(is_first_time, -1), be_const_closure(Autoconf_is_first_time_closure) }, + { be_const_key(web_add_handler, -1), be_const_closure(Autoconf_web_add_handler_closure) }, + { be_const_key(delete_all_configs, 4), be_const_closure(Autoconf_delete_all_configs_closure) }, + { be_const_key(reset, 5), be_const_closure(Autoconf_reset_closure) }, + { be_const_key(get_current_module_name, 11), be_const_closure(Autoconf_get_current_module_name_closure) }, + { be_const_key(init, 6), be_const_closure(Autoconf_init_closure) }, + { be_const_key(_error, -1), be_const_var(1) }, + { be_const_key(set_first_time, -1), be_const_closure(Autoconf_set_first_time_closure) }, + })), + be_str_literal("Autoconf") +); + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(_anonymous_, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_class(be_class_Autoconf), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0xB4000000, // 0001 CLASS K0 + 0x5C080200, // 0002 MOVE R2 R1 + 0x7C080000, // 0003 CALL R2 0 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: autoconf +********************************************************************/ +be_local_module(autoconf, + "autoconf", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(_anonymous__closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(autoconf); +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_crypto_lib.c b/lib/libesp32/berry/default/be_crypto_lib.c new file mode 100644 index 000000000..04a10b28e --- /dev/null +++ b/lib/libesp32/berry/default/be_crypto_lib.c @@ -0,0 +1,56 @@ +/******************************************************************** + * Berry module `webserver` + * + * To use: `import webserver` + * + * Allows to respond to HTTP request + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_ALEXA_AVS + +extern int m_aes_gcm_init(bvm *vm); +extern int m_aes_gcm_encryt(bvm *vm); +extern int m_aes_gcm_decryt(bvm *vm); +extern int m_aes_gcm_tag(bvm *vm); + +extern int m_ec_c25519_pubkey(bvm *vm); +extern int m_ec_c25519_sharedkey(bvm *vm); + +#include "../generate/be_fixed_be_class_aes_gcm.h" +#include "../generate/be_fixed_be_class_ec_c25519.h" + +void be_load_crypto_lib(bvm *vm) { + // insert the class GCM in module AES + be_newmodule(vm); + be_setname(vm, -1, "crypto"); + be_setglobal(vm, "crypto"); + + be_pushntvclass(vm, &be_class_aes_gcm); + be_setmember(vm, -2, "AES_GCM"); + be_pop(vm, 1); + + be_pushntvclass(vm, &be_class_ec_c25519); + be_setmember(vm, -2, "EC_C25519"); + be_pop(vm, 2); +} +/* @const_object_info_begin + +class be_class_aes_gcm (scope: global, name: AES_GCM) { + .p1, var + .p2, var + + init, func(m_aes_gcm_init) + encrypt, func(m_aes_gcm_encryt) + decrypt, func(m_aes_gcm_decryt) + tag, func(m_aes_gcm_tag) +} + +class be_class_ec_c25519 (scope: global, name: EC_C25519) { + public_key, func(m_ec_c25519_pubkey) + shared_key, func(m_ec_c25519_sharedkey) +} + +@const_object_info_end */ + +#endif // USE_ALEXA_AVS diff --git a/lib/libesp32/berry/default/be_ctypes.c b/lib/libesp32/berry/default/be_ctypes.c new file mode 100644 index 000000000..18e655d8b --- /dev/null +++ b/lib/libesp32/berry/default/be_ctypes.c @@ -0,0 +1,494 @@ +/******************************************************************** + * Tasmota ctypes mapping + *******************************************************************/ +#include "be_constobj.h" +#include + +extern __attribute__((noreturn)) void be_raisef(bvm *vm, const char *except, const char *msg, ...); + +// binary search within an array of sorted strings +// the first 4 bytes are a pointer to a string +// returns 0..total_elements-1 or -1 if not found + +int32_t bin_search_ctypes(const char * needle, const void * table, size_t elt_size, size_t total_elements) { + int32_t low = 0; + int32_t high = total_elements - 1; + int32_t mid = (low + high) / 2; + // start a dissect + while (low <= high) { + const char * elt = *(const char **) ( ((uint8_t*)table) + mid * elt_size ); + int32_t comp = strcmp(needle, elt); + if (comp < 0) { + high = mid - 1; + } else if (comp > 0) { + low = mid + 1; + } else { + break; + } + mid = (low + high) / 2; + } + if (low <= high) { + return mid; + } else { + return -1; + } +} + +enum { + ctypes_i32 = 14, + ctypes_i16 = 12, + ctypes_i8 = 11, + ctypes_u32 = 4, + ctypes_u16 = 2, + ctypes_u8 = 1, + + // big endian + ctypes_be_i32 = -14, + ctypes_be_i16 = -12, + ctypes_be_i8 = -11, + ctypes_be_u32 = -4, + ctypes_be_u16 = -2, + ctypes_be_u8 = -1, + + // floating point + ctypes_float = 5, + ctypes_double = 10, + + // pointer + ctypes_ptr32 = 9, + ctypes_ptr64 = -9, + + ctypes_bf = 0, //bif-field +}; + +typedef struct be_ctypes_structure_item_t { + const char * name; + uint16_t offset_bytes; + uint8_t offset_bits : 3; + uint8_t len_bits : 5; + int8_t type : 5; + uint8_t mapping : 3; +} be_ctypes_structure_item_t; + +typedef struct be_ctypes_structure_t { + uint16_t size_bytes; /* size in bytes */ + uint16_t size_elt; /* number of elements */ + const char **instance_mapping; /* array of instance class names for automatic instanciation of class */ + const be_ctypes_structure_item_t * items; +} be_ctypes_structure_t; + +typedef struct be_ctypes_class_t { + const char * name; + const be_ctypes_structure_t * definitions; +} be_ctypes_class_t; + +typedef struct be_ctypes_classes_t { + uint16_t size; + const char **instance_mapping; /* array of instance class names for automatic instanciation of class */ + const be_ctypes_class_t * classes; +} be_ctypes_classes_t; + +// const be_ctypes_class_t * g_ctypes_classes = NULL; + +// +// Constructor for ctypes structure +// +// If no arg: allocate a bytes() structure of the right size, filled with zeroes +// Arg1 is instance self +// If arg 2 is int or comptr (and not null): create a mapped bytes buffer to read/write at a specific location (can be copied if need a snapshot) +// If arg 2 is a bytes object, consider it's comptr and map the buffer (it's basically casting). WARNING no size check is done so you can easily corrupt memory +int be_ctypes_init(bvm *vm) { + int argc = be_top(vm); + void * src_data = NULL; + if (argc > 1 && (be_isint(vm, 2) || be_iscomptr(vm, 2) || be_isbytes(vm, 2))) { + if (be_iscomptr(vm, 2)) { + src_data = be_tocomptr(vm, 2); + } else if (be_isbytes(vm, 2)) { + be_getmember(vm, 2, ".p"); + src_data = be_tocomptr(vm, -1); + be_pop(vm, 1); + } else { + src_data = (void*) be_toint(vm, 2); + } + } + + // look for class definition + be_getmember(vm, 1, "_def"); // static class comptr + const be_ctypes_structure_t *definitions; + definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1); + be_pop(vm, 1); + + // call super(self, bytes) + be_getglobal(vm, "super"); // push super function + be_pushvalue(vm, 1); // push self instance + be_getglobal(vm, "bytes"); // push bytes class + be_call(vm, 2); + be_pop(vm, 2); + // berry_log_C("be_ctypes_init> super found %p", be_toint(vm, -1)); + + // call bytes.init(self) + be_getmember(vm, -1, "init"); + be_pushvalue(vm, -2); + if (src_data) { be_pushcomptr(vm, src_data); } // if mapped, push address + be_pushint(vm, definitions ? -definitions->size_bytes : 0); // negative size signals a fixed size + be_call(vm, src_data ? 3 : 2); // call with 2 or 3 arguments depending on provided address + be_pop(vm, src_data ? 4 : 3); + // super(self, bytes) still on top of stack + + be_pop(vm, 1); + + be_return(vm); +} + +// +// copy ctypes_bytes, with same class and same content +// +int be_ctypes_copy(bvm *vm) { + size_t len; + const void * src = be_tobytes(vm, 1, &len); + be_classof(vm, 1); + // stack: 1/self + class_object + be_call(vm, 0); // call empty constructor to build empty resizable copy + // stack: 1/ self + new_empty_instance + + // source object (self) + be_getmember(vm, 1, ".p"); + const void* src_buf = be_tocomptr(vm, -1); + be_pop(vm, 1); + + be_getmember(vm, 1, ".len"); + int32_t src_len = be_toint(vm, -1); + be_pop(vm, 1); + + // dest object + be_getmember(vm, -1, ".p"); + const void* dst_buf = be_tocomptr(vm, -1); + be_pop(vm, 1); + + be_getmember(vm, -1, ".len"); + int32_t dst_len = be_toint(vm, -1); + be_pop(vm, 1); + + if (src_len != dst_len) { + be_raisef(vm, "internal_error", "new object has wrong size %i (should be %i)", dst_len, src_len); + } + + // copy bytes + memmove((void*)dst_buf, src_buf, src_len); + + be_return(vm); +} + +// get an attribute from a ctypes structure +// arg1: ctypes instance +// arg2: name of the argument +// The class has a `_def` static class attribute with the C low-level mapping definition +int be_ctypes_member(bvm *vm) { + int argc = be_top(vm); + be_getmember(vm, 1, "_def"); + const be_ctypes_structure_t *definitions; + definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1); + be_pop(vm, 1); + const char *name = be_tostring(vm, 2); + + // look for member + int32_t member_idx = bin_search_ctypes(name, &definitions->items[0], sizeof(be_ctypes_structure_item_t), definitions->size_elt); + if (member_idx >= 0) { + const be_ctypes_structure_item_t *member = &definitions->items[member_idx]; + // berry_log_C("member found bytes=%i, bits=%i, len_bits=%i, type=%i", member->offset_bytes, member->offset_bits, member->len_bits, member->type); + + // dispatch according to types + if (ctypes_bf == member->type) { + // bitfield + be_getmember(vm, 1, "getbits"); + be_pushvalue(vm, 1); // self + be_pushint(vm, member->offset_bytes * 8 + member->offset_bits); + be_pushint(vm, member->len_bits); + be_call(vm, 3); + be_pop(vm, 3); + // int result at top of stack + } else if (ctypes_float == member->type) { + // Note: double not supported (no need identified) + // get raw int32_t + be_getmember(vm, 1, "geti"); // self.get or self.geti + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushint(vm, 4); // size is 4 bytes + be_call(vm, 3); + be_pop(vm, 3); + // get int and convert to float + int32_t val = be_toint(vm, -1); + be_pop(vm, 1); + float *fval = (float*) &val; // type wizardry + be_pushreal(vm, *fval); + } else if (ctypes_ptr32 == member->type) { + be_getmember(vm, 1, "geti"); // self.get or self.geti + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushint(vm, 4); // size is 4 bytes TODO 32 bits only supported here + be_call(vm, 3); + be_pop(vm, 3); + // convert to ptr + int32_t val = be_toint(vm, -1); + be_pop(vm, 1); + be_pushcomptr(vm, (void*) val); + } else { + // general int support + int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian + int sign = bfalse; // signed int + if (size >= ctypes_i8) { + size -= ctypes_i8 - 1; + sign = btrue; + } + if (size <= ctypes_be_i8) { + size += ctypes_be_i8 - 1; + sign = btrue; + } + // get + be_getmember(vm, 1, sign ? "geti" : "get"); // self.get or self.geti + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushint(vm, size); + be_call(vm, 3); + be_pop(vm, 3); + // int result at top of stack + } + // the int result is at top of the stack + // check if we need an instance mapping + if (member->mapping > 0 && definitions->instance_mapping) { + const char * mapping_name = definitions->instance_mapping[member->mapping - 1]; + if (mapping_name) { + be_getglobal(vm, mapping_name); // stack: class + be_pushvalue(vm, -2); // stack: class, value + be_pushint(vm, -1); // stack; class, value, -1 + be_call(vm, 2); // call constructor with 2 parameters + be_pop(vm, 2); // leave new instance on top of stack + } + } + be_return(vm); + } + + be_return_nil(vm); +} + +// setmember takes 3 arguments: +// 1: self (subclass of bytes()) +// 2: name of member +// 3: value +int be_ctypes_setmember(bvm *vm) { + int argc = be_top(vm); + + // If the value is an instance, we call 'toint()' and replace the value + if (be_isinstance(vm, 3)) { + + be_getmember(vm, 3, "toint"); + if (!be_isnil(vm, -1)) { + be_pushvalue(vm, 3); + be_call(vm, 1); + be_pop(vm, 1); + be_moveto(vm, -1, 3); + } else { + be_raise(vm, "value_error", "Value is an instance without 'toint()' method"); + } + be_pop(vm, 1); + } + + // If the value is a pointer, replace with an int of same value (works only on 32 bits CPU) + if (be_iscomptr(vm, 3)) { + void * v = be_tocomptr(vm, 3); + be_pushint(vm, (int32_t) v); + be_moveto(vm, -1, 3); + be_pop(vm, 1); + } + + be_getmember(vm, 1, "_def"); + const be_ctypes_structure_t *definitions; + definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1); + be_pop(vm, 1); + const char *name = be_tostring(vm, 2); + + // look for member + int32_t member_idx = bin_search_ctypes(name, &definitions->items[0], sizeof(be_ctypes_structure_item_t), definitions->size_elt); + if (member_idx >= 0) { + const be_ctypes_structure_item_t *member = &definitions->items[member_idx]; + // berry_log_C("member found bytes=%i, bits=%i, len_bits=%i, type=%i", member->offset_bytes, member->offset_bits, member->len_bits, member->type); + + // dispatch according to types + if (ctypes_bf == member->type) { + // bitfield + be_getmember(vm, 1, "setbits"); + be_pushvalue(vm, 1); // self + be_pushint(vm, member->offset_bytes * 8 + member->offset_bits); + be_pushint(vm, member->len_bits); + be_pushvalue(vm, 3); // val + be_call(vm, 4); + be_pop(vm, 5); + be_return_nil(vm); + } else if (ctypes_float == member->type) { + // Note: double not supported (no need identified) + float val = be_toreal(vm, 3); + int32_t *ival = (int32_t*) &val; + // set + be_getmember(vm, 1, "seti"); + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushint(vm, *ival); + be_pushint(vm, 4); // size is 4 bytes + be_call(vm, 4); + be_pop(vm, 5); + be_return_nil(vm); + } else if (ctypes_ptr32 == member->type) { + // Note: 64 bits pointer not supported + int32_t ptr; + if (be_iscomptr(vm, 3)) { + ptr = (int32_t) be_tocomptr(vm, 3); + } else { + ptr = be_toint(vm, 3); + } + // set + be_getmember(vm, 1, "seti"); + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushint(vm, ptr); + be_pushint(vm, 4); // size is 4 bytes - 64 bits not suppported + be_call(vm, 4); + be_pop(vm, 5); + be_return_nil(vm); + } else { + // general int support + int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian + int sign = bfalse; // signed int + if (size >= ctypes_i8) { + size -= ctypes_i8 - 1; + sign = btrue; + } + if (size <= ctypes_be_i8) { + size += ctypes_be_i8 - 1; + sign = btrue; + } + // set + be_getmember(vm, 1, sign ? "seti" : "set"); // self.get or self.geti + be_pushvalue(vm, 1); // push self + be_pushint(vm, member->offset_bytes); + be_pushvalue(vm, 3); // val + be_pushint(vm, size); + be_call(vm, 4); + be_pop(vm, 5); + be_return_nil(vm); + } + } else { + be_raisef(vm, "attribute_error", "class '%s' cannot assign to attribute '%s'", + be_classname(vm, 1), be_tostring(vm, 2)); + } +} + +// +// tomap, create a map instance containing all values decoded +// +int be_ctypes_tomap(bvm *vm) { + // don't need argc + be_getmember(vm, 1, "_def"); + const be_ctypes_structure_t *definitions; + definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1); + be_pop(vm, 1); + + // create empty map + be_newobject(vm, "map"); + + for (uint32_t i = 0; i < definitions->size_elt; i++) { + const be_ctypes_structure_item_t * item = &definitions->items[i]; + + be_pushstring(vm, item->name); // stack: map - key + + be_getmember(vm, 1, "member"); + be_pushvalue(vm, 1); + be_pushstring(vm, item->name); + be_call(vm, 2); + be_pop(vm, 2); // stack: map - key - value + + be_data_insert(vm, -3); + be_pop(vm, 2); // stack: map + } + + be_pop(vm, 1); // remove map struct, to leave map instance + be_return(vm); +} + +// +// Constructor for ctypes_dyn structure +// +// Arg1 is instance self +// Arg2 is int or comptr (and not null): create a mapped bytes buffer to read/write at a specific location +// Arg3 is int or comptr (and not null): the binary definition of the struct (dynamic and not fixed as static member) +int be_ctypes_dyn_init(bvm *vm) { + int argc = be_top(vm); + void * src_data = NULL; + const be_ctypes_structure_t * definitions = NULL; + if (argc > 2 && (be_isint(vm, 2) || be_iscomptr(vm, 2)) && (be_isint(vm, 3) || be_iscomptr(vm, 3))) { + if (be_iscomptr(vm, 2)) { + src_data = be_tocomptr(vm, 2); + } else { + src_data = (void*) be_toint(vm, 2); + } + if (be_iscomptr(vm, 3)) { + definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, 3); + } else { + definitions = (const be_ctypes_structure_t *) be_toint(vm, 3); + } + } + if (!src_data || !definitions) { + be_raise(vm, "value_error", "'address' and 'definition' cannot be null"); + } + + // store definition in member variable + be_pushcomptr(vm, (void*) definitions); + be_setmember(vm, 1, "_def"); // static class comptr + be_pop(vm, 1); + + // call bytes.init(self) + be_getbuiltin(vm, "bytes"); // shortcut `ctypes` init and call directly bytes.init() + be_getmember(vm, -1, "init"); + be_pushvalue(vm, 1); + be_pushcomptr(vm, src_data); + be_pushint(vm, -definitions->size_bytes); // negative size signals a fixed size + be_call(vm, 3); // call with 2 or 3 arguments depending on provided address + be_pop(vm, 4); + // super(self, bytes) still on top of stack + + be_pop(vm, 1); + + be_return(vm); +} + +BE_EXPORT_VARIABLE extern const bclass be_class_bytes; + +#include "../generate/be_fixed_be_class_ctypes.h" +#include "../generate/be_fixed_be_class_ctypes_dyn.h" + +void be_load_ctypes_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_ctypes); + be_setglobal(vm, "ctypes_bytes"); + be_pop(vm, 1); + be_pushntvclass(vm, &be_class_ctypes_dyn); + be_setglobal(vm, "ctypes_bytes_dyn"); + be_pop(vm, 1); +} + +/* @const_object_info_begin +class be_class_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) { + _def, nil() + copy, func(be_ctypes_copy) + init, func(be_ctypes_init) + member, func(be_ctypes_member) + setmember, func(be_ctypes_setmember) + + tomap, func(be_ctypes_tomap) +} +@const_object_info_end */ + +/* @const_object_info_begin +class be_class_ctypes_dyn (scope: global, name: ctypes_bytes_dyn, super: be_class_ctypes) { + _def, var + init, func(be_ctypes_dyn_init) +} +@const_object_info_end */ diff --git a/lib/libesp32/berry/default/be_display_lib.c b/lib/libesp32/berry/default/be_display_lib.c new file mode 100644 index 000000000..3943396fc --- /dev/null +++ b/lib/libesp32/berry/default/be_display_lib.c @@ -0,0 +1,29 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import display` + * + * Initialize Universal Display driver + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_DISPLAY + +// Tasmota specific + +extern int be_ntv_display_start(bvm *vm); + +/******************************************************************** +** Solidified module: display +********************************************************************/ +be_local_module(display, + "display", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(start, -1), be_const_func(be_ntv_display_start) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(display); +/********************************************************************/ + +#endif // USE_DISPLAY \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_driverlib.c b/lib/libesp32/berry/default/be_driverlib.c new file mode 100644 index 000000000..45a611382 --- /dev/null +++ b/lib/libesp32/berry/default/be_driverlib.c @@ -0,0 +1,153 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `d = Driver()` + * + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Driver_init, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_tasmota +********************************************************************/ +be_local_closure(Driver_get_tasmota, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + }), + &be_const_str_get_tasmota, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_cmd +********************************************************************/ +be_local_closure(Driver_add_cmd, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 2]) { /* upvals */ + be_local_const_upval(1, 2), + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x68100000, // 0000 GETUPV R4 U0 + 0x68140001, // 0001 GETUPV R5 U1 + 0x5C180000, // 0002 MOVE R6 R0 + 0x5C1C0200, // 0003 MOVE R7 R1 + 0x5C200400, // 0004 MOVE R8 R2 + 0x5C240600, // 0005 MOVE R9 R3 + 0x7C100A00, // 0006 CALL R4 5 + 0x80040800, // 0007 RET 1 R4 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(add_cmd), + }), + &be_const_str_add_cmd, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0xB80E0000, // 0000 GETNGBL R3 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x84180000, // 0003 CLOSURE R6 P0 + 0x7C0C0600, // 0004 CALL R3 3 + 0xA0000000, // 0005 CLOSE R0 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Driver +********************************************************************/ +be_local_class(Driver, + 13, + NULL, + be_nested_map(16, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(web_add_main_button, 14), be_const_var(4) }, + { be_const_key(web_add_console_button, -1), be_const_var(7) }, + { be_const_key(web_add_management_button, 8), be_const_var(5) }, + { be_const_key(init, -1), be_const_closure(Driver_init_closure) }, + { be_const_key(json_append, -1), be_const_var(10) }, + { be_const_key(web_add_config_button, 7), be_const_var(6) }, + { be_const_key(every_100ms, -1), be_const_var(1) }, + { be_const_key(display, -1), be_const_var(12) }, + { be_const_key(web_add_button, 13), be_const_var(3) }, + { be_const_key(every_second, -1), be_const_var(0) }, + { be_const_key(save_before_restart, -1), be_const_var(8) }, + { be_const_key(get_tasmota, -1), be_const_closure(Driver_get_tasmota_closure) }, + { be_const_key(web_sensor, 6), be_const_var(9) }, + { be_const_key(web_add_handler, -1), be_const_var(2) }, + { be_const_key(button_pressed, 1), be_const_var(11) }, + { be_const_key(add_cmd, -1), be_const_closure(Driver_add_cmd_closure) }, + })), + be_str_literal("Driver") +); +/*******************************************************************/ + +void be_load_Driver_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Driver); + be_setglobal(vm, "Driver"); + be_pop(vm, 1); +} diff --git a/lib/libesp32/berry/default/be_energy_ctypes_definitions.c b/lib/libesp32/berry/default/be_energy_ctypes_definitions.c new file mode 100644 index 000000000..86f84ef64 --- /dev/null +++ b/lib/libesp32/berry/default/be_energy_ctypes_definitions.c @@ -0,0 +1,117 @@ +/******************************************************************** + * Tasmota LVGL ctypes mapping + *******************************************************************/ +#include "be_ctypes.h" + +#ifdef USE_ENERGY_SENSOR + +/******************************************************************** + * Generated code, don't edit + *******************************************************************/ + +static const char * be_ctypes_instance_mappings[]; /* forward definition */ + +const be_ctypes_structure_t be_energy_struct = { + 250, /* size in bytes */ + 85, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[85]) { + { "active_power", 24, 0, 0, ctypes_float, 0 }, + { "active_power_2", 28, 0, 0, ctypes_float, 0 }, + { "active_power_3", 32, 0, 0, ctypes_float, 0 }, + { "apparent_power", 36, 0, 0, ctypes_float, 0 }, + { "apparent_power_2", 40, 0, 0, ctypes_float, 0 }, + { "apparent_power_3", 44, 0, 0, ctypes_float, 0 }, + { "command_code", 205, 0, 0, ctypes_u8, 0 }, + { "current", 12, 0, 0, ctypes_float, 0 }, + { "current_2", 16, 0, 0, ctypes_float, 0 }, + { "current_3", 20, 0, 0, ctypes_float, 0 }, + { "current_available", 215, 0, 0, ctypes_u8, 0 }, + { "daily", 120, 0, 0, ctypes_float, 0 }, + { "daily_2", 124, 0, 0, ctypes_float, 0 }, + { "daily_3", 128, 0, 0, ctypes_float, 0 }, + { "daily_sum", 144, 0, 0, ctypes_float, 0 }, + { "data_valid", 206, 0, 0, ctypes_u8, 0 }, + { "data_valid_2", 207, 0, 0, ctypes_u8, 0 }, + { "data_valid_3", 208, 0, 0, ctypes_u8, 0 }, + { "export_active", 96, 0, 0, ctypes_float, 0 }, + { "export_active_2", 100, 0, 0, ctypes_float, 0 }, + { "export_active_3", 104, 0, 0, ctypes_float, 0 }, + { "fifth_second", 204, 0, 0, ctypes_u8, 0 }, + { "frequency", 72, 0, 0, ctypes_float, 0 }, + { "frequency_2", 76, 0, 0, ctypes_float, 0 }, + { "frequency_3", 80, 0, 0, ctypes_float, 0 }, + { "frequency_common", 211, 0, 0, ctypes_u8, 0 }, + { "import_active", 84, 0, 0, ctypes_float, 0 }, + { "import_active_2", 88, 0, 0, ctypes_float, 0 }, + { "import_active_3", 92, 0, 0, ctypes_float, 0 }, + { "max_current_flag", 242, 0, 0, ctypes_u8, 0 }, + { "max_energy_state", 249, 0, 0, ctypes_u8, 0 }, + { "max_power_flag", 238, 0, 0, ctypes_u8, 0 }, + { "max_voltage_flag", 240, 0, 0, ctypes_u8, 0 }, + { "min_current_flag", 241, 0, 0, ctypes_u8, 0 }, + { "min_power_flag", 237, 0, 0, ctypes_u8, 0 }, + { "min_voltage_flag", 239, 0, 0, ctypes_u8, 0 }, + { "mplh_counter", 244, 0, 0, ctypes_u16, 0 }, + { "mplr_counter", 248, 0, 0, ctypes_u8, 0 }, + { "mplw_counter", 246, 0, 0, ctypes_u16, 0 }, + { "period", 192, 0, 0, ctypes_u32, 0 }, + { "period_2", 196, 0, 0, ctypes_u32, 0 }, + { "period_3", 200, 0, 0, ctypes_u32, 0 }, + { "phase_count", 209, 0, 0, ctypes_u8, 0 }, + { "power_factor", 60, 0, 0, ctypes_float, 0 }, + { "power_factor_2", 64, 0, 0, ctypes_float, 0 }, + { "power_factor_3", 68, 0, 0, ctypes_float, 0 }, + { "power_history_0", 218, 0, 0, ctypes_u16, 0 }, + { "power_history_0_2", 220, 0, 0, ctypes_u16, 0 }, + { "power_history_0_3", 222, 0, 0, ctypes_u16, 0 }, + { "power_history_1", 224, 0, 0, ctypes_u16, 0 }, + { "power_history_1_2", 226, 0, 0, ctypes_u16, 0 }, + { "power_history_1_3", 228, 0, 0, ctypes_u16, 0 }, + { "power_history_2", 230, 0, 0, ctypes_u16, 0 }, + { "power_history_2_2", 232, 0, 0, ctypes_u16, 0 }, + { "power_history_2_3", 234, 0, 0, ctypes_u16, 0 }, + { "power_on", 217, 0, 0, ctypes_u8, 0 }, + { "power_steady_counter", 236, 0, 0, ctypes_u8, 0 }, + { "reactive_power", 48, 0, 0, ctypes_float, 0 }, + { "reactive_power_2", 52, 0, 0, ctypes_float, 0 }, + { "reactive_power_3", 56, 0, 0, ctypes_float, 0 }, + { "start_energy", 108, 0, 0, ctypes_float, 0 }, + { "start_energy_2", 112, 0, 0, ctypes_float, 0 }, + { "start_energy_3", 116, 0, 0, ctypes_float, 0 }, + { "today_delta_kwh", 156, 0, 0, ctypes_u32, 0 }, + { "today_delta_kwh_2", 160, 0, 0, ctypes_u32, 0 }, + { "today_delta_kwh_3", 164, 0, 0, ctypes_u32, 0 }, + { "today_kwh", 180, 0, 0, ctypes_u32, 0 }, + { "today_kwh_2", 184, 0, 0, ctypes_u32, 0 }, + { "today_kwh_3", 188, 0, 0, ctypes_u32, 0 }, + { "today_offset_init_kwh", 213, 0, 0, ctypes_u8, 0 }, + { "today_offset_kwh", 168, 0, 0, ctypes_u32, 0 }, + { "today_offset_kwh_2", 172, 0, 0, ctypes_u32, 0 }, + { "today_offset_kwh_3", 176, 0, 0, ctypes_u32, 0 }, + { "total", 132, 0, 0, ctypes_float, 0 }, + { "total_2", 136, 0, 0, ctypes_float, 0 }, + { "total_3", 140, 0, 0, ctypes_float, 0 }, + { "total_sum", 148, 0, 0, ctypes_float, 0 }, + { "type_dc", 216, 0, 0, ctypes_u8, 0 }, + { "use_overtemp", 212, 0, 0, ctypes_u8, 0 }, + { "voltage", 0, 0, 0, ctypes_float, 0 }, + { "voltage_2", 4, 0, 0, ctypes_float, 0 }, + { "voltage_3", 8, 0, 0, ctypes_float, 0 }, + { "voltage_available", 214, 0, 0, ctypes_u8, 0 }, + { "voltage_common", 210, 0, 0, ctypes_u8, 0 }, + { "yesterday_sum", 152, 0, 0, ctypes_float, 0 }, +}}; + +static const char * be_ctypes_instance_mappings[] = { + NULL +}; + +static be_define_ctypes_class(energy_struct, &be_energy_struct, &be_class_ctypes, "energy_struct"); + +void be_load_ctypes_energy_definitions_lib(bvm *vm) { + ctypes_register_class(vm, &be_class_energy_struct, &be_energy_struct); +} +/********************************************************************/ + +#endif // USE_ENERGY_SENSOR \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_energylib.c b/lib/libesp32/berry/default/be_energylib.c new file mode 100644 index 000000000..cbdddbfca --- /dev/null +++ b/lib/libesp32/berry/default/be_energylib.c @@ -0,0 +1,186 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import power` + * + * read power values + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_ENERGY_SENSOR + +extern struct ENERGY Energy; +/* + +_energy = nil # avoid compilation error +energy = module("energy") +energy._ptr = nil + +def init(m) + import global + global._energy = energy_struct(m._ptr) + return m +end +energy.init = init + +def read() + return _energy.tomap() +end +energy.read = read + +def member(k) + return _energy.(k) +end +energy.member = member + +def setmember(k, v) + _energy.(k) = v +end +energy.setmember = setmember + +import solidify +solidify.dump(energy) +*/ + + +/******************************************************************** +** Solidified function: member +********************************************************************/ +be_local_closure(energy_member, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(_energy), + }), + &be_const_str_member, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x88040200, // 0001 GETMBR R1 R1 R0 + 0x80040200, // 0002 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: setmember +********************************************************************/ +be_local_closure(energy_setmember, /* name */ + be_nested_proto( + 3, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(_energy), + }), + &be_const_str_setmember, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x90080001, // 0001 SETMBR R2 R0 R1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read +********************************************************************/ +be_local_closure(energy_read, /* name */ + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_energy), + /* K1 */ be_nested_str(tomap), + }), + &be_const_str_read, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0xB8020000, // 0000 GETNGBL R0 K0 + 0x8C000101, // 0001 GETMET R0 R0 K1 + 0x7C000200, // 0002 CALL R0 1 + 0x80040000, // 0003 RET 1 R0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(energy_init, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(global), + /* K1 */ be_nested_str(_energy), + /* K2 */ be_nested_str(energy_struct), + /* K3 */ be_nested_str(_ptr), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xB80A0400, // 0001 GETNGBL R2 K2 + 0x880C0103, // 0002 GETMBR R3 R0 K3 + 0x7C080200, // 0003 CALL R2 1 + 0x90060202, // 0004 SETMBR R1 K1 R2 + 0x80040000, // 0005 RET 1 R0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: energy +********************************************************************/ +be_local_module(energy, + "energy", + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(energy_init_closure) }, + { be_const_key(member, 2), be_const_closure(energy_member_closure) }, + { be_const_key(_ptr, 3), be_const_comptr(&Energy) }, + { be_const_key(setmember, -1), be_const_closure(energy_setmember_closure) }, + { be_const_key(read, -1), be_const_closure(energy_read_closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(energy); +/********************************************************************/ + + +// { be_const_key(_ptr, 3), be_const_comptr(&Energy) }, /* patch */ + +#endif // USE_ENERGY_SENSOR \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_flash_lib.c b/lib/libesp32/berry/default/be_flash_lib.c new file mode 100644 index 000000000..539805d5d --- /dev/null +++ b/lib/libesp32/berry/default/be_flash_lib.c @@ -0,0 +1,21 @@ +/******************************************************************** + * Berry module `webserver` + * + * To use: `import webserver` + * + * Allows to respond to HTTP request + *******************************************************************/ +#include "be_constobj.h" + +extern int p_flash_read(bvm *vm); +extern int p_flash_write(bvm *vm); +extern int p_flash_erase(bvm *vm); + +/* @const_object_info_begin +module flash (scope: global) { + read, func(p_flash_read) + write, func(p_flash_write) + erase, func(p_flash_erase) +} +@const_object_info_end */ +#include "../generate/be_fixed_flash.h" diff --git a/lib/libesp32/berry/default/be_gpio_lib.c b/lib/libesp32/berry/default/be_gpio_lib.c new file mode 100644 index 000000000..3f0b2b3ed --- /dev/null +++ b/lib/libesp32/berry/default/be_gpio_lib.c @@ -0,0 +1,34 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import power` + * + * read power values + *******************************************************************/ +#include "be_constobj.h" + +// Tasmota specific + +extern int gp_member(bvm *vm); +extern int gp_pin_mode(bvm *vm); +extern int gp_digital_write(bvm *vm); +extern int gp_digital_read(bvm *vm); +extern int gp_dac_voltage(bvm *vm); + +extern int gp_pin_used(bvm *vm); +extern int gp_pin(bvm *vm); + +/* @const_object_info_begin +module gpio (scope: global) { + member, func(gp_member) + + pin_mode, func(gp_pin_mode) + digital_write, func(gp_digital_write) + digital_read, func(gp_digital_read) + dac_voltage, func(gp_dac_voltage) + + pin_used, func(gp_pin_used) + pin, func(gp_pin) +} +@const_object_info_end */ +#include "../generate/be_fixed_gpio.h" diff --git a/lib/libesp32/berry/default/be_i2c_axp192_lib.c b/lib/libesp32/berry/default/be_i2c_axp192_lib.c new file mode 100644 index 000000000..4f9f02307 --- /dev/null +++ b/lib/libesp32/berry/default/be_i2c_axp192_lib.c @@ -0,0 +1,899 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: get_warning_level +********************************************************************/ +be_local_closure(AXP192_get_warning_level, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_int(1), + }), + &be_const_str_get_warning_level, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0046, // 0001 LDINT R3 71 + 0x7C040400, // 0002 CALL R1 2 + 0x2C040301, // 0003 AND R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_vbus_current +********************************************************************/ +be_local_closure(AXP192_get_vbus_current, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3EC00000), + }), + &be_const_str_get_vbus_current, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E005B, // 0001 LDINT R3 92 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_chg_current +********************************************************************/ +be_local_closure(AXP192_set_chg_current, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(write8), + /* K1 */ be_nested_str(read8), + }), + &be_const_str_set_chg_current, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120032, // 0001 LDINT R4 51 + 0x8C140101, // 0002 GETMET R5 R0 K1 + 0x541E0032, // 0003 LDINT R7 51 + 0x7C140400, // 0004 CALL R5 2 + 0x541A00EF, // 0005 LDINT R6 240 + 0x2C140A06, // 0006 AND R5 R5 R6 + 0x541A000E, // 0007 LDINT R6 15 + 0x2C180206, // 0008 AND R6 R1 R6 + 0x30140A06, // 0009 OR R5 R5 R6 + 0x7C080600, // 000A CALL R2 3 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_current +********************************************************************/ +be_local_closure(AXP192_get_bat_current, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read13), + /* K1 */ be_const_real_hex(0x3F000000), + }), + &be_const_str_get_bat_current, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0079, // 0001 LDINT R3 122 + 0x7C040400, // 0002 CALL R1 2 + 0x8C080100, // 0003 GETMET R2 R0 K0 + 0x5412007B, // 0004 LDINT R4 124 + 0x7C080400, // 0005 CALL R2 2 + 0x04040202, // 0006 SUB R1 R1 R2 + 0x08040301, // 0007 MUL R1 R1 K1 + 0x80040200, // 0008 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_power +********************************************************************/ +be_local_closure(AXP192_get_bat_power, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read24), + /* K1 */ be_const_real_hex(0x3A102DE1), + }), + &be_const_str_get_bat_power, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E006F, // 0001 LDINT R3 112 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: json_append +********************************************************************/ +be_local_closure(AXP192_json_append, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(wire), + }), + &be_const_str_json_append, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x74060001, // 0001 JMPT R1 #0004 + 0x4C040000, // 0002 LDNIL R1 + 0x80040200, // 0003 RET 1 R1 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_vbus_voltage +********************************************************************/ +be_local_closure(AXP192_get_vbus_voltage, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3ADED28A), + }), + &be_const_str_get_vbus_voltage, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0059, // 0001 LDINT R3 90 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_temp +********************************************************************/ +be_local_closure(AXP192_get_temp, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3DCCCCCD), + /* K2 */ be_const_real_hex(0x4310B333), + }), + &be_const_str_get_temp, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E005D, // 0001 LDINT R3 94 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x04040302, // 0004 SUB R1 R1 K2 + 0x80040200, // 0005 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: battery_present +********************************************************************/ +be_local_closure(AXP192_battery_present, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_battery_present, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140003, // 0004 LDCONST R5 K3 + 0x7C040800, // 0005 CALL R1 4 + 0x540A001F, // 0006 LDINT R2 32 + 0x2C040202, // 0007 AND R1 R1 R2 + 0x78060002, // 0008 JMPF R1 #000C + 0x50040200, // 0009 LDBOOL R1 1 0 + 0x80040200, // 000A RET 1 R1 + 0x70020001, // 000B JMP #000E + 0x50040000, // 000C LDBOOL R1 0 0 + 0x80040200, // 000D RET 1 R1 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_aps_voltage +********************************************************************/ +be_local_closure(AXP192_get_aps_voltage, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3AB78035), + }), + &be_const_str_get_aps_voltage, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E007D, // 0001 LDINT R3 126 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_dcdc_enable +********************************************************************/ +be_local_closure(AXP192_set_dcdc_enable, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_int(1), + /* K1 */ be_nested_str(write_bit), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(3), + }), + &be_const_str_set_dcdc_enable, + &be_const_str_solidified, + ( &(const binstruction[22]) { /* code */ + 0x1C0C0300, // 0000 EQ R3 R1 K0 + 0x780E0004, // 0001 JMPF R3 #0007 + 0x8C0C0101, // 0002 GETMET R3 R0 K1 + 0x54160011, // 0003 LDINT R5 18 + 0x58180002, // 0004 LDCONST R6 K2 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x7C0C0800, // 0006 CALL R3 4 + 0x1C0C0303, // 0007 EQ R3 R1 K3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x8C0C0101, // 0009 GETMET R3 R0 K1 + 0x54160011, // 000A LDINT R5 18 + 0x541A0003, // 000B LDINT R6 4 + 0x5C1C0400, // 000C MOVE R7 R2 + 0x7C0C0800, // 000D CALL R3 4 + 0x1C0C0304, // 000E EQ R3 R1 K4 + 0x780E0004, // 000F JMPF R3 #0015 + 0x8C0C0101, // 0010 GETMET R3 R0 K1 + 0x54160011, // 0011 LDINT R5 18 + 0x58180000, // 0012 LDCONST R6 K0 + 0x5C1C0400, // 0013 MOVE R7 R2 + 0x7C0C0800, // 0014 CALL R3 4 + 0x80000000, // 0015 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ldo_voltage +********************************************************************/ +be_local_closure(AXP192_set_ldo_voltage, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_int(2), + /* K1 */ be_nested_str(write8), + /* K2 */ be_nested_str(read8), + /* K3 */ be_const_int(3), + }), + &be_const_str_set_ldo_voltage, + &be_const_str_solidified, + ( &(const binstruction[39]) { /* code */ + 0x540E0CE3, // 0000 LDINT R3 3300 + 0x240C0403, // 0001 GT R3 R2 R3 + 0x780E0001, // 0002 JMPF R3 #0005 + 0x540A000E, // 0003 LDINT R2 15 + 0x70020004, // 0004 JMP #000A + 0x540E0063, // 0005 LDINT R3 100 + 0x0C0C0403, // 0006 DIV R3 R2 R3 + 0x54120011, // 0007 LDINT R4 18 + 0x040C0604, // 0008 SUB R3 R3 R4 + 0x5C080600, // 0009 MOVE R2 R3 + 0x1C0C0300, // 000A EQ R3 R1 K0 + 0x780E000C, // 000B JMPF R3 #0019 + 0x8C0C0101, // 000C GETMET R3 R0 K1 + 0x54160027, // 000D LDINT R5 40 + 0x8C180102, // 000E GETMET R6 R0 K2 + 0x54220027, // 000F LDINT R8 40 + 0x7C180400, // 0010 CALL R6 2 + 0x541E000E, // 0011 LDINT R7 15 + 0x2C180C07, // 0012 AND R6 R6 R7 + 0x541E000E, // 0013 LDINT R7 15 + 0x2C1C0407, // 0014 AND R7 R2 R7 + 0x54220003, // 0015 LDINT R8 4 + 0x381C0E08, // 0016 SHL R7 R7 R8 + 0x30180C07, // 0017 OR R6 R6 R7 + 0x7C0C0600, // 0018 CALL R3 3 + 0x1C0C0303, // 0019 EQ R3 R1 K3 + 0x780E000A, // 001A JMPF R3 #0026 + 0x8C0C0101, // 001B GETMET R3 R0 K1 + 0x54160027, // 001C LDINT R5 40 + 0x8C180102, // 001D GETMET R6 R0 K2 + 0x54220027, // 001E LDINT R8 40 + 0x7C180400, // 001F CALL R6 2 + 0x541E00EF, // 0020 LDINT R7 240 + 0x2C180C07, // 0021 AND R6 R6 R7 + 0x541E000E, // 0022 LDINT R7 15 + 0x2C1C0407, // 0023 AND R7 R2 R7 + 0x30180C07, // 0024 OR R6 R6 R7 + 0x7C0C0600, // 0025 CALL R3 3 + 0x80000000, // 0026 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(AXP192_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(I2C_Driver), + /* K1 */ be_nested_str(init), + /* K2 */ be_nested_str(AXP192), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x60040003, // 0000 GETGBL R1 G3 + 0x5C080000, // 0001 MOVE R2 R0 + 0xB80E0000, // 0002 GETNGBL R3 K0 + 0x7C040400, // 0003 CALL R1 2 + 0x8C040301, // 0004 GETMET R1 R1 K1 + 0x580C0002, // 0005 LDCONST R3 K2 + 0x54120033, // 0006 LDINT R4 52 + 0x7C040600, // 0007 CALL R1 3 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_voltage +********************************************************************/ +be_local_closure(AXP192_get_bat_voltage, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read12), + /* K1 */ be_const_real_hex(0x3A902DE0), + }), + &be_const_str_get_bat_voltage, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0077, // 0001 LDINT R3 120 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ldo_enable +********************************************************************/ +be_local_closure(AXP192_set_ldo_enable, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_const_int(2), + /* K1 */ be_nested_str(write_bit), + /* K2 */ be_const_int(3), + }), + &be_const_str_set_ldo_enable, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x1C0C0300, // 0000 EQ R3 R1 K0 + 0x780E0004, // 0001 JMPF R3 #0007 + 0x8C0C0101, // 0002 GETMET R3 R0 K1 + 0x54160011, // 0003 LDINT R5 18 + 0x58180000, // 0004 LDCONST R6 K0 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x7C0C0800, // 0006 CALL R3 4 + 0x1C0C0302, // 0007 EQ R3 R1 K2 + 0x780E0004, // 0008 JMPF R3 #000E + 0x8C0C0101, // 0009 GETMET R3 R0 K1 + 0x54160011, // 000A LDINT R5 18 + 0x58180002, // 000B LDCONST R6 K2 + 0x5C1C0400, // 000C MOVE R7 R2 + 0x7C0C0800, // 000D CALL R3 4 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_dc_voltage +********************************************************************/ +be_local_closure(AXP192_set_dc_voltage, /* name */ + be_nested_proto( + 11, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_int(1), + /* K1 */ be_const_int(3), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(2), + /* K4 */ be_nested_str(write8), + /* K5 */ be_nested_str(read8), + }), + &be_const_str_set_dc_voltage, + &be_const_str_solidified, + ( &(const binstruction[48]) { /* code */ + 0x140C0300, // 0000 LT R3 R1 K0 + 0x740E0001, // 0001 JMPT R3 #0004 + 0x240C0301, // 0002 GT R3 R1 K1 + 0x780E0000, // 0003 JMPF R3 #0005 + 0x80000600, // 0004 RET 0 + 0x4C0C0000, // 0005 LDNIL R3 + 0x541202BB, // 0006 LDINT R4 700 + 0x14100404, // 0007 LT R4 R2 R4 + 0x78120001, // 0008 JMPF R4 #000B + 0x580C0002, // 0009 LDCONST R3 K2 + 0x70020010, // 000A JMP #001C + 0x54120DAB, // 000B LDINT R4 3500 + 0x24100404, // 000C GT R4 R2 R4 + 0x78120001, // 000D JMPF R4 #0010 + 0x540E006F, // 000E LDINT R3 112 + 0x7002000B, // 000F JMP #001C + 0x1C100303, // 0010 EQ R4 R1 K3 + 0x78120004, // 0011 JMPF R4 #0017 + 0x541208E2, // 0012 LDINT R4 2275 + 0x24100404, // 0013 GT R4 R2 R4 + 0x78120001, // 0014 JMPF R4 #0017 + 0x540E003E, // 0015 LDINT R3 63 + 0x70020004, // 0016 JMP #001C + 0x541202BB, // 0017 LDINT R4 700 + 0x04100404, // 0018 SUB R4 R2 R4 + 0x54160018, // 0019 LDINT R5 25 + 0x0C100805, // 001A DIV R4 R4 R5 + 0x5C0C0800, // 001B MOVE R3 R4 + 0x54120025, // 001C LDINT R4 38 + 0x1C140301, // 001D EQ R5 R1 K1 + 0x78160001, // 001E JMPF R5 #0021 + 0x54120026, // 001F LDINT R4 39 + 0x70020002, // 0020 JMP #0024 + 0x1C140303, // 0021 EQ R5 R1 K3 + 0x78160000, // 0022 JMPF R5 #0024 + 0x54120022, // 0023 LDINT R4 35 + 0x8C140104, // 0024 GETMET R5 R0 K4 + 0x5C1C0800, // 0025 MOVE R7 R4 + 0x8C200105, // 0026 GETMET R8 R0 K5 + 0x5C280800, // 0027 MOVE R10 R4 + 0x7C200400, // 0028 CALL R8 2 + 0x5426007F, // 0029 LDINT R9 128 + 0x2C201009, // 002A AND R8 R8 R9 + 0x5426007E, // 002B LDINT R9 127 + 0x2C240609, // 002C AND R9 R3 R9 + 0x30201009, // 002D OR R8 R8 R9 + 0x7C140600, // 002E CALL R5 3 + 0x80000000, // 002F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: write_gpio +********************************************************************/ +be_local_closure(AXP192_write_gpio, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_const_int(2), + /* K2 */ be_nested_str(write_bit), + /* K3 */ be_const_int(3), + }), + &be_const_str_write_gpio, + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x280C0300, // 0000 GE R3 R1 K0 + 0x780E0007, // 0001 JMPF R3 #000A + 0x180C0301, // 0002 LE R3 R1 K1 + 0x780E0005, // 0003 JMPF R3 #000A + 0x8C0C0102, // 0004 GETMET R3 R0 K2 + 0x54160093, // 0005 LDINT R5 148 + 0x5C180200, // 0006 MOVE R6 R1 + 0x5C1C0400, // 0007 MOVE R7 R2 + 0x7C0C0800, // 0008 CALL R3 4 + 0x70020009, // 0009 JMP #0014 + 0x280C0303, // 000A GE R3 R1 K3 + 0x780E0007, // 000B JMPF R3 #0014 + 0x540E0003, // 000C LDINT R3 4 + 0x180C0203, // 000D LE R3 R1 R3 + 0x780E0004, // 000E JMPF R3 #0014 + 0x8C0C0102, // 000F GETMET R3 R0 K2 + 0x54160095, // 0010 LDINT R5 150 + 0x04180303, // 0011 SUB R6 R1 K3 + 0x5C1C0400, // 0012 MOVE R7 R2 + 0x7C0C0800, // 0013 CALL R3 4 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: web_sensor +********************************************************************/ +be_local_closure(AXP192_web_sensor, /* name */ + be_nested_proto( + 11, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(format), + /* K3 */ be_nested_str(_X7Bs_X7DVBus_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D), + /* K4 */ be_nested_str(_X7Bs_X7DVBus_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D), + /* K5 */ be_nested_str(_X7Bs_X7DBatt_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D), + /* K6 */ be_nested_str(_X7Bs_X7DBatt_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D), + /* K7 */ be_nested_str(_X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_XB0C_X7Be_X7D), + /* K8 */ be_nested_str(get_vbus_voltage), + /* K9 */ be_nested_str(get_bat_voltage), + /* K10 */ be_nested_str(get_bat_current), + /* K11 */ be_nested_str(get_temp), + /* K12 */ be_nested_str(tasmota), + /* K13 */ be_nested_str(web_send_decimal), + }), + &be_const_str_web_sensor, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x74060001, // 0001 JMPT R1 #0004 + 0x4C040000, // 0002 LDNIL R1 + 0x80040200, // 0003 RET 1 R1 + 0xA4060200, // 0004 IMPORT R1 K1 + 0x8C080302, // 0005 GETMET R2 R1 K2 + 0x40120704, // 0006 CONNECT R4 K3 K4 + 0x40100905, // 0007 CONNECT R4 R4 K5 + 0x40100906, // 0008 CONNECT R4 R4 K6 + 0x40100907, // 0009 CONNECT R4 R4 K7 + 0x8C140108, // 000A GETMET R5 R0 K8 + 0x7C140200, // 000B CALL R5 1 + 0x8C180108, // 000C GETMET R6 R0 K8 + 0x7C180200, // 000D CALL R6 1 + 0x8C1C0109, // 000E GETMET R7 R0 K9 + 0x7C1C0200, // 000F CALL R7 1 + 0x8C20010A, // 0010 GETMET R8 R0 K10 + 0x7C200200, // 0011 CALL R8 1 + 0x8C24010B, // 0012 GETMET R9 R0 K11 + 0x7C240200, // 0013 CALL R9 1 + 0x7C080E00, // 0014 CALL R2 7 + 0xB80E1800, // 0015 GETNGBL R3 K12 + 0x8C0C070D, // 0016 GETMET R3 R3 K13 + 0x5C140400, // 0017 MOVE R5 R2 + 0x7C0C0400, // 0018 CALL R3 2 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bat_charge_current +********************************************************************/ +be_local_closure(AXP192_get_bat_charge_current, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(read13), + /* K1 */ be_const_real_hex(0x3F000000), + }), + &be_const_str_get_bat_charge_current, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0079, // 0001 LDINT R3 122 + 0x7C040400, // 0002 CALL R1 2 + 0x08040301, // 0003 MUL R1 R1 K1 + 0x80040200, // 0004 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_battery_chargin_status +********************************************************************/ +be_local_closure(AXP192_get_battery_chargin_status, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_get_battery_chargin_status, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140003, // 0004 LDCONST R5 K3 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_input_power_status +********************************************************************/ +be_local_closure(AXP192_get_input_power_status, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(0), + /* K4 */ be_const_int(1), + }), + &be_const_str_get_input_power_status, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x880C0102, // 0002 GETMBR R3 R0 K2 + 0x58100003, // 0003 LDCONST R4 K3 + 0x58140004, // 0004 LDCONST R5 K4 + 0x7C040800, // 0005 CALL R1 4 + 0x80040200, // 0006 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: AXP192 +********************************************************************/ +extern const bclass be_class_I2C_Driver; +be_local_class(AXP192, + 0, + &be_class_I2C_Driver, + be_nested_map(21, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(get_warning_level, -1), be_const_closure(AXP192_get_warning_level_closure) }, + { be_const_key(get_vbus_current, -1), be_const_closure(AXP192_get_vbus_current_closure) }, + { be_const_key(get_aps_voltage, -1), be_const_closure(AXP192_get_aps_voltage_closure) }, + { be_const_key(get_bat_current, -1), be_const_closure(AXP192_get_bat_current_closure) }, + { be_const_key(get_bat_power, 2), be_const_closure(AXP192_get_bat_power_closure) }, + { be_const_key(json_append, -1), be_const_closure(AXP192_json_append_closure) }, + { be_const_key(get_vbus_voltage, -1), be_const_closure(AXP192_get_vbus_voltage_closure) }, + { be_const_key(get_battery_chargin_status, 9), be_const_closure(AXP192_get_battery_chargin_status_closure) }, + { be_const_key(battery_present, -1), be_const_closure(AXP192_battery_present_closure) }, + { be_const_key(get_bat_charge_current, 14), be_const_closure(AXP192_get_bat_charge_current_closure) }, + { be_const_key(set_dcdc_enable, -1), be_const_closure(AXP192_set_dcdc_enable_closure) }, + { be_const_key(get_temp, 19), be_const_closure(AXP192_get_temp_closure) }, + { be_const_key(set_chg_current, 13), be_const_closure(AXP192_set_chg_current_closure) }, + { be_const_key(set_ldo_enable, 18), be_const_closure(AXP192_set_ldo_enable_closure) }, + { be_const_key(set_dc_voltage, -1), be_const_closure(AXP192_set_dc_voltage_closure) }, + { be_const_key(get_bat_voltage, 7), be_const_closure(AXP192_get_bat_voltage_closure) }, + { be_const_key(write_gpio, -1), be_const_closure(AXP192_write_gpio_closure) }, + { be_const_key(web_sensor, -1), be_const_closure(AXP192_web_sensor_closure) }, + { be_const_key(init, -1), be_const_closure(AXP192_init_closure) }, + { be_const_key(set_ldo_voltage, -1), be_const_closure(AXP192_set_ldo_voltage_closure) }, + { be_const_key(get_input_power_status, -1), be_const_closure(AXP192_get_input_power_status_closure) }, + })), + be_str_literal("AXP192") +); +/*******************************************************************/ + +void be_load_AXP192_class(bvm *vm) { + be_pushntvclass(vm, &be_class_AXP192); + be_setglobal(vm, "AXP192"); + be_pop(vm, 1); +} diff --git a/lib/libesp32/berry/default/be_i2c_driverlib.c b/lib/libesp32/berry/default/be_i2c_driverlib.c new file mode 100644 index 000000000..45f829e19 --- /dev/null +++ b/lib/libesp32/berry/default/be_i2c_driverlib.c @@ -0,0 +1,425 @@ +/******************************************************************** + * Tasmota I2C_Driver class + * + * To use: `d = I2C_Driver(addr, name)` + * where: + * addr: I2C address of the device + * name: name of the I2C chip for logging + * + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: read32 +********************************************************************/ +be_local_closure(I2C_Driver_read32, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(0), + /* K4 */ be_const_int(1), + /* K5 */ be_const_int(2), + /* K6 */ be_const_int(3), + }), + &be_const_str_read32, + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x541A0003, // 0004 LDINT R6 4 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0503, // 0006 GETIDX R3 R2 K3 + 0x54120017, // 0007 LDINT R4 24 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100504, // 0009 GETIDX R4 R2 K4 + 0x5416000F, // 000A LDINT R5 16 + 0x38100805, // 000B SHL R4 R4 R5 + 0x000C0604, // 000C ADD R3 R3 R4 + 0x94100505, // 000D GETIDX R4 R2 K5 + 0x54160007, // 000E LDINT R5 8 + 0x38100805, // 000F SHL R4 R4 R5 + 0x000C0604, // 0010 ADD R3 R3 R4 + 0x94100506, // 0011 GETIDX R4 R2 K6 + 0x000C0604, // 0012 ADD R3 R3 R4 + 0x80040600, // 0013 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: write8 +********************************************************************/ +be_local_closure(I2C_Driver_write8, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(write), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_write8, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x88140102, // 0002 GETMBR R5 R0 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x58200003, // 0005 LDCONST R8 K3 + 0x7C0C0A00, // 0006 CALL R3 5 + 0x80040600, // 0007 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read12 +********************************************************************/ +be_local_closure(I2C_Driver_read12, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + }), + &be_const_str_read12, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x54120003, // 0007 LDINT R4 4 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x80040600, // 000B RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: write_bit +********************************************************************/ +be_local_closure(I2C_Driver_write_bit, /* name */ + be_nested_proto( + 11, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_const_int(1), + /* K2 */ be_nested_str(write8), + /* K3 */ be_nested_str(read8), + }), + &be_const_str_write_bit, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x14100500, // 0000 LT R4 R2 K0 + 0x74120002, // 0001 JMPT R4 #0005 + 0x54120006, // 0002 LDINT R4 7 + 0x24100404, // 0003 GT R4 R2 R4 + 0x78120000, // 0004 JMPF R4 #0006 + 0x80000800, // 0005 RET 0 + 0x38120202, // 0006 SHL R4 K1 R2 + 0x780E0007, // 0007 JMPF R3 #0010 + 0x8C140102, // 0008 GETMET R5 R0 K2 + 0x5C1C0200, // 0009 MOVE R7 R1 + 0x8C200103, // 000A GETMET R8 R0 K3 + 0x5C280200, // 000B MOVE R10 R1 + 0x7C200400, // 000C CALL R8 2 + 0x30201004, // 000D OR R8 R8 R4 + 0x7C140600, // 000E CALL R5 3 + 0x70020008, // 000F JMP #0019 + 0x8C140102, // 0010 GETMET R5 R0 K2 + 0x5C1C0200, // 0011 MOVE R7 R1 + 0x8C200103, // 0012 GETMET R8 R0 K3 + 0x5C280200, // 0013 MOVE R10 R1 + 0x7C200400, // 0014 CALL R8 2 + 0x542600FE, // 0015 LDINT R9 255 + 0x04241204, // 0016 SUB R9 R9 R4 + 0x2C201009, // 0017 AND R8 R8 R9 + 0x7C140600, // 0018 CALL R5 3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read24 +********************************************************************/ +be_local_closure(I2C_Driver_read24, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(3), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + /* K6 */ be_const_int(2), + }), + &be_const_str_read24, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x5412000F, // 0007 LDINT R4 16 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x54160007, // 000A LDINT R5 8 + 0x38100805, // 000B SHL R4 R4 R5 + 0x000C0604, // 000C ADD R3 R3 R4 + 0x94100506, // 000D GETIDX R4 R2 K6 + 0x000C0604, // 000E ADD R3 R3 R4 + 0x80040600, // 000F RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read8 +********************************************************************/ +be_local_closure(I2C_Driver_read8, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_read8, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x80040400, // 0006 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(I2C_Driver_init, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(get_tasmota), + /* K1 */ be_nested_str(i2c_enabled), + /* K2 */ be_nested_str(addr), + /* K3 */ be_nested_str(wire), + /* K4 */ be_nested_str(wire_scan), + /* K5 */ be_nested_str(function), + /* K6 */ be_nested_str(name), + /* K7 */ be_nested_str(I2C_X3A), + /* K8 */ be_nested_str(detected_X20on_X20bus), + /* K9 */ be_nested_str(bus), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[44]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x7C100200, // 0001 CALL R4 1 + 0x4C140000, // 0002 LDNIL R5 + 0x20140605, // 0003 NE R5 R3 R5 + 0x78160004, // 0004 JMPF R5 #000A + 0x8C140901, // 0005 GETMET R5 R4 K1 + 0x5C1C0600, // 0006 MOVE R7 R3 + 0x7C140400, // 0007 CALL R5 2 + 0x74160000, // 0008 JMPT R5 #000A + 0x80000A00, // 0009 RET 0 + 0x90020402, // 000A SETMBR R0 K2 R2 + 0x8C140904, // 000B GETMET R5 R4 K4 + 0x881C0102, // 000C GETMBR R7 R0 K2 + 0x7C140400, // 000D CALL R5 2 + 0x90020605, // 000E SETMBR R0 K3 R5 + 0x88140103, // 000F GETMBR R5 R0 K3 + 0x78160019, // 0010 JMPF R5 #002B + 0x60140004, // 0011 GETGBL R5 G4 + 0x5C180200, // 0012 MOVE R6 R1 + 0x7C140200, // 0013 CALL R5 1 + 0x1C140B05, // 0014 EQ R5 R5 K5 + 0x78160004, // 0015 JMPF R5 #001B + 0x5C140200, // 0016 MOVE R5 R1 + 0x5C180000, // 0017 MOVE R6 R0 + 0x7C140200, // 0018 CALL R5 1 + 0x90020C05, // 0019 SETMBR R0 K6 R5 + 0x70020000, // 001A JMP #001C + 0x90020C01, // 001B SETMBR R0 K6 R1 + 0x88140106, // 001C GETMBR R5 R0 K6 + 0x4C180000, // 001D LDNIL R6 + 0x1C140A06, // 001E EQ R5 R5 R6 + 0x78160001, // 001F JMPF R5 #0022 + 0x4C140000, // 0020 LDNIL R5 + 0x90020605, // 0021 SETMBR R0 K3 R5 + 0x88140103, // 0022 GETMBR R5 R0 K3 + 0x78160006, // 0023 JMPF R5 #002B + 0x60140001, // 0024 GETGBL R5 G1 + 0x58180007, // 0025 LDCONST R6 K7 + 0x881C0106, // 0026 GETMBR R7 R0 K6 + 0x58200008, // 0027 LDCONST R8 K8 + 0x88240103, // 0028 GETMBR R9 R0 K3 + 0x88241309, // 0029 GETMBR R9 R9 K9 + 0x7C140800, // 002A CALL R5 4 + 0x80000000, // 002B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read13 +********************************************************************/ +be_local_closure(I2C_Driver_read13, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + }), + &be_const_str_read13, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x54120004, // 0007 LDINT R4 5 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x80040600, // 000B RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: I2C_Driver +********************************************************************/ +be_local_class(I2C_Driver, + 3, + NULL, + be_nested_map(11, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(read32, -1), be_const_closure(I2C_Driver_read32_closure) }, + { be_const_key(write8, 6), be_const_closure(I2C_Driver_write8_closure) }, + { be_const_key(name, -1), be_const_var(2) }, + { be_const_key(addr, 8), be_const_var(1) }, + { be_const_key(read12, -1), be_const_closure(I2C_Driver_read12_closure) }, + { be_const_key(wire, 10), be_const_var(0) }, + { be_const_key(read13, -1), be_const_closure(I2C_Driver_read13_closure) }, + { be_const_key(read24, -1), be_const_closure(I2C_Driver_read24_closure) }, + { be_const_key(read8, -1), be_const_closure(I2C_Driver_read8_closure) }, + { be_const_key(init, -1), be_const_closure(I2C_Driver_init_closure) }, + { be_const_key(write_bit, -1), be_const_closure(I2C_Driver_write_bit_closure) }, + })), + be_str_literal("I2C_Driver") +); +/*******************************************************************/ + +void be_load_I2C_Driver_class(bvm *vm) { + be_pushntvclass(vm, &be_class_I2C_Driver); + be_setglobal(vm, "I2C_Driver"); + be_pop(vm, 1); +} diff --git a/lib/libesp32/berry/default/be_i2s_audio_lib.c b/lib/libesp32/berry/default/be_i2s_audio_lib.c new file mode 100644 index 000000000..ef8720b23 --- /dev/null +++ b/lib/libesp32/berry/default/be_i2s_audio_lib.c @@ -0,0 +1,113 @@ +/******************************************************************** + * Tasmota I2S audio classes + * + * + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_I2S +#ifdef USE_I2S_AUDIO_BERRY + +extern int i2s_output_i2s_init(bvm *vm); +extern int i2s_output_i2s_deinit(bvm *vm); +extern int i2s_output_i2s_stop(bvm *vm); + +extern int i2s_generator_wav_init(bvm *vm); +extern int i2s_generator_wav_deinit(bvm *vm); +extern int i2s_generator_wav_begin(bvm *vm); +extern int i2s_generator_wav_loop(bvm *vm); +extern int i2s_generator_wav_stop(bvm *vm); +extern int i2s_generator_wav_isrunning(bvm *vm); + +extern int i2s_generator_mp3_init(bvm *vm); +extern int i2s_generator_mp3_deinit(bvm *vm); +extern int i2s_generator_mp3_begin(bvm *vm); +extern int i2s_generator_mp3_loop(bvm *vm); +extern int i2s_generator_mp3_stop(bvm *vm); +extern int i2s_generator_mp3_isrunning(bvm *vm); + +#ifdef USE_UFILESYS +extern int i2s_file_source_fs_init(bvm *vm); +extern int i2s_file_source_fs_deinit(bvm *vm); +#endif // USE_UFILESYS + + +#include "../generate/be_fixed_be_class_audio_output.h" +#include "../generate/be_fixed_be_class_audio_output_i2s.h" +#include "../generate/be_fixed_be_class_audio_generator.h" +#include "../generate/be_fixed_be_class_audio_generator_wav.h" +#include "../generate/be_fixed_be_class_audio_generator_mp3.h" +#include "../generate/be_fixed_be_class_audio_file_source.h" +#include "../generate/be_fixed_be_class_audio_file_source_fs.h" + +void be_load_driver_audio_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_audio_output); + be_setglobal(vm, "AudioOutput"); + be_pop(vm, 1); + + be_pushntvclass(vm, &be_class_audio_output_i2s); + be_setglobal(vm, "AudioOutputI2S"); + be_pop(vm, 1); + + be_pushntvclass(vm, &be_class_audio_generator_wav); + be_setglobal(vm, "AudioGeneratorWAV"); + be_pop(vm, 1); + + be_pushntvclass(vm, &be_class_audio_generator_mp3); + be_setglobal(vm, "AudioGeneratorMP3"); + be_pop(vm, 1); + +#ifdef USE_UFILESYS + be_pushntvclass(vm, &be_class_audio_file_source_fs); + be_setglobal(vm, "AudioFileSourceFS"); + be_pop(vm, 1); +#endif // USE_UFILESYS +} + +/* @const_object_info_begin + +class be_class_audio_output (scope: global, name: AudioOutput) { + .p, var +} + +class be_class_audio_generator (scope: global, name: AudioGenerator) { + .p, var +} + +class be_class_audio_file_source (scope: global, name: AudioFileSource) { + .p, var +} + +class be_class_audio_output_i2s (scope: global, name: AudioOutputI2S, super: be_class_audio_output) { + init, func(i2s_output_i2s_init) + deinit, func(i2s_output_i2s_deinit) + stop, func(i2s_output_i2s_stop) +} + +class be_class_audio_generator_wav (scope: global, name: AudioGeneratorWAV, super: be_class_audio_generator) { + init, func(i2s_generator_wav_init) + deinit, func(i2s_generator_wav_deinit) + begin, func(i2s_generator_wav_begin) + loop, func(i2s_generator_wav_loop) + stop, func(i2s_generator_wav_stop) + isrunning, func(i2s_generator_wav_isrunning) +} + +class be_class_audio_generator_mp3 (scope: global, name: AudioGeneratorMP3, super: be_class_audio_generator) { + init, func(i2s_generator_mp3_init) + deinit, func(i2s_generator_mp3_deinit) + begin, func(i2s_generator_mp3_begin) + loop, func(i2s_generator_mp3_loop) + stop, func(i2s_generator_mp3_stop) + isrunning, func(i2s_generator_mp3_isrunning) +} + +class be_class_audio_file_source_fs (scope: global, name: AudioFileSourceFS, super: be_class_audio_file_source) { + init, func(i2s_file_source_fs_init) + deinit, func(i2s_file_source_fs_deinit) +} + +@const_object_info_end */ + +#endif // USE_I2S_AUDIO_BERRY +#endif // USE_I2S \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_leds_animator_lib.c b/lib/libesp32/berry/default/be_leds_animator_lib.c new file mode 100644 index 000000000..bd82193b9 --- /dev/null +++ b/lib/libesp32/berry/default/be_leds_animator_lib.c @@ -0,0 +1,381 @@ +/******************************************************************** + * Berry class `Leds_animator` + * + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_WS2812 + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_animator_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(bri), + /* K2 */ be_nested_str(running), + /* K3 */ be_nested_str(pixel_count), + /* K4 */ be_nested_str(animators), + /* K5 */ be_nested_str(clear), + /* K6 */ be_nested_str(tasmota), + /* K7 */ be_nested_str(add_driver), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x540A0031, // 0001 LDINT R2 50 + 0x90020202, // 0002 SETMBR R0 K1 R2 + 0x50080000, // 0003 LDBOOL R2 0 0 + 0x90020402, // 0004 SETMBR R0 K2 R2 + 0x8C080303, // 0005 GETMET R2 R1 K3 + 0x7C080200, // 0006 CALL R2 1 + 0x90020602, // 0007 SETMBR R0 K3 R2 + 0x60080012, // 0008 GETGBL R2 G18 + 0x7C080000, // 0009 CALL R2 0 + 0x90020802, // 000A SETMBR R0 K4 R2 + 0x8C080105, // 000B GETMET R2 R0 K5 + 0x7C080200, // 000C CALL R2 1 + 0xB80A0C00, // 000D GETNGBL R2 K6 + 0x8C080507, // 000E GETMET R2 R2 K7 + 0x5C100000, // 000F MOVE R4 R0 + 0x7C080400, // 0010 CALL R2 2 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Leds_animator_set_bri, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(bri), + }), + &be_const_str_set_bri, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Leds_animator_stop, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(running), + }), + &be_const_str_stop, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x50040000, // 0000 LDBOOL R1 0 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Leds_animator_animate, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_animate, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove +********************************************************************/ +be_local_closure(Leds_animator_remove, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(remove_driver), + }), + &be_const_str_remove, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: every_50ms +********************************************************************/ +be_local_closure(Leds_animator_every_50ms, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(running), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(animators), + /* K3 */ be_nested_str(is_running), + /* K4 */ be_nested_str(animate), + /* K5 */ be_const_int(1), + /* K6 */ be_nested_str(remove), + }), + &be_const_str_every_50ms, + &be_const_str_solidified, + ( &(const binstruction[25]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x78060015, // 0001 JMPF R1 #0018 + 0x58040001, // 0002 LDCONST R1 K1 + 0x6008000C, // 0003 GETGBL R2 G12 + 0x880C0102, // 0004 GETMBR R3 R0 K2 + 0x7C080200, // 0005 CALL R2 1 + 0x14080202, // 0006 LT R2 R1 R2 + 0x780A000D, // 0007 JMPF R2 #0016 + 0x88080102, // 0008 GETMBR R2 R0 K2 + 0x94080401, // 0009 GETIDX R2 R2 R1 + 0x8C0C0503, // 000A GETMET R3 R2 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x780E0003, // 000C JMPF R3 #0011 + 0x8C0C0504, // 000D GETMET R3 R2 K4 + 0x7C0C0200, // 000E CALL R3 1 + 0x00040305, // 000F ADD R1 R1 K5 + 0x70020003, // 0010 JMP #0015 + 0x880C0102, // 0011 GETMBR R3 R0 K2 + 0x8C0C0706, // 0012 GETMET R3 R3 K6 + 0x5C140200, // 0013 MOVE R5 R1 + 0x7C0C0400, // 0014 CALL R3 2 + 0x7001FFEC, // 0015 JMP #0003 + 0x8C080104, // 0016 GETMET R2 R0 K4 + 0x7C080200, // 0017 CALL R2 1 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bri +********************************************************************/ +be_local_closure(Leds_animator_get_bri, /* name */ + be_nested_proto( + 3, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(bri), + }), + &be_const_str_get_bri, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x80040400, // 0001 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Leds_animator_start, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(running), + }), + &be_const_str_start, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x50040200, // 0000 LDBOOL R1 1 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_anim +********************************************************************/ +be_local_closure(Leds_animator_add_anim, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(animators), + /* K1 */ be_nested_str(push), + /* K2 */ be_nested_str(run), + }), + &be_const_str_add_anim, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x8C080302, // 0004 GETMET R2 R1 K2 + 0x7C080200, // 0005 CALL R2 1 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_animator_clear, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(stop), + /* K1 */ be_nested_str(strip), + /* K2 */ be_nested_str(clear), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_animator +********************************************************************/ +be_local_class(Leds_animator, + 5, + NULL, + be_nested_map(15, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, 12), be_const_closure(Leds_animator_init_closure) }, + { be_const_key(clear, -1), be_const_closure(Leds_animator_clear_closure) }, + { be_const_key(stop, -1), be_const_closure(Leds_animator_stop_closure) }, + { be_const_key(strip, 4), be_const_var(0) }, + { be_const_key(pixel_count, 6), be_const_var(1) }, + { be_const_key(animate, -1), be_const_closure(Leds_animator_animate_closure) }, + { be_const_key(add_anim, 13), be_const_closure(Leds_animator_add_anim_closure) }, + { be_const_key(bri, -1), be_const_var(2) }, + { be_const_key(every_50ms, -1), be_const_closure(Leds_animator_every_50ms_closure) }, + { be_const_key(remove, 7), be_const_closure(Leds_animator_remove_closure) }, + { be_const_key(get_bri, -1), be_const_closure(Leds_animator_get_bri_closure) }, + { be_const_key(start, -1), be_const_closure(Leds_animator_start_closure) }, + { be_const_key(running, -1), be_const_var(3) }, + { be_const_key(animators, -1), be_const_var(4) }, + { be_const_key(set_bri, 1), be_const_closure(Leds_animator_set_bri_closure) }, + })), + be_str_literal("Leds_animator") +); +/*******************************************************************/ + +void be_load_Leds_animator_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_animator); + be_setglobal(vm, "Leds_animator"); + be_pop(vm, 1); +} + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry/default/be_leds_lib.c b/lib/libesp32/berry/default/be_leds_lib.c new file mode 100644 index 000000000..58b0a991e --- /dev/null +++ b/lib/libesp32/berry/default/be_leds_lib.c @@ -0,0 +1,1815 @@ +/******************************************************************** + * Berry class `Leds` + * + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_WS2812 + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_matrix_pixel_count, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(w), + /* K1 */ be_nested_str(h), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x08040202, // 0002 MUL R1 R1 R2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_alternate +********************************************************************/ +be_local_closure(Leds_matrix_set_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_set_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_matrix_pixel_size, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(pixel_size), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_pixel_color, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(set_pixel_color), + /* K2 */ be_nested_str(offset), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x8C100901, // 0001 GETMET R4 R4 K1 + 0x88180102, // 0002 GETMBR R6 R0 K2 + 0x00180206, // 0003 ADD R6 R1 R6 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x5C200600, // 0005 MOVE R8 R3 + 0x7C100800, // 0006 CALL R4 4 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_matrix_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ + be_nested_proto( + 10, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(alternate), + /* K1 */ be_const_int(2), + /* K2 */ be_nested_str(strip), + /* K3 */ be_nested_str(set_pixel_color), + /* K4 */ be_nested_str(w), + /* K5 */ be_nested_str(h), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str(offset), + }), + &be_const_str_set_matrix_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x88140100, // 0000 GETMBR R5 R0 K0 + 0x7816000F, // 0001 JMPF R5 #0012 + 0x10140301, // 0002 MOD R5 R1 K1 + 0x7816000D, // 0003 JMPF R5 #0012 + 0x88140102, // 0004 GETMBR R5 R0 K2 + 0x8C140B03, // 0005 GETMET R5 R5 K3 + 0x881C0104, // 0006 GETMBR R7 R0 K4 + 0x081C0207, // 0007 MUL R7 R1 R7 + 0x88200105, // 0008 GETMBR R8 R0 K5 + 0x001C0E08, // 0009 ADD R7 R7 R8 + 0x041C0E02, // 000A SUB R7 R7 R2 + 0x041C0F06, // 000B SUB R7 R7 K6 + 0x88200107, // 000C GETMBR R8 R0 K7 + 0x001C0E08, // 000D ADD R7 R7 R8 + 0x5C200600, // 000E MOVE R8 R3 + 0x5C240800, // 000F MOVE R9 R4 + 0x7C140800, // 0010 CALL R5 4 + 0x70020009, // 0011 JMP #001C + 0x88140102, // 0012 GETMBR R5 R0 K2 + 0x8C140B03, // 0013 GETMET R5 R5 K3 + 0x881C0104, // 0014 GETMBR R7 R0 K4 + 0x081C0207, // 0015 MUL R7 R1 R7 + 0x001C0E02, // 0016 ADD R7 R7 R2 + 0x88200107, // 0017 GETMBR R8 R0 K7 + 0x001C0E08, // 0018 ADD R7 R7 R8 + 0x5C200600, // 0019 MOVE R8 R3 + 0x5C240800, // 001A MOVE R9 R4 + 0x7C140800, // 001B CALL R5 4 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_matrix_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(offset), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(w), + /* K3 */ be_nested_str(h), + /* K4 */ be_nested_str(strip), + /* K5 */ be_nested_str(leds), + /* K6 */ be_nested_str(show), + }), + &be_const_str_show, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x740A0009, // 0003 JMPT R2 #000E + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x1C080501, // 0005 EQ R2 R2 K1 + 0x780A0009, // 0006 JMPF R2 #0011 + 0x88080102, // 0007 GETMBR R2 R0 K2 + 0x880C0103, // 0008 GETMBR R3 R0 K3 + 0x08080403, // 0009 MUL R2 R2 R3 + 0x880C0104, // 000A GETMBR R3 R0 K4 + 0x880C0705, // 000B GETMBR R3 R3 K5 + 0x1C080403, // 000C EQ R2 R2 R3 + 0x780A0002, // 000D JMPF R2 #0011 + 0x88080104, // 000E GETMBR R2 R0 K4 + 0x8C080506, // 000F GETMET R2 R2 K6 + 0x7C080200, // 0010 CALL R2 1 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_matrix_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_matrix_clear_to, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(w), + /* K2 */ be_nested_str(h), + /* K3 */ be_nested_str(strip), + /* K4 */ be_nested_str(set_pixel_color), + /* K5 */ be_nested_str(offset), + /* K6 */ be_const_int(1), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x580C0000, // 0000 LDCONST R3 K0 + 0x88100101, // 0001 GETMBR R4 R0 K1 + 0x88140102, // 0002 GETMBR R5 R0 K2 + 0x08100805, // 0003 MUL R4 R4 R5 + 0x14100604, // 0004 LT R4 R3 R4 + 0x78120008, // 0005 JMPF R4 #000F + 0x88100103, // 0006 GETMBR R4 R0 K3 + 0x8C100904, // 0007 GETMET R4 R4 K4 + 0x88180105, // 0008 GETMBR R6 R0 K5 + 0x00180606, // 0009 ADD R6 R3 R6 + 0x5C1C0200, // 000A MOVE R7 R1 + 0x5C200400, // 000B MOVE R8 R2 + 0x7C100800, // 000C CALL R4 4 + 0x000C0706, // 000D ADD R3 R3 K6 + 0x7001FFF1, // 000E JMP #0001 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_matrix_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_matrix_pixels_buffer, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_matrix_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(h), + /* K3 */ be_nested_str(w), + /* K4 */ be_nested_str(alternate), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020204, // 0001 SETMBR R0 K1 R4 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x90020602, // 0003 SETMBR R0 K3 R2 + 0x50140000, // 0004 LDBOOL R5 0 0 + 0x90020805, // 0005 SETMBR R0 K4 R5 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_matrix_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_get_pixel_color, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_alternate +********************************************************************/ +be_local_closure(Leds_matrix_get_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_get_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_matrix_begin, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_begin, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: can_show +********************************************************************/ +be_local_closure(Leds_matrix_can_show, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(can_show), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_matrix +********************************************************************/ +be_local_class(Leds_matrix, + 5, + NULL, + be_nested_map(21, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(pixel_count, -1), be_const_closure(Leds_matrix_pixel_count_closure) }, + { be_const_key(h, 6), be_const_var(2) }, + { be_const_key(set_alternate, 7), be_const_closure(Leds_matrix_set_alternate_closure) }, + { be_const_key(pixel_size, 16), be_const_closure(Leds_matrix_pixel_size_closure) }, + { be_const_key(set_pixel_color, 19), be_const_closure(Leds_matrix_set_pixel_color_closure) }, + { be_const_key(set_matrix_pixel_color, 10), be_const_closure(Leds_matrix_set_matrix_pixel_color_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_matrix_show_closure) }, + { be_const_key(alternate, -1), be_const_var(4) }, + { be_const_key(strip, -1), be_const_var(0) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_matrix_clear_to_closure) }, + { be_const_key(w, 15), be_const_var(3) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_matrix_pixels_buffer_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_matrix_init_closure) }, + { be_const_key(dirty, -1), be_const_closure(Leds_matrix_dirty_closure) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_matrix_get_pixel_color_closure) }, + { be_const_key(get_alternate, 17), be_const_closure(Leds_matrix_get_alternate_closure) }, + { be_const_key(offset, 8), be_const_var(1) }, + { be_const_key(clear, -1), be_const_closure(Leds_matrix_clear_closure) }, + { be_const_key(begin, -1), be_const_closure(Leds_matrix_begin_closure) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_matrix_is_dirty_closure) }, + { be_const_key(can_show, -1), be_const_closure(Leds_matrix_can_show_closure) }, + })), + be_str_literal("Leds_matrix") +); + +/******************************************************************** +** Solidified function: create_matrix +********************************************************************/ +be_local_closure(Leds_create_matrix, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(out_X20of_X20range), + /* K4 */ be_const_class(be_class_Leds_matrix), + }), + &be_const_str_create_matrix, + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x60100009, // 0000 GETGBL R4 G9 + 0x5C140600, // 0001 MOVE R5 R3 + 0x7C100200, // 0002 CALL R4 1 + 0x5C0C0800, // 0003 MOVE R3 R4 + 0x60100009, // 0004 GETGBL R4 G9 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x5C040800, // 0007 MOVE R1 R4 + 0x60100009, // 0008 GETGBL R4 G9 + 0x5C140400, // 0009 MOVE R5 R2 + 0x7C100200, // 000A CALL R4 1 + 0x5C080800, // 000B MOVE R2 R4 + 0x4C100000, // 000C LDNIL R4 + 0x1C100604, // 000D EQ R4 R3 R4 + 0x78120000, // 000E JMPF R4 #0010 + 0x580C0000, // 000F LDCONST R3 K0 + 0x08100202, // 0010 MUL R4 R1 R2 + 0x00100803, // 0011 ADD R4 R4 R3 + 0x88140101, // 0012 GETMBR R5 R0 K1 + 0x24100805, // 0013 GT R4 R4 R5 + 0x74120005, // 0014 JMPT R4 #001B + 0x14100500, // 0015 LT R4 R2 K0 + 0x74120003, // 0016 JMPT R4 #001B + 0x14100300, // 0017 LT R4 R1 K0 + 0x74120001, // 0018 JMPT R4 #001B + 0x14100700, // 0019 LT R4 R3 K0 + 0x78120000, // 001A JMPF R4 #001C + 0xB0060503, // 001B RAISE 1 K2 K3 + 0x58100004, // 001C LDCONST R4 K4 + 0xB4000004, // 001D CLASS K4 + 0x5C140800, // 001E MOVE R5 R4 + 0x5C180000, // 001F MOVE R6 R0 + 0x5C1C0200, // 0020 MOVE R7 R1 + 0x5C200400, // 0021 MOVE R8 R2 + 0x5C240600, // 0022 MOVE R9 R3 + 0x7C140800, // 0023 CALL R5 4 + 0x80040A00, // 0024 RET 1 R5 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_begin, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(1), + }), + &be_const_str_begin, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: to_gamma +********************************************************************/ +be_local_closure(Leds_to_gamma, /* name */ + be_nested_proto( + 12, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(scale_uint), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(16711680), + /* K4 */ be_nested_str(gamma), + /* K5 */ be_nested_str(light), + /* K6 */ be_nested_str(gamma8), + }), + &be_const_str_to_gamma, + &be_const_str_solidified, + ( &(const binstruction[67]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x200C0403, // 0001 NE R3 R2 R3 + 0x780E0001, // 0002 JMPF R3 #0005 + 0x5C0C0400, // 0003 MOVE R3 R2 + 0x70020000, // 0004 JMP #0006 + 0x540E0063, // 0005 LDINT R3 100 + 0x5C080600, // 0006 MOVE R2 R3 + 0xB80E0000, // 0007 GETNGBL R3 K0 + 0x8C0C0701, // 0008 GETMET R3 R3 K1 + 0x5C140400, // 0009 MOVE R5 R2 + 0x58180002, // 000A LDCONST R6 K2 + 0x541E0063, // 000B LDINT R7 100 + 0x58200002, // 000C LDCONST R8 K2 + 0x2C240303, // 000D AND R9 R1 K3 + 0x542A000F, // 000E LDINT R10 16 + 0x3C24120A, // 000F SHR R9 R9 R10 + 0x7C0C0C00, // 0010 CALL R3 6 + 0xB8120000, // 0011 GETNGBL R4 K0 + 0x8C100901, // 0012 GETMET R4 R4 K1 + 0x5C180400, // 0013 MOVE R6 R2 + 0x581C0002, // 0014 LDCONST R7 K2 + 0x54220063, // 0015 LDINT R8 100 + 0x58240002, // 0016 LDCONST R9 K2 + 0x542AFEFF, // 0017 LDINT R10 65280 + 0x2C28020A, // 0018 AND R10 R1 R10 + 0x542E0007, // 0019 LDINT R11 8 + 0x3C28140B, // 001A SHR R10 R10 R11 + 0x7C100C00, // 001B CALL R4 6 + 0xB8160000, // 001C GETNGBL R5 K0 + 0x8C140B01, // 001D GETMET R5 R5 K1 + 0x5C1C0400, // 001E MOVE R7 R2 + 0x58200002, // 001F LDCONST R8 K2 + 0x54260063, // 0020 LDINT R9 100 + 0x58280002, // 0021 LDCONST R10 K2 + 0x542E00FE, // 0022 LDINT R11 255 + 0x2C2C020B, // 0023 AND R11 R1 R11 + 0x7C140C00, // 0024 CALL R5 6 + 0x88180104, // 0025 GETMBR R6 R0 K4 + 0x781A0013, // 0026 JMPF R6 #003B + 0xB81A0A00, // 0027 GETNGBL R6 K5 + 0x8C180D06, // 0028 GETMET R6 R6 K6 + 0x5C200600, // 0029 MOVE R8 R3 + 0x7C180400, // 002A CALL R6 2 + 0x541E000F, // 002B LDINT R7 16 + 0x38180C07, // 002C SHL R6 R6 R7 + 0xB81E0A00, // 002D GETNGBL R7 K5 + 0x8C1C0F06, // 002E GETMET R7 R7 K6 + 0x5C240800, // 002F MOVE R9 R4 + 0x7C1C0400, // 0030 CALL R7 2 + 0x54220007, // 0031 LDINT R8 8 + 0x381C0E08, // 0032 SHL R7 R7 R8 + 0x30180C07, // 0033 OR R6 R6 R7 + 0xB81E0A00, // 0034 GETNGBL R7 K5 + 0x8C1C0F06, // 0035 GETMET R7 R7 K6 + 0x5C240A00, // 0036 MOVE R9 R5 + 0x7C1C0400, // 0037 CALL R7 2 + 0x30180C07, // 0038 OR R6 R6 R7 + 0x80040C00, // 0039 RET 1 R6 + 0x70020006, // 003A JMP #0042 + 0x541A000F, // 003B LDINT R6 16 + 0x38180606, // 003C SHL R6 R3 R6 + 0x541E0007, // 003D LDINT R7 8 + 0x381C0807, // 003E SHL R7 R4 R7 + 0x30180C07, // 003F OR R6 R6 R7 + 0x30180C05, // 0040 OR R6 R6 R5 + 0x80040C00, // 0041 RET 1 R6 + 0x80000000, // 0042 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_pixel_count, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0007, // 0001 LDINT R3 8 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: matrix +********************************************************************/ +be_local_closure(Leds_matrix, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(Leds), + /* K1 */ be_nested_str(create_matrix), + /* K2 */ be_const_int(0), + }), + &be_const_str_matrix, + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x08140001, // 0001 MUL R5 R0 R1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x5C1C0600, // 0003 MOVE R7 R3 + 0x7C100600, // 0004 CALL R4 3 + 0x8C140901, // 0005 GETMET R5 R4 K1 + 0x5C1C0000, // 0006 MOVE R7 R0 + 0x5C200200, // 0007 MOVE R8 R1 + 0x58240002, // 0008 LDCONST R9 K2 + 0x7C140800, // 0009 CALL R5 4 + 0x80040A00, // 000A RET 1 R5 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_pixel_size, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0006, // 0001 LDINT R3 7 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_pixels_buffer, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0005, // 0001 LDINT R3 6 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_get_pixel_color, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5412000A, // 0001 LDINT R4 11 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C080600, // 0003 CALL R2 3 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_set_pixel_color, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x541A0009, // 0001 LDINT R6 10 + 0x5C1C0200, // 0002 MOVE R7 R1 + 0x8C200101, // 0003 GETMET R8 R0 K1 + 0x5C280400, // 0004 MOVE R10 R2 + 0x5C2C0600, // 0005 MOVE R11 R3 + 0x7C200600, // 0006 CALL R8 3 + 0x7C100800, // 0007 CALL R4 4 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_is_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0003, // 0001 LDINT R3 4 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_init, /* name */ + be_nested_proto( + 11, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(gamma), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(pin), + /* K3 */ be_nested_str(WS2812), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str(valuer_error), + /* K6 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), + /* K7 */ be_nested_str(ctor), + /* K8 */ be_nested_str(_p), + /* K9 */ be_nested_str(internal_error), + /* K10 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), + /* K11 */ be_nested_str(begin), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[36]) { /* code */ + 0x50140200, // 0000 LDBOOL R5 1 0 + 0x90020005, // 0001 SETMBR R0 K0 R5 + 0x60140009, // 0002 GETGBL R5 G9 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C140200, // 0004 CALL R5 1 + 0x90020205, // 0005 SETMBR R0 K1 R5 + 0x4C140000, // 0006 LDNIL R5 + 0x1C140405, // 0007 EQ R5 R2 R5 + 0x78160008, // 0008 JMPF R5 #0012 + 0x8C140502, // 0009 GETMET R5 R2 K2 + 0x881C0503, // 000A GETMBR R7 R2 K3 + 0x7C140400, // 000B CALL R5 2 + 0x28140B04, // 000C GE R5 R5 K4 + 0x78160003, // 000D JMPF R5 #0012 + 0x8C140502, // 000E GETMET R5 R2 K2 + 0x881C0503, // 000F GETMBR R7 R2 K3 + 0x7C140400, // 0010 CALL R5 2 + 0x5C080A00, // 0011 MOVE R2 R5 + 0x4C140000, // 0012 LDNIL R5 + 0x1C140405, // 0013 EQ R5 R2 R5 + 0x78160000, // 0014 JMPF R5 #0016 + 0xB0060B06, // 0015 RAISE 1 K5 K6 + 0x8C140107, // 0016 GETMET R5 R0 K7 + 0x881C0101, // 0017 GETMBR R7 R0 K1 + 0x5C200400, // 0018 MOVE R8 R2 + 0x5C240600, // 0019 MOVE R9 R3 + 0x5C280800, // 001A MOVE R10 R4 + 0x7C140A00, // 001B CALL R5 5 + 0x88140108, // 001C GETMBR R5 R0 K8 + 0x4C180000, // 001D LDNIL R6 + 0x1C140A06, // 001E EQ R5 R5 R6 + 0x78160000, // 001F JMPF R5 #0021 + 0xB006130A, // 0020 RAISE 1 K9 K10 + 0x8C14010B, // 0021 GETMET R5 R0 K11 + 0x7C140200, // 0022 CALL R5 1 + 0x80000000, // 0023 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_clear_to, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x54160008, // 0001 LDINT R5 9 + 0x8C180101, // 0002 GETMET R6 R0 K1 + 0x5C200200, // 0003 MOVE R8 R1 + 0x5C240400, // 0004 MOVE R9 R2 + 0x7C180600, // 0005 CALL R6 3 + 0x7C0C0600, // 0006 CALL R3 3 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: can_show +********************************************************************/ +be_local_closure(Leds_can_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(3), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(2), + }), + &be_const_str_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: ctor +********************************************************************/ +be_local_closure(Leds_ctor, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(0), + }), + &be_const_str_ctor, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100604, // 0001 EQ R4 R3 R4 + 0x78120005, // 0002 JMPF R4 #0009 + 0x8C100100, // 0003 GETMET R4 R0 K0 + 0x58180001, // 0004 LDCONST R6 K1 + 0x5C1C0200, // 0005 MOVE R7 R1 + 0x5C200400, // 0006 MOVE R8 R2 + 0x7C100800, // 0007 CALL R4 4 + 0x70020005, // 0008 JMP #000F + 0x8C100100, // 0009 GETMET R4 R0 K0 + 0x58180001, // 000A LDCONST R6 K1 + 0x5C1C0200, // 000B MOVE R7 R1 + 0x5C200400, // 000C MOVE R8 R2 + 0x5C240600, // 000D MOVE R9 R3 + 0x7C100A00, // 000E CALL R4 5 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0004, // 0001 LDINT R3 5 + 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_segment_get_pixel_color, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_segment_clear_to, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(strip), + /* K3 */ be_nested_str(set_pixel_color), + /* K4 */ be_nested_str(offset), + /* K5 */ be_const_int(1), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x580C0000, // 0000 LDCONST R3 K0 + 0x88100101, // 0001 GETMBR R4 R0 K1 + 0x14100604, // 0002 LT R4 R3 R4 + 0x78120008, // 0003 JMPF R4 #000D + 0x88100102, // 0004 GETMBR R4 R0 K2 + 0x8C100903, // 0005 GETMET R4 R4 K3 + 0x88180104, // 0006 GETMBR R6 R0 K4 + 0x00180606, // 0007 ADD R6 R3 R6 + 0x5C1C0200, // 0008 MOVE R7 R1 + 0x5C200400, // 0009 MOVE R8 R2 + 0x7C100800, // 000A CALL R4 4 + 0x000C0705, // 000B ADD R3 R3 K5 + 0x7001FFF3, // 000C JMP #0001 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: can_show +********************************************************************/ +be_local_closure(Leds_segment_can_show, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(can_show), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_segment_set_pixel_color, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(set_pixel_color), + /* K2 */ be_nested_str(offset), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x8C100901, // 0001 GETMET R4 R4 K1 + 0x88180102, // 0002 GETMBR R6 R0 K2 + 0x00180206, // 0003 ADD R6 R1 R6 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x5C200600, // 0005 MOVE R8 R3 + 0x7C100800, // 0006 CALL R4 4 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_segment_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_segment_begin, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_begin, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_segment_pixel_count, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(leds), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_segment_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(leds), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x60100009, // 0001 GETGBL R4 G9 + 0x5C140400, // 0002 MOVE R5 R2 + 0x7C100200, // 0003 CALL R4 1 + 0x90020204, // 0004 SETMBR R0 K1 R4 + 0x60100009, // 0005 GETGBL R4 G9 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0x90020404, // 0008 SETMBR R0 K2 R4 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_segment_pixel_size, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(pixel_size), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_segment_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_segment_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(offset), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(leds), + /* K3 */ be_nested_str(strip), + /* K4 */ be_nested_str(show), + }), + &be_const_str_show, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x740A0007, // 0003 JMPT R2 #000C + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x1C080501, // 0005 EQ R2 R2 K1 + 0x780A0007, // 0006 JMPF R2 #000F + 0x88080102, // 0007 GETMBR R2 R0 K2 + 0x880C0103, // 0008 GETMBR R3 R0 K3 + 0x880C0702, // 0009 GETMBR R3 R3 K2 + 0x1C080403, // 000A EQ R2 R2 R3 + 0x780A0002, // 000B JMPF R2 #000F + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x8C080504, // 000D GETMET R2 R2 K4 + 0x7C080200, // 000E CALL R2 1 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_segment_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_segment_pixels_buffer, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_segment +********************************************************************/ +be_local_class(Leds_segment, + 3, + NULL, + be_nested_map(16, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_segment_get_pixel_color_closure) }, + { be_const_key(strip, -1), be_const_var(0) }, + { be_const_key(clear_to, 5), be_const_closure(Leds_segment_clear_to_closure) }, + { be_const_key(can_show, 13), be_const_closure(Leds_segment_can_show_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_segment_set_pixel_color_closure) }, + { be_const_key(clear, -1), be_const_closure(Leds_segment_clear_closure) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_segment_is_dirty_closure) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_segment_pixel_count_closure) }, + { be_const_key(leds, -1), be_const_var(2) }, + { be_const_key(pixel_size, -1), be_const_closure(Leds_segment_pixel_size_closure) }, + { be_const_key(offset, -1), be_const_var(1) }, + { be_const_key(dirty, 8), be_const_closure(Leds_segment_dirty_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_segment_show_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_segment_init_closure) }, + { be_const_key(begin, 6), be_const_closure(Leds_segment_begin_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_segment_pixels_buffer_closure) }, + })), + be_str_literal("Leds_segment") +); + +/******************************************************************** +** Solidified function: create_segment +********************************************************************/ +be_local_closure(Leds_create_segment, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(leds), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(out_X20of_X20range), + /* K4 */ be_const_class(be_class_Leds_segment), + }), + &be_const_str_create_segment, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0x600C0009, // 0000 GETGBL R3 G9 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C0C0200, // 0002 CALL R3 1 + 0x60100009, // 0003 GETGBL R4 G9 + 0x5C140400, // 0004 MOVE R5 R2 + 0x7C100200, // 0005 CALL R4 1 + 0x000C0604, // 0006 ADD R3 R3 R4 + 0x88100100, // 0007 GETMBR R4 R0 K0 + 0x240C0604, // 0008 GT R3 R3 R4 + 0x740E0003, // 0009 JMPT R3 #000E + 0x140C0301, // 000A LT R3 R1 K1 + 0x740E0001, // 000B JMPT R3 #000E + 0x140C0501, // 000C LT R3 R2 K1 + 0x780E0000, // 000D JMPF R3 #000F + 0xB0060503, // 000E RAISE 1 K2 K3 + 0x580C0004, // 000F LDCONST R3 K4 + 0xB4000004, // 0010 CLASS K4 + 0x5C100600, // 0011 MOVE R4 R3 + 0x5C140000, // 0012 MOVE R5 R0 + 0x5C180200, // 0013 MOVE R6 R1 + 0x5C1C0400, // 0014 MOVE R7 R2 + 0x7C100600, // 0015 CALL R4 3 + 0x80040800, // 0016 RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds +********************************************************************/ +extern const bclass be_class_Leds_ntv; +be_local_class(Leds, + 2, + &be_class_Leds_ntv, + be_nested_map(20, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(pixel_count, -1), be_const_closure(Leds_pixel_count_closure) }, + { be_const_key(dirty, 6), be_const_closure(Leds_dirty_closure) }, + { be_const_key(to_gamma, -1), be_const_closure(Leds_to_gamma_closure) }, + { be_const_key(create_matrix, 1), be_const_closure(Leds_create_matrix_closure) }, + { be_const_key(matrix, -1), be_const_static_closure(Leds_matrix_closure) }, + { be_const_key(pixel_size, -1), be_const_closure(Leds_pixel_size_closure) }, + { be_const_key(ctor, 0), be_const_closure(Leds_ctor_closure) }, + { be_const_key(pixels_buffer, 13), be_const_closure(Leds_pixels_buffer_closure) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_show_closure) }, + { be_const_key(begin, 17), be_const_closure(Leds_begin_closure) }, + { be_const_key(leds, -1), be_const_var(1) }, + { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, + { be_const_key(can_show, -1), be_const_closure(Leds_can_show_closure) }, + { be_const_key(gamma, 12), be_const_var(0) }, + { be_const_key(init, 11), be_const_closure(Leds_init_closure) }, + { be_const_key(set_pixel_color, 9), be_const_closure(Leds_set_pixel_color_closure) }, + { be_const_key(clear_to, 18), be_const_closure(Leds_clear_to_closure) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_is_dirty_closure) }, + { be_const_key(create_segment, -1), be_const_closure(Leds_create_segment_closure) }, + })), + be_str_literal("Leds") +); +/*******************************************************************/ + +void be_load_Leds_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds); + be_setglobal(vm, "Leds"); + be_pop(vm, 1); +} + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry/default/be_leds_ntv_lib.c b/lib/libesp32/berry/default/be_leds_ntv_lib.c new file mode 100644 index 000000000..4d5b07bb6 --- /dev/null +++ b/lib/libesp32/berry/default/be_leds_ntv_lib.c @@ -0,0 +1,50 @@ +/******************************************************************** + * Berry class `neopixelbus_ntv` + * + *******************************************************************/ +/* + +class Leds_ntv + var _p # pointer to internal object of type `NeoPixelBus(uint16_t countPixels, uint8_t pin)` + var _t # type of led strip + static WS2812_GRB = 1 + static SK6812_GRBW = 2 + + # skeleton for native call + def call_native() end +end + +*/ +#include "be_constobj.h" + +#ifdef USE_WS2812 + +extern int be_neopixelbus_call_native(bvm *vm); + + +/******************************************************************** +** Solidified class: Leds_ntv +********************************************************************/ +be_local_class(Leds_ntv, + 2, + NULL, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(call_native, -1), be_const_func(be_neopixelbus_call_native) }, + { be_const_key(_t, -1), be_const_var(1) }, + { be_const_key(_p, 3), be_const_var(0) }, + { be_const_key(SK6812_GRBW, 4), be_const_int(2) }, + { be_const_key(WS2812_GRB, -1), be_const_int(1) }, + })), + be_str_literal("Leds_ntv") +); +/*******************************************************************/ + +void be_load_Leds_ntv_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_ntv); + be_setglobal(vm, "Leds_ntv"); + be_pop(vm, 1); +} + +// be_const_func(be_neopixelbus_call_native) +#endif // USE_WS2812 diff --git a/lib/libesp32/berry/default/be_light_lib.c b/lib/libesp32/berry/default/be_light_lib.c new file mode 100644 index 000000000..6d020eca8 --- /dev/null +++ b/lib/libesp32/berry/default/be_light_lib.c @@ -0,0 +1,28 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import tasmota` + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LIGHT +extern int l_getlight(bvm *vm); +extern int l_setlight(bvm *vm); + +extern int l_gamma8(bvm *vm); +extern int l_gamma10(bvm *vm); +extern int l_rev_gamma10(bvm *vm); + +/* @const_object_info_begin +module light (scope: global) { + get, func(l_getlight) + set, func(l_setlight) + + gamma8, func(l_gamma8) + gamma10, func(l_gamma10) + reverse_gamma10, func(l_rev_gamma10) +} +@const_object_info_end */ +#include "../generate/be_fixed_light.h" + +#endif // USE_LIGHT \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_clock_icon_lib.c b/lib/libesp32/berry/default/be_lvgl_clock_icon_lib.c new file mode 100644 index 000000000..c9cf7f207 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_clock_icon_lib.c @@ -0,0 +1,313 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: set_time +********************************************************************/ +be_local_closure(lv_clock_icon_set_time, /* name */ + be_nested_proto( + 11, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(hour), + /* K2 */ be_nested_str(minute), + /* K3 */ be_nested_str(sec), + /* K4 */ be_nested_str(format), + /* K5 */ be_nested_str(_X2502d_X25s_X2502d), + /* K6 */ be_const_int(2), + /* K7 */ be_nested_str(_X3A), + /* K8 */ be_nested_str(_X20), + /* K9 */ be_nested_str(set_text), + }), + &be_const_str_set_time, + &be_const_str_solidified, + ( &(const binstruction[27]) { /* code */ + 0xA4120000, // 0000 IMPORT R4 K0 + 0x88140101, // 0001 GETMBR R5 R0 K1 + 0x20140205, // 0002 NE R5 R1 R5 + 0x74160005, // 0003 JMPT R5 #000A + 0x88140102, // 0004 GETMBR R5 R0 K2 + 0x20140405, // 0005 NE R5 R2 R5 + 0x74160002, // 0006 JMPT R5 #000A + 0x88140103, // 0007 GETMBR R5 R0 K3 + 0x20140605, // 0008 NE R5 R3 R5 + 0x7816000F, // 0009 JMPF R5 #001A + 0x8C140904, // 000A GETMET R5 R4 K4 + 0x581C0005, // 000B LDCONST R7 K5 + 0x5C200200, // 000C MOVE R8 R1 + 0x10240706, // 000D MOD R9 R3 K6 + 0x78260001, // 000E JMPF R9 #0011 + 0x58240007, // 000F LDCONST R9 K7 + 0x70020000, // 0010 JMP #0012 + 0x58240008, // 0011 LDCONST R9 K8 + 0x5C280400, // 0012 MOVE R10 R2 + 0x7C140A00, // 0013 CALL R5 5 + 0x90020201, // 0014 SETMBR R0 K1 R1 + 0x90020402, // 0015 SETMBR R0 K2 R2 + 0x90020603, // 0016 SETMBR R0 K3 R3 + 0x8C180109, // 0017 GETMET R6 R0 K9 + 0x5C200A00, // 0018 MOVE R8 R5 + 0x7C180400, // 0019 CALL R6 2 + 0x80000000, // 001A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: every_second +********************************************************************/ +be_local_closure(lv_clock_icon_every_second, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(time_dump), + /* K2 */ be_nested_str(rtc), + /* K3 */ be_nested_str(local), + /* K4 */ be_nested_str(year), + /* K5 */ be_nested_str(set_time), + /* K6 */ be_nested_str(hour), + /* K7 */ be_nested_str(min), + /* K8 */ be_nested_str(sec), + }), + &be_const_str_every_second, + &be_const_str_solidified, + ( &(const binstruction[17]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0xB80E0000, // 0002 GETNGBL R3 K0 + 0x8C0C0702, // 0003 GETMET R3 R3 K2 + 0x7C0C0200, // 0004 CALL R3 1 + 0x940C0703, // 0005 GETIDX R3 R3 K3 + 0x7C040400, // 0006 CALL R1 2 + 0x94080304, // 0007 GETIDX R2 R1 K4 + 0x540E07B1, // 0008 LDINT R3 1970 + 0x20080403, // 0009 NE R2 R2 R3 + 0x780A0004, // 000A JMPF R2 #0010 + 0x8C080105, // 000B GETMET R2 R0 K5 + 0x94100306, // 000C GETIDX R4 R1 K6 + 0x94140307, // 000D GETIDX R5 R1 K7 + 0x94180308, // 000E GETIDX R6 R1 K8 + 0x7C080800, // 000F CALL R2 4 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_clock_icon_init, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[22]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(seg7_font), + /* K3 */ be_nested_str(set_style_text_font), + /* K4 */ be_nested_str(PART_MAIN), + /* K5 */ be_nested_str(STATE_DEFAULT), + /* K6 */ be_nested_str(get_height), + /* K7 */ be_nested_str(set_text), + /* K8 */ be_nested_str(_X2D_X2D_X3A_X2D_X2D), + /* K9 */ be_nested_str(refr_size), + /* K10 */ be_nested_str(get_width), + /* K11 */ be_nested_str(set_y), + /* K12 */ be_const_int(2), + /* K13 */ be_nested_str(get_style_pad_right), + /* K14 */ be_nested_str(set_x), + /* K15 */ be_const_int(3), + /* K16 */ be_nested_str(set_style_pad_right), + /* K17 */ be_nested_str(set_style_bg_color), + /* K18 */ be_nested_str(color), + /* K19 */ be_nested_str(COLOR_BLACK), + /* K20 */ be_nested_str(tasmota), + /* K21 */ be_nested_str(add_driver), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[82]) { /* code */ + 0x60080003, // 0000 GETGBL R2 G3 + 0x5C0C0000, // 0001 MOVE R3 R0 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080500, // 0003 GETMET R2 R2 K0 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x5412000F, // 0008 LDINT R4 16 + 0x7C080400, // 0009 CALL R2 2 + 0x4C0C0000, // 000A LDNIL R3 + 0x200C0403, // 000B NE R3 R2 R3 + 0x780E0007, // 000C JMPF R3 #0015 + 0x8C0C0103, // 000D GETMET R3 R0 K3 + 0x5C140400, // 000E MOVE R5 R2 + 0xB81A0200, // 000F GETNGBL R6 K1 + 0x88180D04, // 0010 GETMBR R6 R6 K4 + 0xB81E0200, // 0011 GETNGBL R7 K1 + 0x881C0F05, // 0012 GETMBR R7 R7 K5 + 0x30180C07, // 0013 OR R6 R6 R7 + 0x7C0C0600, // 0014 CALL R3 3 + 0x4C0C0000, // 0015 LDNIL R3 + 0x200C0203, // 0016 NE R3 R1 R3 + 0x780E0034, // 0017 JMPF R3 #004D + 0x8C0C0306, // 0018 GETMET R3 R1 K6 + 0x7C0C0200, // 0019 CALL R3 1 + 0x8C100107, // 001A GETMET R4 R0 K7 + 0x58180008, // 001B LDCONST R6 K8 + 0x7C100400, // 001C CALL R4 2 + 0x8C100109, // 001D GETMET R4 R0 K9 + 0x7C100200, // 001E CALL R4 1 + 0x8C10010A, // 001F GETMET R4 R0 K10 + 0x7C100200, // 0020 CALL R4 1 + 0x8C14010B, // 0021 GETMET R5 R0 K11 + 0x8C1C0306, // 0022 GETMET R7 R1 K6 + 0x7C1C0200, // 0023 CALL R7 1 + 0x8C200106, // 0024 GETMET R8 R0 K6 + 0x7C200200, // 0025 CALL R8 1 + 0x041C0E08, // 0026 SUB R7 R7 R8 + 0x0C1C0F0C, // 0027 DIV R7 R7 K12 + 0x7C140400, // 0028 CALL R5 2 + 0x8C14030D, // 0029 GETMET R5 R1 K13 + 0xB81E0200, // 002A GETNGBL R7 K1 + 0x881C0F04, // 002B GETMBR R7 R7 K4 + 0xB8220200, // 002C GETNGBL R8 K1 + 0x88201105, // 002D GETMBR R8 R8 K5 + 0x301C0E08, // 002E OR R7 R7 R8 + 0x7C140400, // 002F CALL R5 2 + 0x8C18010E, // 0030 GETMET R6 R0 K14 + 0x8C20030A, // 0031 GETMET R8 R1 K10 + 0x7C200200, // 0032 CALL R8 1 + 0x04201004, // 0033 SUB R8 R8 R4 + 0x04201005, // 0034 SUB R8 R8 R5 + 0x0420110F, // 0035 SUB R8 R8 K15 + 0x7C180400, // 0036 CALL R6 2 + 0x8C180310, // 0037 GETMET R6 R1 K16 + 0x00200A04, // 0038 ADD R8 R5 R4 + 0x54260005, // 0039 LDINT R9 6 + 0x00201009, // 003A ADD R8 R8 R9 + 0xB8260200, // 003B GETNGBL R9 K1 + 0x88241304, // 003C GETMBR R9 R9 K4 + 0xB82A0200, // 003D GETNGBL R10 K1 + 0x88281505, // 003E GETMBR R10 R10 K5 + 0x3024120A, // 003F OR R9 R9 R10 + 0x7C180600, // 0040 CALL R6 3 + 0x8C180111, // 0041 GETMET R6 R0 K17 + 0xB8220200, // 0042 GETNGBL R8 K1 + 0x8C201112, // 0043 GETMET R8 R8 K18 + 0xB82A0200, // 0044 GETNGBL R10 K1 + 0x88281513, // 0045 GETMBR R10 R10 K19 + 0x7C200400, // 0046 CALL R8 2 + 0xB8260200, // 0047 GETNGBL R9 K1 + 0x88241304, // 0048 GETMBR R9 R9 K4 + 0xB82A0200, // 0049 GETNGBL R10 K1 + 0x88281505, // 004A GETMBR R10 R10 K5 + 0x3024120A, // 004B OR R9 R9 R10 + 0x7C180600, // 004C CALL R6 3 + 0xB80E2800, // 004D GETNGBL R3 K20 + 0x8C0C0715, // 004E GETMET R3 R3 K21 + 0x5C140000, // 004F MOVE R5 R0 + 0x7C0C0400, // 0050 CALL R3 2 + 0x80000000, // 0051 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: del +********************************************************************/ +be_local_closure(lv_clock_icon_del, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(del), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(remove_driver), + }), + &be_const_str_del, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x60040003, // 0000 GETGBL R1 G3 + 0x5C080000, // 0001 MOVE R2 R0 + 0x7C040200, // 0002 CALL R1 1 + 0x8C040300, // 0003 GETMET R1 R1 K0 + 0x7C040200, // 0004 CALL R1 1 + 0xB8060200, // 0005 GETNGBL R1 K1 + 0x8C040302, // 0006 GETMET R1 R1 K2 + 0x5C0C0000, // 0007 MOVE R3 R0 + 0x7C040400, // 0008 CALL R1 2 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_clock_icon +********************************************************************/ +extern const bclass be_class_lv_label; +be_local_class(lv_clock_icon, + 3, + &be_class_lv_label, + be_nested_map(7, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(sec, -1), be_const_var(2) }, + { be_const_key(hour, -1), be_const_var(0) }, + { be_const_key(set_time, 6), be_const_closure(lv_clock_icon_set_time_closure) }, + { be_const_key(every_second, -1), be_const_closure(lv_clock_icon_every_second_closure) }, + { be_const_key(minute, -1), be_const_var(1) }, + { be_const_key(init, 2), be_const_closure(lv_clock_icon_init_closure) }, + { be_const_key(del, -1), be_const_closure(lv_clock_icon_del_closure) }, + })), + be_str_literal("lv_clock_icon") +); +/*******************************************************************/ + +void be_load_lv_clock_icon_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_clock_icon); + be_setglobal(vm, "lv_clock_icon"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_ctypes_definitions.c b/lib/libesp32/berry/default/be_lvgl_ctypes_definitions.c new file mode 100644 index 000000000..bb1ffb65c --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_ctypes_definitions.c @@ -0,0 +1,531 @@ +/******************************************************************** + * Tasmota LVGL ctypes mapping + *******************************************************************/ +#include "be_ctypes.h" + +#ifdef USE_LVGL + +#include "lvgl.h" +#include "be_lvgl.h" + +/******************************************************************** + * Generated code, don't edit + *******************************************************************/ + +static const char * be_ctypes_instance_mappings[]; /* forward definition */ + +const be_ctypes_structure_t be_lv_point = { + 4, /* size in bytes */ + 2, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[2]) { + { "x", 0, 0, 0, ctypes_i16, 0 }, + { "y", 2, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_area = { + 8, /* size in bytes */ + 4, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[4]) { + { "x1", 0, 0, 0, ctypes_i16, 0 }, + { "x2", 4, 0, 0, ctypes_i16, 0 }, + { "y1", 2, 0, 0, ctypes_i16, 0 }, + { "y2", 6, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_rect_dsc = { + 51, /* size in bytes */ + 29, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[29]) { + { "bg_color", 4, 0, 0, ctypes_u16, 1 }, + { "bg_grad_color", 6, 0, 0, ctypes_u16, 1 }, + { "bg_grad_color_stop", 9, 0, 0, ctypes_u8, 0 }, + { "bg_grad_dir", 11, 0, 3, ctypes_bf, 0 }, + { "bg_img_opa", 22, 0, 0, ctypes_u8, 0 }, + { "bg_img_recolor", 20, 0, 0, ctypes_u16, 1 }, + { "bg_img_recolor_opa", 23, 0, 0, ctypes_u8, 0 }, + { "bg_img_src", 12, 0, 0, ctypes_ptr32, 0 }, + { "bg_img_symbol_font", 16, 0, 0, ctypes_ptr32, 0 }, + { "bg_img_tiled", 24, 0, 0, ctypes_u8, 0 }, + { "bg_main_color_stop", 8, 0, 0, ctypes_u8, 0 }, + { "bg_opa", 10, 0, 0, ctypes_u8, 0 }, + { "blend_mode", 2, 0, 0, ctypes_u8, 0 }, + { "border_color", 26, 0, 0, ctypes_u16, 1 }, + { "border_opa", 30, 0, 0, ctypes_u8, 0 }, + { "border_post", 31, 0, 1, ctypes_bf, 0 }, + { "border_side", 31, 1, 5, ctypes_bf, 0 }, + { "border_width", 28, 0, 0, ctypes_i16, 0 }, + { "outline_color", 32, 0, 0, ctypes_u16, 1 }, + { "outline_opa", 38, 0, 0, ctypes_u8, 0 }, + { "outline_pad", 36, 0, 0, ctypes_i16, 0 }, + { "outline_width", 34, 0, 0, ctypes_i16, 0 }, + { "radius", 0, 0, 0, ctypes_i16, 0 }, + { "shadow_color", 40, 0, 0, ctypes_u16, 1 }, + { "shadow_ofs_x", 44, 0, 0, ctypes_i16, 0 }, + { "shadow_ofs_y", 46, 0, 0, ctypes_i16, 0 }, + { "shadow_opa", 50, 0, 0, ctypes_u8, 0 }, + { "shadow_spread", 48, 0, 0, ctypes_i16, 0 }, + { "shadow_width", 42, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_line_dsc = { + 10, /* size in bytes */ + 9, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[9]) { + { "blend_mode", 9, 0, 2, ctypes_bf, 0 }, + { "color", 0, 0, 0, ctypes_u16, 1 }, + { "dash_gap", 6, 0, 0, ctypes_i16, 0 }, + { "dash_width", 4, 0, 0, ctypes_i16, 0 }, + { "opa", 8, 0, 0, ctypes_u8, 0 }, + { "raw_end", 9, 4, 1, ctypes_bf, 0 }, + { "round_end", 9, 3, 1, ctypes_bf, 0 }, + { "round_start", 9, 2, 1, ctypes_bf, 0 }, + { "width", 2, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_img_dsc = { + 21, /* size in bytes */ + 10, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[10]) { + { "angle", 0, 0, 0, ctypes_u16, 0 }, + { "antialias", 20, 0, 1, ctypes_bf, 0 }, + { "blend_mode", 12, 0, 4, ctypes_bf, 0 }, + { "frame_id", 16, 0, 0, ctypes_i32, 0 }, + { "opa", 11, 0, 0, ctypes_u8, 0 }, + { "pivot_x", 4, 0, 0, ctypes_i16, 0 }, + { "pivot_y", 6, 0, 0, ctypes_i16, 0 }, + { "recolor", 8, 0, 0, ctypes_u16, 1 }, + { "recolor_opa", 10, 0, 0, ctypes_u8, 0 }, + { "zoom", 2, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_common_dsc = { + 5, /* size in bytes */ + 2, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[2]) { + { "cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg = { + 9, /* size in bytes */ + 5, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[5]) { + { "p1_x", 0, 0, 0, ctypes_i16, 0 }, + { "p1_y", 2, 0, 0, ctypes_i16, 0 }, + { "p2_x", 4, 0, 0, ctypes_i16, 0 }, + { "p2_y", 6, 0, 0, ctypes_i16, 0 }, + { "side", 8, 0, 2, ctypes_bf, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_line_param = { + 41, /* size in bytes */ + 15, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[15]) { + { "cfg_p1_x", 8, 0, 0, ctypes_i16, 0 }, + { "cfg_p1_y", 10, 0, 0, ctypes_i16, 0 }, + { "cfg_p2_x", 12, 0, 0, ctypes_i16, 0 }, + { "cfg_p2_y", 14, 0, 0, ctypes_i16, 0 }, + { "cfg_side", 16, 0, 2, ctypes_bf, 0 }, + { "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "dsc_type", 4, 0, 0, ctypes_u8, 0 }, + { "flat", 40, 0, 1, ctypes_bf, 0 }, + { "inv", 40, 1, 1, ctypes_bf, 0 }, + { "origo_x", 20, 0, 0, ctypes_i16, 0 }, + { "origo_y", 22, 0, 0, ctypes_i16, 0 }, + { "spx", 36, 0, 0, ctypes_i32, 0 }, + { "steep", 32, 0, 0, ctypes_i32, 0 }, + { "xy_steep", 24, 0, 0, ctypes_i32, 0 }, + { "yx_steep", 28, 0, 0, ctypes_i32, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg = { + 8, /* size in bytes */ + 4, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[4]) { + { "end_angle", 6, 0, 0, ctypes_i16, 0 }, + { "start_angle", 4, 0, 0, ctypes_i16, 0 }, + { "vertex_p_x", 0, 0, 0, ctypes_i16, 0 }, + { "vertex_p_y", 2, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_angle_param = { + 104, /* size in bytes */ + 37, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[37]) { + { "cfg_end_angle", 14, 0, 0, ctypes_i16, 0 }, + { "cfg_start_angle", 12, 0, 0, ctypes_i16, 0 }, + { "cfg_vertex_p_x", 8, 0, 0, ctypes_i16, 0 }, + { "cfg_vertex_p_y", 10, 0, 0, ctypes_i16, 0 }, + { "delta_deg", 102, 0, 0, ctypes_u16, 0 }, + { "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "dsc_type", 4, 0, 0, ctypes_u8, 0 }, + { "end_line_cfg_p1_x", 68, 0, 0, ctypes_i16, 0 }, + { "end_line_cfg_p1_y", 70, 0, 0, ctypes_i16, 0 }, + { "end_line_cfg_p2_x", 72, 0, 0, ctypes_i16, 0 }, + { "end_line_cfg_p2_y", 74, 0, 0, ctypes_i16, 0 }, + { "end_line_cfg_side", 76, 0, 2, ctypes_bf, 0 }, + { "end_line_dsc_cb", 60, 0, 0, ctypes_ptr32, 0 }, + { "end_line_dsc_type", 64, 0, 0, ctypes_u8, 0 }, + { "end_line_flat", 100, 0, 1, ctypes_bf, 0 }, + { "end_line_inv", 100, 1, 1, ctypes_bf, 0 }, + { "end_line_origo_x", 80, 0, 0, ctypes_i16, 0 }, + { "end_line_origo_y", 82, 0, 0, ctypes_i16, 0 }, + { "end_line_spx", 96, 0, 0, ctypes_i32, 0 }, + { "end_line_steep", 92, 0, 0, ctypes_i32, 0 }, + { "end_line_xy_steep", 84, 0, 0, ctypes_i32, 0 }, + { "end_line_yx_steep", 88, 0, 0, ctypes_i32, 0 }, + { "start_line_cfg_p1_x", 24, 0, 0, ctypes_i16, 0 }, + { "start_line_cfg_p1_y", 26, 0, 0, ctypes_i16, 0 }, + { "start_line_cfg_p2_x", 28, 0, 0, ctypes_i16, 0 }, + { "start_line_cfg_p2_y", 30, 0, 0, ctypes_i16, 0 }, + { "start_line_cfg_side", 32, 0, 2, ctypes_bf, 0 }, + { "start_line_dsc_cb", 16, 0, 0, ctypes_ptr32, 0 }, + { "start_line_dsc_type", 20, 0, 0, ctypes_u8, 0 }, + { "start_line_flat", 56, 0, 1, ctypes_bf, 0 }, + { "start_line_inv", 56, 1, 1, ctypes_bf, 0 }, + { "start_line_origo_x", 36, 0, 0, ctypes_i16, 0 }, + { "start_line_origo_y", 38, 0, 0, ctypes_i16, 0 }, + { "start_line_spx", 52, 0, 0, ctypes_i32, 0 }, + { "start_line_steep", 48, 0, 0, ctypes_i32, 0 }, + { "start_line_xy_steep", 40, 0, 0, ctypes_i32, 0 }, + { "start_line_yx_steep", 44, 0, 0, ctypes_i32, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = { + 11, /* size in bytes */ + 6, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[6]) { + { "outer", 10, 0, 1, ctypes_bf, 0 }, + { "radius", 8, 0, 0, ctypes_i16, 0 }, + { "rect_x1", 0, 0, 0, ctypes_i16, 0 }, + { "rect_x2", 4, 0, 0, ctypes_i16, 0 }, + { "rect_y1", 2, 0, 0, ctypes_i16, 0 }, + { "rect_y2", 6, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_sqrt_res = { + 4, /* size in bytes */ + 2, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[2]) { + { "f", 2, 0, 0, ctypes_u16, 0 }, + { "i", 0, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_radius_param = { + 28, /* size in bytes */ + 11, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[11]) { + { "cfg_outer", 18, 0, 1, ctypes_bf, 0 }, + { "cfg_radius", 16, 0, 0, ctypes_i16, 0 }, + { "cfg_rect_x1", 8, 0, 0, ctypes_i16, 0 }, + { "cfg_rect_x2", 12, 0, 0, ctypes_i16, 0 }, + { "cfg_rect_y1", 10, 0, 0, ctypes_i16, 0 }, + { "cfg_rect_y2", 14, 0, 0, ctypes_i16, 0 }, + { "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "dsc_type", 4, 0, 0, ctypes_u8, 0 }, + { "y_prev", 20, 0, 0, ctypes_i32, 0 }, + { "y_prev_x_f", 26, 0, 0, ctypes_u16, 0 }, + { "y_prev_x_i", 24, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = { + 14, /* size in bytes */ + 8, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[8]) { + { "coords_x1", 0, 0, 0, ctypes_i16, 0 }, + { "coords_x2", 4, 0, 0, ctypes_i16, 0 }, + { "coords_y1", 2, 0, 0, ctypes_i16, 0 }, + { "coords_y2", 6, 0, 0, ctypes_i16, 0 }, + { "opa_bottom", 13, 0, 0, ctypes_u8, 0 }, + { "opa_top", 12, 0, 0, ctypes_u8, 0 }, + { "y_bottom", 10, 0, 0, ctypes_i16, 0 }, + { "y_top", 8, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_fade_param = { + 22, /* size in bytes */ + 10, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[10]) { + { "cfg_coords_x1", 8, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_x2", 12, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_y1", 10, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_y2", 14, 0, 0, ctypes_i16, 0 }, + { "cfg_opa_bottom", 21, 0, 0, ctypes_u8, 0 }, + { "cfg_opa_top", 20, 0, 0, ctypes_u8, 0 }, + { "cfg_y_bottom", 18, 0, 0, ctypes_i16, 0 }, + { "cfg_y_top", 16, 0, 0, ctypes_i16, 0 }, + { "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "dsc_type", 4, 0, 0, ctypes_u8, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg = { + 12, /* size in bytes */ + 5, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[5]) { + { "coords_x1", 0, 0, 0, ctypes_i16, 0 }, + { "coords_x2", 4, 0, 0, ctypes_i16, 0 }, + { "coords_y1", 2, 0, 0, ctypes_i16, 0 }, + { "coords_y2", 6, 0, 0, ctypes_i16, 0 }, + { "map", 8, 0, 0, ctypes_ptr32, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_map_param = { + 20, /* size in bytes */ + 7, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[7]) { + { "cfg_coords_x1", 8, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_x2", 12, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_y1", 10, 0, 0, ctypes_i16, 0 }, + { "cfg_coords_y2", 14, 0, 0, ctypes_i16, 0 }, + { "cfg_map", 16, 0, 0, ctypes_ptr32, 0 }, + { "dsc_cb", 0, 0, 0, ctypes_ptr32, 0 }, + { "dsc_type", 4, 0, 0, ctypes_u8, 0 }, +}}; + +const be_ctypes_structure_t be_lv_draw_mask_saved = { + 8, /* size in bytes */ + 2, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[2]) { + { "custom_id", 4, 0, 0, ctypes_ptr32, 0 }, + { "param", 0, 0, 0, ctypes_ptr32, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_scale = { + 34, /* size in bytes */ + 15, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[15]) { + { "angle_range", 30, 0, 0, ctypes_u16, 0 }, + { "label_color", 18, 0, 0, ctypes_i16, 0 }, + { "label_gap", 16, 0, 0, ctypes_i16, 0 }, + { "max", 24, 0, 0, ctypes_i32, 0 }, + { "min", 20, 0, 0, ctypes_i32, 0 }, + { "r_mod", 28, 0, 0, ctypes_i16, 0 }, + { "rotation", 32, 0, 0, ctypes_i16, 0 }, + { "tick_cnt", 2, 0, 0, ctypes_u16, 0 }, + { "tick_color", 0, 0, 0, ctypes_u16, 1 }, + { "tick_length", 4, 0, 0, ctypes_u16, 0 }, + { "tick_major_color", 8, 0, 0, ctypes_u16, 1 }, + { "tick_major_length", 12, 0, 0, ctypes_u16, 0 }, + { "tick_major_nth", 10, 0, 0, ctypes_u16, 0 }, + { "tick_major_width", 14, 0, 0, ctypes_u16, 0 }, + { "tick_width", 6, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_indicator = { + 16, /* size in bytes */ + 5, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[5]) { + { "end_value", 12, 0, 0, ctypes_i32, 0 }, + { "opa", 5, 0, 0, ctypes_u8, 0 }, + { "scale", 0, 0, 0, ctypes_ptr32, 0 }, + { "start_value", 8, 0, 0, ctypes_i32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_indicator_needle_img = { + 24, /* size in bytes */ + 8, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[8]) { + { "end_value", 12, 0, 0, ctypes_i32, 0 }, + { "opa", 5, 0, 0, ctypes_u8, 0 }, + { "pivot_x", 20, 0, 0, ctypes_i16, 0 }, + { "pivot_y", 22, 0, 0, ctypes_i16, 0 }, + { "scale", 0, 0, 0, ctypes_ptr32, 0 }, + { "src", 16, 0, 0, ctypes_ptr32, 0 }, + { "start_value", 8, 0, 0, ctypes_i32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_indicator_needle_line = { + 22, /* size in bytes */ + 8, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[8]) { + { "color", 20, 0, 0, ctypes_u16, 1 }, + { "end_value", 12, 0, 0, ctypes_i32, 0 }, + { "opa", 5, 0, 0, ctypes_u8, 0 }, + { "r_mod", 18, 0, 0, ctypes_i16, 0 }, + { "scale", 0, 0, 0, ctypes_ptr32, 0 }, + { "start_value", 8, 0, 0, ctypes_i32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, + { "width", 16, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_indicator_arc = { + 28, /* size in bytes */ + 9, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[9]) { + { "color", 24, 0, 0, ctypes_u16, 1 }, + { "end_value", 12, 0, 0, ctypes_i32, 0 }, + { "opa", 5, 0, 0, ctypes_u8, 0 }, + { "r_mod", 26, 0, 0, ctypes_i16, 0 }, + { "scale", 0, 0, 0, ctypes_ptr32, 0 }, + { "src", 20, 0, 0, ctypes_ptr32, 0 }, + { "start_value", 8, 0, 0, ctypes_i32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, + { "width", 16, 0, 0, ctypes_u16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_meter_indicator_scale_lines = { + 23, /* size in bytes */ + 9, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[9]) { + { "color_end", 20, 0, 0, ctypes_u16, 1 }, + { "color_start", 18, 0, 0, ctypes_u16, 1 }, + { "end_value", 12, 0, 0, ctypes_i32, 0 }, + { "local_grad", 22, 0, 1, ctypes_bf, 0 }, + { "opa", 5, 0, 0, ctypes_u8, 0 }, + { "scale", 0, 0, 0, ctypes_ptr32, 0 }, + { "start_value", 8, 0, 0, ctypes_i32, 0 }, + { "type", 4, 0, 0, ctypes_u8, 0 }, + { "width_mod", 16, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_obj_class = { + 27, /* size in bytes */ + 10, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[10]) { + { "base_class", 0, 0, 0, ctypes_ptr32, 0 }, + { "constructor_cb", 4, 0, 0, ctypes_ptr32, 0 }, + { "destructor_cb", 8, 0, 0, ctypes_ptr32, 0 }, + { "editable", 24, 0, 2, ctypes_bf, 0 }, + { "event_cb", 16, 0, 0, ctypes_ptr32, 0 }, + { "group_def", 24, 2, 2, ctypes_bf, 0 }, + { "height_def", 22, 0, 0, ctypes_i16, 0 }, + { "instance_size", 24, 4, 16, ctypes_bf, 0 }, + { "user_data", 12, 0, 0, ctypes_ptr32, 0 }, + { "width_def", 20, 0, 0, ctypes_i16, 0 }, +}}; + +const be_ctypes_structure_t be_lv_event = { + 25, /* size in bytes */ + 7, /* number of elements */ + be_ctypes_instance_mappings, + (const be_ctypes_structure_item_t[7]) { + { "code", 8, 0, 0, ctypes_i32, 0 }, + { "current_target", 4, 0, 0, ctypes_ptr32, 0 }, + { "deleted", 24, 0, 1, ctypes_bf, 0 }, + { "param", 16, 0, 0, ctypes_ptr32, 0 }, + { "prev", 20, 0, 0, ctypes_ptr32, 0 }, + { "target", 0, 0, 0, ctypes_ptr32, 0 }, + { "user_data", 12, 0, 0, ctypes_ptr32, 0 }, +}}; + +static const char * be_ctypes_instance_mappings[] = { + "lv_color", + NULL +}; + +static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes, "lv_area"); +static be_define_ctypes_class(lv_draw_img_dsc, &be_lv_draw_img_dsc, &be_class_ctypes, "lv_draw_img_dsc"); +static be_define_ctypes_class(lv_draw_line_dsc, &be_lv_draw_line_dsc, &be_class_ctypes, "lv_draw_line_dsc"); +static be_define_ctypes_class(lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param, &be_class_ctypes, "lv_draw_mask_angle_param"); +static be_define_ctypes_class(lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg, &be_class_ctypes, "lv_draw_mask_angle_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc, &be_class_ctypes, "lv_draw_mask_common_dsc"); +static be_define_ctypes_class(lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param, &be_class_ctypes, "lv_draw_mask_fade_param"); +static be_define_ctypes_class(lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg, &be_class_ctypes, "lv_draw_mask_fade_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_line_param, &be_lv_draw_mask_line_param, &be_class_ctypes, "lv_draw_mask_line_param"); +static be_define_ctypes_class(lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg, &be_class_ctypes, "lv_draw_mask_line_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_map_param, &be_lv_draw_mask_map_param, &be_class_ctypes, "lv_draw_mask_map_param"); +static be_define_ctypes_class(lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg, &be_class_ctypes, "lv_draw_mask_map_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param, &be_class_ctypes, "lv_draw_mask_radius_param"); +static be_define_ctypes_class(lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg, &be_class_ctypes, "lv_draw_mask_radius_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_saved, &be_lv_draw_mask_saved, &be_class_ctypes, "lv_draw_mask_saved"); +static be_define_ctypes_class(lv_draw_rect_dsc, &be_lv_draw_rect_dsc, &be_class_ctypes, "lv_draw_rect_dsc"); +static be_define_ctypes_class(lv_event, &be_lv_event, &be_class_ctypes, "lv_event"); +static be_define_ctypes_class(lv_meter_indicator, &be_lv_meter_indicator, &be_class_ctypes, "lv_meter_indicator"); +static be_define_ctypes_class(lv_meter_indicator_arc, &be_lv_meter_indicator_arc, &be_class_ctypes, "lv_meter_indicator_arc"); +static be_define_ctypes_class(lv_meter_indicator_needle_img, &be_lv_meter_indicator_needle_img, &be_class_ctypes, "lv_meter_indicator_needle_img"); +static be_define_ctypes_class(lv_meter_indicator_needle_line, &be_lv_meter_indicator_needle_line, &be_class_ctypes, "lv_meter_indicator_needle_line"); +static be_define_ctypes_class(lv_meter_indicator_scale_lines, &be_lv_meter_indicator_scale_lines, &be_class_ctypes, "lv_meter_indicator_scale_lines"); +static be_define_ctypes_class(lv_meter_scale, &be_lv_meter_scale, &be_class_ctypes, "lv_meter_scale"); +static be_define_ctypes_class(lv_obj_class, &be_lv_obj_class, &be_class_ctypes, "lv_obj_class"); +static be_define_ctypes_class(lv_point, &be_lv_point, &be_class_ctypes, "lv_point"); +static be_define_ctypes_class(lv_sqrt_res, &be_lv_sqrt_res, &be_class_ctypes, "lv_sqrt_res"); + +void be_load_ctypes_lvgl_definitions_lib(bvm *vm) { + ctypes_register_class(vm, &be_class_lv_area, &be_lv_area); + ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc); + ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc); + ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param); + ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg); + ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc); + ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param); + ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg); + ctypes_register_class(vm, &be_class_lv_draw_mask_line_param, &be_lv_draw_mask_line_param); + ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg); + ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param); + ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg); + ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param); + ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg); + ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved); + ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc); + ctypes_register_class(vm, &be_class_lv_event, &be_lv_event); + ctypes_register_class(vm, &be_class_lv_meter_indicator, &be_lv_meter_indicator); + ctypes_register_class(vm, &be_class_lv_meter_indicator_arc, &be_lv_meter_indicator_arc); + ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_img, &be_lv_meter_indicator_needle_img); + ctypes_register_class(vm, &be_class_lv_meter_indicator_needle_line, &be_lv_meter_indicator_needle_line); + ctypes_register_class(vm, &be_class_lv_meter_indicator_scale_lines, &be_lv_meter_indicator_scale_lines); + ctypes_register_class(vm, &be_class_lv_meter_scale, &be_lv_meter_scale); + ctypes_register_class(vm, &be_class_lv_obj_class, &be_lv_obj_class); + ctypes_register_class(vm, &be_class_lv_point, &be_lv_point); + ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res); +} + +be_ctypes_class_by_name_t be_ctypes_lvgl_classes[] = { + { "lv_area", &be_class_lv_area }, + { "lv_draw_img_dsc", &be_class_lv_draw_img_dsc }, + { "lv_draw_line_dsc", &be_class_lv_draw_line_dsc }, + { "lv_draw_mask_angle_param", &be_class_lv_draw_mask_angle_param }, + { "lv_draw_mask_angle_param_cfg", &be_class_lv_draw_mask_angle_param_cfg }, + { "lv_draw_mask_common_dsc", &be_class_lv_draw_mask_common_dsc }, + { "lv_draw_mask_fade_param", &be_class_lv_draw_mask_fade_param }, + { "lv_draw_mask_fade_param_cfg", &be_class_lv_draw_mask_fade_param_cfg }, + { "lv_draw_mask_line_param", &be_class_lv_draw_mask_line_param }, + { "lv_draw_mask_line_param_cfg", &be_class_lv_draw_mask_line_param_cfg }, + { "lv_draw_mask_map_param", &be_class_lv_draw_mask_map_param }, + { "lv_draw_mask_map_param_cfg", &be_class_lv_draw_mask_map_param_cfg }, + { "lv_draw_mask_radius_param", &be_class_lv_draw_mask_radius_param }, + { "lv_draw_mask_radius_param_cfg", &be_class_lv_draw_mask_radius_param_cfg }, + { "lv_draw_mask_saved", &be_class_lv_draw_mask_saved }, + { "lv_draw_rect_dsc", &be_class_lv_draw_rect_dsc }, + { "lv_event", &be_class_lv_event }, + { "lv_meter_indicator", &be_class_lv_meter_indicator }, + { "lv_meter_indicator_arc", &be_class_lv_meter_indicator_arc }, + { "lv_meter_indicator_needle_img", &be_class_lv_meter_indicator_needle_img }, + { "lv_meter_indicator_needle_line", &be_class_lv_meter_indicator_needle_line }, + { "lv_meter_indicator_scale_lines", &be_class_lv_meter_indicator_scale_lines }, + { "lv_meter_scale", &be_class_lv_meter_scale }, + { "lv_obj_class", &be_class_lv_obj_class }, + { "lv_point", &be_class_lv_point }, + { "lv_sqrt_res", &be_class_lv_sqrt_res }, +}; +const size_t be_ctypes_lvgl_classes_size = sizeof(be_ctypes_lvgl_classes)/sizeof(be_ctypes_lvgl_classes[0]); + +/********************************************************************/ + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_glob_lib.c b/lib/libesp32/berry/default/be_lvgl_glob_lib.c new file mode 100644 index 000000000..06827fc0e --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_glob_lib.c @@ -0,0 +1,826 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: get_object_from_ptr +********************************************************************/ +be_local_closure(LVGL_glob_get_object_from_ptr, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(cb_obj), + /* K1 */ be_nested_str(find), + }), + &be_const_str_get_object_from_ptr, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0004, // 0003 JMPF R2 #0009 + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x8C080501, // 0005 GETMET R2 R2 K1 + 0x5C100200, // 0006 MOVE R4 R1 + 0x7C080400, // 0007 CALL R2 2 + 0x80040400, // 0008 RET 1 R2 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_event_impl +********************************************************************/ +be_local_closure(LVGL_glob_widget_event_impl, /* name */ + be_nested_proto( + 12, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj_class), + /* K3 */ be_nested_str(lv_event), + /* K4 */ be_nested_str(target), + /* K5 */ be_nested_str(get_object_from_ptr), + /* K6 */ be_nested_str(instance), + /* K7 */ be_nested_str(get), + /* K8 */ be_nested_str(widget_event), + }), + &be_const_str_widget_event_impl, + &be_const_str_solidified, + ( &(const binstruction[28]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xB8120200, // 0001 GETNGBL R4 K1 + 0x8C100902, // 0002 GETMET R4 R4 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C100400, // 0004 CALL R4 2 + 0xB8160200, // 0005 GETNGBL R5 K1 + 0x8C140B03, // 0006 GETMET R5 R5 K3 + 0x5C1C0400, // 0007 MOVE R7 R2 + 0x7C140400, // 0008 CALL R5 2 + 0x88180B04, // 0009 GETMBR R6 R5 K4 + 0x8C1C0105, // 000A GETMET R7 R0 K5 + 0x5C240C00, // 000B MOVE R9 R6 + 0x7C1C0400, // 000C CALL R7 2 + 0x60200004, // 000D GETGBL R8 G4 + 0x5C240E00, // 000E MOVE R9 R7 + 0x7C200200, // 000F CALL R8 1 + 0x1C201106, // 0010 EQ R8 R8 K6 + 0x78220008, // 0011 JMPF R8 #001B + 0x8C200707, // 0012 GETMET R8 R3 K7 + 0x5C280E00, // 0013 MOVE R10 R7 + 0x582C0008, // 0014 LDCONST R11 K8 + 0x7C200600, // 0015 CALL R8 3 + 0x78220003, // 0016 JMPF R8 #001B + 0x8C200F08, // 0017 GETMET R8 R7 K8 + 0x5C280800, // 0018 MOVE R10 R4 + 0x5C2C0A00, // 0019 MOVE R11 R5 + 0x7C200600, // 001A CALL R8 3 + 0x80000000, // 001B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: lvgl_event_dispatch +********************************************************************/ +be_local_closure(LVGL_glob_lvgl_event_dispatch, /* name */ + be_nested_proto( + 10, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_event), + /* K3 */ be_nested_str(toptr), + /* K4 */ be_nested_str(target), + /* K5 */ be_nested_str(cb_event_closure), + /* K6 */ be_nested_str(get_object_from_ptr), + }), + &be_const_str_lvgl_event_dispatch, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0xB80E0200, // 0001 GETNGBL R3 K1 + 0x8C0C0702, // 0002 GETMET R3 R3 K2 + 0x8C140503, // 0003 GETMET R5 R2 K3 + 0x5C1C0200, // 0004 MOVE R7 R1 + 0x7C140400, // 0005 CALL R5 2 + 0x7C0C0400, // 0006 CALL R3 2 + 0x88100704, // 0007 GETMBR R4 R3 K4 + 0x88140105, // 0008 GETMBR R5 R0 K5 + 0x94140A04, // 0009 GETIDX R5 R5 R4 + 0x8C180106, // 000A GETMET R6 R0 K6 + 0x5C200800, // 000B MOVE R8 R4 + 0x7C180400, // 000C CALL R6 2 + 0x5C1C0A00, // 000D MOVE R7 R5 + 0x5C200C00, // 000E MOVE R8 R6 + 0x5C240600, // 000F MOVE R9 R3 + 0x7C1C0400, // 0010 CALL R7 2 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_dtor_impl +********************************************************************/ +be_local_closure(LVGL_glob_widget_dtor_impl, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj_class), + /* K3 */ be_nested_str(get_object_from_ptr), + /* K4 */ be_nested_str(instance), + /* K5 */ be_nested_str(get), + /* K6 */ be_nested_str(widget_destructor), + }), + &be_const_str_widget_dtor_impl, + &be_const_str_solidified, + ( &(const binstruction[22]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xB8120200, // 0001 GETNGBL R4 K1 + 0x8C100902, // 0002 GETMET R4 R4 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C100400, // 0004 CALL R4 2 + 0x8C140103, // 0005 GETMET R5 R0 K3 + 0x5C1C0400, // 0006 MOVE R7 R2 + 0x7C140400, // 0007 CALL R5 2 + 0x60180004, // 0008 GETGBL R6 G4 + 0x5C1C0A00, // 0009 MOVE R7 R5 + 0x7C180200, // 000A CALL R6 1 + 0x1C180D04, // 000B EQ R6 R6 K4 + 0x781A0007, // 000C JMPF R6 #0015 + 0x8C180705, // 000D GETMET R6 R3 K5 + 0x5C200A00, // 000E MOVE R8 R5 + 0x58240006, // 000F LDCONST R9 K6 + 0x7C180600, // 0010 CALL R6 3 + 0x781A0002, // 0011 JMPF R6 #0015 + 0x8C180B06, // 0012 GETMET R6 R5 K6 + 0x5C200800, // 0013 MOVE R8 R4 + 0x7C180400, // 0014 CALL R6 2 + 0x80000000, // 0015 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: register_obj +********************************************************************/ +be_local_closure(LVGL_glob_register_obj, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(cb_obj), + /* K1 */ be_nested_str(_p), + }), + &be_const_str_register_obj, + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0002, // 0003 JMPF R2 #0007 + 0x60080013, // 0004 GETGBL R2 G19 + 0x7C080000, // 0005 CALL R2 0 + 0x90020002, // 0006 SETMBR R0 K0 R2 + 0x88080301, // 0007 GETMBR R2 R1 K1 + 0x880C0100, // 0008 GETMBR R3 R0 K0 + 0x980C0401, // 0009 SETIDX R3 R2 R1 + 0x80000000, // 000A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: gen_cb +********************************************************************/ +be_local_closure(LVGL_glob_gen_cb, /* name */ + be_nested_proto( + 8, /* nstack */ + 5, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(lvgl_event_dispatch), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x68040000, // 0000 GETUPV R1 U0 + 0x8C040300, // 0001 GETMET R1 R1 K0 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80040200, // 0004 RET 1 R1 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(lv_event_cb), + /* K1 */ be_nested_str(cb_event_closure), + /* K2 */ be_nested_str(event_cb), + /* K3 */ be_nested_str(tasmota), + /* K4 */ be_nested_str(gen_cb), + /* K5 */ be_nested_str(register_obj), + /* K6 */ be_nested_str(null_cb), + /* K7 */ be_nested_str(cb_do_nothing), + }), + &be_const_str_gen_cb, + &be_const_str_solidified, + ( &(const binstruction[41]) { /* code */ + 0x1C140300, // 0000 EQ R5 R1 K0 + 0x78160018, // 0001 JMPF R5 #001B + 0x88140101, // 0002 GETMBR R5 R0 K1 + 0x4C180000, // 0003 LDNIL R6 + 0x1C140A06, // 0004 EQ R5 R5 R6 + 0x78160002, // 0005 JMPF R5 #0009 + 0x60140013, // 0006 GETGBL R5 G19 + 0x7C140000, // 0007 CALL R5 0 + 0x90020205, // 0008 SETMBR R0 K1 R5 + 0x88140102, // 0009 GETMBR R5 R0 K2 + 0x4C180000, // 000A LDNIL R6 + 0x1C140A06, // 000B EQ R5 R5 R6 + 0x78160004, // 000C JMPF R5 #0012 + 0xB8160600, // 000D GETNGBL R5 K3 + 0x8C140B04, // 000E GETMET R5 R5 K4 + 0x841C0000, // 000F CLOSURE R7 P0 + 0x7C140400, // 0010 CALL R5 2 + 0x90020405, // 0011 SETMBR R0 K2 R5 + 0x8C140105, // 0012 GETMET R5 R0 K5 + 0x5C1C0600, // 0013 MOVE R7 R3 + 0x7C140400, // 0014 CALL R5 2 + 0x88140101, // 0015 GETMBR R5 R0 K1 + 0x98140802, // 0016 SETIDX R5 R4 R2 + 0x88140102, // 0017 GETMBR R5 R0 K2 + 0xA0000000, // 0018 CLOSE R0 + 0x80040A00, // 0019 RET 1 R5 + 0x7002000B, // 001A JMP #0027 + 0x88140106, // 001B GETMBR R5 R0 K6 + 0x4C180000, // 001C LDNIL R6 + 0x1C140A06, // 001D EQ R5 R5 R6 + 0x78160004, // 001E JMPF R5 #0024 + 0xB8160600, // 001F GETNGBL R5 K3 + 0x8C140B04, // 0020 GETMET R5 R5 K4 + 0x881C0107, // 0021 GETMBR R7 R0 K7 + 0x7C140400, // 0022 CALL R5 2 + 0x90020C05, // 0023 SETMBR R0 K6 R5 + 0x88140106, // 0024 GETMBR R5 R0 K6 + 0xA0000000, // 0025 CLOSE R0 + 0x80040A00, // 0026 RET 1 R5 + 0xA0000000, // 0027 CLOSE R0 + 0x80000000, // 0028 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: deregister_obj +********************************************************************/ +be_local_closure(LVGL_glob_deregister_obj, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(cb_obj), + /* K1 */ be_nested_str(remove), + /* K2 */ be_nested_str(cb_event_closure), + }), + &be_const_str_deregister_obj, + &be_const_str_solidified, + ( &(const binstruction[17]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0003, // 0003 JMPF R2 #0008 + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x8C080501, // 0005 GETMET R2 R2 K1 + 0x5C100200, // 0006 MOVE R4 R1 + 0x7C080400, // 0007 CALL R2 2 + 0x88080102, // 0008 GETMBR R2 R0 K2 + 0x4C0C0000, // 0009 LDNIL R3 + 0x20080403, // 000A NE R2 R2 R3 + 0x780A0003, // 000B JMPF R2 #0010 + 0x88080102, // 000C GETMBR R2 R0 K2 + 0x8C080501, // 000D GETMET R2 R2 K1 + 0x5C100200, // 000E MOVE R4 R1 + 0x7C080400, // 000F CALL R2 2 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_cb +********************************************************************/ +be_local_closure(LVGL_glob_widget_cb, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 3]) { + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_ctor_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_dtor_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(widget_event_impl), + }), + &be_const_str__X3Clambda_X3E, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68080000, // 0000 GETUPV R2 U0 + 0x8C080500, // 0001 GETMET R2 R2 K0 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[15]) { /* constants */ + /* K0 */ be_nested_str(widget_ctor_cb), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(gen_cb), + /* K3 */ be_nested_str(widget_dtor_cb), + /* K4 */ be_nested_str(widget_event_cb), + /* K5 */ be_nested_str(widget_struct_default), + /* K6 */ be_nested_str(lv), + /* K7 */ be_nested_str(lv_obj_class), + /* K8 */ be_nested_str(lv_obj), + /* K9 */ be_nested_str(_class), + /* K10 */ be_nested_str(copy), + /* K11 */ be_nested_str(base_class), + /* K12 */ be_nested_str(constructor_cb), + /* K13 */ be_nested_str(destructor_cb), + /* K14 */ be_nested_str(event_cb), + }), + &be_const_str_widget_cb, + &be_const_str_solidified, + ( &(const binstruction[56]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x78060004, // 0003 JMPF R1 #0009 + 0xB8060200, // 0004 GETNGBL R1 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x840C0000, // 0006 CLOSURE R3 P0 + 0x7C040400, // 0007 CALL R1 2 + 0x90020001, // 0008 SETMBR R0 K0 R1 + 0x88040103, // 0009 GETMBR R1 R0 K3 + 0x4C080000, // 000A LDNIL R2 + 0x1C040202, // 000B EQ R1 R1 R2 + 0x78060004, // 000C JMPF R1 #0012 + 0xB8060200, // 000D GETNGBL R1 K1 + 0x8C040302, // 000E GETMET R1 R1 K2 + 0x840C0001, // 000F CLOSURE R3 P1 + 0x7C040400, // 0010 CALL R1 2 + 0x90020601, // 0011 SETMBR R0 K3 R1 + 0x88040104, // 0012 GETMBR R1 R0 K4 + 0x4C080000, // 0013 LDNIL R2 + 0x1C040202, // 0014 EQ R1 R1 R2 + 0x78060004, // 0015 JMPF R1 #001B + 0xB8060200, // 0016 GETNGBL R1 K1 + 0x8C040302, // 0017 GETMET R1 R1 K2 + 0x840C0002, // 0018 CLOSURE R3 P2 + 0x7C040400, // 0019 CALL R1 2 + 0x90020801, // 001A SETMBR R0 K4 R1 + 0x88040105, // 001B GETMBR R1 R0 K5 + 0x4C080000, // 001C LDNIL R2 + 0x1C040202, // 001D EQ R1 R1 R2 + 0x78060016, // 001E JMPF R1 #0036 + 0xB8060C00, // 001F GETNGBL R1 K6 + 0x8C040307, // 0020 GETMET R1 R1 K7 + 0xB80E0C00, // 0021 GETNGBL R3 K6 + 0x880C0708, // 0022 GETMBR R3 R3 K8 + 0x880C0709, // 0023 GETMBR R3 R3 K9 + 0x7C040400, // 0024 CALL R1 2 + 0x8C04030A, // 0025 GETMET R1 R1 K10 + 0x7C040200, // 0026 CALL R1 1 + 0x90020A01, // 0027 SETMBR R0 K5 R1 + 0x88040105, // 0028 GETMBR R1 R0 K5 + 0xB80A0C00, // 0029 GETNGBL R2 K6 + 0x88080508, // 002A GETMBR R2 R2 K8 + 0x88080509, // 002B GETMBR R2 R2 K9 + 0x90061602, // 002C SETMBR R1 K11 R2 + 0x88040105, // 002D GETMBR R1 R0 K5 + 0x88080100, // 002E GETMBR R2 R0 K0 + 0x90061802, // 002F SETMBR R1 K12 R2 + 0x88040105, // 0030 GETMBR R1 R0 K5 + 0x88080103, // 0031 GETMBR R2 R0 K3 + 0x90061A02, // 0032 SETMBR R1 K13 R2 + 0x88040105, // 0033 GETMBR R1 R0 K5 + 0x88080104, // 0034 GETMBR R2 R0 K4 + 0x90061C02, // 0035 SETMBR R1 K14 R2 + 0xA0000000, // 0036 CLOSE R0 + 0x80000000, // 0037 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(LVGL_glob__anonymous_, /* name */ + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(LVG_X3A_X20call_X20to_X20unsupported_X20callback), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x60000001, // 0000 GETGBL R0 G1 + 0x58040000, // 0001 LDCONST R1 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: create_custom_widget +********************************************************************/ +be_local_closure(LVGL_glob_create_custom_widget, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[27]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj), + /* K3 */ be_nested_str(value_error), + /* K4 */ be_nested_str(arg_X20must_X20be_X20a_X20subclass_X20of_X20lv_obj), + /* K5 */ be_nested_str(widget_struct_by_class), + /* K6 */ be_nested_str(find), + /* K7 */ be_nested_str(widget_cb), + /* K8 */ be_nested_str(widget_struct_default), + /* K9 */ be_nested_str(copy), + /* K10 */ be_nested_str(base_class), + /* K11 */ be_nested_str(_class), + /* K12 */ be_nested_str(get), + /* K13 */ be_nested_str(widget_width_def), + /* K14 */ be_nested_str(width_def), + /* K15 */ be_nested_str(widget_height_def), + /* K16 */ be_nested_str(height_def), + /* K17 */ be_nested_str(widget_editable), + /* K18 */ be_nested_str(editable), + /* K19 */ be_nested_str(widget_group_def), + /* K20 */ be_nested_str(group_def), + /* K21 */ be_nested_str(widget_instance_size), + /* K22 */ be_nested_str(instance_size), + /* K23 */ be_nested_str(obj_class_create_obj), + /* K24 */ be_nested_str(_p), + /* K25 */ be_nested_str(register_obj), + /* K26 */ be_nested_str(class_init_obj), + }), + &be_const_str_create_custom_widget, + &be_const_str_solidified, + ( &(const binstruction[86]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x6010000F, // 0001 GETGBL R4 G15 + 0x5C140200, // 0002 MOVE R5 R1 + 0xB81A0200, // 0003 GETNGBL R6 K1 + 0x88180D02, // 0004 GETMBR R6 R6 K2 + 0x7C100400, // 0005 CALL R4 2 + 0x74120000, // 0006 JMPT R4 #0008 + 0xB0060704, // 0007 RAISE 1 K3 K4 + 0x88100105, // 0008 GETMBR R4 R0 K5 + 0x4C140000, // 0009 LDNIL R5 + 0x1C100805, // 000A EQ R4 R4 R5 + 0x78120002, // 000B JMPF R4 #000F + 0x60100013, // 000C GETGBL R4 G19 + 0x7C100000, // 000D CALL R4 0 + 0x90020A04, // 000E SETMBR R0 K5 R4 + 0x60100005, // 000F GETGBL R4 G5 + 0x5C140200, // 0010 MOVE R5 R1 + 0x7C100200, // 0011 CALL R4 1 + 0x88140105, // 0012 GETMBR R5 R0 K5 + 0x8C140B06, // 0013 GETMET R5 R5 K6 + 0x5C1C0800, // 0014 MOVE R7 R4 + 0x7C140400, // 0015 CALL R5 2 + 0x4C180000, // 0016 LDNIL R6 + 0x1C180A06, // 0017 EQ R6 R5 R6 + 0x781A002F, // 0018 JMPF R6 #0049 + 0x8C180107, // 0019 GETMET R6 R0 K7 + 0x7C180200, // 001A CALL R6 1 + 0x88180108, // 001B GETMBR R6 R0 K8 + 0x8C180D09, // 001C GETMET R6 R6 K9 + 0x7C180200, // 001D CALL R6 1 + 0x5C140C00, // 001E MOVE R5 R6 + 0x60180003, // 001F GETGBL R6 G3 + 0x5C1C0200, // 0020 MOVE R7 R1 + 0x7C180200, // 0021 CALL R6 1 + 0x88180D0B, // 0022 GETMBR R6 R6 K11 + 0x90161406, // 0023 SETMBR R5 K10 R6 + 0x8C18070C, // 0024 GETMET R6 R3 K12 + 0x5C200200, // 0025 MOVE R8 R1 + 0x5824000D, // 0026 LDCONST R9 K13 + 0x7C180600, // 0027 CALL R6 3 + 0x781A0001, // 0028 JMPF R6 #002B + 0x8818030D, // 0029 GETMBR R6 R1 K13 + 0x90161C06, // 002A SETMBR R5 K14 R6 + 0x8C18070C, // 002B GETMET R6 R3 K12 + 0x5C200200, // 002C MOVE R8 R1 + 0x5824000F, // 002D LDCONST R9 K15 + 0x7C180600, // 002E CALL R6 3 + 0x781A0001, // 002F JMPF R6 #0032 + 0x8818030F, // 0030 GETMBR R6 R1 K15 + 0x90162006, // 0031 SETMBR R5 K16 R6 + 0x8C18070C, // 0032 GETMET R6 R3 K12 + 0x5C200200, // 0033 MOVE R8 R1 + 0x58240011, // 0034 LDCONST R9 K17 + 0x7C180600, // 0035 CALL R6 3 + 0x781A0001, // 0036 JMPF R6 #0039 + 0x88180311, // 0037 GETMBR R6 R1 K17 + 0x90162406, // 0038 SETMBR R5 K18 R6 + 0x8C18070C, // 0039 GETMET R6 R3 K12 + 0x5C200200, // 003A MOVE R8 R1 + 0x58240013, // 003B LDCONST R9 K19 + 0x7C180600, // 003C CALL R6 3 + 0x781A0001, // 003D JMPF R6 #0040 + 0x88180313, // 003E GETMBR R6 R1 K19 + 0x90162806, // 003F SETMBR R5 K20 R6 + 0x8C18070C, // 0040 GETMET R6 R3 K12 + 0x5C200200, // 0041 MOVE R8 R1 + 0x58240015, // 0042 LDCONST R9 K21 + 0x7C180600, // 0043 CALL R6 3 + 0x781A0001, // 0044 JMPF R6 #0047 + 0x88180315, // 0045 GETMBR R6 R1 K21 + 0x90162C06, // 0046 SETMBR R5 K22 R6 + 0x88180105, // 0047 GETMBR R6 R0 K5 + 0x98180805, // 0048 SETIDX R6 R4 R5 + 0xB81A0200, // 0049 GETNGBL R6 K1 + 0x8C180D17, // 004A GETMET R6 R6 K23 + 0x5C200A00, // 004B MOVE R8 R5 + 0x5C240400, // 004C MOVE R9 R2 + 0x7C180600, // 004D CALL R6 3 + 0x881C0D18, // 004E GETMBR R7 R6 K24 + 0x90063007, // 004F SETMBR R1 K24 R7 + 0x8C1C0119, // 0050 GETMET R7 R0 K25 + 0x5C240200, // 0051 MOVE R9 R1 + 0x7C1C0400, // 0052 CALL R7 2 + 0x8C1C031A, // 0053 GETMET R7 R1 K26 + 0x7C1C0200, // 0054 CALL R7 1 + 0x80000000, // 0055 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_ctor_impl +********************************************************************/ +be_local_closure(LVGL_glob_widget_ctor_impl, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(lv), + /* K2 */ be_nested_str(lv_obj_class), + /* K3 */ be_nested_str(get_object_from_ptr), + /* K4 */ be_nested_str(cb_obj), + /* K5 */ be_nested_str(find), + /* K6 */ be_nested_str(instance), + /* K7 */ be_nested_str(get), + /* K8 */ be_nested_str(widget_constructor), + }), + &be_const_str_widget_ctor_impl, + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xB8120200, // 0001 GETNGBL R4 K1 + 0x8C100902, // 0002 GETMET R4 R4 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C100400, // 0004 CALL R4 2 + 0x8C140103, // 0005 GETMET R5 R0 K3 + 0x5C1C0400, // 0006 MOVE R7 R2 + 0x7C140400, // 0007 CALL R5 2 + 0x88180104, // 0008 GETMBR R6 R0 K4 + 0x8C180D05, // 0009 GETMET R6 R6 K5 + 0x5C200A00, // 000A MOVE R8 R5 + 0x7C180400, // 000B CALL R6 2 + 0x781A0001, // 000C JMPF R6 #000F + 0x88180104, // 000D GETMBR R6 R0 K4 + 0x94140C05, // 000E GETIDX R5 R6 R5 + 0x60180004, // 000F GETGBL R6 G4 + 0x5C1C0A00, // 0010 MOVE R7 R5 + 0x7C180200, // 0011 CALL R6 1 + 0x1C180D06, // 0012 EQ R6 R6 K6 + 0x781A0007, // 0013 JMPF R6 #001C + 0x8C180707, // 0014 GETMET R6 R3 K7 + 0x5C200A00, // 0015 MOVE R8 R5 + 0x58240008, // 0016 LDCONST R9 K8 + 0x7C180600, // 0017 CALL R6 3 + 0x781A0002, // 0018 JMPF R6 #001C + 0x8C180B08, // 0019 GETMET R6 R5 K8 + 0x5C200800, // 001A MOVE R8 R4 + 0x7C180400, // 001B CALL R6 2 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: LVGL_glob +********************************************************************/ +be_local_class(LVGL_glob, + 9, + NULL, + be_nested_map(20, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(widget_ctor_cb, 8), be_const_var(4) }, + { be_const_key(get_object_from_ptr, 4), be_const_closure(LVGL_glob_get_object_from_ptr_closure) }, + { be_const_key(cb_obj, 7), be_const_var(0) }, + { be_const_key(widget_struct_by_class, -1), be_const_var(8) }, + { be_const_key(widget_event_impl, -1), be_const_closure(LVGL_glob_widget_event_impl_closure) }, + { be_const_key(widget_dtor_cb, 6), be_const_var(5) }, + { be_const_key(cb_event_closure, -1), be_const_var(1) }, + { be_const_key(cb_do_nothing, 16), be_const_static_closure(LVGL_glob__anonymous__closure) }, + { be_const_key(null_cb, -1), be_const_var(3) }, + { be_const_key(register_obj, -1), be_const_closure(LVGL_glob_register_obj_closure) }, + { be_const_key(widget_dtor_impl, 9), be_const_closure(LVGL_glob_widget_dtor_impl_closure) }, + { be_const_key(gen_cb, -1), be_const_closure(LVGL_glob_gen_cb_closure) }, + { be_const_key(deregister_obj, -1), be_const_closure(LVGL_glob_deregister_obj_closure) }, + { be_const_key(widget_struct_default, 12), be_const_var(7) }, + { be_const_key(widget_event_cb, -1), be_const_var(6) }, + { be_const_key(widget_cb, -1), be_const_closure(LVGL_glob_widget_cb_closure) }, + { be_const_key(lvgl_event_dispatch, 3), be_const_closure(LVGL_glob_lvgl_event_dispatch_closure) }, + { be_const_key(event_cb, -1), be_const_var(2) }, + { be_const_key(create_custom_widget, -1), be_const_closure(LVGL_glob_create_custom_widget_closure) }, + { be_const_key(widget_ctor_impl, -1), be_const_closure(LVGL_glob_widget_ctor_impl_closure) }, + })), + be_str_literal("LVGL_glob") +); +/*******************************************************************/ + +void be_load_LVGL_glob_class(bvm *vm) { + be_pushntvclass(vm, &be_class_LVGL_glob); + be_setglobal(vm, "LVGL_glob"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_module.c b/lib/libesp32/berry/default/be_lvgl_module.c new file mode 100644 index 000000000..890efd2ff --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_module.c @@ -0,0 +1,692 @@ +/******************************************************************** + * Generated code, don't edit + *******************************************************************/ +/******************************************************************** + * LVGL Module + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" +#include "be_lvgl.h" +#include "lv_theme_openhasp.h" + +extern int lv0_member(bvm *vm); // resolve virtual members + +extern int lv0_start(bvm *vm); + +extern int lv0_register_button_encoder(bvm *vm); // add buttons with encoder logic + +extern int lv0_load_montserrat_font(bvm *vm); +extern int lv0_load_seg7_font(bvm *vm); +extern int lv0_load_robotocondensed_latin1_font(bvm *vm); +extern int lv0_load_font(bvm *vm); +extern int lv0_load_freetype_font(bvm *vm); + +extern int lv0_screenshot(bvm *vm); + +static int lv_get_hor_res(void) { + return lv_disp_get_hor_res(lv_disp_get_default()); +} +static int lv_get_ver_res(void) { + return lv_disp_get_ver_res(lv_disp_get_default()); +} + +/* `lv` methods */ +const lvbe_call_c_t lv_func[] = { + + { "clamp_height", (void*) &lv_clamp_height, "i", "iiii" }, + { "clamp_width", (void*) &lv_clamp_width, "i", "iiii" }, + { "color_mix", (void*) &lv_color_mix, "lv.lv_color", "(lv.lv_color)(lv.lv_color)i" }, + { "dpx", (void*) &lv_dpx, "i", "i" }, + { "draw_arc", (void*) &lv_draw_arc, "", "iiiii(lv.lv_area)(lv.lv_draw_arc_dsc)" }, + { "draw_arc_dsc_init", (void*) &lv_draw_arc_dsc_init, "", "(lv.lv_draw_arc_dsc)" }, + { "draw_arc_get_area", (void*) &lv_draw_arc_get_area, "", "iiiiiib(lv.lv_area)" }, + { "draw_img", (void*) &lv_draw_img, "", "(lv.lv_area)(lv.lv_area).(lv.lv_draw_img_dsc)" }, + { "draw_img_dsc_init", (void*) &lv_draw_img_dsc_init, "", "(lv.lv_draw_img_dsc)" }, + { "draw_label", (void*) &lv_draw_label, "", "(lv.lv_area)(lv.lv_area)(lv.lv_draw_label_dsc)s(lv.lv_draw_label_hint)" }, + { "draw_label_dsc_init", (void*) &lv_draw_label_dsc_init, "", "(lv.lv_draw_label_dsc)" }, + { "draw_letter", (void*) &lv_draw_letter, "", "(lv.lv_point)(lv.lv_area)(lv.lv_font)i(lv.lv_color)ii" }, + { "draw_line", (void*) &lv_draw_line, "", "(lv.lv_point)(lv.lv_point)(lv.lv_area)(lv.lv_draw_line_dsc)" }, + { "draw_line_dsc_init", (void*) &lv_draw_line_dsc_init, "", "(lv.lv_draw_line_dsc)" }, + { "draw_mask_add", (void*) &lv_draw_mask_add, "i", ".." }, + { "draw_mask_angle_init", (void*) &lv_draw_mask_angle_init, "", "(lv.lv_draw_mask_angle_param)iiii" }, + { "draw_mask_fade_init", (void*) &lv_draw_mask_fade_init, "", "(lv.lv_draw_mask_fade_param)(lv.lv_area)iiii" }, + { "draw_mask_get_cnt", (void*) &lv_draw_mask_get_cnt, "i", "" }, + { "draw_mask_line_angle_init", (void*) &lv_draw_mask_line_angle_init, "", "(lv.lv_draw_mask_line_param)iiii" }, + { "draw_mask_line_points_init", (void*) &lv_draw_mask_line_points_init, "", "(lv.lv_draw_mask_line_param)iiiii" }, + { "draw_mask_map_init", (void*) &lv_draw_mask_map_init, "", "(lv.lv_draw_mask_map_param)(lv.lv_area)(lv.lv_opa)" }, + { "draw_mask_radius_init", (void*) &lv_draw_mask_radius_init, "", "(lv.lv_draw_mask_radius_param)(lv.lv_area)ib" }, + { "draw_mask_remove_custom", (void*) &lv_draw_mask_remove_custom, ".", "." }, + { "draw_mask_remove_id", (void*) &lv_draw_mask_remove_id, ".", "i" }, + { "draw_polygon", (void*) &lv_draw_polygon, "", "ii(lv.lv_area)(lv.lv_draw_rect_dsc)" }, + { "draw_rect", (void*) &lv_draw_rect, "", "(lv.lv_area)(lv.lv_area)(lv.lv_draw_rect_dsc)" }, + { "draw_rect_dsc_init", (void*) &lv_draw_rect_dsc_init, "", "(lv.lv_draw_rect_dsc)" }, + { "draw_triangle", (void*) &lv_draw_triangle, "", "i(lv.lv_area)(lv.lv_draw_rect_dsc)" }, + { "event_register_id", (void*) &lv_event_register_id, "i", "" }, + { "event_send", (void*) &lv_event_send, "i", "(lv.lv_obj)i." }, + { "event_set_cover_res", (void*) &lv_event_set_cover_res, "", "(lv.lv_event)(lv.lv_cover_res)" }, + { "event_set_ext_draw_size", (void*) &lv_event_set_ext_draw_size, "", "(lv.lv_event)i" }, + { "get_hor_res", (void*) &lv_get_hor_res, "i", "" }, + { "get_ver_res", (void*) &lv_get_ver_res, "i", "" }, + { "group_get_default", (void*) &lv_group_get_default, "lv.lv_group", "" }, + { "img_src_get_type", (void*) &lv_img_src_get_type, "i", "." }, + { "indev_get_act", (void*) &lv_indev_get_act, "lv.lv_indev", "" }, + { "indev_get_obj_act", (void*) &lv_indev_get_obj_act, "lv.lv_obj", "" }, + { "indev_read_timer_cb", (void*) &lv_indev_read_timer_cb, "", "(lv.lv_timer)" }, + { "layer_sys", (void*) &lv_layer_sys, "lv.lv_obj", "" }, + { "layer_top", (void*) &lv_layer_top, "lv.lv_obj", "" }, + { "layout_register", (void*) &lv_layout_register, "i", "^lv_layout_update_cb^." }, + { "obj_class_create_obj", (void*) &lv_obj_class_create_obj, "lv.lv_obj", "(lv._lv_obj_class)(lv.lv_obj)" }, + { "obj_del_anim_ready_cb", (void*) &lv_obj_del_anim_ready_cb, "", "(lv.lv_anim)" }, + { "obj_draw_dsc_init", (void*) &lv_obj_draw_dsc_init, "", "(lv.lv_obj_draw_part_dsc)(lv.lv_area)" }, + { "obj_enable_style_refresh", (void*) &lv_obj_enable_style_refresh, "", "b" }, + { "obj_event_base", (void*) &lv_obj_event_base, "i", "(lv.lv_obj_class)(lv.lv_event)" }, + { "obj_report_style_change", (void*) &lv_obj_report_style_change, "", "(lv.lv_style)" }, + { "obj_style_get_selector_part", (void*) &lv_obj_style_get_selector_part, "i", "i" }, + { "obj_style_get_selector_state", (void*) &lv_obj_style_get_selector_state, "i", "i" }, + { "refr_now", (void*) &lv_refr_now, "", "(lv.lv_disp)" }, + { "scr_act", (void*) &lv_scr_act, "lv.lv_obj", "" }, + { "scr_load", (void*) &lv_scr_load, "", "(lv.lv_obj)" }, + { "scr_load_anim", (void*) &lv_scr_load_anim, "", "(lv.lv_obj)iiib" }, + { "theme_apply", (void*) &lv_theme_apply, "", "(lv.lv_obj)" }, + { "theme_default_init", (void*) &lv_theme_default_init, "lv.lv_theme", "(lv.lv_disp)(lv.lv_color)(lv.lv_color)b(lv.lv_font)" }, + { "theme_default_is_inited", (void*) &lv_theme_default_is_inited, "b", "" }, + { "theme_get_color_primary", (void*) &lv_theme_get_color_primary, "lv.lv_color", "(lv.lv_obj)" }, + { "theme_get_color_secondary", (void*) &lv_theme_get_color_secondary, "lv.lv_color", "(lv.lv_obj)" }, + { "theme_get_font_large", (void*) &lv_theme_get_font_large, "lv.lv_font", "(lv.lv_obj)" }, + { "theme_get_font_normal", (void*) &lv_theme_get_font_normal, "lv.lv_font", "(lv.lv_obj)" }, + { "theme_get_font_small", (void*) &lv_theme_get_font_small, "lv.lv_font", "(lv.lv_obj)" }, + { "theme_get_from_obj", (void*) &lv_theme_get_from_obj, "lv.lv_theme", "(lv.lv_obj)" }, + { "theme_mono_init", (void*) &lv_theme_mono_init, "lv.lv_theme", "(lv.lv_disp)b(lv.lv_font)" }, + { "theme_openhasp_init", (void*) &lv_theme_openhasp_init, "lv.lv_theme", "(lv.lv_disp)(lv.lv_color)(lv.lv_color)b(lv.lv_font)" }, + { "theme_openhasp_is_inited", (void*) &lv_theme_openhasp_is_inited, "b", "" }, + { "theme_set_apply_cb", (void*) &lv_theme_set_apply_cb, "", "(lv.lv_theme)^lv_theme_apply_cb^" }, + { "theme_set_parent", (void*) &lv_theme_set_parent, "", "(lv.lv_theme)(lv.lv_theme)" }, + +}; +const size_t lv_func_size = sizeof(lv_func) / sizeof(lv_func[0]); + + + + +typedef struct be_constint_t { + const char * name; + int32_t value; +} be_constint_t; + +const be_constint_t lv0_constants[] = { + + { "ALIGN_BOTTOM_LEFT", LV_ALIGN_BOTTOM_LEFT }, + { "ALIGN_BOTTOM_MID", LV_ALIGN_BOTTOM_MID }, + { "ALIGN_BOTTOM_RIGHT", LV_ALIGN_BOTTOM_RIGHT }, + { "ALIGN_CENTER", LV_ALIGN_CENTER }, + { "ALIGN_DEFAULT", LV_ALIGN_DEFAULT }, + { "ALIGN_LEFT_MID", LV_ALIGN_LEFT_MID }, + { "ALIGN_OUT_BOTTOM_LEFT", LV_ALIGN_OUT_BOTTOM_LEFT }, + { "ALIGN_OUT_BOTTOM_MID", LV_ALIGN_OUT_BOTTOM_MID }, + { "ALIGN_OUT_BOTTOM_RIGHT", LV_ALIGN_OUT_BOTTOM_RIGHT }, + { "ALIGN_OUT_LEFT_BOTTOM", LV_ALIGN_OUT_LEFT_BOTTOM }, + { "ALIGN_OUT_LEFT_MID", LV_ALIGN_OUT_LEFT_MID }, + { "ALIGN_OUT_LEFT_TOP", LV_ALIGN_OUT_LEFT_TOP }, + { "ALIGN_OUT_RIGHT_BOTTOM", LV_ALIGN_OUT_RIGHT_BOTTOM }, + { "ALIGN_OUT_RIGHT_MID", LV_ALIGN_OUT_RIGHT_MID }, + { "ALIGN_OUT_RIGHT_TOP", LV_ALIGN_OUT_RIGHT_TOP }, + { "ALIGN_OUT_TOP_LEFT", LV_ALIGN_OUT_TOP_LEFT }, + { "ALIGN_OUT_TOP_MID", LV_ALIGN_OUT_TOP_MID }, + { "ALIGN_OUT_TOP_RIGHT", LV_ALIGN_OUT_TOP_RIGHT }, + { "ALIGN_RIGHT_MID", LV_ALIGN_RIGHT_MID }, + { "ALIGN_TOP_LEFT", LV_ALIGN_TOP_LEFT }, + { "ALIGN_TOP_MID", LV_ALIGN_TOP_MID }, + { "ALIGN_TOP_RIGHT", LV_ALIGN_TOP_RIGHT }, + { "ANIM_IMG_PART_MAIN", LV_ANIM_IMG_PART_MAIN }, + { "ANIM_OFF", LV_ANIM_OFF }, + { "ANIM_ON", LV_ANIM_ON }, + { "ARC_MODE_NORMAL", LV_ARC_MODE_NORMAL }, + { "ARC_MODE_REVERSE", LV_ARC_MODE_REVERSE }, + { "ARC_MODE_SYMMETRICAL", LV_ARC_MODE_SYMMETRICAL }, + { "BAR_MODE_NORMAL", LV_BAR_MODE_NORMAL }, + { "BAR_MODE_RANGE", LV_BAR_MODE_RANGE }, + { "BAR_MODE_SYMMETRICAL", LV_BAR_MODE_SYMMETRICAL }, + { "BASE_DIR_AUTO", LV_BASE_DIR_AUTO }, + { "BASE_DIR_LTR", LV_BASE_DIR_LTR }, + { "BASE_DIR_NEUTRAL", LV_BASE_DIR_NEUTRAL }, + { "BASE_DIR_RTL", LV_BASE_DIR_RTL }, + { "BASE_DIR_WEAK", LV_BASE_DIR_WEAK }, + { "BLEND_MODE_ADDITIVE", LV_BLEND_MODE_ADDITIVE }, + { "BLEND_MODE_NORMAL", LV_BLEND_MODE_NORMAL }, + { "BLEND_MODE_SUBTRACTIVE", LV_BLEND_MODE_SUBTRACTIVE }, + { "BORDER_SIDE_BOTTOM", LV_BORDER_SIDE_BOTTOM }, + { "BORDER_SIDE_FULL", LV_BORDER_SIDE_FULL }, + { "BORDER_SIDE_INTERNAL", LV_BORDER_SIDE_INTERNAL }, + { "BORDER_SIDE_LEFT", LV_BORDER_SIDE_LEFT }, + { "BORDER_SIDE_NONE", LV_BORDER_SIDE_NONE }, + { "BORDER_SIDE_RIGHT", LV_BORDER_SIDE_RIGHT }, + { "BORDER_SIDE_TOP", LV_BORDER_SIDE_TOP }, + { "BTNMATRIX_CTRL_CHECKABLE", LV_BTNMATRIX_CTRL_CHECKABLE }, + { "BTNMATRIX_CTRL_CHECKED", LV_BTNMATRIX_CTRL_CHECKED }, + { "BTNMATRIX_CTRL_CLICK_TRIG", LV_BTNMATRIX_CTRL_CLICK_TRIG }, + { "BTNMATRIX_CTRL_CUSTOM_1", LV_BTNMATRIX_CTRL_CUSTOM_1 }, + { "BTNMATRIX_CTRL_CUSTOM_2", LV_BTNMATRIX_CTRL_CUSTOM_2 }, + { "BTNMATRIX_CTRL_DISABLED", LV_BTNMATRIX_CTRL_DISABLED }, + { "BTNMATRIX_CTRL_HIDDEN", LV_BTNMATRIX_CTRL_HIDDEN }, + { "BTNMATRIX_CTRL_NO_REPEAT", LV_BTNMATRIX_CTRL_NO_REPEAT }, + { "BTNMATRIX_CTRL_RECOLOR", LV_BTNMATRIX_CTRL_RECOLOR }, + { "CHART_AXIS_PRIMARY_X", LV_CHART_AXIS_PRIMARY_X }, + { "CHART_AXIS_PRIMARY_Y", LV_CHART_AXIS_PRIMARY_Y }, + { "CHART_AXIS_SECONDARY_X", LV_CHART_AXIS_SECONDARY_X }, + { "CHART_AXIS_SECONDARY_Y", LV_CHART_AXIS_SECONDARY_Y }, + { "CHART_TYPE_BAR", LV_CHART_TYPE_BAR }, + { "CHART_TYPE_LINE", LV_CHART_TYPE_LINE }, + { "CHART_TYPE_NONE", LV_CHART_TYPE_NONE }, + { "CHART_TYPE_SCATTER", LV_CHART_TYPE_SCATTER }, + { "CHART_UPDATE_MODE_CIRCULAR", LV_CHART_UPDATE_MODE_CIRCULAR }, + { "CHART_UPDATE_MODE_SHIFT", LV_CHART_UPDATE_MODE_SHIFT }, + { "COLORWHEEL_MODE_HUE", LV_COLORWHEEL_MODE_HUE }, + { "COLORWHEEL_MODE_SATURATION", LV_COLORWHEEL_MODE_SATURATION }, + { "COLORWHEEL_MODE_VALUE", LV_COLORWHEEL_MODE_VALUE }, + { "COLOR_AQUA", (int32_t) 0x00FFFF }, + { "COLOR_BLACK", (int32_t) 0x000000 }, + { "COLOR_BLUE", (int32_t) 0x0000FF }, + { "COLOR_CYAN", (int32_t) 0x00FFFF }, + { "COLOR_GRAY", (int32_t) 0x808080 }, + { "COLOR_GREEN", (int32_t) 0x008000 }, + { "COLOR_LIME", (int32_t) 0x00FF00 }, + { "COLOR_MAGENTA", (int32_t) 0xFF00FF }, + { "COLOR_MAROON", (int32_t) 0x800000 }, + { "COLOR_NAVY", (int32_t) 0x000080 }, + { "COLOR_OLIVE", (int32_t) 0x808000 }, + { "COLOR_PURPLE", (int32_t) 0x800080 }, + { "COLOR_RED", (int32_t) 0xFF0000 }, + { "COLOR_SILVER", (int32_t) 0xC0C0C0 }, + { "COLOR_TEAL", (int32_t) 0x008080 }, + { "COLOR_WHITE", (int32_t) 0xFFFFFF }, + { "COLOR_YELLOW", (int32_t) 0xFFFF00 }, + { "COVER_RES_COVER", LV_COVER_RES_COVER }, + { "COVER_RES_MASKED", LV_COVER_RES_MASKED }, + { "COVER_RES_NOT_COVER", LV_COVER_RES_NOT_COVER }, + { "DIR_ALL", LV_DIR_ALL }, + { "DIR_BOTTOM", LV_DIR_BOTTOM }, + { "DIR_HOR", LV_DIR_HOR }, + { "DIR_LEFT", LV_DIR_LEFT }, + { "DIR_NONE", LV_DIR_NONE }, + { "DIR_RIGHT", LV_DIR_RIGHT }, + { "DIR_TOP", LV_DIR_TOP }, + { "DIR_VER", LV_DIR_VER }, + { "DISP_ROT_180", LV_DISP_ROT_180 }, + { "DISP_ROT_270", LV_DISP_ROT_270 }, + { "DISP_ROT_90", LV_DISP_ROT_90 }, + { "DISP_ROT_NONE", LV_DISP_ROT_NONE }, + { "DRAW_MASK_LINE_SIDE_BOTTOM", LV_DRAW_MASK_LINE_SIDE_BOTTOM }, + { "DRAW_MASK_LINE_SIDE_LEFT", LV_DRAW_MASK_LINE_SIDE_LEFT }, + { "DRAW_MASK_LINE_SIDE_RIGHT", LV_DRAW_MASK_LINE_SIDE_RIGHT }, + { "DRAW_MASK_LINE_SIDE_TOP", LV_DRAW_MASK_LINE_SIDE_TOP }, + { "DRAW_MASK_RES_CHANGED", LV_DRAW_MASK_RES_CHANGED }, + { "DRAW_MASK_RES_FULL_COVER", LV_DRAW_MASK_RES_FULL_COVER }, + { "DRAW_MASK_RES_TRANSP", LV_DRAW_MASK_RES_TRANSP }, + { "DRAW_MASK_RES_UNKNOWN", LV_DRAW_MASK_RES_UNKNOWN }, + { "DRAW_MASK_TYPE_ANGLE", LV_DRAW_MASK_TYPE_ANGLE }, + { "DRAW_MASK_TYPE_FADE", LV_DRAW_MASK_TYPE_FADE }, + { "DRAW_MASK_TYPE_LINE", LV_DRAW_MASK_TYPE_LINE }, + { "DRAW_MASK_TYPE_MAP", LV_DRAW_MASK_TYPE_MAP }, + { "DRAW_MASK_TYPE_RADIUS", LV_DRAW_MASK_TYPE_RADIUS }, + { "EVENT_ALL", LV_EVENT_ALL }, + { "EVENT_CANCEL", LV_EVENT_CANCEL }, + { "EVENT_CHILD_CHANGED", LV_EVENT_CHILD_CHANGED }, + { "EVENT_CLICKED", LV_EVENT_CLICKED }, + { "EVENT_COVER_CHECK", LV_EVENT_COVER_CHECK }, + { "EVENT_DEFOCUSED", LV_EVENT_DEFOCUSED }, + { "EVENT_DELETE", LV_EVENT_DELETE }, + { "EVENT_DRAW_MAIN", LV_EVENT_DRAW_MAIN }, + { "EVENT_DRAW_MAIN_BEGIN", LV_EVENT_DRAW_MAIN_BEGIN }, + { "EVENT_DRAW_MAIN_END", LV_EVENT_DRAW_MAIN_END }, + { "EVENT_DRAW_PART_BEGIN", LV_EVENT_DRAW_PART_BEGIN }, + { "EVENT_DRAW_PART_END", LV_EVENT_DRAW_PART_END }, + { "EVENT_DRAW_POST", LV_EVENT_DRAW_POST }, + { "EVENT_DRAW_POST_BEGIN", LV_EVENT_DRAW_POST_BEGIN }, + { "EVENT_DRAW_POST_END", LV_EVENT_DRAW_POST_END }, + { "EVENT_FOCUSED", LV_EVENT_FOCUSED }, + { "EVENT_GESTURE", LV_EVENT_GESTURE }, + { "EVENT_GET_SELF_SIZE", LV_EVENT_GET_SELF_SIZE }, + { "EVENT_HIT_TEST", LV_EVENT_HIT_TEST }, + { "EVENT_INSERT", LV_EVENT_INSERT }, + { "EVENT_KEY", LV_EVENT_KEY }, + { "EVENT_LAYOUT_CHANGED", LV_EVENT_LAYOUT_CHANGED }, + { "EVENT_LEAVE", LV_EVENT_LEAVE }, + { "EVENT_LONG_PRESSED", LV_EVENT_LONG_PRESSED }, + { "EVENT_LONG_PRESSED_REPEAT", LV_EVENT_LONG_PRESSED_REPEAT }, + { "EVENT_PRESSED", LV_EVENT_PRESSED }, + { "EVENT_PRESSING", LV_EVENT_PRESSING }, + { "EVENT_PRESS_LOST", LV_EVENT_PRESS_LOST }, + { "EVENT_READY", LV_EVENT_READY }, + { "EVENT_REFRESH", LV_EVENT_REFRESH }, + { "EVENT_REFR_EXT_DRAW_SIZE", LV_EVENT_REFR_EXT_DRAW_SIZE }, + { "EVENT_RELEASED", LV_EVENT_RELEASED }, + { "EVENT_SCROLL", LV_EVENT_SCROLL }, + { "EVENT_SCROLL_BEGIN", LV_EVENT_SCROLL_BEGIN }, + { "EVENT_SCROLL_END", LV_EVENT_SCROLL_END }, + { "EVENT_SHORT_CLICKED", LV_EVENT_SHORT_CLICKED }, + { "EVENT_SIZE_CHANGED", LV_EVENT_SIZE_CHANGED }, + { "EVENT_STYLE_CHANGED", LV_EVENT_STYLE_CHANGED }, + { "EVENT_VALUE_CHANGED", LV_EVENT_VALUE_CHANGED }, + { "FLEX_ALIGN_CENTER", LV_FLEX_ALIGN_CENTER }, + { "FLEX_ALIGN_END", LV_FLEX_ALIGN_END }, + { "FLEX_ALIGN_SPACE_AROUND", LV_FLEX_ALIGN_SPACE_AROUND }, + { "FLEX_ALIGN_SPACE_BETWEEN", LV_FLEX_ALIGN_SPACE_BETWEEN }, + { "FLEX_ALIGN_SPACE_EVENLY", LV_FLEX_ALIGN_SPACE_EVENLY }, + { "FLEX_ALIGN_START", LV_FLEX_ALIGN_START }, + { "FLEX_FLOW_COLUMN", LV_FLEX_FLOW_COLUMN }, + { "FLEX_FLOW_COLUMN_REVERSE", LV_FLEX_FLOW_COLUMN_REVERSE }, + { "FLEX_FLOW_COLUMN_WRAP", LV_FLEX_FLOW_COLUMN_WRAP }, + { "FLEX_FLOW_COLUMN_WRAP_REVERSE", LV_FLEX_FLOW_COLUMN_WRAP_REVERSE }, + { "FLEX_FLOW_ROW", LV_FLEX_FLOW_ROW }, + { "FLEX_FLOW_ROW_REVERSE", LV_FLEX_FLOW_ROW_REVERSE }, + { "FLEX_FLOW_ROW_WRAP", LV_FLEX_FLOW_ROW_WRAP }, + { "FLEX_FLOW_ROW_WRAP_REVERSE", LV_FLEX_FLOW_ROW_WRAP_REVERSE }, + { "FS_MODE_RD", LV_FS_MODE_RD }, + { "FS_MODE_WR", LV_FS_MODE_WR }, + { "FS_RES_BUSY", LV_FS_RES_BUSY }, + { "FS_RES_DENIED", LV_FS_RES_DENIED }, + { "FS_RES_FS_ERR", LV_FS_RES_FS_ERR }, + { "FS_RES_FULL", LV_FS_RES_FULL }, + { "FS_RES_HW_ERR", LV_FS_RES_HW_ERR }, + { "FS_RES_INV_PARAM", LV_FS_RES_INV_PARAM }, + { "FS_RES_LOCKED", LV_FS_RES_LOCKED }, + { "FS_RES_NOT_EX", LV_FS_RES_NOT_EX }, + { "FS_RES_NOT_IMP", LV_FS_RES_NOT_IMP }, + { "FS_RES_OK", LV_FS_RES_OK }, + { "FS_RES_OUT_OF_MEM", LV_FS_RES_OUT_OF_MEM }, + { "FS_RES_TOUT", LV_FS_RES_TOUT }, + { "FS_RES_UNKNOWN", LV_FS_RES_UNKNOWN }, + { "FS_SEEK_CUR", LV_FS_SEEK_CUR }, + { "FS_SEEK_END", LV_FS_SEEK_END }, + { "FS_SEEK_SET", LV_FS_SEEK_SET }, + { "GRAD_DIR_HOR", LV_GRAD_DIR_HOR }, + { "GRAD_DIR_NONE", LV_GRAD_DIR_NONE }, + { "GRAD_DIR_VER", LV_GRAD_DIR_VER }, + { "GRID_ALIGN_CENTER", LV_GRID_ALIGN_CENTER }, + { "GRID_ALIGN_END", LV_GRID_ALIGN_END }, + { "GRID_ALIGN_SPACE_AROUND", LV_GRID_ALIGN_SPACE_AROUND }, + { "GRID_ALIGN_SPACE_BETWEEN", LV_GRID_ALIGN_SPACE_BETWEEN }, + { "GRID_ALIGN_SPACE_EVENLY", LV_GRID_ALIGN_SPACE_EVENLY }, + { "GRID_ALIGN_START", LV_GRID_ALIGN_START }, + { "GRID_ALIGN_STRETCH", LV_GRID_ALIGN_STRETCH }, + { "GROUP_REFOCUS_POLICY_NEXT", LV_GROUP_REFOCUS_POLICY_NEXT }, + { "GROUP_REFOCUS_POLICY_PREV", LV_GROUP_REFOCUS_POLICY_PREV }, + { "IMGBTN_STATE_CHECKED_DISABLED", LV_IMGBTN_STATE_CHECKED_DISABLED }, + { "IMGBTN_STATE_CHECKED_PRESSED", LV_IMGBTN_STATE_CHECKED_PRESSED }, + { "IMGBTN_STATE_CHECKED_RELEASED", LV_IMGBTN_STATE_CHECKED_RELEASED }, + { "IMGBTN_STATE_DISABLED", LV_IMGBTN_STATE_DISABLED }, + { "IMGBTN_STATE_PRESSED", LV_IMGBTN_STATE_PRESSED }, + { "IMGBTN_STATE_RELEASED", LV_IMGBTN_STATE_RELEASED }, + { "IMG_CF_ALPHA_1BIT", LV_IMG_CF_ALPHA_1BIT }, + { "IMG_CF_ALPHA_2BIT", LV_IMG_CF_ALPHA_2BIT }, + { "IMG_CF_ALPHA_4BIT", LV_IMG_CF_ALPHA_4BIT }, + { "IMG_CF_ALPHA_8BIT", LV_IMG_CF_ALPHA_8BIT }, + { "IMG_CF_INDEXED_1BIT", LV_IMG_CF_INDEXED_1BIT }, + { "IMG_CF_INDEXED_2BIT", LV_IMG_CF_INDEXED_2BIT }, + { "IMG_CF_INDEXED_4BIT", LV_IMG_CF_INDEXED_4BIT }, + { "IMG_CF_INDEXED_8BIT", LV_IMG_CF_INDEXED_8BIT }, + { "IMG_CF_RAW", LV_IMG_CF_RAW }, + { "IMG_CF_RAW_ALPHA", LV_IMG_CF_RAW_ALPHA }, + { "IMG_CF_RAW_CHROMA_KEYED", LV_IMG_CF_RAW_CHROMA_KEYED }, + { "IMG_CF_TRUE_COLOR", LV_IMG_CF_TRUE_COLOR }, + { "IMG_CF_TRUE_COLOR_ALPHA", LV_IMG_CF_TRUE_COLOR_ALPHA }, + { "IMG_CF_TRUE_COLOR_CHROMA_KEYED", LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED }, + { "IMG_CF_UNKNOWN", LV_IMG_CF_UNKNOWN }, + { "IMG_SRC_FILE", LV_IMG_SRC_FILE }, + { "IMG_SRC_SYMBOL", LV_IMG_SRC_SYMBOL }, + { "IMG_SRC_UNKNOWN", LV_IMG_SRC_UNKNOWN }, + { "IMG_SRC_VARIABLE", LV_IMG_SRC_VARIABLE }, + { "INDEV_STATE_PRESSED", LV_INDEV_STATE_PRESSED }, + { "INDEV_STATE_RELEASED", LV_INDEV_STATE_RELEASED }, + { "INDEV_TYPE_BUTTON", LV_INDEV_TYPE_BUTTON }, + { "INDEV_TYPE_ENCODER", LV_INDEV_TYPE_ENCODER }, + { "INDEV_TYPE_KEYPAD", LV_INDEV_TYPE_KEYPAD }, + { "INDEV_TYPE_NONE", LV_INDEV_TYPE_NONE }, + { "INDEV_TYPE_POINTER", LV_INDEV_TYPE_POINTER }, + { "KEY_BACKSPACE", LV_KEY_BACKSPACE }, + { "KEY_DEL", LV_KEY_DEL }, + { "KEY_DOWN", LV_KEY_DOWN }, + { "KEY_END", LV_KEY_END }, + { "KEY_ENTER", LV_KEY_ENTER }, + { "KEY_ESC", LV_KEY_ESC }, + { "KEY_HOME", LV_KEY_HOME }, + { "KEY_LEFT", LV_KEY_LEFT }, + { "KEY_NEXT", LV_KEY_NEXT }, + { "KEY_PREV", LV_KEY_PREV }, + { "KEY_RIGHT", LV_KEY_RIGHT }, + { "KEY_UP", LV_KEY_UP }, + { "LABEL_LONG_CLIP", LV_LABEL_LONG_CLIP }, + { "LABEL_LONG_DOT", LV_LABEL_LONG_DOT }, + { "LABEL_LONG_SCROLL", LV_LABEL_LONG_SCROLL }, + { "LABEL_LONG_SCROLL_CIRCULAR", LV_LABEL_LONG_SCROLL_CIRCULAR }, + { "LABEL_LONG_WRAP", LV_LABEL_LONG_WRAP }, + { "METER_INDICATOR_TYPE_ARC", LV_METER_INDICATOR_TYPE_ARC }, + { "METER_INDICATOR_TYPE_NEEDLE_IMG", LV_METER_INDICATOR_TYPE_NEEDLE_IMG }, + { "METER_INDICATOR_TYPE_NEEDLE_LINE", LV_METER_INDICATOR_TYPE_NEEDLE_LINE }, + { "METER_INDICATOR_TYPE_SCALE_LINES", LV_METER_INDICATOR_TYPE_SCALE_LINES }, + { "OBJ_CLASS_EDITABLE_FALSE", LV_OBJ_CLASS_EDITABLE_FALSE }, + { "OBJ_CLASS_EDITABLE_INHERIT", LV_OBJ_CLASS_EDITABLE_INHERIT }, + { "OBJ_CLASS_EDITABLE_TRUE", LV_OBJ_CLASS_EDITABLE_TRUE }, + { "OBJ_CLASS_GROUP_DEF_FALSE", LV_OBJ_CLASS_GROUP_DEF_FALSE }, + { "OBJ_CLASS_GROUP_DEF_INHERIT", LV_OBJ_CLASS_GROUP_DEF_INHERIT }, + { "OBJ_CLASS_GROUP_DEF_TRUE", LV_OBJ_CLASS_GROUP_DEF_TRUE }, + { "OBJ_FLAG_ADV_HITTEST", LV_OBJ_FLAG_ADV_HITTEST }, + { "OBJ_FLAG_CHECKABLE", LV_OBJ_FLAG_CHECKABLE }, + { "OBJ_FLAG_CLICKABLE", LV_OBJ_FLAG_CLICKABLE }, + { "OBJ_FLAG_CLICK_FOCUSABLE", LV_OBJ_FLAG_CLICK_FOCUSABLE }, + { "OBJ_FLAG_EVENT_BUBBLE", LV_OBJ_FLAG_EVENT_BUBBLE }, + { "OBJ_FLAG_FLOATING", LV_OBJ_FLAG_FLOATING }, + { "OBJ_FLAG_GESTURE_BUBBLE", LV_OBJ_FLAG_GESTURE_BUBBLE }, + { "OBJ_FLAG_HIDDEN", LV_OBJ_FLAG_HIDDEN }, + { "OBJ_FLAG_IGNORE_LAYOUT", LV_OBJ_FLAG_IGNORE_LAYOUT }, + { "OBJ_FLAG_LAYOUT_1", LV_OBJ_FLAG_LAYOUT_1 }, + { "OBJ_FLAG_LAYOUT_2", LV_OBJ_FLAG_LAYOUT_2 }, + { "OBJ_FLAG_PRESS_LOCK", LV_OBJ_FLAG_PRESS_LOCK }, + { "OBJ_FLAG_SCROLLABLE", LV_OBJ_FLAG_SCROLLABLE }, + { "OBJ_FLAG_SCROLL_CHAIN", LV_OBJ_FLAG_SCROLL_CHAIN }, + { "OBJ_FLAG_SCROLL_ELASTIC", LV_OBJ_FLAG_SCROLL_ELASTIC }, + { "OBJ_FLAG_SCROLL_MOMENTUM", LV_OBJ_FLAG_SCROLL_MOMENTUM }, + { "OBJ_FLAG_SCROLL_ONE", LV_OBJ_FLAG_SCROLL_ONE }, + { "OBJ_FLAG_SCROLL_ON_FOCUS", LV_OBJ_FLAG_SCROLL_ON_FOCUS }, + { "OBJ_FLAG_SNAPABLE", LV_OBJ_FLAG_SNAPABLE }, + { "OBJ_FLAG_USER_1", LV_OBJ_FLAG_USER_1 }, + { "OBJ_FLAG_USER_2", LV_OBJ_FLAG_USER_2 }, + { "OBJ_FLAG_USER_3", LV_OBJ_FLAG_USER_3 }, + { "OBJ_FLAG_USER_4", LV_OBJ_FLAG_USER_4 }, + { "OBJ_FLAG_WIDGET_1", LV_OBJ_FLAG_WIDGET_1 }, + { "OBJ_FLAG_WIDGET_2", LV_OBJ_FLAG_WIDGET_2 }, + { "OBJ_TREE_WALK_END", LV_OBJ_TREE_WALK_END }, + { "OBJ_TREE_WALK_NEXT", LV_OBJ_TREE_WALK_NEXT }, + { "OBJ_TREE_WALK_SKIP_CHILDREN", LV_OBJ_TREE_WALK_SKIP_CHILDREN }, + { "OPA_0", LV_OPA_0 }, + { "OPA_10", LV_OPA_10 }, + { "OPA_100", LV_OPA_100 }, + { "OPA_20", LV_OPA_20 }, + { "OPA_30", LV_OPA_30 }, + { "OPA_40", LV_OPA_40 }, + { "OPA_50", LV_OPA_50 }, + { "OPA_60", LV_OPA_60 }, + { "OPA_70", LV_OPA_70 }, + { "OPA_80", LV_OPA_80 }, + { "OPA_90", LV_OPA_90 }, + { "OPA_COVER", LV_OPA_COVER }, + { "OPA_TRANSP", LV_OPA_TRANSP }, + { "PALETTE_AMBER", LV_PALETTE_AMBER }, + { "PALETTE_BLUE", LV_PALETTE_BLUE }, + { "PALETTE_BLUE_GREY", LV_PALETTE_BLUE_GREY }, + { "PALETTE_BROWN", LV_PALETTE_BROWN }, + { "PALETTE_CYAN", LV_PALETTE_CYAN }, + { "PALETTE_DEEP_ORANGE", LV_PALETTE_DEEP_ORANGE }, + { "PALETTE_DEEP_PURPLE", LV_PALETTE_DEEP_PURPLE }, + { "PALETTE_GREEN", LV_PALETTE_GREEN }, + { "PALETTE_GREY", LV_PALETTE_GREY }, + { "PALETTE_INDIGO", LV_PALETTE_INDIGO }, + { "PALETTE_LIGHT_BLUE", LV_PALETTE_LIGHT_BLUE }, + { "PALETTE_LIGHT_GREEN", LV_PALETTE_LIGHT_GREEN }, + { "PALETTE_LIME", LV_PALETTE_LIME }, + { "PALETTE_NONE", LV_PALETTE_NONE }, + { "PALETTE_ORANGE", LV_PALETTE_ORANGE }, + { "PALETTE_PINK", LV_PALETTE_PINK }, + { "PALETTE_PURPLE", LV_PALETTE_PURPLE }, + { "PALETTE_RED", LV_PALETTE_RED }, + { "PALETTE_TEAL", LV_PALETTE_TEAL }, + { "PALETTE_YELLOW", LV_PALETTE_YELLOW }, + { "PART_ANY", LV_PART_ANY }, + { "PART_CURSOR", LV_PART_CURSOR }, + { "PART_CUSTOM_FIRST", LV_PART_CUSTOM_FIRST }, + { "PART_INDICATOR", LV_PART_INDICATOR }, + { "PART_ITEMS", LV_PART_ITEMS }, + { "PART_KNOB", LV_PART_KNOB }, + { "PART_MAIN", LV_PART_MAIN }, + { "PART_SCROLLBAR", LV_PART_SCROLLBAR }, + { "PART_SELECTED", LV_PART_SELECTED }, + { "PART_TEXTAREA_PLACEHOLDER", LV_PART_TEXTAREA_PLACEHOLDER }, + { "PART_TICKS", LV_PART_TICKS }, + { "RADIUS_CIRCLE", LV_RADIUS_CIRCLE }, + { "RES_INV", LV_RES_INV }, + { "RES_OK", LV_RES_OK }, + { "ROLLER_MODE_INFINITE", LV_ROLLER_MODE_INFINITE }, + { "ROLLER_MODE_NORMAL", LV_ROLLER_MODE_NORMAL }, + { "SCROLLBAR_MODE_ACTIVE", LV_SCROLLBAR_MODE_ACTIVE }, + { "SCROLLBAR_MODE_AUTO", LV_SCROLLBAR_MODE_AUTO }, + { "SCROLLBAR_MODE_OFF", LV_SCROLLBAR_MODE_OFF }, + { "SCROLLBAR_MODE_ON", LV_SCROLLBAR_MODE_ON }, + { "SCROLL_SNAP_CENTER", LV_SCROLL_SNAP_CENTER }, + { "SCROLL_SNAP_END", LV_SCROLL_SNAP_END }, + { "SCROLL_SNAP_NONE", LV_SCROLL_SNAP_NONE }, + { "SCROLL_SNAP_START", LV_SCROLL_SNAP_START }, + { "SCR_LOAD_ANIM_FADE_ON", LV_SCR_LOAD_ANIM_FADE_ON }, + { "SCR_LOAD_ANIM_MOVE_BOTTOM", LV_SCR_LOAD_ANIM_MOVE_BOTTOM }, + { "SCR_LOAD_ANIM_MOVE_LEFT", LV_SCR_LOAD_ANIM_MOVE_LEFT }, + { "SCR_LOAD_ANIM_MOVE_RIGHT", LV_SCR_LOAD_ANIM_MOVE_RIGHT }, + { "SCR_LOAD_ANIM_MOVE_TOP", LV_SCR_LOAD_ANIM_MOVE_TOP }, + { "SCR_LOAD_ANIM_NONE", LV_SCR_LOAD_ANIM_NONE }, + { "SCR_LOAD_ANIM_OVER_BOTTOM", LV_SCR_LOAD_ANIM_OVER_BOTTOM }, + { "SCR_LOAD_ANIM_OVER_LEFT", LV_SCR_LOAD_ANIM_OVER_LEFT }, + { "SCR_LOAD_ANIM_OVER_RIGHT", LV_SCR_LOAD_ANIM_OVER_RIGHT }, + { "SCR_LOAD_ANIM_OVER_TOP", LV_SCR_LOAD_ANIM_OVER_TOP }, + { "SIZE_CONTENT", LV_SIZE_CONTENT }, + { "SLIDER_MODE_NORMAL", LV_SLIDER_MODE_NORMAL }, + { "SLIDER_MODE_RANGE", LV_SLIDER_MODE_RANGE }, + { "SLIDER_MODE_SYMMETRICAL", LV_SLIDER_MODE_SYMMETRICAL }, + { "SPAN_MODE_BREAK", LV_SPAN_MODE_BREAK }, + { "SPAN_MODE_EXPAND", LV_SPAN_MODE_EXPAND }, + { "SPAN_MODE_FIXED", LV_SPAN_MODE_FIXED }, + { "SPAN_OVERFLOW_CLIP", LV_SPAN_OVERFLOW_CLIP }, + { "SPAN_OVERFLOW_ELLIPSIS", LV_SPAN_OVERFLOW_ELLIPSIS }, + { "STATE_ANY", LV_STATE_ANY }, + { "STATE_CHECKED", LV_STATE_CHECKED }, + { "STATE_DEFAULT", LV_STATE_DEFAULT }, + { "STATE_DISABLED", LV_STATE_DISABLED }, + { "STATE_EDITED", LV_STATE_EDITED }, + { "STATE_FOCUSED", LV_STATE_FOCUSED }, + { "STATE_FOCUS_KEY", LV_STATE_FOCUS_KEY }, + { "STATE_HOVERED", LV_STATE_HOVERED }, + { "STATE_PRESSED", LV_STATE_PRESSED }, + { "STATE_SCROLLED", LV_STATE_SCROLLED }, + { "STATE_USER_1", LV_STATE_USER_1 }, + { "STATE_USER_2", LV_STATE_USER_2 }, + { "STATE_USER_3", LV_STATE_USER_3 }, + { "STATE_USER_4", LV_STATE_USER_4 }, + { "STYLE_ALIGN", LV_STYLE_ALIGN }, + { "STYLE_ANIM_SPEED", LV_STYLE_ANIM_SPEED }, + { "STYLE_ANIM_TIME", LV_STYLE_ANIM_TIME }, + { "STYLE_ARC_COLOR", LV_STYLE_ARC_COLOR }, + { "STYLE_ARC_COLOR_FILTERED", LV_STYLE_ARC_COLOR_FILTERED }, + { "STYLE_ARC_IMG_SRC", LV_STYLE_ARC_IMG_SRC }, + { "STYLE_ARC_OPA", LV_STYLE_ARC_OPA }, + { "STYLE_ARC_ROUNDED", LV_STYLE_ARC_ROUNDED }, + { "STYLE_ARC_WIDTH", LV_STYLE_ARC_WIDTH }, + { "STYLE_BASE_DIR", LV_STYLE_BASE_DIR }, + { "STYLE_BG_COLOR", LV_STYLE_BG_COLOR }, + { "STYLE_BG_COLOR_FILTERED", LV_STYLE_BG_COLOR_FILTERED }, + { "STYLE_BG_GRAD_COLOR", LV_STYLE_BG_GRAD_COLOR }, + { "STYLE_BG_GRAD_COLOR_FILTERED", LV_STYLE_BG_GRAD_COLOR_FILTERED }, + { "STYLE_BG_GRAD_DIR", LV_STYLE_BG_GRAD_DIR }, + { "STYLE_BG_GRAD_STOP", LV_STYLE_BG_GRAD_STOP }, + { "STYLE_BG_IMG_OPA", LV_STYLE_BG_IMG_OPA }, + { "STYLE_BG_IMG_RECOLOR", LV_STYLE_BG_IMG_RECOLOR }, + { "STYLE_BG_IMG_RECOLOR_FILTERED", LV_STYLE_BG_IMG_RECOLOR_FILTERED }, + { "STYLE_BG_IMG_RECOLOR_OPA", LV_STYLE_BG_IMG_RECOLOR_OPA }, + { "STYLE_BG_IMG_SRC", LV_STYLE_BG_IMG_SRC }, + { "STYLE_BG_IMG_TILED", LV_STYLE_BG_IMG_TILED }, + { "STYLE_BG_MAIN_STOP", LV_STYLE_BG_MAIN_STOP }, + { "STYLE_BG_OPA", LV_STYLE_BG_OPA }, + { "STYLE_BLEND_MODE", LV_STYLE_BLEND_MODE }, + { "STYLE_BORDER_COLOR", LV_STYLE_BORDER_COLOR }, + { "STYLE_BORDER_COLOR_FILTERED", LV_STYLE_BORDER_COLOR_FILTERED }, + { "STYLE_BORDER_OPA", LV_STYLE_BORDER_OPA }, + { "STYLE_BORDER_POST", LV_STYLE_BORDER_POST }, + { "STYLE_BORDER_SIDE", LV_STYLE_BORDER_SIDE }, + { "STYLE_BORDER_WIDTH", LV_STYLE_BORDER_WIDTH }, + { "STYLE_CLIP_CORNER", LV_STYLE_CLIP_CORNER }, + { "STYLE_COLOR_FILTER_DSC", LV_STYLE_COLOR_FILTER_DSC }, + { "STYLE_COLOR_FILTER_OPA", LV_STYLE_COLOR_FILTER_OPA }, + { "STYLE_HEIGHT", LV_STYLE_HEIGHT }, + { "STYLE_IMG_OPA", LV_STYLE_IMG_OPA }, + { "STYLE_IMG_RECOLOR", LV_STYLE_IMG_RECOLOR }, + { "STYLE_IMG_RECOLOR_FILTERED", LV_STYLE_IMG_RECOLOR_FILTERED }, + { "STYLE_IMG_RECOLOR_OPA", LV_STYLE_IMG_RECOLOR_OPA }, + { "STYLE_LAYOUT", LV_STYLE_LAYOUT }, + { "STYLE_LINE_COLOR", LV_STYLE_LINE_COLOR }, + { "STYLE_LINE_COLOR_FILTERED", LV_STYLE_LINE_COLOR_FILTERED }, + { "STYLE_LINE_DASH_GAP", LV_STYLE_LINE_DASH_GAP }, + { "STYLE_LINE_DASH_WIDTH", LV_STYLE_LINE_DASH_WIDTH }, + { "STYLE_LINE_OPA", LV_STYLE_LINE_OPA }, + { "STYLE_LINE_ROUNDED", LV_STYLE_LINE_ROUNDED }, + { "STYLE_LINE_WIDTH", LV_STYLE_LINE_WIDTH }, + { "STYLE_MAX_HEIGHT", LV_STYLE_MAX_HEIGHT }, + { "STYLE_MAX_WIDTH", LV_STYLE_MAX_WIDTH }, + { "STYLE_MIN_HEIGHT", LV_STYLE_MIN_HEIGHT }, + { "STYLE_MIN_WIDTH", LV_STYLE_MIN_WIDTH }, + { "STYLE_OPA", LV_STYLE_OPA }, + { "STYLE_OUTLINE_COLOR", LV_STYLE_OUTLINE_COLOR }, + { "STYLE_OUTLINE_COLOR_FILTERED", LV_STYLE_OUTLINE_COLOR_FILTERED }, + { "STYLE_OUTLINE_OPA", LV_STYLE_OUTLINE_OPA }, + { "STYLE_OUTLINE_PAD", LV_STYLE_OUTLINE_PAD }, + { "STYLE_OUTLINE_WIDTH", LV_STYLE_OUTLINE_WIDTH }, + { "STYLE_PAD_BOTTOM", LV_STYLE_PAD_BOTTOM }, + { "STYLE_PAD_COLUMN", LV_STYLE_PAD_COLUMN }, + { "STYLE_PAD_LEFT", LV_STYLE_PAD_LEFT }, + { "STYLE_PAD_RIGHT", LV_STYLE_PAD_RIGHT }, + { "STYLE_PAD_ROW", LV_STYLE_PAD_ROW }, + { "STYLE_PAD_TOP", LV_STYLE_PAD_TOP }, + { "STYLE_PROP_ANY", LV_STYLE_PROP_ANY }, + { "STYLE_PROP_INV", LV_STYLE_PROP_INV }, + { "STYLE_RADIUS", LV_STYLE_RADIUS }, + { "STYLE_SHADOW_COLOR", LV_STYLE_SHADOW_COLOR }, + { "STYLE_SHADOW_COLOR_FILTERED", LV_STYLE_SHADOW_COLOR_FILTERED }, + { "STYLE_SHADOW_OFS_X", LV_STYLE_SHADOW_OFS_X }, + { "STYLE_SHADOW_OFS_Y", LV_STYLE_SHADOW_OFS_Y }, + { "STYLE_SHADOW_OPA", LV_STYLE_SHADOW_OPA }, + { "STYLE_SHADOW_SPREAD", LV_STYLE_SHADOW_SPREAD }, + { "STYLE_SHADOW_WIDTH", LV_STYLE_SHADOW_WIDTH }, + { "STYLE_TEXT_ALIGN", LV_STYLE_TEXT_ALIGN }, + { "STYLE_TEXT_COLOR", LV_STYLE_TEXT_COLOR }, + { "STYLE_TEXT_COLOR_FILTERED", LV_STYLE_TEXT_COLOR_FILTERED }, + { "STYLE_TEXT_DECOR", LV_STYLE_TEXT_DECOR }, + { "STYLE_TEXT_FONT", LV_STYLE_TEXT_FONT }, + { "STYLE_TEXT_LETTER_SPACE", LV_STYLE_TEXT_LETTER_SPACE }, + { "STYLE_TEXT_LINE_SPACE", LV_STYLE_TEXT_LINE_SPACE }, + { "STYLE_TEXT_OPA", LV_STYLE_TEXT_OPA }, + { "STYLE_TRANSFORM_ANGLE", LV_STYLE_TRANSFORM_ANGLE }, + { "STYLE_TRANSFORM_HEIGHT", LV_STYLE_TRANSFORM_HEIGHT }, + { "STYLE_TRANSFORM_WIDTH", LV_STYLE_TRANSFORM_WIDTH }, + { "STYLE_TRANSFORM_ZOOM", LV_STYLE_TRANSFORM_ZOOM }, + { "STYLE_TRANSITION", LV_STYLE_TRANSITION }, + { "STYLE_TRANSLATE_X", LV_STYLE_TRANSLATE_X }, + { "STYLE_TRANSLATE_Y", LV_STYLE_TRANSLATE_Y }, + { "STYLE_WIDTH", LV_STYLE_WIDTH }, + { "STYLE_X", LV_STYLE_X }, + { "STYLE_Y", LV_STYLE_Y }, + { "$SYMBOL_AUDIO", (int32_t) "\xef\x80\x81" }, + { "$SYMBOL_BACKSPACE", (int32_t) "\xef\x95\x9A" }, + { "$SYMBOL_BATTERY_1", (int32_t) "\xef\x89\x83" }, + { "$SYMBOL_BATTERY_2", (int32_t) "\xef\x89\x82" }, + { "$SYMBOL_BATTERY_3", (int32_t) "\xef\x89\x81" }, + { "$SYMBOL_BATTERY_EMPTY", (int32_t) "\xef\x89\x84" }, + { "$SYMBOL_BATTERY_FULL", (int32_t) "\xef\x89\x80" }, + { "$SYMBOL_BELL", (int32_t) "\xef\x83\xb3" }, + { "$SYMBOL_BLUETOOTH", (int32_t) "\xef\x8a\x93" }, + { "$SYMBOL_BULLET", (int32_t) "\xE2\x80\xA2" }, + { "$SYMBOL_CALL", (int32_t) "\xef\x82\x95" }, + { "$SYMBOL_CHARGE", (int32_t) "\xef\x83\xa7" }, + { "$SYMBOL_CLOSE", (int32_t) "\xef\x80\x8d" }, + { "$SYMBOL_COPY", (int32_t) "\xef\x83\x85" }, + { "$SYMBOL_CUT", (int32_t) "\xef\x83\x84" }, + { "$SYMBOL_DIRECTORY", (int32_t) "\xef\x81\xbb" }, + { "$SYMBOL_DOWN", (int32_t) "\xef\x81\xb8" }, + { "$SYMBOL_DOWNLOAD", (int32_t) "\xef\x80\x99" }, + { "$SYMBOL_DRIVE", (int32_t) "\xef\x80\x9c" }, + { "$SYMBOL_DUMMY", (int32_t) "\xEF\xA3\xBF" }, + { "$SYMBOL_EDIT", (int32_t) "\xef\x8C\x84" }, + { "$SYMBOL_EJECT", (int32_t) "\xef\x81\x92" }, + { "$SYMBOL_EYE_CLOSE", (int32_t) "\xef\x81\xb0" }, + { "$SYMBOL_EYE_OPEN", (int32_t) "\xef\x81\xae" }, + { "$SYMBOL_FILE", (int32_t) "\xef\x85\x9b" }, + { "$SYMBOL_GPS", (int32_t) "\xef\x84\xa4" }, + { "$SYMBOL_HOME", (int32_t) "\xef\x80\x95" }, + { "$SYMBOL_IMAGE", (int32_t) "\xef\x80\xbe" }, + { "$SYMBOL_KEYBOARD", (int32_t) "\xef\x84\x9c" }, + { "$SYMBOL_LEFT", (int32_t) "\xef\x81\x93" }, + { "$SYMBOL_LIST", (int32_t) "\xef\x80\x8b" }, + { "$SYMBOL_LOOP", (int32_t) "\xef\x81\xb9" }, + { "$SYMBOL_MINUS", (int32_t) "\xef\x81\xa8" }, + { "$SYMBOL_MUTE", (int32_t) "\xef\x80\xa6" }, + { "$SYMBOL_NEW_LINE", (int32_t) "\xef\xA2\xA2" }, + { "$SYMBOL_NEXT", (int32_t) "\xef\x81\x91" }, + { "$SYMBOL_OK", (int32_t) "\xef\x80\x8c" }, + { "$SYMBOL_PASTE", (int32_t) "\xef\x83\xAA" }, + { "$SYMBOL_PAUSE", (int32_t) "\xef\x81\x8c" }, + { "$SYMBOL_PLAY", (int32_t) "\xef\x81\x8b" }, + { "$SYMBOL_PLUS", (int32_t) "\xef\x81\xa7" }, + { "$SYMBOL_POWER", (int32_t) "\xef\x80\x91" }, + { "$SYMBOL_PREV", (int32_t) "\xef\x81\x88" }, + { "$SYMBOL_REFRESH", (int32_t) "\xef\x80\xa1" }, + { "$SYMBOL_RIGHT", (int32_t) "\xef\x81\x94" }, + { "$SYMBOL_SAVE", (int32_t) "\xef\x83\x87" }, + { "$SYMBOL_SD_CARD", (int32_t) "\xef\x9F\x82" }, + { "$SYMBOL_SETTINGS", (int32_t) "\xef\x80\x93" }, + { "$SYMBOL_SHUFFLE", (int32_t) "\xef\x81\xb4" }, + { "$SYMBOL_STOP", (int32_t) "\xef\x81\x8d" }, + { "$SYMBOL_TRASH", (int32_t) "\xef\x8B\xAD" }, + { "$SYMBOL_UP", (int32_t) "\xef\x81\xb7" }, + { "$SYMBOL_UPLOAD", (int32_t) "\xef\x82\x93" }, + { "$SYMBOL_USB", (int32_t) "\xef\x8a\x87" }, + { "$SYMBOL_VIDEO", (int32_t) "\xef\x80\x88" }, + { "$SYMBOL_VOLUME_MAX", (int32_t) "\xef\x80\xa8" }, + { "$SYMBOL_VOLUME_MID", (int32_t) "\xef\x80\xa7" }, + { "$SYMBOL_WARNING", (int32_t) "\xef\x81\xb1" }, + { "$SYMBOL_WIFI", (int32_t) "\xef\x87\xab" }, + { "TABLE_CELL_CTRL_CUSTOM_1", LV_TABLE_CELL_CTRL_CUSTOM_1 }, + { "TABLE_CELL_CTRL_CUSTOM_2", LV_TABLE_CELL_CTRL_CUSTOM_2 }, + { "TABLE_CELL_CTRL_CUSTOM_3", LV_TABLE_CELL_CTRL_CUSTOM_3 }, + { "TABLE_CELL_CTRL_CUSTOM_4", LV_TABLE_CELL_CTRL_CUSTOM_4 }, + { "TABLE_CELL_CTRL_MERGE_RIGHT", LV_TABLE_CELL_CTRL_MERGE_RIGHT }, + { "TABLE_CELL_CTRL_TEXT_CROP", LV_TABLE_CELL_CTRL_TEXT_CROP }, + { "TEXTAREA_CURSOR_LAST", LV_TEXTAREA_CURSOR_LAST }, + { "TEXT_ALIGN_AUTO", LV_TEXT_ALIGN_AUTO }, + { "TEXT_ALIGN_CENTER", LV_TEXT_ALIGN_CENTER }, + { "TEXT_ALIGN_LEFT", LV_TEXT_ALIGN_LEFT }, + { "TEXT_ALIGN_RIGHT", LV_TEXT_ALIGN_RIGHT }, + { "TEXT_CMD_STATE_IN", LV_TEXT_CMD_STATE_IN }, + { "TEXT_CMD_STATE_PAR", LV_TEXT_CMD_STATE_PAR }, + { "TEXT_CMD_STATE_WAIT", LV_TEXT_CMD_STATE_WAIT }, + { "TEXT_DECOR_NONE", LV_TEXT_DECOR_NONE }, + { "TEXT_DECOR_STRIKETHROUGH", LV_TEXT_DECOR_STRIKETHROUGH }, + { "TEXT_DECOR_UNDERLINE", LV_TEXT_DECOR_UNDERLINE }, + { "TEXT_FLAG_EXPAND", LV_TEXT_FLAG_EXPAND }, + { "TEXT_FLAG_FIT", LV_TEXT_FLAG_FIT }, + { "TEXT_FLAG_NONE", LV_TEXT_FLAG_NONE }, + { "TEXT_FLAG_RECOLOR", LV_TEXT_FLAG_RECOLOR }, + { "&font_montserrat", (int32_t) &lv0_load_montserrat_font }, + { "&font_robotocondensed_latin1", (int32_t) &lv0_load_robotocondensed_latin1_font }, + { "&font_seg7", (int32_t) &lv0_load_seg7_font }, + { "&load_font", (int32_t) &lv0_load_font }, + { "&load_freetype_font", (int32_t) &lv0_load_freetype_font }, + { "&montserrat_font", (int32_t) &lv0_load_montserrat_font }, + { "®ister_button_encoder", (int32_t) &lv0_register_button_encoder }, + { "&screenshot", (int32_t) &lv0_screenshot }, + { "&seg7_font", (int32_t) &lv0_load_seg7_font }, + +}; + +const size_t lv0_constants_size = sizeof(lv0_constants)/sizeof(lv0_constants[0]); + +/* generated */ +be_local_module(lv, + "lv", + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("member", 719708611, 6, -1), be_const_func(lv0_member) }, + { be_nested_key("start", 1697318111, 5, 0), be_const_func(lv0_start) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(lv); + +#endif // USE_LVGL + +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_lvgl_signal_arcs_lib.c b/lib/libesp32/berry/default/be_lvgl_signal_arcs_lib.c new file mode 100644 index 000000000..a127cddd9 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_signal_arcs_lib.c @@ -0,0 +1,434 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: set_percentage +********************************************************************/ +be_local_closure(lv_signal_arcs_set_percentage, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(percentage), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(invalidate), + }), + &be_const_str_set_percentage, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x540E0018, // 0001 LDINT R3 25 + 0x0C080403, // 0002 DIV R2 R2 R3 + 0x540E0063, // 0003 LDINT R3 100 + 0x240C0203, // 0004 GT R3 R1 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x54060063, // 0006 LDINT R1 100 + 0x140C0301, // 0007 LT R3 R1 K1 + 0x780E0000, // 0008 JMPF R3 #000A + 0x58040001, // 0009 LDCONST R1 K1 + 0x90020001, // 000A SETMBR R0 K0 R1 + 0x540E0018, // 000B LDINT R3 25 + 0x0C0C0203, // 000C DIV R3 R1 R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E0001, // 000E JMPF R3 #0011 + 0x8C0C0102, // 000F GETMET R3 R0 K2 + 0x7C0C0200, // 0010 CALL R3 1 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_signal_arcs_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(_lvgl), + /* K1 */ be_nested_str(create_custom_widget), + /* K2 */ be_nested_str(percentage), + /* K3 */ be_nested_str(p1), + /* K4 */ be_nested_str(lv), + /* K5 */ be_nested_str(point), + /* K6 */ be_nested_str(p2), + /* K7 */ be_nested_str(area), + /* K8 */ be_nested_str(line_dsc), + /* K9 */ be_nested_str(draw_line_dsc), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x540A0063, // 0005 LDINT R2 100 + 0x90020402, // 0006 SETMBR R0 K2 R2 + 0xB80A0800, // 0007 GETNGBL R2 K4 + 0x8C080505, // 0008 GETMET R2 R2 K5 + 0x7C080200, // 0009 CALL R2 1 + 0x90020602, // 000A SETMBR R0 K3 R2 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x7C080200, // 000D CALL R2 1 + 0x90020C02, // 000E SETMBR R0 K6 R2 + 0xB80A0800, // 000F GETNGBL R2 K4 + 0x8C080507, // 0010 GETMET R2 R2 K7 + 0x7C080200, // 0011 CALL R2 1 + 0x90020E02, // 0012 SETMBR R0 K7 R2 + 0xB80A0800, // 0013 GETNGBL R2 K4 + 0x8C080509, // 0014 GETMET R2 R2 K9 + 0x7C080200, // 0015 CALL R2 1 + 0x90021002, // 0016 SETMBR R0 K8 R2 + 0x80000000, // 0017 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_event +********************************************************************/ +be_local_closure(lv_signal_arcs_widget_event, /* name */ + be_nested_proto( + 28, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_int(1), + }), + &be_const_str_atleast1, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x28040100, // 0000 GE R1 R0 K0 + 0x78060001, // 0001 JMPF R1 #0004 + 0x80040000, // 0002 RET 1 R0 + 0x70020000, // 0003 JMP #0005 + 0x80060000, // 0004 RET 1 K0 + 0x80000000, // 0005 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[35]) { /* constants */ + /* K0 */ be_nested_str(lv), + /* K1 */ be_nested_str(obj_event_base), + /* K2 */ be_nested_str(RES_OK), + /* K3 */ be_nested_str(code), + /* K4 */ be_nested_str(math), + /* K5 */ be_nested_str(get_height), + /* K6 */ be_nested_str(get_width), + /* K7 */ be_const_int(2), + /* K8 */ be_const_int(3), + /* K9 */ be_nested_str(EVENT_DRAW_MAIN), + /* K10 */ be_nested_str(area), + /* K11 */ be_nested_str(param), + /* K12 */ be_nested_str(get_coords), + /* K13 */ be_nested_str(x1), + /* K14 */ be_nested_str(y1), + /* K15 */ be_nested_str(draw_line_dsc_init), + /* K16 */ be_nested_str(line_dsc), + /* K17 */ be_nested_str(init_draw_line_dsc), + /* K18 */ be_nested_str(PART_MAIN), + /* K19 */ be_nested_str(round_start), + /* K20 */ be_const_int(1), + /* K21 */ be_nested_str(round_end), + /* K22 */ be_nested_str(width), + /* K23 */ be_nested_str(get_style_line_color), + /* K24 */ be_nested_str(STATE_DEFAULT), + /* K25 */ be_nested_str(get_style_bg_color), + /* K26 */ be_nested_str(deg), + /* K27 */ be_nested_str(acos), + /* K28 */ be_nested_str(p1), + /* K29 */ be_nested_str(x), + /* K30 */ be_nested_str(y), + /* K31 */ be_nested_str(color), + /* K32 */ be_nested_str(percentage), + /* K33 */ be_nested_str(draw_arc), + /* K34 */ be_const_int(0), + }), + &be_const_str_widget_event, + &be_const_str_solidified, + ( &(const binstruction[182]) { /* code */ + 0xB80E0000, // 0000 GETNGBL R3 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x5C180400, // 0003 MOVE R6 R2 + 0x7C0C0600, // 0004 CALL R3 3 + 0xB8120000, // 0005 GETNGBL R4 K0 + 0x88100902, // 0006 GETMBR R4 R4 K2 + 0x200C0604, // 0007 NE R3 R3 R4 + 0x780E0000, // 0008 JMPF R3 #000A + 0x80000600, // 0009 RET 0 + 0x880C0503, // 000A GETMBR R3 R2 K3 + 0xA4120800, // 000B IMPORT R4 K4 + 0x84140000, // 000C CLOSURE R5 P0 + 0x8C180105, // 000D GETMET R6 R0 K5 + 0x7C180200, // 000E CALL R6 1 + 0x8C1C0106, // 000F GETMET R7 R0 K6 + 0x7C1C0200, // 0010 CALL R7 1 + 0x5C200A00, // 0011 MOVE R8 R5 + 0x54260007, // 0012 LDINT R9 8 + 0x0C240C09, // 0013 DIV R9 R6 R9 + 0x7C200200, // 0014 CALL R8 1 + 0x5C240A00, // 0015 MOVE R9 R5 + 0x08281107, // 0016 MUL R10 R8 K7 + 0x04280C0A, // 0017 SUB R10 R6 R10 + 0x0C281508, // 0018 DIV R10 R10 K8 + 0x7C240200, // 0019 CALL R9 1 + 0x0C281307, // 001A DIV R10 R9 K7 + 0xB82E0000, // 001B GETNGBL R11 K0 + 0x882C1709, // 001C GETMBR R11 R11 K9 + 0x1C2C060B, // 001D EQ R11 R3 R11 + 0x782E0095, // 001E JMPF R11 #00B5 + 0xB82E0000, // 001F GETNGBL R11 K0 + 0x8C2C170A, // 0020 GETMET R11 R11 K10 + 0x8834050B, // 0021 GETMBR R13 R2 K11 + 0x7C2C0400, // 0022 CALL R11 2 + 0x8C30010C, // 0023 GETMET R12 R0 K12 + 0x8838010A, // 0024 GETMBR R14 R0 K10 + 0x7C300400, // 0025 CALL R12 2 + 0x8830010A, // 0026 GETMBR R12 R0 K10 + 0x8830190D, // 0027 GETMBR R12 R12 K13 + 0x8834010A, // 0028 GETMBR R13 R0 K10 + 0x88341B0E, // 0029 GETMBR R13 R13 K14 + 0xB83A0000, // 002A GETNGBL R14 K0 + 0x8C381D0F, // 002B GETMET R14 R14 K15 + 0x88400110, // 002C GETMBR R16 R0 K16 + 0x7C380400, // 002D CALL R14 2 + 0x8C380111, // 002E GETMET R14 R0 K17 + 0xB8420000, // 002F GETNGBL R16 K0 + 0x88402112, // 0030 GETMBR R16 R16 K18 + 0x88440110, // 0031 GETMBR R17 R0 K16 + 0x7C380600, // 0032 CALL R14 3 + 0x88380110, // 0033 GETMBR R14 R0 K16 + 0x903A2714, // 0034 SETMBR R14 K19 K20 + 0x88380110, // 0035 GETMBR R14 R0 K16 + 0x903A2B14, // 0036 SETMBR R14 K21 K20 + 0x88380110, // 0037 GETMBR R14 R0 K16 + 0x083C1308, // 0038 MUL R15 R9 K8 + 0x003C1F14, // 0039 ADD R15 R15 K20 + 0x54420003, // 003A LDINT R16 4 + 0x0C3C1E10, // 003B DIV R15 R15 R16 + 0x903A2C0F, // 003C SETMBR R14 K22 R15 + 0x8C380117, // 003D GETMET R14 R0 K23 + 0xB8420000, // 003E GETNGBL R16 K0 + 0x88402112, // 003F GETMBR R16 R16 K18 + 0xB8460000, // 0040 GETNGBL R17 K0 + 0x88442318, // 0041 GETMBR R17 R17 K24 + 0x30402011, // 0042 OR R16 R16 R17 + 0x7C380400, // 0043 CALL R14 2 + 0x8C3C0119, // 0044 GETMET R15 R0 K25 + 0xB8460000, // 0045 GETNGBL R17 K0 + 0x88442312, // 0046 GETMBR R17 R17 K18 + 0xB84A0000, // 0047 GETNGBL R18 K0 + 0x88482518, // 0048 GETMBR R18 R18 K24 + 0x30442212, // 0049 OR R17 R17 R18 + 0x7C3C0400, // 004A CALL R15 2 + 0x04400C09, // 004B SUB R16 R6 R9 + 0x0C440F07, // 004C DIV R17 R7 K7 + 0x0444220A, // 004D SUB R17 R17 R10 + 0x60480009, // 004E GETGBL R18 G9 + 0x544E0059, // 004F LDINT R19 90 + 0x8C50091A, // 0050 GETMET R20 R4 K26 + 0x8C58091B, // 0051 GETMET R22 R4 K27 + 0x6060000A, // 0052 GETGBL R24 G10 + 0x5C642200, // 0053 MOVE R25 R17 + 0x7C600200, // 0054 CALL R24 1 + 0x6064000A, // 0055 GETGBL R25 G10 + 0x5C682000, // 0056 MOVE R26 R16 + 0x7C640200, // 0057 CALL R25 1 + 0x0C603019, // 0058 DIV R24 R24 R25 + 0x7C580400, // 0059 CALL R22 2 + 0x7C500400, // 005A CALL R20 2 + 0x044C2614, // 005B SUB R19 R19 R20 + 0x7C480200, // 005C CALL R18 1 + 0x544E002C, // 005D LDINT R19 45 + 0x244C2413, // 005E GT R19 R18 R19 + 0x784E0000, // 005F JMPF R19 #0061 + 0x544A002C, // 0060 LDINT R18 45 + 0x884C011C, // 0061 GETMBR R19 R0 K28 + 0x0C500F07, // 0062 DIV R20 R7 K7 + 0x00501814, // 0063 ADD R20 R12 R20 + 0x904E3A14, // 0064 SETMBR R19 K29 R20 + 0x884C011C, // 0065 GETMBR R19 R0 K28 + 0x00501A06, // 0066 ADD R20 R13 R6 + 0x04502914, // 0067 SUB R20 R20 K20 + 0x0450280A, // 0068 SUB R20 R20 R10 + 0x904E3C14, // 0069 SETMBR R19 K30 R20 + 0x884C0110, // 006A GETMBR R19 R0 K16 + 0x88500120, // 006B GETMBR R20 R0 K32 + 0x54560018, // 006C LDINT R21 25 + 0x28502815, // 006D GE R20 R20 R21 + 0x78520001, // 006E JMPF R20 #0071 + 0x5C501C00, // 006F MOVE R20 R14 + 0x70020000, // 0070 JMP #0072 + 0x5C501E00, // 0071 MOVE R20 R15 + 0x904E3E14, // 0072 SETMBR R19 K31 R20 + 0xB84E0000, // 0073 GETNGBL R19 K0 + 0x8C4C2721, // 0074 GETMET R19 R19 K33 + 0x8854011C, // 0075 GETMBR R21 R0 K28 + 0x88542B1D, // 0076 GETMBR R21 R21 K29 + 0x8858011C, // 0077 GETMBR R22 R0 K28 + 0x88582D1E, // 0078 GETMBR R22 R22 K30 + 0x005C1208, // 0079 ADD R23 R9 R8 + 0x085E4417, // 007A MUL R23 K34 R23 + 0x005C2E0A, // 007B ADD R23 R23 R10 + 0x58600022, // 007C LDCONST R24 K34 + 0x54660167, // 007D LDINT R25 360 + 0x5C681600, // 007E MOVE R26 R11 + 0x886C0110, // 007F GETMBR R27 R0 K16 + 0x7C4C1000, // 0080 CALL R19 8 + 0x884C0110, // 0081 GETMBR R19 R0 K16 + 0x88500120, // 0082 GETMBR R20 R0 K32 + 0x54560031, // 0083 LDINT R21 50 + 0x28502815, // 0084 GE R20 R20 R21 + 0x78520001, // 0085 JMPF R20 #0088 + 0x5C501C00, // 0086 MOVE R20 R14 + 0x70020000, // 0087 JMP #0089 + 0x5C501E00, // 0088 MOVE R20 R15 + 0x904E3E14, // 0089 SETMBR R19 K31 R20 + 0xB84E0000, // 008A GETNGBL R19 K0 + 0x8C4C2721, // 008B GETMET R19 R19 K33 + 0x8854011C, // 008C GETMBR R21 R0 K28 + 0x88542B1D, // 008D GETMBR R21 R21 K29 + 0x8858011C, // 008E GETMBR R22 R0 K28 + 0x88582D1E, // 008F GETMBR R22 R22 K30 + 0x005C1208, // 0090 ADD R23 R9 R8 + 0x085E2817, // 0091 MUL R23 K20 R23 + 0x005C2E0A, // 0092 ADD R23 R23 R10 + 0x045C2F14, // 0093 SUB R23 R23 K20 + 0x5462010D, // 0094 LDINT R24 270 + 0x04603012, // 0095 SUB R24 R24 R18 + 0x5466010D, // 0096 LDINT R25 270 + 0x00643212, // 0097 ADD R25 R25 R18 + 0x5C681600, // 0098 MOVE R26 R11 + 0x886C0110, // 0099 GETMBR R27 R0 K16 + 0x7C4C1000, // 009A CALL R19 8 + 0x884C0110, // 009B GETMBR R19 R0 K16 + 0x88500120, // 009C GETMBR R20 R0 K32 + 0x5456004A, // 009D LDINT R21 75 + 0x28502815, // 009E GE R20 R20 R21 + 0x78520001, // 009F JMPF R20 #00A2 + 0x5C501C00, // 00A0 MOVE R20 R14 + 0x70020000, // 00A1 JMP #00A3 + 0x5C501E00, // 00A2 MOVE R20 R15 + 0x904E3E14, // 00A3 SETMBR R19 K31 R20 + 0xB84E0000, // 00A4 GETNGBL R19 K0 + 0x8C4C2721, // 00A5 GETMET R19 R19 K33 + 0x8854011C, // 00A6 GETMBR R21 R0 K28 + 0x88542B1D, // 00A7 GETMBR R21 R21 K29 + 0x8858011C, // 00A8 GETMBR R22 R0 K28 + 0x88582D1E, // 00A9 GETMBR R22 R22 K30 + 0x005C1208, // 00AA ADD R23 R9 R8 + 0x085E0E17, // 00AB MUL R23 K7 R23 + 0x005C2E0A, // 00AC ADD R23 R23 R10 + 0x045C2F07, // 00AD SUB R23 R23 K7 + 0x5462010D, // 00AE LDINT R24 270 + 0x04603012, // 00AF SUB R24 R24 R18 + 0x5466010D, // 00B0 LDINT R25 270 + 0x00643212, // 00B1 ADD R25 R25 R18 + 0x5C681600, // 00B2 MOVE R26 R11 + 0x886C0110, // 00B3 GETMBR R27 R0 K16 + 0x7C4C1000, // 00B4 CALL R19 8 + 0x80000000, // 00B5 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_percentage +********************************************************************/ +be_local_closure(lv_signal_arcs_get_percentage, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(percentage), + }), + &be_const_str_get_percentage, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_signal_arcs +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_signal_arcs, + 5, + &be_class_lv_obj, + be_nested_map(9, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(percentage, 4), be_const_var(0) }, + { be_const_key(p1, 3), be_const_var(1) }, + { be_const_key(p2, -1), be_const_var(2) }, + { be_const_key(area, -1), be_const_var(3) }, + { be_const_key(line_dsc, -1), be_const_var(4) }, + { be_const_key(set_percentage, -1), be_const_closure(lv_signal_arcs_set_percentage_closure) }, + { be_const_key(init, -1), be_const_closure(lv_signal_arcs_init_closure) }, + { be_const_key(widget_event, -1), be_const_closure(lv_signal_arcs_widget_event_closure) }, + { be_const_key(get_percentage, 5), be_const_closure(lv_signal_arcs_get_percentage_closure) }, + })), + be_str_literal("lv_signal_arcs") +); +/*******************************************************************/ + +void be_load_lv_signal_arcs_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_signal_arcs); + be_setglobal(vm, "lv_signal_arcs"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_signal_bars_lib.c b/lib/libesp32/berry/default/be_lvgl_signal_bars_lib.c new file mode 100644 index 000000000..18452ae34 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_signal_bars_lib.c @@ -0,0 +1,392 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: set_percentage +********************************************************************/ +be_local_closure(lv_signal_bars_set_percentage, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(percentage), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(invalidate), + }), + &be_const_str_set_percentage, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x540E0013, // 0001 LDINT R3 20 + 0x0C080403, // 0002 DIV R2 R2 R3 + 0x540E0063, // 0003 LDINT R3 100 + 0x240C0203, // 0004 GT R3 R1 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x54060063, // 0006 LDINT R1 100 + 0x140C0301, // 0007 LT R3 R1 K1 + 0x780E0000, // 0008 JMPF R3 #000A + 0x58040001, // 0009 LDCONST R1 K1 + 0x90020001, // 000A SETMBR R0 K0 R1 + 0x540E0013, // 000B LDINT R3 20 + 0x0C0C0203, // 000C DIV R3 R1 R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E0001, // 000E JMPF R3 #0011 + 0x8C0C0102, // 000F GETMET R3 R0 K2 + 0x7C0C0200, // 0010 CALL R3 1 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_signal_bars_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(_lvgl), + /* K1 */ be_nested_str(create_custom_widget), + /* K2 */ be_nested_str(percentage), + /* K3 */ be_nested_str(p1), + /* K4 */ be_nested_str(lv), + /* K5 */ be_nested_str(point), + /* K6 */ be_nested_str(p2), + /* K7 */ be_nested_str(area), + /* K8 */ be_nested_str(line_dsc), + /* K9 */ be_nested_str(draw_line_dsc), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100000, // 0002 MOVE R4 R0 + 0x5C140200, // 0003 MOVE R5 R1 + 0x7C080600, // 0004 CALL R2 3 + 0x540A0063, // 0005 LDINT R2 100 + 0x90020402, // 0006 SETMBR R0 K2 R2 + 0xB80A0800, // 0007 GETNGBL R2 K4 + 0x8C080505, // 0008 GETMET R2 R2 K5 + 0x7C080200, // 0009 CALL R2 1 + 0x90020602, // 000A SETMBR R0 K3 R2 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x7C080200, // 000D CALL R2 1 + 0x90020C02, // 000E SETMBR R0 K6 R2 + 0xB80A0800, // 000F GETNGBL R2 K4 + 0x8C080507, // 0010 GETMET R2 R2 K7 + 0x7C080200, // 0011 CALL R2 1 + 0x90020E02, // 0012 SETMBR R0 K7 R2 + 0xB80A0800, // 0013 GETNGBL R2 K4 + 0x8C080509, // 0014 GETMET R2 R2 K9 + 0x7C080200, // 0015 CALL R2 1 + 0x90021002, // 0016 SETMBR R0 K8 R2 + 0x80000000, // 0017 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: widget_event +********************************************************************/ +be_local_closure(lv_signal_bars_widget_event, /* name */ + be_nested_proto( + 23, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_int(1), + }), + &be_const_str_atleast1, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x28040100, // 0000 GE R1 R0 K0 + 0x78060001, // 0001 JMPF R1 #0004 + 0x80040000, // 0002 RET 1 R0 + 0x70020000, // 0003 JMP #0005 + 0x80060000, // 0004 RET 1 K0 + 0x80000000, // 0005 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[37]) { /* constants */ + /* K0 */ be_nested_str(lv), + /* K1 */ be_nested_str(obj_event_base), + /* K2 */ be_nested_str(RES_OK), + /* K3 */ be_nested_str(code), + /* K4 */ be_nested_str(get_height), + /* K5 */ be_nested_str(get_width), + /* K6 */ be_const_int(3), + /* K7 */ be_const_int(2), + /* K8 */ be_nested_str(EVENT_DRAW_MAIN), + /* K9 */ be_nested_str(area), + /* K10 */ be_nested_str(param), + /* K11 */ be_nested_str(get_coords), + /* K12 */ be_nested_str(x1), + /* K13 */ be_nested_str(y1), + /* K14 */ be_nested_str(draw_line_dsc_init), + /* K15 */ be_nested_str(line_dsc), + /* K16 */ be_nested_str(init_draw_line_dsc), + /* K17 */ be_nested_str(PART_MAIN), + /* K18 */ be_nested_str(round_start), + /* K19 */ be_const_int(1), + /* K20 */ be_nested_str(round_end), + /* K21 */ be_nested_str(width), + /* K22 */ be_nested_str(get_style_line_color), + /* K23 */ be_nested_str(STATE_DEFAULT), + /* K24 */ be_nested_str(get_style_bg_color), + /* K25 */ be_nested_str(event_send), + /* K26 */ be_nested_str(EVENT_DRAW_PART_BEGIN), + /* K27 */ be_const_int(0), + /* K28 */ be_nested_str(color), + /* K29 */ be_nested_str(percentage), + /* K30 */ be_nested_str(p1), + /* K31 */ be_nested_str(y), + /* K32 */ be_nested_str(x), + /* K33 */ be_nested_str(p2), + /* K34 */ be_nested_str(draw_line), + /* K35 */ be_nested_str(stop_iteration), + /* K36 */ be_nested_str(EVENT_DRAW_PART_END), + }), + &be_const_str_widget_event, + &be_const_str_solidified, + ( &(const binstruction[138]) { /* code */ + 0xB80E0000, // 0000 GETNGBL R3 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x5C180400, // 0003 MOVE R6 R2 + 0x7C0C0600, // 0004 CALL R3 3 + 0xB8120000, // 0005 GETNGBL R4 K0 + 0x88100902, // 0006 GETMBR R4 R4 K2 + 0x200C0604, // 0007 NE R3 R3 R4 + 0x780E0000, // 0008 JMPF R3 #000A + 0x80000600, // 0009 RET 0 + 0x880C0503, // 000A GETMBR R3 R2 K3 + 0x84100000, // 000B CLOSURE R4 P0 + 0x8C140104, // 000C GETMET R5 R0 K4 + 0x7C140200, // 000D CALL R5 1 + 0x8C180105, // 000E GETMET R6 R0 K5 + 0x7C180200, // 000F CALL R6 1 + 0x5C1C0800, // 0010 MOVE R7 R4 + 0x5422000E, // 0011 LDINT R8 15 + 0x0C200C08, // 0012 DIV R8 R6 R8 + 0x7C1C0200, // 0013 CALL R7 1 + 0x5C200800, // 0014 MOVE R8 R4 + 0x08240F06, // 0015 MUL R9 R7 K6 + 0x04240C09, // 0016 SUB R9 R6 R9 + 0x542A0003, // 0017 LDINT R10 4 + 0x0C24120A, // 0018 DIV R9 R9 R10 + 0x7C200200, // 0019 CALL R8 1 + 0x0C241107, // 001A DIV R9 R8 K7 + 0xB82A0000, // 001B GETNGBL R10 K0 + 0x88281508, // 001C GETMBR R10 R10 K8 + 0x1C28060A, // 001D EQ R10 R3 R10 + 0x782A0069, // 001E JMPF R10 #0089 + 0xB82A0000, // 001F GETNGBL R10 K0 + 0x8C281509, // 0020 GETMET R10 R10 K9 + 0x8830050A, // 0021 GETMBR R12 R2 K10 + 0x7C280400, // 0022 CALL R10 2 + 0x8C2C010B, // 0023 GETMET R11 R0 K11 + 0x88340109, // 0024 GETMBR R13 R0 K9 + 0x7C2C0400, // 0025 CALL R11 2 + 0x882C0109, // 0026 GETMBR R11 R0 K9 + 0x882C170C, // 0027 GETMBR R11 R11 K12 + 0x88300109, // 0028 GETMBR R12 R0 K9 + 0x8830190D, // 0029 GETMBR R12 R12 K13 + 0xB8360000, // 002A GETNGBL R13 K0 + 0x8C341B0E, // 002B GETMET R13 R13 K14 + 0x883C010F, // 002C GETMBR R15 R0 K15 + 0x7C340400, // 002D CALL R13 2 + 0x8C340110, // 002E GETMET R13 R0 K16 + 0xB83E0000, // 002F GETNGBL R15 K0 + 0x883C1F11, // 0030 GETMBR R15 R15 K17 + 0x8840010F, // 0031 GETMBR R16 R0 K15 + 0x7C340600, // 0032 CALL R13 3 + 0x8834010F, // 0033 GETMBR R13 R0 K15 + 0x90362513, // 0034 SETMBR R13 K18 K19 + 0x8834010F, // 0035 GETMBR R13 R0 K15 + 0x90362913, // 0036 SETMBR R13 K20 K19 + 0x8834010F, // 0037 GETMBR R13 R0 K15 + 0x90362A08, // 0038 SETMBR R13 K21 R8 + 0x8C340116, // 0039 GETMET R13 R0 K22 + 0xB83E0000, // 003A GETNGBL R15 K0 + 0x883C1F11, // 003B GETMBR R15 R15 K17 + 0xB8420000, // 003C GETNGBL R16 K0 + 0x88402117, // 003D GETMBR R16 R16 K23 + 0x303C1E10, // 003E OR R15 R15 R16 + 0x7C340400, // 003F CALL R13 2 + 0x8C380118, // 0040 GETMET R14 R0 K24 + 0xB8420000, // 0041 GETNGBL R16 K0 + 0x88402111, // 0042 GETMBR R16 R16 K17 + 0xB8460000, // 0043 GETNGBL R17 K0 + 0x88442317, // 0044 GETMBR R17 R17 K23 + 0x30402011, // 0045 OR R16 R16 R17 + 0x7C380400, // 0046 CALL R14 2 + 0xB83E0000, // 0047 GETNGBL R15 K0 + 0x8C3C1F19, // 0048 GETMET R15 R15 K25 + 0x5C440000, // 0049 MOVE R17 R0 + 0xB84A0000, // 004A GETNGBL R18 K0 + 0x8848251A, // 004B GETMBR R18 R18 K26 + 0x884C010F, // 004C GETMBR R19 R0 K15 + 0x7C3C0800, // 004D CALL R15 4 + 0x603C0010, // 004E GETGBL R15 G16 + 0x40423706, // 004F CONNECT R16 K27 K6 + 0x7C3C0200, // 0050 CALL R15 1 + 0xA802002C, // 0051 EXBLK 0 #007F + 0x5C401E00, // 0052 MOVE R16 R15 + 0x7C400000, // 0053 CALL R16 0 + 0x8844010F, // 0054 GETMBR R17 R0 K15 + 0x8848011D, // 0055 GETMBR R18 R0 K29 + 0x004C2113, // 0056 ADD R19 R16 K19 + 0x54520013, // 0057 LDINT R20 20 + 0x084C2614, // 0058 MUL R19 R19 R20 + 0x28482413, // 0059 GE R18 R18 R19 + 0x784A0001, // 005A JMPF R18 #005D + 0x5C481A00, // 005B MOVE R18 R13 + 0x70020000, // 005C JMP #005E + 0x5C481C00, // 005D MOVE R18 R14 + 0x90463812, // 005E SETMBR R17 K28 R18 + 0x8844011E, // 005F GETMBR R17 R0 K30 + 0x00481805, // 0060 ADD R18 R12 R5 + 0x04482513, // 0061 SUB R18 R18 K19 + 0x04482409, // 0062 SUB R18 R18 R9 + 0x90463E12, // 0063 SETMBR R17 K31 R18 + 0x8844011E, // 0064 GETMBR R17 R0 K30 + 0x00481007, // 0065 ADD R18 R8 R7 + 0x08482012, // 0066 MUL R18 R16 R18 + 0x00481612, // 0067 ADD R18 R11 R18 + 0x00482409, // 0068 ADD R18 R18 R9 + 0x90464012, // 0069 SETMBR R17 K32 R18 + 0x88440121, // 006A GETMBR R17 R0 K33 + 0x044A0C10, // 006B SUB R18 K6 R16 + 0x044C0A08, // 006C SUB R19 R5 R8 + 0x08482413, // 006D MUL R18 R18 R19 + 0x544E0003, // 006E LDINT R19 4 + 0x0C482413, // 006F DIV R18 R18 R19 + 0x00481812, // 0070 ADD R18 R12 R18 + 0x00482409, // 0071 ADD R18 R18 R9 + 0x90463E12, // 0072 SETMBR R17 K31 R18 + 0x88440121, // 0073 GETMBR R17 R0 K33 + 0x8848011E, // 0074 GETMBR R18 R0 K30 + 0x88482520, // 0075 GETMBR R18 R18 K32 + 0x90464012, // 0076 SETMBR R17 K32 R18 + 0xB8460000, // 0077 GETNGBL R17 K0 + 0x8C442322, // 0078 GETMET R17 R17 K34 + 0x884C011E, // 0079 GETMBR R19 R0 K30 + 0x88500121, // 007A GETMBR R20 R0 K33 + 0x5C541400, // 007B MOVE R21 R10 + 0x8858010F, // 007C GETMBR R22 R0 K15 + 0x7C440A00, // 007D CALL R17 5 + 0x7001FFD2, // 007E JMP #0052 + 0x583C0023, // 007F LDCONST R15 K35 + 0xAC3C0200, // 0080 CATCH R15 1 0 + 0xB0080000, // 0081 RAISE 2 R0 R0 + 0xB83E0000, // 0082 GETNGBL R15 K0 + 0x8C3C1F19, // 0083 GETMET R15 R15 K25 + 0x5C440000, // 0084 MOVE R17 R0 + 0xB84A0000, // 0085 GETNGBL R18 K0 + 0x88482524, // 0086 GETMBR R18 R18 K36 + 0x884C010F, // 0087 GETMBR R19 R0 K15 + 0x7C3C0800, // 0088 CALL R15 4 + 0x80000000, // 0089 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_percentage +********************************************************************/ +be_local_closure(lv_signal_bars_get_percentage, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(percentage), + }), + &be_const_str_get_percentage, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_signal_bars +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_signal_bars, + 5, + &be_class_lv_obj, + be_nested_map(9, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(percentage, 4), be_const_var(0) }, + { be_const_key(p1, 3), be_const_var(1) }, + { be_const_key(p2, -1), be_const_var(2) }, + { be_const_key(area, -1), be_const_var(3) }, + { be_const_key(line_dsc, -1), be_const_var(4) }, + { be_const_key(set_percentage, -1), be_const_closure(lv_signal_bars_set_percentage_closure) }, + { be_const_key(init, -1), be_const_closure(lv_signal_bars_init_closure) }, + { be_const_key(widget_event, -1), be_const_closure(lv_signal_bars_widget_event_closure) }, + { be_const_key(get_percentage, 5), be_const_closure(lv_signal_bars_get_percentage_closure) }, + })), + be_str_literal("lv_signal_bars") +); +/*******************************************************************/ + +void be_load_lv_signal_bars_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_signal_bars); + be_setglobal(vm, "lv_signal_bars"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_widgets_lib.c b/lib/libesp32/berry/default/be_lvgl_widgets_lib.c new file mode 100644 index 000000000..68950d144 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_widgets_lib.c @@ -0,0 +1,1564 @@ + +/******************************************************************** + * Generated code, don't edit + *******************************************************************/ + + /******************************************************************** + * Tasmota LVGL classes for widgets + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +extern int lv0_init(bvm *vm); + +extern int lco_init(bvm *vm); // generic function +extern int lco_tostring(bvm *vm); // generic function +extern int lco_toint(bvm *vm); // generic function + +extern int lvx_member(bvm *vm); +extern int lvx_tostring(bvm *vm); // generic function + +extern int lvs_init(bvm *vm); +extern int lvs_tostring(bvm *vm); + +BE_EXPORT_VARIABLE extern const bclass be_class_lv_obj; + +extern int lvbe_font_create(bvm *vm); +extern int lvbe_theme_create(bvm *vm); + + +/* `lv_style` external functions definitions */ +extern int lvbe_style_set_width(bvm *vm); +extern int lvbe_style_set_min_width(bvm *vm); +extern int lvbe_style_set_max_width(bvm *vm); +extern int lvbe_style_set_height(bvm *vm); +extern int lvbe_style_set_min_height(bvm *vm); +extern int lvbe_style_set_max_height(bvm *vm); +extern int lvbe_style_set_x(bvm *vm); +extern int lvbe_style_set_y(bvm *vm); +extern int lvbe_style_set_align(bvm *vm); +extern int lvbe_style_set_transform_width(bvm *vm); +extern int lvbe_style_set_transform_height(bvm *vm); +extern int lvbe_style_set_translate_x(bvm *vm); +extern int lvbe_style_set_translate_y(bvm *vm); +extern int lvbe_style_set_transform_zoom(bvm *vm); +extern int lvbe_style_set_transform_angle(bvm *vm); +extern int lvbe_style_set_pad_top(bvm *vm); +extern int lvbe_style_set_pad_bottom(bvm *vm); +extern int lvbe_style_set_pad_left(bvm *vm); +extern int lvbe_style_set_pad_right(bvm *vm); +extern int lvbe_style_set_pad_row(bvm *vm); +extern int lvbe_style_set_pad_column(bvm *vm); +extern int lvbe_style_set_radius(bvm *vm); +extern int lvbe_style_set_clip_corner(bvm *vm); +extern int lvbe_style_set_opa(bvm *vm); +extern int lvbe_style_set_color_filter_dsc(bvm *vm); +extern int lvbe_style_set_color_filter_opa(bvm *vm); +extern int lvbe_style_set_anim_time(bvm *vm); +extern int lvbe_style_set_anim_speed(bvm *vm); +extern int lvbe_style_set_transition(bvm *vm); +extern int lvbe_style_set_blend_mode(bvm *vm); +extern int lvbe_style_set_layout(bvm *vm); +extern int lvbe_style_set_base_dir(bvm *vm); +extern int lvbe_style_set_bg_color(bvm *vm); +extern int lvbe_style_set_bg_color_filtered(bvm *vm); +extern int lvbe_style_set_bg_opa(bvm *vm); +extern int lvbe_style_set_bg_grad_color(bvm *vm); +extern int lvbe_style_set_bg_grad_color_filtered(bvm *vm); +extern int lvbe_style_set_bg_grad_dir(bvm *vm); +extern int lvbe_style_set_bg_main_stop(bvm *vm); +extern int lvbe_style_set_bg_grad_stop(bvm *vm); +extern int lvbe_style_set_bg_img_src(bvm *vm); +extern int lvbe_style_set_bg_img_opa(bvm *vm); +extern int lvbe_style_set_bg_img_recolor(bvm *vm); +extern int lvbe_style_set_bg_img_recolor_filtered(bvm *vm); +extern int lvbe_style_set_bg_img_recolor_opa(bvm *vm); +extern int lvbe_style_set_bg_img_tiled(bvm *vm); +extern int lvbe_style_set_border_color(bvm *vm); +extern int lvbe_style_set_border_color_filtered(bvm *vm); +extern int lvbe_style_set_border_opa(bvm *vm); +extern int lvbe_style_set_border_width(bvm *vm); +extern int lvbe_style_set_border_side(bvm *vm); +extern int lvbe_style_set_border_post(bvm *vm); +extern int lvbe_style_set_text_color(bvm *vm); +extern int lvbe_style_set_text_color_filtered(bvm *vm); +extern int lvbe_style_set_text_opa(bvm *vm); +extern int lvbe_style_set_text_font(bvm *vm); +extern int lvbe_style_set_text_letter_space(bvm *vm); +extern int lvbe_style_set_text_line_space(bvm *vm); +extern int lvbe_style_set_text_decor(bvm *vm); +extern int lvbe_style_set_text_align(bvm *vm); +extern int lvbe_style_set_img_opa(bvm *vm); +extern int lvbe_style_set_img_recolor(bvm *vm); +extern int lvbe_style_set_img_recolor_filtered(bvm *vm); +extern int lvbe_style_set_img_recolor_opa(bvm *vm); +extern int lvbe_style_set_outline_width(bvm *vm); +extern int lvbe_style_set_outline_color(bvm *vm); +extern int lvbe_style_set_outline_color_filtered(bvm *vm); +extern int lvbe_style_set_outline_opa(bvm *vm); +extern int lvbe_style_set_outline_pad(bvm *vm); +extern int lvbe_style_set_shadow_width(bvm *vm); +extern int lvbe_style_set_shadow_ofs_x(bvm *vm); +extern int lvbe_style_set_shadow_ofs_y(bvm *vm); +extern int lvbe_style_set_shadow_spread(bvm *vm); +extern int lvbe_style_set_shadow_color(bvm *vm); +extern int lvbe_style_set_shadow_color_filtered(bvm *vm); +extern int lvbe_style_set_shadow_opa(bvm *vm); +extern int lvbe_style_set_line_width(bvm *vm); +extern int lvbe_style_set_line_dash_width(bvm *vm); +extern int lvbe_style_set_line_dash_gap(bvm *vm); +extern int lvbe_style_set_line_rounded(bvm *vm); +extern int lvbe_style_set_line_color(bvm *vm); +extern int lvbe_style_set_line_color_filtered(bvm *vm); +extern int lvbe_style_set_line_opa(bvm *vm); +extern int lvbe_style_set_arc_width(bvm *vm); +extern int lvbe_style_set_arc_rounded(bvm *vm); +extern int lvbe_style_set_arc_color(bvm *vm); +extern int lvbe_style_set_arc_color_filtered(bvm *vm); +extern int lvbe_style_set_arc_opa(bvm *vm); +extern int lvbe_style_set_arc_img_src(bvm *vm); + +/* `lv_font` external functions definitions */ + +/* `lv_color` external functions definitions */ + +/* `lv_theme` external functions definitions */ + +/* `lv_img` external functions definitions */ +extern int lvbe_img_set_tasmota_logo(bvm *vm); +extern int lvbe_img_create(bvm *vm); +extern int lvbe_img_set_src(bvm *vm); +extern int lvbe_img_set_offset_x(bvm *vm); +extern int lvbe_img_set_offset_y(bvm *vm); +extern int lvbe_img_set_angle(bvm *vm); +extern int lvbe_img_set_pivot(bvm *vm); +extern int lvbe_img_set_zoom(bvm *vm); +extern int lvbe_img_set_antialias(bvm *vm); +extern int lvbe_img_get_src(bvm *vm); +extern int lvbe_img_get_offset_x(bvm *vm); +extern int lvbe_img_get_offset_y(bvm *vm); +extern int lvbe_img_get_angle(bvm *vm); +extern int lvbe_img_get_pivot(bvm *vm); +extern int lvbe_img_get_zoom(bvm *vm); +extern int lvbe_img_get_antialias(bvm *vm); + +/* `lv_disp` external functions definitions */ +extern int lvbe_disp_get_scr_act(bvm *vm); +extern int lvbe_disp_get_scr_prev(bvm *vm); +extern int lvbe_disp_load_scr(bvm *vm); +extern int lvbe_disp_get_layer_top(bvm *vm); +extern int lvbe_disp_get_layer_sys(bvm *vm); +extern int lvbe_disp_set_theme(bvm *vm); +extern int lvbe_disp_get_theme(bvm *vm); +extern int lvbe_disp_set_bg_color(bvm *vm); +extern int lvbe_disp_set_bg_image(bvm *vm); +extern int lvbe_disp_set_bg_opa(bvm *vm); +extern int lvbe_disp_get_inactive_time(bvm *vm); +extern int lvbe_disp_trig_activity(bvm *vm); +extern int lvbe_disp_clean_dcache(bvm *vm); +extern int lvbe_disp_dpx(bvm *vm); + +/* `lv_obj` external functions definitions */ +extern int lvbe_obj_add_event_cb(bvm *vm); +extern int lvbe_obj_remove_event_cb(bvm *vm); +extern int lvbe_obj_remove_event_dsc(bvm *vm); +extern int lvbe_obj_create(bvm *vm); +extern int lvbe_obj_add_flag(bvm *vm); +extern int lvbe_obj_clear_flag(bvm *vm); +extern int lvbe_obj_add_state(bvm *vm); +extern int lvbe_obj_clear_state(bvm *vm); +extern int lvbe_obj_set_user_data(bvm *vm); +extern int lvbe_obj_has_flag(bvm *vm); +extern int lvbe_obj_has_flag_any(bvm *vm); +extern int lvbe_obj_get_state(bvm *vm); +extern int lvbe_obj_has_state(bvm *vm); +extern int lvbe_obj_get_group(bvm *vm); +extern int lvbe_obj_get_user_data(bvm *vm); +extern int lvbe_obj_allocate_spec_attr(bvm *vm); +extern int lvbe_obj_check_type(bvm *vm); +extern int lvbe_obj_has_class(bvm *vm); +extern int lvbe_obj_get_class(bvm *vm); +extern int lvbe_obj_is_valid(bvm *vm); +extern int lvbe_obj_dpx(bvm *vm); +extern int lvbe_obj_class_init_obj(bvm *vm); +extern int lvbe_obj_is_editable(bvm *vm); +extern int lvbe_obj_is_group_def(bvm *vm); +extern int lvbe_obj_init_draw_rect_dsc(bvm *vm); +extern int lvbe_obj_init_draw_label_dsc(bvm *vm); +extern int lvbe_obj_init_draw_img_dsc(bvm *vm); +extern int lvbe_obj_init_draw_line_dsc(bvm *vm); +extern int lvbe_obj_init_draw_arc_dsc(bvm *vm); +extern int lvbe_obj_calculate_ext_draw_size(bvm *vm); +extern int lvbe_obj_refresh_ext_draw_size(bvm *vm); +extern int lvbe_obj_set_pos(bvm *vm); +extern int lvbe_obj_set_x(bvm *vm); +extern int lvbe_obj_set_y(bvm *vm); +extern int lvbe_obj_set_size(bvm *vm); +extern int lvbe_obj_refr_size(bvm *vm); +extern int lvbe_obj_set_width(bvm *vm); +extern int lvbe_obj_set_height(bvm *vm); +extern int lvbe_obj_set_content_width(bvm *vm); +extern int lvbe_obj_set_content_height(bvm *vm); +extern int lvbe_obj_set_layout(bvm *vm); +extern int lvbe_obj_is_layout_positioned(bvm *vm); +extern int lvbe_obj_mark_layout_as_dirty(bvm *vm); +extern int lvbe_obj_update_layout(bvm *vm); +extern int lvbe_obj_set_align(bvm *vm); +extern int lvbe_obj_align(bvm *vm); +extern int lvbe_obj_align_to(bvm *vm); +extern int lvbe_obj_center(bvm *vm); +extern int lvbe_obj_get_coords(bvm *vm); +extern int lvbe_obj_get_x(bvm *vm); +extern int lvbe_obj_get_x2(bvm *vm); +extern int lvbe_obj_get_y(bvm *vm); +extern int lvbe_obj_get_y2(bvm *vm); +extern int lvbe_obj_get_width(bvm *vm); +extern int lvbe_obj_get_height(bvm *vm); +extern int lvbe_obj_get_content_width(bvm *vm); +extern int lvbe_obj_get_content_height(bvm *vm); +extern int lvbe_obj_get_content_coords(bvm *vm); +extern int lvbe_obj_get_self_width(bvm *vm); +extern int lvbe_obj_get_self_height(bvm *vm); +extern int lvbe_obj_refresh_self_size(bvm *vm); +extern int lvbe_obj_refr_pos(bvm *vm); +extern int lvbe_obj_move_to(bvm *vm); +extern int lvbe_obj_move_children_by(bvm *vm); +extern int lvbe_obj_invalidate_area(bvm *vm); +extern int lvbe_obj_invalidate(bvm *vm); +extern int lvbe_obj_area_is_visible(bvm *vm); +extern int lvbe_obj_is_visible(bvm *vm); +extern int lvbe_obj_set_ext_click_area(bvm *vm); +extern int lvbe_obj_get_click_area(bvm *vm); +extern int lvbe_obj_hit_test(bvm *vm); +extern int lvbe_obj_set_scrollbar_mode(bvm *vm); +extern int lvbe_obj_set_scroll_dir(bvm *vm); +extern int lvbe_obj_set_scroll_snap_x(bvm *vm); +extern int lvbe_obj_set_scroll_snap_y(bvm *vm); +extern int lvbe_obj_get_scrollbar_mode(bvm *vm); +extern int lvbe_obj_get_scroll_dir(bvm *vm); +extern int lvbe_obj_get_scroll_snap_x(bvm *vm); +extern int lvbe_obj_get_scroll_snap_y(bvm *vm); +extern int lvbe_obj_get_scroll_x(bvm *vm); +extern int lvbe_obj_get_scroll_y(bvm *vm); +extern int lvbe_obj_get_scroll_top(bvm *vm); +extern int lvbe_obj_get_scroll_bottom(bvm *vm); +extern int lvbe_obj_get_scroll_left(bvm *vm); +extern int lvbe_obj_get_scroll_right(bvm *vm); +extern int lvbe_obj_get_scroll_end(bvm *vm); +extern int lvbe_obj_scroll_by(bvm *vm); +extern int lvbe_obj_scroll_to(bvm *vm); +extern int lvbe_obj_scroll_to_x(bvm *vm); +extern int lvbe_obj_scroll_to_y(bvm *vm); +extern int lvbe_obj_scroll_to_view(bvm *vm); +extern int lvbe_obj_scroll_to_view_recursive(bvm *vm); +extern int lvbe_obj_is_scrolling(bvm *vm); +extern int lvbe_obj_update_snap(bvm *vm); +extern int lvbe_obj_get_scrollbar_area(bvm *vm); +extern int lvbe_obj_scrollbar_invalidate(bvm *vm); +extern int lvbe_obj_readjust_scroll(bvm *vm); +extern int lvbe_obj_add_style(bvm *vm); +extern int lvbe_obj_remove_style(bvm *vm); +extern int lvbe_obj_remove_style_all(bvm *vm); +extern int lvbe_obj_refresh_style(bvm *vm); +extern int lvbe_obj_get_style_prop(bvm *vm); +extern int lvbe_obj_set_local_style_prop(bvm *vm); +extern int lvbe_obj_get_local_style_prop(bvm *vm); +extern int lvbe_obj_remove_local_style_prop(bvm *vm); +extern int lvbe_obj_fade_in(bvm *vm); +extern int lvbe_obj_fade_out(bvm *vm); +extern int lvbe_obj_set_style_pad_all(bvm *vm); +extern int lvbe_obj_set_style_pad_hor(bvm *vm); +extern int lvbe_obj_set_style_pad_ver(bvm *vm); +extern int lvbe_obj_set_style_pad_gap(bvm *vm); +extern int lvbe_obj_set_style_size(bvm *vm); +extern int lvbe_obj_get_style_width(bvm *vm); +extern int lvbe_obj_get_style_min_width(bvm *vm); +extern int lvbe_obj_get_style_max_width(bvm *vm); +extern int lvbe_obj_get_style_height(bvm *vm); +extern int lvbe_obj_get_style_min_height(bvm *vm); +extern int lvbe_obj_get_style_max_height(bvm *vm); +extern int lvbe_obj_get_style_x(bvm *vm); +extern int lvbe_obj_get_style_y(bvm *vm); +extern int lvbe_obj_get_style_align(bvm *vm); +extern int lvbe_obj_get_style_transform_width(bvm *vm); +extern int lvbe_obj_get_style_transform_height(bvm *vm); +extern int lvbe_obj_get_style_translate_x(bvm *vm); +extern int lvbe_obj_get_style_translate_y(bvm *vm); +extern int lvbe_obj_get_style_transform_zoom(bvm *vm); +extern int lvbe_obj_get_style_transform_angle(bvm *vm); +extern int lvbe_obj_get_style_pad_top(bvm *vm); +extern int lvbe_obj_get_style_pad_bottom(bvm *vm); +extern int lvbe_obj_get_style_pad_left(bvm *vm); +extern int lvbe_obj_get_style_pad_right(bvm *vm); +extern int lvbe_obj_get_style_pad_row(bvm *vm); +extern int lvbe_obj_get_style_pad_column(bvm *vm); +extern int lvbe_obj_get_style_radius(bvm *vm); +extern int lvbe_obj_get_style_clip_corner(bvm *vm); +extern int lvbe_obj_get_style_opa(bvm *vm); +extern int lvbe_obj_get_style_color_filter_opa(bvm *vm); +extern int lvbe_obj_get_style_anim_time(bvm *vm); +extern int lvbe_obj_get_style_anim_speed(bvm *vm); +extern int lvbe_obj_get_style_blend_mode(bvm *vm); +extern int lvbe_obj_get_style_layout(bvm *vm); +extern int lvbe_obj_get_style_base_dir(bvm *vm); +extern int lvbe_obj_get_style_bg_color(bvm *vm); +extern int lvbe_obj_get_style_bg_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_bg_opa(bvm *vm); +extern int lvbe_obj_get_style_bg_grad_color(bvm *vm); +extern int lvbe_obj_get_style_bg_grad_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_bg_grad_dir(bvm *vm); +extern int lvbe_obj_get_style_bg_main_stop(bvm *vm); +extern int lvbe_obj_get_style_bg_grad_stop(bvm *vm); +extern int lvbe_obj_get_style_bg_img_src(bvm *vm); +extern int lvbe_obj_get_style_bg_img_opa(bvm *vm); +extern int lvbe_obj_get_style_bg_img_recolor(bvm *vm); +extern int lvbe_obj_get_style_bg_img_recolor_filtered(bvm *vm); +extern int lvbe_obj_get_style_bg_img_recolor_opa(bvm *vm); +extern int lvbe_obj_get_style_bg_img_tiled(bvm *vm); +extern int lvbe_obj_get_style_border_color(bvm *vm); +extern int lvbe_obj_get_style_border_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_border_opa(bvm *vm); +extern int lvbe_obj_get_style_border_width(bvm *vm); +extern int lvbe_obj_get_style_border_side(bvm *vm); +extern int lvbe_obj_get_style_border_post(bvm *vm); +extern int lvbe_obj_get_style_text_color(bvm *vm); +extern int lvbe_obj_get_style_text_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_text_opa(bvm *vm); +extern int lvbe_obj_get_style_text_font(bvm *vm); +extern int lvbe_obj_get_style_text_letter_space(bvm *vm); +extern int lvbe_obj_get_style_text_line_space(bvm *vm); +extern int lvbe_obj_get_style_text_decor(bvm *vm); +extern int lvbe_obj_get_style_text_align(bvm *vm); +extern int lvbe_obj_get_style_img_opa(bvm *vm); +extern int lvbe_obj_get_style_img_recolor(bvm *vm); +extern int lvbe_obj_get_style_img_recolor_filtered(bvm *vm); +extern int lvbe_obj_get_style_img_recolor_opa(bvm *vm); +extern int lvbe_obj_get_style_outline_width(bvm *vm); +extern int lvbe_obj_get_style_outline_color(bvm *vm); +extern int lvbe_obj_get_style_outline_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_outline_opa(bvm *vm); +extern int lvbe_obj_get_style_outline_pad(bvm *vm); +extern int lvbe_obj_get_style_shadow_width(bvm *vm); +extern int lvbe_obj_get_style_shadow_ofs_x(bvm *vm); +extern int lvbe_obj_get_style_shadow_ofs_y(bvm *vm); +extern int lvbe_obj_get_style_shadow_spread(bvm *vm); +extern int lvbe_obj_get_style_shadow_color(bvm *vm); +extern int lvbe_obj_get_style_shadow_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_shadow_opa(bvm *vm); +extern int lvbe_obj_get_style_line_width(bvm *vm); +extern int lvbe_obj_get_style_line_dash_width(bvm *vm); +extern int lvbe_obj_get_style_line_dash_gap(bvm *vm); +extern int lvbe_obj_get_style_line_rounded(bvm *vm); +extern int lvbe_obj_get_style_line_color(bvm *vm); +extern int lvbe_obj_get_style_line_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_line_opa(bvm *vm); +extern int lvbe_obj_get_style_arc_width(bvm *vm); +extern int lvbe_obj_get_style_arc_rounded(bvm *vm); +extern int lvbe_obj_get_style_arc_color(bvm *vm); +extern int lvbe_obj_get_style_arc_color_filtered(bvm *vm); +extern int lvbe_obj_get_style_arc_opa(bvm *vm); +extern int lvbe_obj_get_style_arc_img_src(bvm *vm); +extern int lvbe_obj_set_style_width(bvm *vm); +extern int lvbe_obj_set_style_min_width(bvm *vm); +extern int lvbe_obj_set_style_max_width(bvm *vm); +extern int lvbe_obj_set_style_height(bvm *vm); +extern int lvbe_obj_set_style_min_height(bvm *vm); +extern int lvbe_obj_set_style_max_height(bvm *vm); +extern int lvbe_obj_set_style_x(bvm *vm); +extern int lvbe_obj_set_style_y(bvm *vm); +extern int lvbe_obj_set_style_align(bvm *vm); +extern int lvbe_obj_set_style_transform_width(bvm *vm); +extern int lvbe_obj_set_style_transform_height(bvm *vm); +extern int lvbe_obj_set_style_translate_x(bvm *vm); +extern int lvbe_obj_set_style_translate_y(bvm *vm); +extern int lvbe_obj_set_style_transform_zoom(bvm *vm); +extern int lvbe_obj_set_style_transform_angle(bvm *vm); +extern int lvbe_obj_set_style_pad_top(bvm *vm); +extern int lvbe_obj_set_style_pad_bottom(bvm *vm); +extern int lvbe_obj_set_style_pad_left(bvm *vm); +extern int lvbe_obj_set_style_pad_right(bvm *vm); +extern int lvbe_obj_set_style_pad_row(bvm *vm); +extern int lvbe_obj_set_style_pad_column(bvm *vm); +extern int lvbe_obj_set_style_radius(bvm *vm); +extern int lvbe_obj_set_style_clip_corner(bvm *vm); +extern int lvbe_obj_set_style_opa(bvm *vm); +extern int lvbe_obj_set_style_color_filter_dsc(bvm *vm); +extern int lvbe_obj_set_style_color_filter_opa(bvm *vm); +extern int lvbe_obj_set_style_anim_time(bvm *vm); +extern int lvbe_obj_set_style_anim_speed(bvm *vm); +extern int lvbe_obj_set_style_transition(bvm *vm); +extern int lvbe_obj_set_style_blend_mode(bvm *vm); +extern int lvbe_obj_set_style_layout(bvm *vm); +extern int lvbe_obj_set_style_base_dir(bvm *vm); +extern int lvbe_obj_set_style_bg_color(bvm *vm); +extern int lvbe_obj_set_style_bg_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_bg_opa(bvm *vm); +extern int lvbe_obj_set_style_bg_grad_color(bvm *vm); +extern int lvbe_obj_set_style_bg_grad_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_bg_grad_dir(bvm *vm); +extern int lvbe_obj_set_style_bg_main_stop(bvm *vm); +extern int lvbe_obj_set_style_bg_grad_stop(bvm *vm); +extern int lvbe_obj_set_style_bg_img_src(bvm *vm); +extern int lvbe_obj_set_style_bg_img_opa(bvm *vm); +extern int lvbe_obj_set_style_bg_img_recolor(bvm *vm); +extern int lvbe_obj_set_style_bg_img_recolor_filtered(bvm *vm); +extern int lvbe_obj_set_style_bg_img_recolor_opa(bvm *vm); +extern int lvbe_obj_set_style_bg_img_tiled(bvm *vm); +extern int lvbe_obj_set_style_border_color(bvm *vm); +extern int lvbe_obj_set_style_border_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_border_opa(bvm *vm); +extern int lvbe_obj_set_style_border_width(bvm *vm); +extern int lvbe_obj_set_style_border_side(bvm *vm); +extern int lvbe_obj_set_style_border_post(bvm *vm); +extern int lvbe_obj_set_style_text_color(bvm *vm); +extern int lvbe_obj_set_style_text_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_text_opa(bvm *vm); +extern int lvbe_obj_set_style_text_font(bvm *vm); +extern int lvbe_obj_set_style_text_letter_space(bvm *vm); +extern int lvbe_obj_set_style_text_line_space(bvm *vm); +extern int lvbe_obj_set_style_text_decor(bvm *vm); +extern int lvbe_obj_set_style_text_align(bvm *vm); +extern int lvbe_obj_set_style_img_opa(bvm *vm); +extern int lvbe_obj_set_style_img_recolor(bvm *vm); +extern int lvbe_obj_set_style_img_recolor_filtered(bvm *vm); +extern int lvbe_obj_set_style_img_recolor_opa(bvm *vm); +extern int lvbe_obj_set_style_outline_width(bvm *vm); +extern int lvbe_obj_set_style_outline_color(bvm *vm); +extern int lvbe_obj_set_style_outline_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_outline_opa(bvm *vm); +extern int lvbe_obj_set_style_outline_pad(bvm *vm); +extern int lvbe_obj_set_style_shadow_width(bvm *vm); +extern int lvbe_obj_set_style_shadow_ofs_x(bvm *vm); +extern int lvbe_obj_set_style_shadow_ofs_y(bvm *vm); +extern int lvbe_obj_set_style_shadow_spread(bvm *vm); +extern int lvbe_obj_set_style_shadow_color(bvm *vm); +extern int lvbe_obj_set_style_shadow_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_shadow_opa(bvm *vm); +extern int lvbe_obj_set_style_line_width(bvm *vm); +extern int lvbe_obj_set_style_line_dash_width(bvm *vm); +extern int lvbe_obj_set_style_line_dash_gap(bvm *vm); +extern int lvbe_obj_set_style_line_rounded(bvm *vm); +extern int lvbe_obj_set_style_line_color(bvm *vm); +extern int lvbe_obj_set_style_line_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_line_opa(bvm *vm); +extern int lvbe_obj_set_style_arc_width(bvm *vm); +extern int lvbe_obj_set_style_arc_rounded(bvm *vm); +extern int lvbe_obj_set_style_arc_color(bvm *vm); +extern int lvbe_obj_set_style_arc_color_filtered(bvm *vm); +extern int lvbe_obj_set_style_arc_opa(bvm *vm); +extern int lvbe_obj_set_style_arc_img_src(bvm *vm); +extern int lvbe_obj_del(bvm *vm); +extern int lvbe_obj_clean(bvm *vm); +extern int lvbe_obj_del_async(bvm *vm); +extern int lvbe_obj_set_parent(bvm *vm); +extern int lvbe_obj_move_foreground(bvm *vm); +extern int lvbe_obj_move_background(bvm *vm); +extern int lvbe_obj_get_screen(bvm *vm); +extern int lvbe_obj_get_disp(bvm *vm); +extern int lvbe_obj_get_parent(bvm *vm); +extern int lvbe_obj_get_child(bvm *vm); +extern int lvbe_obj_get_child_cnt(bvm *vm); +extern int lvbe_obj_get_child_id(bvm *vm); +extern int lvbe_obj_tree_walk(bvm *vm); + +/* `lv_group` external functions definitions */ +extern int lvbe_group_create(bvm *vm); +extern int lvbe_group_del(bvm *vm); +extern int lvbe_group_set_default(bvm *vm); +extern int lvbe_group_add_obj(bvm *vm); +extern int lvbe_group_remove_obj(bvm *vm); +extern int lvbe_group_remove_all_objs(bvm *vm); +extern int lvbe_group_focus_obj(bvm *vm); +extern int lvbe_group_focus_next(bvm *vm); +extern int lvbe_group_focus_prev(bvm *vm); +extern int lvbe_group_focus_freeze(bvm *vm); +extern int lvbe_group_send_data(bvm *vm); +extern int lvbe_group_set_focus_cb(bvm *vm); +extern int lvbe_group_set_refocus_policy(bvm *vm); +extern int lvbe_group_set_editing(bvm *vm); +extern int lvbe_group_set_wrap(bvm *vm); +extern int lvbe_group_get_focused(bvm *vm); +extern int lvbe_group_get_focus_cb(bvm *vm); +extern int lvbe_group_get_editing(bvm *vm); +extern int lvbe_group_get_wrap(bvm *vm); +extern int lvbe_group_get_obj_count(bvm *vm); + +/* `lv_indev` external functions definitions */ +extern int lvbe_indev_enable(bvm *vm); +extern int lvbe_indev_get_type(bvm *vm); +extern int lvbe_indev_reset(bvm *vm); +extern int lvbe_indev_reset_long_press(bvm *vm); +extern int lvbe_indev_set_cursor(bvm *vm); +extern int lvbe_indev_set_group(bvm *vm); +extern int lvbe_indev_set_button_points(bvm *vm); +extern int lvbe_indev_get_point(bvm *vm); +extern int lvbe_indev_get_gesture_dir(bvm *vm); +extern int lvbe_indev_get_key(bvm *vm); +extern int lvbe_indev_get_scroll_dir(bvm *vm); +extern int lvbe_indev_get_scroll_obj(bvm *vm); +extern int lvbe_indev_get_vect(bvm *vm); +extern int lvbe_indev_wait_release(bvm *vm); +extern int lvbe_indev_search_obj(bvm *vm); + +/* `lv_chart` external functions definitions */ +extern int lvbe_chart_create(bvm *vm); +extern int lvbe_chart_set_type(bvm *vm); +extern int lvbe_chart_set_point_count(bvm *vm); +extern int lvbe_chart_set_range(bvm *vm); +extern int lvbe_chart_set_update_mode(bvm *vm); +extern int lvbe_chart_set_div_line_count(bvm *vm); +extern int lvbe_chart_set_zoom_x(bvm *vm); +extern int lvbe_chart_set_zoom_y(bvm *vm); +extern int lvbe_chart_get_zoom_x(bvm *vm); +extern int lvbe_chart_get_zoom_y(bvm *vm); +extern int lvbe_chart_set_axis_tick(bvm *vm); +extern int lvbe_chart_get_type(bvm *vm); +extern int lvbe_chart_get_point_count(bvm *vm); +extern int lvbe_chart_get_x_start_point(bvm *vm); +extern int lvbe_chart_get_point_pos_by_id(bvm *vm); +extern int lvbe_chart_refresh(bvm *vm); +extern int lvbe_chart_remove_series(bvm *vm); +extern int lvbe_chart_hide_series(bvm *vm); +extern int lvbe_chart_set_series_color(bvm *vm); +extern int lvbe_chart_set_x_start_point(bvm *vm); +extern int lvbe_chart_set_cursor_pos(bvm *vm); +extern int lvbe_chart_set_cursor_point(bvm *vm); +extern int lvbe_chart_get_cursor_point(bvm *vm); +extern int lvbe_chart_set_all_value(bvm *vm); +extern int lvbe_chart_set_next_value(bvm *vm); +extern int lvbe_chart_set_next_value2(bvm *vm); +extern int lvbe_chart_set_value_by_id(bvm *vm); +extern int lvbe_chart_set_value_by_id2(bvm *vm); +extern int lvbe_chart_set_ext_y_array(bvm *vm); +extern int lvbe_chart_set_ext_x_array(bvm *vm); +extern int lvbe_chart_get_pressed_point(bvm *vm); + +/* `lv_colorwheel` external functions definitions */ +extern int lvbe_colorwheel_create(bvm *vm); +extern int lvbe_colorwheel_set_hsv(bvm *vm); +extern int lvbe_colorwheel_set_rgb(bvm *vm); +extern int lvbe_colorwheel_set_mode(bvm *vm); +extern int lvbe_colorwheel_set_mode_fixed(bvm *vm); +extern int lvbe_colorwheel_get_hsv(bvm *vm); +extern int lvbe_colorwheel_get_rgb(bvm *vm); +extern int lvbe_colorwheel_get_color_mode(bvm *vm); +extern int lvbe_colorwheel_get_color_mode_fixed(bvm *vm); + +/* `lv_imgbtn` external functions definitions */ +extern int lvbe_imgbtn_create(bvm *vm); +extern int lvbe_imgbtn_set_src(bvm *vm); + +/* `lv_led` external functions definitions */ +extern int lvbe_led_create(bvm *vm); +extern int lvbe_led_set_color(bvm *vm); +extern int lvbe_led_set_brightness(bvm *vm); +extern int lvbe_led_on(bvm *vm); +extern int lvbe_led_off(bvm *vm); +extern int lvbe_led_toggle(bvm *vm); +extern int lvbe_led_get_brightness(bvm *vm); + +/* `lv_meter` external functions definitions */ +extern int lvbe_meter_create(bvm *vm); +extern int lvbe_meter_add_scale(bvm *vm); +extern int lvbe_meter_set_scale_ticks(bvm *vm); +extern int lvbe_meter_set_scale_major_ticks(bvm *vm); +extern int lvbe_meter_set_scale_range(bvm *vm); +extern int lvbe_meter_add_needle_line(bvm *vm); +extern int lvbe_meter_add_needle_img(bvm *vm); +extern int lvbe_meter_add_arc(bvm *vm); +extern int lvbe_meter_add_scale_lines(bvm *vm); +extern int lvbe_meter_set_indicator_value(bvm *vm); +extern int lvbe_meter_set_indicator_start_value(bvm *vm); +extern int lvbe_meter_set_indicator_end_value(bvm *vm); + +/* `lv_msgbox` external functions definitions */ +extern int lvbe_msgbox_create(bvm *vm); +extern int lvbe_msgbox_get_title(bvm *vm); +extern int lvbe_msgbox_get_close_btn(bvm *vm); +extern int lvbe_msgbox_get_text(bvm *vm); +extern int lvbe_msgbox_get_btns(bvm *vm); +extern int lvbe_msgbox_get_active_btn_text(bvm *vm); +extern int lvbe_msgbox_close(bvm *vm); + +/* `lv_spinbox` external functions definitions */ +extern int lvbe_spinbox_create(bvm *vm); +extern int lvbe_spinbox_set_value(bvm *vm); +extern int lvbe_spinbox_set_rollover(bvm *vm); +extern int lvbe_spinbox_set_digit_format(bvm *vm); +extern int lvbe_spinbox_set_step(bvm *vm); +extern int lvbe_spinbox_set_range(bvm *vm); +extern int lvbe_spinbox_get_rollover(bvm *vm); +extern int lvbe_spinbox_get_value(bvm *vm); +extern int lvbe_spinbox_get_step(bvm *vm); +extern int lvbe_spinbox_step_next(bvm *vm); +extern int lvbe_spinbox_step_prev(bvm *vm); +extern int lvbe_spinbox_increment(bvm *vm); +extern int lvbe_spinbox_decrement(bvm *vm); + +/* `lv_spinner` external functions definitions */ +extern int lvbe_spinner_create(bvm *vm); + +/* `lv_arc` external functions definitions */ +extern int lvbe_arc_create(bvm *vm); +extern int lvbe_arc_set_start_angle(bvm *vm); +extern int lvbe_arc_set_end_angle(bvm *vm); +extern int lvbe_arc_set_angles(bvm *vm); +extern int lvbe_arc_set_bg_start_angle(bvm *vm); +extern int lvbe_arc_set_bg_end_angle(bvm *vm); +extern int lvbe_arc_set_bg_angles(bvm *vm); +extern int lvbe_arc_set_rotation(bvm *vm); +extern int lvbe_arc_set_mode(bvm *vm); +extern int lvbe_arc_set_value(bvm *vm); +extern int lvbe_arc_set_range(bvm *vm); +extern int lvbe_arc_set_change_rate(bvm *vm); +extern int lvbe_arc_get_angle_start(bvm *vm); +extern int lvbe_arc_get_angle_end(bvm *vm); +extern int lvbe_arc_get_bg_angle_start(bvm *vm); +extern int lvbe_arc_get_bg_angle_end(bvm *vm); +extern int lvbe_arc_get_value(bvm *vm); +extern int lvbe_arc_get_min_value(bvm *vm); +extern int lvbe_arc_get_max_value(bvm *vm); +extern int lvbe_arc_get_mode(bvm *vm); + +/* `lv_bar` external functions definitions */ +extern int lvbe_bar_create(bvm *vm); +extern int lvbe_bar_set_value(bvm *vm); +extern int lvbe_bar_set_start_value(bvm *vm); +extern int lvbe_bar_set_range(bvm *vm); +extern int lvbe_bar_set_mode(bvm *vm); +extern int lvbe_bar_get_value(bvm *vm); +extern int lvbe_bar_get_start_value(bvm *vm); +extern int lvbe_bar_get_min_value(bvm *vm); +extern int lvbe_bar_get_max_value(bvm *vm); +extern int lvbe_bar_get_mode(bvm *vm); + +/* `lv_btn` external functions definitions */ +extern int lvbe_btn_create(bvm *vm); + +/* `lv_btnmatrix` external functions definitions */ +extern int lvbe_btnmatrix_create(bvm *vm); +extern int lvbe_btnmatrix_set_map(bvm *vm); +extern int lvbe_btnmatrix_set_ctrl_map(bvm *vm); +extern int lvbe_btnmatrix_set_selected_btn(bvm *vm); +extern int lvbe_btnmatrix_set_btn_ctrl(bvm *vm); +extern int lvbe_btnmatrix_clear_btn_ctrl(bvm *vm); +extern int lvbe_btnmatrix_set_btn_ctrl_all(bvm *vm); +extern int lvbe_btnmatrix_clear_btn_ctrl_all(bvm *vm); +extern int lvbe_btnmatrix_set_btn_width(bvm *vm); +extern int lvbe_btnmatrix_set_one_checked(bvm *vm); +extern int lvbe_btnmatrix_get_selected_btn(bvm *vm); +extern int lvbe_btnmatrix_get_btn_text(bvm *vm); +extern int lvbe_btnmatrix_has_btn_ctrl(bvm *vm); +extern int lvbe_btnmatrix_get_one_checked(bvm *vm); + +/* `lv_canvas` external functions definitions */ +extern int lvbe_canvas_create(bvm *vm); +extern int lvbe_canvas_set_buffer(bvm *vm); +extern int lvbe_canvas_set_px(bvm *vm); +extern int lvbe_canvas_set_palette(bvm *vm); +extern int lvbe_canvas_get_px(bvm *vm); +extern int lvbe_canvas_copy_buf(bvm *vm); +extern int lvbe_canvas_transform(bvm *vm); +extern int lvbe_canvas_blur_hor(bvm *vm); +extern int lvbe_canvas_blur_ver(bvm *vm); +extern int lvbe_canvas_fill_bg(bvm *vm); +extern int lvbe_canvas_draw_rect(bvm *vm); +extern int lvbe_canvas_draw_text(bvm *vm); +extern int lvbe_canvas_draw_img(bvm *vm); +extern int lvbe_canvas_draw_line(bvm *vm); +extern int lvbe_canvas_draw_polygon(bvm *vm); +extern int lvbe_canvas_draw_arc(bvm *vm); + +/* `lv_checkbox` external functions definitions */ +extern int lvbe_checkbox_create(bvm *vm); +extern int lvbe_checkbox_set_text(bvm *vm); +extern int lvbe_checkbox_set_text_static(bvm *vm); +extern int lvbe_checkbox_get_text(bvm *vm); + +/* `lv_dropdown` external functions definitions */ +extern int lvbe_dropdown_create(bvm *vm); +extern int lvbe_dropdown_set_text(bvm *vm); +extern int lvbe_dropdown_set_options(bvm *vm); +extern int lvbe_dropdown_set_options_static(bvm *vm); +extern int lvbe_dropdown_add_option(bvm *vm); +extern int lvbe_dropdown_clear_options(bvm *vm); +extern int lvbe_dropdown_set_selected(bvm *vm); +extern int lvbe_dropdown_set_dir(bvm *vm); +extern int lvbe_dropdown_set_symbol(bvm *vm); +extern int lvbe_dropdown_set_selected_highlight(bvm *vm); +extern int lvbe_dropdown_get_list(bvm *vm); +extern int lvbe_dropdown_get_text(bvm *vm); +extern int lvbe_dropdown_get_options(bvm *vm); +extern int lvbe_dropdown_get_selected(bvm *vm); +extern int lvbe_dropdown_get_option_cnt(bvm *vm); +extern int lvbe_dropdown_get_selected_str(bvm *vm); +extern int lvbe_dropdown_get_symbol(bvm *vm); +extern int lvbe_dropdown_get_selected_highlight(bvm *vm); +extern int lvbe_dropdown_get_dir(bvm *vm); +extern int lvbe_dropdown_open(bvm *vm); +extern int lvbe_dropdown_close(bvm *vm); + +/* `lv_label` external functions definitions */ +extern int lvbe_label_create(bvm *vm); +extern int lvbe_label_set_text(bvm *vm); +extern int lvbe_label_set_text_fmt(bvm *vm); +extern int lvbe_label_set_text_static(bvm *vm); +extern int lvbe_label_set_long_mode(bvm *vm); +extern int lvbe_label_set_recolor(bvm *vm); +extern int lvbe_label_set_text_sel_start(bvm *vm); +extern int lvbe_label_set_text_sel_end(bvm *vm); +extern int lvbe_label_get_text(bvm *vm); +extern int lvbe_label_get_long_mode(bvm *vm); +extern int lvbe_label_get_recolor(bvm *vm); +extern int lvbe_label_get_letter_pos(bvm *vm); +extern int lvbe_label_get_letter_on(bvm *vm); +extern int lvbe_label_is_char_under_pos(bvm *vm); +extern int lvbe_label_get_text_selection_start(bvm *vm); +extern int lvbe_label_get_text_selection_end(bvm *vm); +extern int lvbe_label_ins_text(bvm *vm); +extern int lvbe_label_cut_text(bvm *vm); + +/* `lv_line` external functions definitions */ +extern int lvbe_line_create(bvm *vm); +extern int lvbe_line_set_points(bvm *vm); +extern int lvbe_line_set_y_invert(bvm *vm); +extern int lvbe_line_get_y_invert(bvm *vm); + +/* `lv_roller` external functions definitions */ +extern int lvbe_roller_create(bvm *vm); +extern int lvbe_roller_set_options(bvm *vm); +extern int lvbe_roller_set_selected(bvm *vm); +extern int lvbe_roller_set_visible_row_count(bvm *vm); +extern int lvbe_roller_get_selected(bvm *vm); +extern int lvbe_roller_get_selected_str(bvm *vm); +extern int lvbe_roller_get_options(bvm *vm); +extern int lvbe_roller_get_option_cnt(bvm *vm); + +/* `lv_slider` external functions definitions */ +extern int lvbe_slider_create(bvm *vm); +extern int lvbe_slider_set_value(bvm *vm); +extern int lvbe_slider_set_left_value(bvm *vm); +extern int lvbe_slider_set_range(bvm *vm); +extern int lvbe_slider_set_mode(bvm *vm); +extern int lvbe_slider_get_value(bvm *vm); +extern int lvbe_slider_get_left_value(bvm *vm); +extern int lvbe_slider_get_min_value(bvm *vm); +extern int lvbe_slider_get_max_value(bvm *vm); +extern int lvbe_slider_is_dragged(bvm *vm); +extern int lvbe_slider_get_mode(bvm *vm); + +/* `lv_switch` external functions definitions */ +extern int lvbe_switch_create(bvm *vm); + +/* `lv_table` external functions definitions */ +extern int lvbe_table_create(bvm *vm); +extern int lvbe_table_set_cell_value(bvm *vm); +extern int lvbe_table_set_cell_value_fmt(bvm *vm); +extern int lvbe_table_set_row_cnt(bvm *vm); +extern int lvbe_table_set_col_cnt(bvm *vm); +extern int lvbe_table_set_col_width(bvm *vm); +extern int lvbe_table_add_cell_ctrl(bvm *vm); +extern int lvbe_table_clear_cell_ctrl(bvm *vm); +extern int lvbe_table_get_cell_value(bvm *vm); +extern int lvbe_table_get_row_cnt(bvm *vm); +extern int lvbe_table_get_col_cnt(bvm *vm); +extern int lvbe_table_get_col_width(bvm *vm); +extern int lvbe_table_has_cell_ctrl(bvm *vm); +extern int lvbe_table_get_selected_cell(bvm *vm); + +/* `lv_textarea` external functions definitions */ +extern int lvbe_textarea_create(bvm *vm); +extern int lvbe_textarea_add_char(bvm *vm); +extern int lvbe_textarea_add_text(bvm *vm); +extern int lvbe_textarea_del_char(bvm *vm); +extern int lvbe_textarea_del_char_forward(bvm *vm); +extern int lvbe_textarea_set_text(bvm *vm); +extern int lvbe_textarea_set_placeholder_text(bvm *vm); +extern int lvbe_textarea_set_cursor_pos(bvm *vm); +extern int lvbe_textarea_set_cursor_click_pos(bvm *vm); +extern int lvbe_textarea_set_password_mode(bvm *vm); +extern int lvbe_textarea_set_one_line(bvm *vm); +extern int lvbe_textarea_set_accepted_chars(bvm *vm); +extern int lvbe_textarea_set_max_length(bvm *vm); +extern int lvbe_textarea_set_insert_replace(bvm *vm); +extern int lvbe_textarea_set_text_selection(bvm *vm); +extern int lvbe_textarea_set_password_show_time(bvm *vm); +extern int lvbe_textarea_set_align(bvm *vm); +extern int lvbe_textarea_get_text(bvm *vm); +extern int lvbe_textarea_get_placeholder_text(bvm *vm); +extern int lvbe_textarea_get_label(bvm *vm); +extern int lvbe_textarea_get_cursor_pos(bvm *vm); +extern int lvbe_textarea_get_cursor_click_pos(bvm *vm); +extern int lvbe_textarea_get_password_mode(bvm *vm); +extern int lvbe_textarea_get_one_line(bvm *vm); +extern int lvbe_textarea_get_accepted_chars(bvm *vm); +extern int lvbe_textarea_get_max_length(bvm *vm); +extern int lvbe_textarea_text_is_selected(bvm *vm); +extern int lvbe_textarea_get_text_selection(bvm *vm); +extern int lvbe_textarea_get_password_show_time(bvm *vm); +extern int lvbe_textarea_clear_selection(bvm *vm); +extern int lvbe_textarea_cursor_right(bvm *vm); +extern int lvbe_textarea_cursor_left(bvm *vm); +extern int lvbe_textarea_cursor_down(bvm *vm); +extern int lvbe_textarea_cursor_up(bvm *vm); + +extern int be_ntv_lv_style_init(bvm *vm); +extern int be_ntv_lv_font_init(bvm *vm); +extern int be_ntv_lv_color_init(bvm *vm); +extern int be_ntv_lv_theme_init(bvm *vm); +extern int be_ntv_lv_img_init(bvm *vm); +extern int be_ntv_lv_disp_init(bvm *vm); +extern int be_ntv_lv_obj_init(bvm *vm); +extern int be_ntv_lv_group_init(bvm *vm); +extern int be_ntv_lv_indev_init(bvm *vm); +extern int be_ntv_lv_chart_init(bvm *vm); +extern int be_ntv_lv_colorwheel_init(bvm *vm); +extern int be_ntv_lv_imgbtn_init(bvm *vm); +extern int be_ntv_lv_led_init(bvm *vm); +extern int be_ntv_lv_meter_init(bvm *vm); +extern int be_ntv_lv_msgbox_init(bvm *vm); +extern int be_ntv_lv_spinbox_init(bvm *vm); +extern int be_ntv_lv_spinner_init(bvm *vm); +extern int be_ntv_lv_arc_init(bvm *vm); +extern int be_ntv_lv_bar_init(bvm *vm); +extern int be_ntv_lv_btn_init(bvm *vm); +extern int be_ntv_lv_btnmatrix_init(bvm *vm); +extern int be_ntv_lv_canvas_init(bvm *vm); +extern int be_ntv_lv_checkbox_init(bvm *vm); +extern int be_ntv_lv_dropdown_init(bvm *vm); +extern int be_ntv_lv_label_init(bvm *vm); +extern int be_ntv_lv_line_init(bvm *vm); +extern int be_ntv_lv_roller_init(bvm *vm); +extern int be_ntv_lv_slider_init(bvm *vm); +extern int be_ntv_lv_switch_init(bvm *vm); +extern int be_ntv_lv_table_init(bvm *vm); +extern int be_ntv_lv_textarea_init(bvm *vm); + +extern const bclass be_class_lv_arc; +extern const bclass be_class_lv_bar; +extern const bclass be_class_lv_btn; +extern const bclass be_class_lv_btnmatrix; +extern const bclass be_class_lv_canvas; +extern const bclass be_class_lv_chart; +extern const bclass be_class_lv_checkbox; +extern const bclass be_class_lv_color; +extern const bclass be_class_lv_colorwheel; +extern const bclass be_class_lv_disp; +extern const bclass be_class_lv_dropdown; +extern const bclass be_class_lv_font; +extern const bclass be_class_lv_group; +extern const bclass be_class_lv_img; +extern const bclass be_class_lv_imgbtn; +extern const bclass be_class_lv_indev; +extern const bclass be_class_lv_label; +extern const bclass be_class_lv_led; +extern const bclass be_class_lv_line; +extern const bclass be_class_lv_meter; +extern const bclass be_class_lv_msgbox; +extern const bclass be_class_lv_obj; +extern const bclass be_class_lv_roller; +extern const bclass be_class_lv_slider; +extern const bclass be_class_lv_spinbox; +extern const bclass be_class_lv_spinner; +extern const bclass be_class_lv_style; +extern const bclass be_class_lv_switch; +extern const bclass be_class_lv_table; +extern const bclass be_class_lv_textarea; +extern const bclass be_class_lv_theme; + + +/******************************************************************** +** Solidified class: lv_style +********************************************************************/ +be_local_class(lv_style, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(lvs_init) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvs_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("member", 719708611, 6, 0), be_const_func(lvx_member) }, + })), + (be_nested_const_str("lv_style", -143355747, 8)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_obj +********************************************************************/ +be_local_class(lv_obj, + 1, + NULL, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("tostring", -1995258651, 8, 3), be_const_func(lvx_tostring) }, + { be_nested_key("member", 719708611, 6, -1), be_const_func(lvx_member) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("init", 380752755, 4, 4), be_const_func(be_ntv_lv_obj_init) }, + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_obj_class) }, + })), + (be_nested_const_str("lv_obj", -37134147, 6)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_group +********************************************************************/ +be_local_class(lv_group, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_group_init) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvx_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("member", 719708611, 6, 0), be_const_func(lvx_member) }, + })), + (be_nested_const_str("lv_group", -442928277, 8)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_indev +********************************************************************/ +be_local_class(lv_indev, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(lv0_init) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvx_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("member", 719708611, 6, 0), be_const_func(lvx_member) }, + })), + (be_nested_const_str("lv_indev", 225602374, 8)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_disp +********************************************************************/ +be_local_class(lv_disp, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(lv0_init) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvx_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("member", 719708611, 6, 0), be_const_func(lvx_member) }, + })), + (be_nested_const_str("lv_disp", 609712084, 8)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_font +********************************************************************/ +be_local_class(lv_font, + 1, + NULL, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(lvbe_font_create) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvx_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + })), + (be_nested_const_str("lv_font", 1550958453, 7)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_theme +********************************************************************/ +be_local_class(lv_theme, + 1, + NULL, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("init", 380752755, 4, -1), be_const_func(lvbe_theme_create) }, + { be_nested_key("tostring", -1995258651, 8, -1), be_const_func(lvx_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + })), + (be_nested_const_str("lv_theme", 1550958453, 7)) +); +/*******************************************************************/ + +/******************************************************************** +** Solidified class: lv_color +********************************************************************/ +be_local_class(lv_color, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("toint", -681784387, 5, -1), be_const_func(lco_toint) }, + { be_nested_key("tostring", -1995258651, 8, 0), be_const_func(lco_tostring) }, + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(lco_init) }, + })), + (be_nested_const_str("lv_color", 1419148319, 8)) +); +/*******************************************************************/ + +void be_load_lv_style_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_style); + be_setglobal(vm, "lv_style"); + be_pop(vm, 1); +} + +void be_load_lv_font_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_font); + be_setglobal(vm, "lv_font"); + be_pop(vm, 1); +} + +void be_load_lv_color_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_color); + be_setglobal(vm, "lv_color"); + be_pop(vm, 1); +} + +void be_load_lv_theme_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_theme); + be_setglobal(vm, "lv_theme"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_img +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_img, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_img_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_img_init) }, + })), + (be_nested_const_str("lv_img", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_img_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_img); + be_setglobal(vm, "lv_img"); + be_pop(vm, 1); +} + +void be_load_lv_disp_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_disp); + be_setglobal(vm, "lv_disp"); + be_pop(vm, 1); +} + +void be_load_lv_obj_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_obj); + be_setglobal(vm, "lv_obj"); + be_pop(vm, 1); +} + +void be_load_lv_group_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_group); + be_setglobal(vm, "lv_group"); + be_pop(vm, 1); +} + +void be_load_lv_indev_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_indev); + be_setglobal(vm, "lv_indev"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_chart +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_chart, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_chart_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_chart_init) }, + })), + (be_nested_const_str("lv_chart", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_chart_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_chart); + be_setglobal(vm, "lv_chart"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_colorwheel +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_colorwheel, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_colorwheel_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_colorwheel_init) }, + })), + (be_nested_const_str("lv_colorwheel", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_colorwheel_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_colorwheel); + be_setglobal(vm, "lv_colorwheel"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_imgbtn +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_imgbtn, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_imgbtn_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_imgbtn_init) }, + })), + (be_nested_const_str("lv_imgbtn", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_imgbtn_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_imgbtn); + be_setglobal(vm, "lv_imgbtn"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_led +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_led, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_led_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_led_init) }, + })), + (be_nested_const_str("lv_led", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_led_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_led); + be_setglobal(vm, "lv_led"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_meter +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_meter, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_meter_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_meter_init) }, + })), + (be_nested_const_str("lv_meter", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_meter_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_meter); + be_setglobal(vm, "lv_meter"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_msgbox +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_msgbox, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_msgbox_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_msgbox_init) }, + })), + (be_nested_const_str("lv_msgbox", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_msgbox_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_msgbox); + be_setglobal(vm, "lv_msgbox"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_spinbox +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_spinbox, + 0, + &be_class_lv_textarea, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_spinbox_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_spinbox_init) }, + })), + (be_nested_const_str("lv_spinbox", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_spinbox_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_spinbox); + be_setglobal(vm, "lv_spinbox"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_spinner +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_spinner, + 0, + &be_class_lv_arc, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_spinner_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_spinner_init) }, + })), + (be_nested_const_str("lv_spinner", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_spinner_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_spinner); + be_setglobal(vm, "lv_spinner"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_arc +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_arc, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_arc_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_arc_init) }, + })), + (be_nested_const_str("lv_arc", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_arc_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_arc); + be_setglobal(vm, "lv_arc"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_bar +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_bar, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_bar_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_bar_init) }, + })), + (be_nested_const_str("lv_bar", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_bar_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_bar); + be_setglobal(vm, "lv_bar"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_btn +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_btn, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_btn_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_btn_init) }, + })), + (be_nested_const_str("lv_btn", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_btn_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_btn); + be_setglobal(vm, "lv_btn"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_btnmatrix +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_btnmatrix, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_btnmatrix_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_btnmatrix_init) }, + })), + (be_nested_const_str("lv_btnmatrix", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_btnmatrix_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_btnmatrix); + be_setglobal(vm, "lv_btnmatrix"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_canvas +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_canvas, + 0, + &be_class_lv_img, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_canvas_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_canvas_init) }, + })), + (be_nested_const_str("lv_canvas", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_canvas_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_canvas); + be_setglobal(vm, "lv_canvas"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_checkbox +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_checkbox, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_checkbox_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_checkbox_init) }, + })), + (be_nested_const_str("lv_checkbox", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_checkbox_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_checkbox); + be_setglobal(vm, "lv_checkbox"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_dropdown +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_dropdown, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_dropdown_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_dropdown_init) }, + })), + (be_nested_const_str("lv_dropdown", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_dropdown_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_dropdown); + be_setglobal(vm, "lv_dropdown"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_label +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_label, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_label_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_label_init) }, + })), + (be_nested_const_str("lv_label", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_label_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_label); + be_setglobal(vm, "lv_label"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_line +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_line, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_line_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_line_init) }, + })), + (be_nested_const_str("lv_line", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_line_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_line); + be_setglobal(vm, "lv_line"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_roller +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_roller, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_roller_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_roller_init) }, + })), + (be_nested_const_str("lv_roller", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_roller_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_roller); + be_setglobal(vm, "lv_roller"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_slider +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_slider, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_slider_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_slider_init) }, + })), + (be_nested_const_str("lv_slider", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_slider_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_slider); + be_setglobal(vm, "lv_slider"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_switch +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_switch, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_switch_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_switch_init) }, + })), + (be_nested_const_str("lv_switch", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_switch_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_switch); + be_setglobal(vm, "lv_switch"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_table +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_table, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_table_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_table_init) }, + })), + (be_nested_const_str("lv_table", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_table_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_table); + be_setglobal(vm, "lv_table"); + be_pop(vm, 1); +} + +/******************************************************************** +** Solidified class: lv_textarea +********************************************************************/ +extern const bclass be_class_lv_obj; +be_local_class(lv_textarea, + 0, + &be_class_lv_obj, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_class", -1562820946, 6, -1), be_const_comptr(&lv_textarea_class) }, + { be_nested_key("init", 380752755, 4, -1), be_const_func(be_ntv_lv_textarea_init) }, + })), + (be_nested_const_str("lv_textarea", 1612829968, 6)) +); +/*******************************************************************/ + +void be_load_lv_textarea_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_textarea); + be_setglobal(vm, "lv_textarea"); + be_pop(vm, 1); +} + + +#endif // USE_LVGL + diff --git a/lib/libesp32/berry/default/be_lvgl_wifi_arcs_icon_lib.c b/lib/libesp32/berry/default/be_lvgl_wifi_arcs_icon_lib.c new file mode 100644 index 000000000..d8fe9ce08 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_wifi_arcs_icon_lib.c @@ -0,0 +1,140 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_wifi_arcs_icon_init, /* name */ + be_nested_proto( + 10, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[18]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(set_style_line_color), + /* K2 */ be_nested_str(lv), + /* K3 */ be_nested_str(color), + /* K4 */ be_nested_str(COLOR_WHITE), + /* K5 */ be_nested_str(PART_MAIN), + /* K6 */ be_nested_str(STATE_DEFAULT), + /* K7 */ be_nested_str(set_style_bg_color), + /* K8 */ be_nested_str(COLOR_BLACK), + /* K9 */ be_nested_str(get_height), + /* K10 */ be_nested_str(get_style_pad_right), + /* K11 */ be_nested_str(set_height), + /* K12 */ be_const_int(3), + /* K13 */ be_nested_str(set_width), + /* K14 */ be_nested_str(set_x), + /* K15 */ be_nested_str(get_width), + /* K16 */ be_nested_str(set_style_pad_right), + /* K17 */ be_const_int(1), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[67]) { /* code */ + 0x60080003, // 0000 GETGBL R2 G3 + 0x5C0C0000, // 0001 MOVE R3 R0 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080500, // 0003 GETMET R2 R2 K0 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0x8C080101, // 0006 GETMET R2 R0 K1 + 0xB8120400, // 0007 GETNGBL R4 K2 + 0x8C100903, // 0008 GETMET R4 R4 K3 + 0xB81A0400, // 0009 GETNGBL R6 K2 + 0x88180D04, // 000A GETMBR R6 R6 K4 + 0x7C100400, // 000B CALL R4 2 + 0xB8160400, // 000C GETNGBL R5 K2 + 0x88140B05, // 000D GETMBR R5 R5 K5 + 0xB81A0400, // 000E GETNGBL R6 K2 + 0x88180D06, // 000F GETMBR R6 R6 K6 + 0x30140A06, // 0010 OR R5 R5 R6 + 0x7C080600, // 0011 CALL R2 3 + 0x8C080107, // 0012 GETMET R2 R0 K7 + 0xB8120400, // 0013 GETNGBL R4 K2 + 0x8C100903, // 0014 GETMET R4 R4 K3 + 0xB81A0400, // 0015 GETNGBL R6 K2 + 0x88180D08, // 0016 GETMBR R6 R6 K8 + 0x7C100400, // 0017 CALL R4 2 + 0xB8160400, // 0018 GETNGBL R5 K2 + 0x88140B05, // 0019 GETMBR R5 R5 K5 + 0xB81A0400, // 001A GETNGBL R6 K2 + 0x88180D06, // 001B GETMBR R6 R6 K6 + 0x30140A06, // 001C OR R5 R5 R6 + 0x7C080600, // 001D CALL R2 3 + 0x4C080000, // 001E LDNIL R2 + 0x20080202, // 001F NE R2 R1 R2 + 0x780A0020, // 0020 JMPF R2 #0042 + 0x8C080309, // 0021 GETMET R2 R1 K9 + 0x7C080200, // 0022 CALL R2 1 + 0x8C0C030A, // 0023 GETMET R3 R1 K10 + 0xB8160400, // 0024 GETNGBL R5 K2 + 0x88140B05, // 0025 GETMBR R5 R5 K5 + 0xB81A0400, // 0026 GETNGBL R6 K2 + 0x88180D06, // 0027 GETMBR R6 R6 K6 + 0x30140A06, // 0028 OR R5 R5 R6 + 0x7C0C0400, // 0029 CALL R3 2 + 0x8C10010B, // 002A GETMET R4 R0 K11 + 0x5C180400, // 002B MOVE R6 R2 + 0x7C100400, // 002C CALL R4 2 + 0x54120003, // 002D LDINT R4 4 + 0x08100404, // 002E MUL R4 R2 R4 + 0x0C10090C, // 002F DIV R4 R4 K12 + 0x8C14010D, // 0030 GETMET R5 R0 K13 + 0x5C1C0800, // 0031 MOVE R7 R4 + 0x7C140400, // 0032 CALL R5 2 + 0x8C14010E, // 0033 GETMET R5 R0 K14 + 0x8C1C030F, // 0034 GETMET R7 R1 K15 + 0x7C1C0200, // 0035 CALL R7 1 + 0x041C0E04, // 0036 SUB R7 R7 R4 + 0x041C0E03, // 0037 SUB R7 R7 R3 + 0x7C140400, // 0038 CALL R5 2 + 0x8C140310, // 0039 GETMET R5 R1 K16 + 0x001C0604, // 003A ADD R7 R3 R4 + 0x001C0F11, // 003B ADD R7 R7 K17 + 0xB8220400, // 003C GETNGBL R8 K2 + 0x88201105, // 003D GETMBR R8 R8 K5 + 0xB8260400, // 003E GETNGBL R9 K2 + 0x88241306, // 003F GETMBR R9 R9 K6 + 0x30201009, // 0040 OR R8 R8 R9 + 0x7C140600, // 0041 CALL R5 3 + 0x80000000, // 0042 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_wifi_arcs_icon +********************************************************************/ +extern const bclass be_class_lv_wifi_arcs; +be_local_class(lv_wifi_arcs_icon, + 0, + &be_class_lv_wifi_arcs, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(lv_wifi_arcs_icon_init_closure) }, + })), + be_str_literal("lv_wifi_arcs_icon") +); +/*******************************************************************/ + +void be_load_lv_wifi_arcs_icon_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_wifi_arcs_icon); + be_setglobal(vm, "lv_wifi_arcs_icon"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_wifi_arcs_lib.c b/lib/libesp32/berry/default/be_lvgl_wifi_arcs_lib.c new file mode 100644 index 000000000..57cbf18a9 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_wifi_arcs_lib.c @@ -0,0 +1,167 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: every_second +********************************************************************/ +be_local_closure(lv_wifi_arcs_every_second, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(wifi), + /* K2 */ be_nested_str(find), + /* K3 */ be_nested_str(quality), + /* K4 */ be_nested_str(ip), + /* K5 */ be_nested_str(set_percentage), + /* K6 */ be_const_int(0), + }), + &be_const_str_every_second, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x58100003, // 0004 LDCONST R4 K3 + 0x7C080400, // 0005 CALL R2 2 + 0x8C0C0302, // 0006 GETMET R3 R1 K2 + 0x58140004, // 0007 LDCONST R5 K4 + 0x7C0C0400, // 0008 CALL R3 2 + 0x4C100000, // 0009 LDNIL R4 + 0x1C100604, // 000A EQ R4 R3 R4 + 0x78120003, // 000B JMPF R4 #0010 + 0x8C100105, // 000C GETMET R4 R0 K5 + 0x58180006, // 000D LDCONST R6 K6 + 0x7C100400, // 000E CALL R4 2 + 0x70020005, // 000F JMP #0016 + 0x4C100000, // 0010 LDNIL R4 + 0x20100404, // 0011 NE R4 R2 R4 + 0x78120002, // 0012 JMPF R4 #0016 + 0x8C100105, // 0013 GETMET R4 R0 K5 + 0x5C180400, // 0014 MOVE R6 R2 + 0x7C100400, // 0015 CALL R4 2 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_wifi_arcs_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(add_driver), + /* K3 */ be_nested_str(set_percentage), + /* K4 */ be_const_int(0), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x60080003, // 0000 GETGBL R2 G3 + 0x5C0C0000, // 0001 MOVE R3 R0 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080500, // 0003 GETMET R2 R2 K0 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x5C100000, // 0008 MOVE R4 R0 + 0x7C080400, // 0009 CALL R2 2 + 0x8C080103, // 000A GETMET R2 R0 K3 + 0x58100004, // 000B LDCONST R4 K4 + 0x7C080400, // 000C CALL R2 2 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: del +********************************************************************/ +be_local_closure(lv_wifi_arcs_del, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(del), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(remove_driver), + }), + &be_const_str_del, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x60040003, // 0000 GETGBL R1 G3 + 0x5C080000, // 0001 MOVE R2 R0 + 0x7C040200, // 0002 CALL R1 1 + 0x8C040300, // 0003 GETMET R1 R1 K0 + 0x7C040200, // 0004 CALL R1 1 + 0xB8060200, // 0005 GETNGBL R1 K1 + 0x8C040302, // 0006 GETMET R1 R1 K2 + 0x5C0C0000, // 0007 MOVE R3 R0 + 0x7C040400, // 0008 CALL R1 2 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_wifi_arcs +********************************************************************/ +extern const bclass be_class_lv_signal_arcs; +be_local_class(lv_wifi_arcs, + 0, + &be_class_lv_signal_arcs, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(every_second, 1), be_const_closure(lv_wifi_arcs_every_second_closure) }, + { be_const_key(init, -1), be_const_closure(lv_wifi_arcs_init_closure) }, + { be_const_key(del, -1), be_const_closure(lv_wifi_arcs_del_closure) }, + })), + be_str_literal("lv_wifi_arcs") +); +/*******************************************************************/ + +void be_load_lv_wifi_arcs_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_wifi_arcs); + be_setglobal(vm, "lv_wifi_arcs"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_wifi_bars_icon_lib.c b/lib/libesp32/berry/default/be_lvgl_wifi_bars_icon_lib.c new file mode 100644 index 000000000..a1cf693e5 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_wifi_bars_icon_lib.c @@ -0,0 +1,136 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_wifi_bars_icon_init, /* name */ + be_nested_proto( + 9, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[17]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(set_style_line_color), + /* K2 */ be_nested_str(lv), + /* K3 */ be_nested_str(color), + /* K4 */ be_nested_str(COLOR_WHITE), + /* K5 */ be_nested_str(PART_MAIN), + /* K6 */ be_nested_str(STATE_DEFAULT), + /* K7 */ be_nested_str(set_style_bg_color), + /* K8 */ be_nested_str(COLOR_BLACK), + /* K9 */ be_nested_str(get_height), + /* K10 */ be_nested_str(get_style_pad_right), + /* K11 */ be_nested_str(set_height), + /* K12 */ be_nested_str(set_width), + /* K13 */ be_nested_str(set_x), + /* K14 */ be_nested_str(get_width), + /* K15 */ be_nested_str(set_style_pad_right), + /* K16 */ be_const_int(1), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[64]) { /* code */ + 0x60080003, // 0000 GETGBL R2 G3 + 0x5C0C0000, // 0001 MOVE R3 R0 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080500, // 0003 GETMET R2 R2 K0 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0x8C080101, // 0006 GETMET R2 R0 K1 + 0xB8120400, // 0007 GETNGBL R4 K2 + 0x8C100903, // 0008 GETMET R4 R4 K3 + 0xB81A0400, // 0009 GETNGBL R6 K2 + 0x88180D04, // 000A GETMBR R6 R6 K4 + 0x7C100400, // 000B CALL R4 2 + 0xB8160400, // 000C GETNGBL R5 K2 + 0x88140B05, // 000D GETMBR R5 R5 K5 + 0xB81A0400, // 000E GETNGBL R6 K2 + 0x88180D06, // 000F GETMBR R6 R6 K6 + 0x30140A06, // 0010 OR R5 R5 R6 + 0x7C080600, // 0011 CALL R2 3 + 0x8C080107, // 0012 GETMET R2 R0 K7 + 0xB8120400, // 0013 GETNGBL R4 K2 + 0x8C100903, // 0014 GETMET R4 R4 K3 + 0xB81A0400, // 0015 GETNGBL R6 K2 + 0x88180D08, // 0016 GETMBR R6 R6 K8 + 0x7C100400, // 0017 CALL R4 2 + 0xB8160400, // 0018 GETNGBL R5 K2 + 0x88140B05, // 0019 GETMBR R5 R5 K5 + 0xB81A0400, // 001A GETNGBL R6 K2 + 0x88180D06, // 001B GETMBR R6 R6 K6 + 0x30140A06, // 001C OR R5 R5 R6 + 0x7C080600, // 001D CALL R2 3 + 0x4C080000, // 001E LDNIL R2 + 0x20080202, // 001F NE R2 R1 R2 + 0x780A001D, // 0020 JMPF R2 #003F + 0x8C080309, // 0021 GETMET R2 R1 K9 + 0x7C080200, // 0022 CALL R2 1 + 0x8C0C030A, // 0023 GETMET R3 R1 K10 + 0xB8160400, // 0024 GETNGBL R5 K2 + 0x88140B05, // 0025 GETMBR R5 R5 K5 + 0xB81A0400, // 0026 GETNGBL R6 K2 + 0x88180D06, // 0027 GETMBR R6 R6 K6 + 0x30140A06, // 0028 OR R5 R5 R6 + 0x7C0C0400, // 0029 CALL R3 2 + 0x8C10010B, // 002A GETMET R4 R0 K11 + 0x5C180400, // 002B MOVE R6 R2 + 0x7C100400, // 002C CALL R4 2 + 0x8C10010C, // 002D GETMET R4 R0 K12 + 0x5C180400, // 002E MOVE R6 R2 + 0x7C100400, // 002F CALL R4 2 + 0x8C10010D, // 0030 GETMET R4 R0 K13 + 0x8C18030E, // 0031 GETMET R6 R1 K14 + 0x7C180200, // 0032 CALL R6 1 + 0x04180C02, // 0033 SUB R6 R6 R2 + 0x04180C03, // 0034 SUB R6 R6 R3 + 0x7C100400, // 0035 CALL R4 2 + 0x8C10030F, // 0036 GETMET R4 R1 K15 + 0x00180602, // 0037 ADD R6 R3 R2 + 0x00180D10, // 0038 ADD R6 R6 K16 + 0xB81E0400, // 0039 GETNGBL R7 K2 + 0x881C0F05, // 003A GETMBR R7 R7 K5 + 0xB8220400, // 003B GETNGBL R8 K2 + 0x88201106, // 003C GETMBR R8 R8 K6 + 0x301C0E08, // 003D OR R7 R7 R8 + 0x7C100600, // 003E CALL R4 3 + 0x80000000, // 003F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_wifi_bars_icon +********************************************************************/ +extern const bclass be_class_lv_wifi_bars; +be_local_class(lv_wifi_bars_icon, + 0, + &be_class_lv_wifi_bars, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(lv_wifi_bars_icon_init_closure) }, + })), + be_str_literal("lv_wifi_bars_icon") +); +/*******************************************************************/ + +void be_load_lv_wifi_bars_icon_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_wifi_bars_icon); + be_setglobal(vm, "lv_wifi_bars_icon"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_lvgl_wifi_bars_lib.c b/lib/libesp32/berry/default/be_lvgl_wifi_bars_lib.c new file mode 100644 index 000000000..c61cb2bb3 --- /dev/null +++ b/lib/libesp32/berry/default/be_lvgl_wifi_bars_lib.c @@ -0,0 +1,167 @@ +/******************************************************************** + * Tasmota LVGL lv_signal_bars widget + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_LVGL + +#include "lvgl.h" + +/******************************************************************** +** Solidified function: every_second +********************************************************************/ +be_local_closure(lv_wifi_bars_every_second, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(wifi), + /* K2 */ be_nested_str(find), + /* K3 */ be_nested_str(quality), + /* K4 */ be_nested_str(ip), + /* K5 */ be_nested_str(set_percentage), + /* K6 */ be_const_int(0), + }), + &be_const_str_every_second, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x58100003, // 0004 LDCONST R4 K3 + 0x7C080400, // 0005 CALL R2 2 + 0x8C0C0302, // 0006 GETMET R3 R1 K2 + 0x58140004, // 0007 LDCONST R5 K4 + 0x7C0C0400, // 0008 CALL R3 2 + 0x4C100000, // 0009 LDNIL R4 + 0x1C100604, // 000A EQ R4 R3 R4 + 0x78120003, // 000B JMPF R4 #0010 + 0x8C100105, // 000C GETMET R4 R0 K5 + 0x58180006, // 000D LDCONST R6 K6 + 0x7C100400, // 000E CALL R4 2 + 0x70020005, // 000F JMP #0016 + 0x4C100000, // 0010 LDNIL R4 + 0x20100404, // 0011 NE R4 R2 R4 + 0x78120002, // 0012 JMPF R4 #0016 + 0x8C100105, // 0013 GETMET R4 R0 K5 + 0x5C180400, // 0014 MOVE R6 R2 + 0x7C100400, // 0015 CALL R4 2 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lv_wifi_bars_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(init), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(add_driver), + /* K3 */ be_nested_str(set_percentage), + /* K4 */ be_const_int(0), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x60080003, // 0000 GETGBL R2 G3 + 0x5C0C0000, // 0001 MOVE R3 R0 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080500, // 0003 GETMET R2 R2 K0 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x5C100000, // 0008 MOVE R4 R0 + 0x7C080400, // 0009 CALL R2 2 + 0x8C080103, // 000A GETMET R2 R0 K3 + 0x58100004, // 000B LDCONST R4 K4 + 0x7C080400, // 000C CALL R2 2 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: del +********************************************************************/ +be_local_closure(lv_wifi_bars_del, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(del), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(remove_driver), + }), + &be_const_str_del, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x60040003, // 0000 GETGBL R1 G3 + 0x5C080000, // 0001 MOVE R2 R0 + 0x7C040200, // 0002 CALL R1 1 + 0x8C040300, // 0003 GETMET R1 R1 K0 + 0x7C040200, // 0004 CALL R1 1 + 0xB8060200, // 0005 GETNGBL R1 K1 + 0x8C040302, // 0006 GETMET R1 R1 K2 + 0x5C0C0000, // 0007 MOVE R3 R0 + 0x7C040400, // 0008 CALL R1 2 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: lv_wifi_bars +********************************************************************/ +extern const bclass be_class_lv_signal_bars; +be_local_class(lv_wifi_bars, + 0, + &be_class_lv_signal_bars, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(every_second, 1), be_const_closure(lv_wifi_bars_every_second_closure) }, + { be_const_key(init, -1), be_const_closure(lv_wifi_bars_init_closure) }, + { be_const_key(del, -1), be_const_closure(lv_wifi_bars_del_closure) }, + })), + be_str_literal("lv_wifi_bars") +); +/*******************************************************************/ + +void be_load_lv_wifi_bars_class(bvm *vm) { + be_pushntvclass(vm, &be_class_lv_wifi_bars); + be_setglobal(vm, "lv_wifi_bars"); + be_pop(vm, 1); +} + +#endif // USE_LVGL \ No newline at end of file diff --git a/lib/libesp32/berry/default/be_md5_lib.c b/lib/libesp32/berry/default/be_md5_lib.c new file mode 100644 index 000000000..2c8dfd77b --- /dev/null +++ b/lib/libesp32/berry/default/be_md5_lib.c @@ -0,0 +1,30 @@ +/******************************************************************** + * Berry module `webserver` + * + * To use: `import webserver` + * + * Allows to respond to HTTP request + *******************************************************************/ +#include "be_constobj.h" + +extern int m_md5_init(bvm *vm); +extern int m_md5_update(bvm *vm); +extern int m_md5_finish(bvm *vm); + +#include "../generate/be_fixed_be_class_md5.h" + +void be_load_md5_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_md5); + be_setglobal(vm, "MD5"); + be_pop(vm, 1); +} +/* @const_object_info_begin + +class be_class_md5 (scope: global, name: MD5) { + .p, var + + init, func(m_md5_init) + update, func(m_md5_update) + finish, func(m_md5_finish) +} +@const_object_info_end */ diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c new file mode 100644 index 000000000..934400bbb --- /dev/null +++ b/lib/libesp32/berry/default/be_modtab.c @@ -0,0 +1,230 @@ +/******************************************************************** +** Copyright (c) 2018-2020 Guan Wenliang +** This file is part of the Berry default interpreter. +** skiars@qq.com, https://github.com/Skiars/berry +** See Copyright Notice in the LICENSE file or at +** https://github.com/Skiars/berry/blob/master/LICENSE +********************************************************************/ +#include "berry.h" + +/* this file contains the declaration of the module table. */ + +/* default modules declare */ +be_extern_native_module(string); +be_extern_native_module(json); +be_extern_native_module(math); +be_extern_native_module(time); +be_extern_native_module(os); +be_extern_native_module(global); +be_extern_native_module(sys); +be_extern_native_module(debug); +be_extern_native_module(gc); +be_extern_native_module(solidify); +be_extern_native_module(introspect); +be_extern_native_module(strict); + +/* Berry extensions */ +#include "be_mapping.h" +be_extern_native_module(cb); + +/* Tasmota specific */ +be_extern_native_module(python_compat); +be_extern_native_module(re); +be_extern_native_module(persist); +be_extern_native_module(autoconf); +be_extern_native_module(tapp); +be_extern_native_module(light); +be_extern_native_module(gpio); +be_extern_native_module(display); +be_extern_native_module(energy); +be_extern_native_module(webserver); +be_extern_native_module(flash); +be_extern_native_module(path); +be_extern_native_module(unishox); +be_extern_native_module(animate); +#ifdef USE_LVGL +be_extern_native_module(lv); +#endif // USE_LVGL + +/* user-defined modules declare start */ + +/* user-defined modules declare end */ + +/* module list declaration */ +BERRY_LOCAL const bntvmodule* const be_module_table[] = { +/* default modules register */ +#if BE_USE_STRING_MODULE + &be_native_module(string), +#endif +#if BE_USE_JSON_MODULE + &be_native_module(json), +#endif +#if BE_USE_MATH_MODULE + &be_native_module(math), +#endif +#if BE_USE_TIME_MODULE + &be_native_module(time), +#endif +#if BE_USE_OS_MODULE + &be_native_module(os), +#endif +#if BE_USE_GLOBAL_MODULE + &be_native_module(global), +#endif +#if BE_USE_SYS_MODULE + &be_native_module(sys), +#endif +#if BE_USE_DEBUG_MODULE + &be_native_module(debug), +#endif +#if BE_USE_GC_MODULE + &be_native_module(gc), +#endif +#if BE_USE_SOLIDIFY_MODULE + &be_native_module(solidify), +#endif +#if BE_USE_INTROSPECT_MODULE + &be_native_module(introspect), +#endif +#if BE_USE_STRICT_MODULE + &be_native_module(strict), +#endif + + /* Berry extensions */ + &be_native_module(cb), + + /* user-defined modules register start */ + + &be_native_module(python_compat), + &be_native_module(re), + &be_native_module(path), + &be_native_module(persist), +#ifdef USE_AUTOCONF + &be_native_module(autoconf), +#endif // USE_AUTOCONF + &be_native_module(tapp), + &be_native_module(gpio), +#ifdef USE_DISPLAY + &be_native_module(display), +#endif // USE_DISPLAY +#ifdef USE_LIGHT + &be_native_module(light), +#endif + +#ifdef USE_UNISHOX_COMPRESSION + &be_native_module(unishox), +#endif // USE_UNISHOX_COMPRESSION + &be_native_module(animate), + +#ifdef USE_LVGL + &be_native_module(lv), +#endif // USE_LVGL +#ifdef USE_ENERGY_SENSOR + &be_native_module(energy), +#endif // USE_ENERGY_SENSOR +#ifdef USE_WEBSERVER + &be_native_module(webserver), +#endif // USE_WEBSERVER + &be_native_module(flash), + + + /* user-defined modules register end */ + NULL /* do not remove */ +}; + +#ifdef ESP32 +extern void be_load_tasmota_ntvlib(bvm *vm); +extern void be_load_wirelib(bvm *vm); +extern void be_load_onewirelib(bvm *vm); +extern void be_load_serial_lib(bvm *vm); +extern void be_load_Driver_class(bvm *vm); +extern void be_load_Timer_class(bvm *vm); +extern void be_load_I2C_Driver_class(bvm *vm); +extern void be_load_AXP192_class(bvm *vm); +extern void be_load_md5_lib(bvm *vm); +extern void be_load_webclient_lib(bvm *vm); +extern void be_load_tcpclient_lib(bvm *vm); +extern void be_load_crypto_lib(bvm *vm); +extern void be_load_Leds_ntv_class(bvm *vm); +extern void be_load_Leds_class(bvm *vm); +extern void be_load_Leds_animator_class(bvm *vm); + +extern void be_load_ctypes_lib(bvm *vm); +extern void be_load_ctypes_energy_definitions_lib(bvm *vm); + +#ifdef USE_I2S_AUDIO_BERRY +extern void be_load_driver_audio_lib(bvm *vm); +#endif + +#ifdef USE_LVGL +extern void be_load_lv_color_class(bvm *vm); +extern void be_load_lv_font_class(bvm *vm); +extern void be_load_LVGL_glob_class(bvm *vm); +// custom widgets +extern void be_load_lv_signal_bars_class(bvm *vm); +extern void be_load_lv_wifi_bars_class(bvm *vm); +extern void be_load_lv_wifi_bars_icon_class(bvm *vm); +extern void be_load_lv_signal_arcs_class(bvm *vm); +extern void be_load_lv_wifi_arcs_class(bvm *vm); +extern void be_load_lv_wifi_arcs_icon_class(bvm *vm); +extern void be_load_lv_clock_icon_class(bvm *vm); +#endif// USE_LVGL + +/* this code loads the native class definitions */ +BERRY_API void be_load_custom_libs(bvm *vm) +{ + (void)vm; /* prevent a compiler warning */ + + /* add here custom libs */ +#if !BE_USE_PRECOMPILED_OBJECT + /* be_load_xxxlib(vm); */ +#endif + be_load_Timer_class(vm); + be_load_tasmota_ntvlib(vm); + be_load_Driver_class(vm); + be_load_md5_lib(vm); + be_load_serial_lib(vm); + be_load_ctypes_lib(vm); +#ifdef USE_ALEXA_AVS + be_load_crypto_lib(vm); +#endif +#ifdef USE_I2C + be_load_wirelib(vm); + be_load_I2C_Driver_class(vm); + be_load_AXP192_class(vm); +#endif // USE_I2C +#ifdef USE_ENERGY_SENSOR + be_load_ctypes_energy_definitions_lib(vm); +#endif // USE_ENERGY_SENSOR +#ifdef USE_WEBCLIENT + be_load_webclient_lib(vm); + be_load_tcpclient_lib(vm); +#endif // USE_WEBCLIENT +#if defined(USE_ONEWIRE) || defined(USE_DS18x20) + be_load_onewirelib(vm); +#endif +#ifdef USE_WS2812 + be_load_Leds_ntv_class(vm); + be_load_Leds_class(vm); + be_load_Leds_animator_class(vm); +#endif // USE_WS2812 +#ifdef USE_I2S_AUDIO_BERRY + be_load_driver_audio_lib(vm); +#endif +#ifdef USE_LVGL + // LVGL + be_load_lv_color_class(vm); + be_load_lv_font_class(vm); + + be_load_LVGL_glob_class(vm); + // custom widgets + be_load_lv_signal_bars_class(vm); + be_load_lv_wifi_bars_class(vm); + be_load_lv_wifi_bars_icon_class(vm); + be_load_lv_signal_arcs_class(vm); + be_load_lv_wifi_arcs_class(vm); + be_load_lv_wifi_arcs_icon_class(vm); + be_load_lv_clock_icon_class(vm); +#endif // USE_LVGL +} +#endif diff --git a/lib/libesp32/berry/default/be_onewire_lib.c b/lib/libesp32/berry/default/be_onewire_lib.c new file mode 100644 index 000000000..838e6ccf9 --- /dev/null +++ b/lib/libesp32/berry/default/be_onewire_lib.c @@ -0,0 +1,57 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import wire` + * + * 2 wire communication - I2C + *******************************************************************/ +#include "be_constobj.h" + +#if defined(USE_ONEWIRE) || defined(USE_DS18x20) + +extern int b_onewire_init(bvm *vm); +extern int b_onewire_deinit(bvm *vm); + +extern int b_onewire_reset(bvm *vm); +extern int b_onewire_select(bvm *vm); +extern int b_onewire_skip(bvm *vm); +extern int b_onewire_depower(bvm *vm); + +extern int b_onewire_write(bvm *vm); +extern int b_onewire_read(bvm *vm); + +extern int b_onewire_reset_search(bvm *vm); +extern int b_onewire_target_search(bvm *vm); +extern int b_onewire_search(bvm *vm); + +#include "../generate/be_fixed_be_class_tasmota_onewire.h" + +void be_load_onewirelib(bvm *vm) { + be_pushntvclass(vm, &be_class_tasmota_onewire); + be_setglobal(vm, "OneWire"); + be_pop(vm, 1); +} + +/* @const_object_info_begin + +class be_class_tasmota_onewire (scope: global, name: OneWire) { + .p, var + + init, func(b_onewire_init) + deinit, func(b_onewire_deinit) + + reset, func(b_onewire_reset) + select, func(b_onewire_select) + skip, func(b_onewire_skip) + depower, func(b_onewire_depower) + + write, func(b_onewire_write) + read, func(b_onewire_read) + + reset_search, func(b_onewire_reset_search) + target_search, func(b_onewire_target_search) + search, func(b_onewire_search) +} +@const_object_info_end */ + +#endif // defined(USE_ONEWIRE) || defined(USE_DS18x20) diff --git a/lib/libesp32/berry/default/be_path_tasmota_lib.c b/lib/libesp32/berry/default/be_path_tasmota_lib.c new file mode 100644 index 000000000..81711a053 --- /dev/null +++ b/lib/libesp32/berry/default/be_path_tasmota_lib.c @@ -0,0 +1,70 @@ +/******************************************************************** +** Copyright (c) 2018-2020 Guan Wenliang +** This file is part of the Berry default interpreter. +** skiars@qq.com, https://github.com/Skiars/berry +** See Copyright Notice in the LICENSE file or at +** https://github.com/Skiars/berry/blob/master/LICENSE +********************************************************************/ + +/******************************************************************** + * Berry module `path` + * + * Minimal version of `import path` + * + *******************************************************************/ +#include "be_object.h" +#include "be_strlib.h" +#include "be_mem.h" +#include "be_sys.h" +#include + +extern int m_path_listdir(bvm *vm); + +static int m_path_exists(bvm *vm) +{ + const char *path = NULL; + if (be_top(vm) >= 1 && be_isstring(vm, 1)) { + path = be_tostring(vm, 1); + be_pushbool(vm, be_isexist(path)); + } else { + be_pushbool(vm, bfalse); + } + be_return(vm); +} +extern time_t be_last_modified(void *hfile); + +static int m_path_last_modified(bvm *vm) +{ + if (be_top(vm) >= 1 && be_isstring(vm, 1)) { + const char *path = be_tostring(vm, 1); + void * f = be_fopen(path, "r"); + if (f) { + be_pushint(vm, be_last_modified(f)); + be_fclose(f); + be_return(vm); + } + } + be_return_nil(vm); +} + +static int m_path_remove(bvm *vm) +{ + const char *path = NULL; + if (be_top(vm) >= 1 && be_isstring(vm, 1)) { + path = be_tostring(vm, 1); + be_pushbool(vm, be_unlink(path)); + } else { + be_pushbool(vm, bfalse); + } + be_return(vm); +} + +/* @const_object_info_begin +module path (scope: global, file: tasmota_path) { + exists, func(m_path_exists) + last_modified, func(m_path_last_modified) + listdir, func(m_path_listdir) + remove, func(m_path_remove) +} +@const_object_info_end */ +#include "../generate/be_fixed_tasmota_path.h" diff --git a/lib/libesp32/berry/default/be_persist_lib.c b/lib/libesp32/berry/default/be_persist_lib.c new file mode 100644 index 000000000..0581081c7 --- /dev/null +++ b/lib/libesp32/berry/default/be_persist_lib.c @@ -0,0 +1,703 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import power` + * + * read power values + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: json_fdump_map +********************************************************************/ +be_local_closure(Persist_json_fdump_map, /* name */ + be_nested_proto( + 13, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(json), + /* K1 */ be_nested_str(write), + /* K2 */ be_nested_str(_X7B), + /* K3 */ be_nested_str(keys), + /* K4 */ be_nested_str(dump), + /* K5 */ be_nested_str(_X3A), + /* K6 */ be_nested_str(json_fdump_any), + /* K7 */ be_nested_str(_X2C), + /* K8 */ be_nested_str(stop_iteration), + /* K9 */ be_nested_str(_X7D), + }), + &be_const_str_json_fdump_map, + &be_const_str_solidified, + ( &(const binstruction[41]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x8C100301, // 0001 GETMET R4 R1 K1 + 0x58180002, // 0002 LDCONST R6 K2 + 0x7C100400, // 0003 CALL R4 2 + 0x4C100000, // 0004 LDNIL R4 + 0x60140010, // 0005 GETGBL R5 G16 + 0x8C180503, // 0006 GETMET R6 R2 K3 + 0x7C180200, // 0007 CALL R6 1 + 0x7C140200, // 0008 CALL R5 1 + 0xA8020017, // 0009 EXBLK 0 #0022 + 0x5C180A00, // 000A MOVE R6 R5 + 0x7C180000, // 000B CALL R6 0 + 0x4C1C0000, // 000C LDNIL R7 + 0x201C0807, // 000D NE R7 R4 R7 + 0x781E0002, // 000E JMPF R7 #0012 + 0x8C1C0301, // 000F GETMET R7 R1 K1 + 0x5C240800, // 0010 MOVE R9 R4 + 0x7C1C0400, // 0011 CALL R7 2 + 0x8C1C0301, // 0012 GETMET R7 R1 K1 + 0x8C240704, // 0013 GETMET R9 R3 K4 + 0x602C0008, // 0014 GETGBL R11 G8 + 0x5C300C00, // 0015 MOVE R12 R6 + 0x7C2C0200, // 0016 CALL R11 1 + 0x7C240400, // 0017 CALL R9 2 + 0x7C1C0400, // 0018 CALL R7 2 + 0x8C1C0301, // 0019 GETMET R7 R1 K1 + 0x58240005, // 001A LDCONST R9 K5 + 0x7C1C0400, // 001B CALL R7 2 + 0x8C1C0106, // 001C GETMET R7 R0 K6 + 0x5C240200, // 001D MOVE R9 R1 + 0x94280406, // 001E GETIDX R10 R2 R6 + 0x7C1C0600, // 001F CALL R7 3 + 0x58100007, // 0020 LDCONST R4 K7 + 0x7001FFE7, // 0021 JMP #000A + 0x58140008, // 0022 LDCONST R5 K8 + 0xAC140200, // 0023 CATCH R5 1 0 + 0xB0080000, // 0024 RAISE 2 R0 R0 + 0x8C140301, // 0025 GETMET R5 R1 K1 + 0x581C0009, // 0026 LDCONST R7 K9 + 0x7C140400, // 0027 CALL R5 2 + 0x80000000, // 0028 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: setmember +********************************************************************/ +be_local_closure(Persist_setmember, /* name */ + be_nested_proto( + 4, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(_dirty), + }), + &be_const_str_setmember, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x980C0202, // 0001 SETIDX R3 R1 R2 + 0x500C0200, // 0002 LDBOOL R3 1 0 + 0x90020203, // 0003 SETMBR R0 K1 R3 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: zero +********************************************************************/ +be_local_closure(Persist_zero, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(_dirty), + }), + &be_const_str_zero, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x60040013, // 0000 GETGBL R1 G19 + 0x7C040000, // 0001 CALL R1 0 + 0x90020001, // 0002 SETMBR R0 K0 R1 + 0x50040200, // 0003 LDBOOL R1 1 0 + 0x90020201, // 0004 SETMBR R0 K1 R1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: member +********************************************************************/ +be_local_closure(Persist_member, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(find), + }), + &be_const_str_member, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: json_fdump +********************************************************************/ +be_local_closure(Persist_json_fdump, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(json), + /* K1 */ be_nested_str(_p), + /* K2 */ be_nested_str(json_fdump_map), + /* K3 */ be_nested_str(internal_error), + /* K4 */ be_nested_str(persist_X2E_p_X20is_X20not_X20a_X20map), + }), + &be_const_str_json_fdump, + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x600C000F, // 0001 GETGBL R3 G15 + 0x88100101, // 0002 GETMBR R4 R0 K1 + 0x60140013, // 0003 GETGBL R5 G19 + 0x7C0C0400, // 0004 CALL R3 2 + 0x780E0004, // 0005 JMPF R3 #000B + 0x8C0C0102, // 0006 GETMET R3 R0 K2 + 0x5C140200, // 0007 MOVE R5 R1 + 0x88180101, // 0008 GETMBR R6 R0 K1 + 0x7C0C0600, // 0009 CALL R3 3 + 0x70020000, // 000A JMP #000C + 0xB0060704, // 000B RAISE 1 K3 K4 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove +********************************************************************/ +be_local_closure(Persist_remove, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(remove), + /* K2 */ be_nested_str(_dirty), + }), + &be_const_str_remove, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x50080200, // 0004 LDBOOL R2 1 0 + 0x90020402, // 0005 SETMBR R0 K2 R2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: json_fdump_any +********************************************************************/ +be_local_closure(Persist_json_fdump_any, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(json), + /* K1 */ be_nested_str(json_fdump_map), + /* K2 */ be_nested_str(json_fdump_list), + /* K3 */ be_nested_str(write), + /* K4 */ be_nested_str(dump), + }), + &be_const_str_json_fdump_any, + &be_const_str_solidified, + ( &(const binstruction[27]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x6010000F, // 0001 GETGBL R4 G15 + 0x5C140400, // 0002 MOVE R5 R2 + 0x60180013, // 0003 GETGBL R6 G19 + 0x7C100400, // 0004 CALL R4 2 + 0x78120004, // 0005 JMPF R4 #000B + 0x8C100101, // 0006 GETMET R4 R0 K1 + 0x5C180200, // 0007 MOVE R6 R1 + 0x5C1C0400, // 0008 MOVE R7 R2 + 0x7C100600, // 0009 CALL R4 3 + 0x7002000E, // 000A JMP #001A + 0x6010000F, // 000B GETGBL R4 G15 + 0x5C140400, // 000C MOVE R5 R2 + 0x60180012, // 000D GETGBL R6 G18 + 0x7C100400, // 000E CALL R4 2 + 0x78120004, // 000F JMPF R4 #0015 + 0x8C100102, // 0010 GETMET R4 R0 K2 + 0x5C180200, // 0011 MOVE R6 R1 + 0x5C1C0400, // 0012 MOVE R7 R2 + 0x7C100600, // 0013 CALL R4 3 + 0x70020004, // 0014 JMP #001A + 0x8C100303, // 0015 GETMET R4 R1 K3 + 0x8C180704, // 0016 GETMET R6 R3 K4 + 0x5C200400, // 0017 MOVE R8 R2 + 0x7C180400, // 0018 CALL R6 2 + 0x7C100400, // 0019 CALL R4 2 + 0x80000000, // 001A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: save +********************************************************************/ +be_local_closure(Persist_save, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(_filename), + /* K1 */ be_nested_str(w), + /* K2 */ be_nested_str(json_fdump), + /* K3 */ be_nested_str(close), + /* K4 */ be_nested_str(write), + /* K5 */ be_nested_str(_X7B_X7D), + /* K6 */ be_nested_str(_dirty), + }), + &be_const_str_save, + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0xA802000B, // 0001 EXBLK 0 #000E + 0x60080011, // 0002 GETGBL R2 G17 + 0x880C0100, // 0003 GETMBR R3 R0 K0 + 0x58100001, // 0004 LDCONST R4 K1 + 0x7C080400, // 0005 CALL R2 2 + 0x5C040400, // 0006 MOVE R1 R2 + 0x8C080102, // 0007 GETMET R2 R0 K2 + 0x5C100200, // 0008 MOVE R4 R1 + 0x7C080400, // 0009 CALL R2 2 + 0x8C080303, // 000A GETMET R2 R1 K3 + 0x7C080200, // 000B CALL R2 1 + 0xA8040001, // 000C EXBLK 1 1 + 0x70020013, // 000D JMP #0022 + 0xAC080002, // 000E CATCH R2 0 2 + 0x70020010, // 000F JMP #0021 + 0x4C100000, // 0010 LDNIL R4 + 0x20100204, // 0011 NE R4 R1 R4 + 0x78120001, // 0012 JMPF R4 #0015 + 0x8C100303, // 0013 GETMET R4 R1 K3 + 0x7C100200, // 0014 CALL R4 1 + 0x60100011, // 0015 GETGBL R4 G17 + 0x88140100, // 0016 GETMBR R5 R0 K0 + 0x58180001, // 0017 LDCONST R6 K1 + 0x7C100400, // 0018 CALL R4 2 + 0x5C040800, // 0019 MOVE R1 R4 + 0x8C100304, // 001A GETMET R4 R1 K4 + 0x58180005, // 001B LDCONST R6 K5 + 0x7C100400, // 001C CALL R4 2 + 0x8C100303, // 001D GETMET R4 R1 K3 + 0x7C100200, // 001E CALL R4 1 + 0xB0040403, // 001F RAISE 1 R2 R3 + 0x70020000, // 0020 JMP #0022 + 0xB0080000, // 0021 RAISE 2 R0 R0 + 0x50080000, // 0022 LDBOOL R2 0 0 + 0x90020C02, // 0023 SETMBR R0 K6 R2 + 0x80000000, // 0024 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: load +********************************************************************/ +be_local_closure(Persist_load, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(json), + /* K1 */ be_nested_str(path), + /* K2 */ be_nested_str(exists), + /* K3 */ be_nested_str(_filename), + /* K4 */ be_nested_str(r), + /* K5 */ be_nested_str(load), + /* K6 */ be_nested_str(read), + /* K7 */ be_nested_str(close), + /* K8 */ be_nested_str(_p), + /* K9 */ be_nested_str(BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson), + /* K10 */ be_nested_str(_dirty), + /* K11 */ be_nested_str(save), + }), + &be_const_str_load, + &be_const_str_solidified, + ( &(const binstruction[49]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x4C0C0000, // 0002 LDNIL R3 + 0x4C100000, // 0003 LDNIL R4 + 0x8C140502, // 0004 GETMET R5 R2 K2 + 0x881C0103, // 0005 GETMBR R7 R0 K3 + 0x7C140400, // 0006 CALL R5 2 + 0x78160025, // 0007 JMPF R5 #002E + 0xA802000D, // 0008 EXBLK 0 #0017 + 0x60140011, // 0009 GETGBL R5 G17 + 0x88180103, // 000A GETMBR R6 R0 K3 + 0x581C0004, // 000B LDCONST R7 K4 + 0x7C140400, // 000C CALL R5 2 + 0x5C0C0A00, // 000D MOVE R3 R5 + 0x8C140305, // 000E GETMET R5 R1 K5 + 0x8C1C0706, // 000F GETMET R7 R3 K6 + 0x7C1C0200, // 0010 CALL R7 1 + 0x7C140400, // 0011 CALL R5 2 + 0x5C100A00, // 0012 MOVE R4 R5 + 0x8C140707, // 0013 GETMET R5 R3 K7 + 0x7C140200, // 0014 CALL R5 1 + 0xA8040001, // 0015 EXBLK 1 1 + 0x70020009, // 0016 JMP #0021 + 0xAC140002, // 0017 CATCH R5 0 2 + 0x70020006, // 0018 JMP #0020 + 0x4C1C0000, // 0019 LDNIL R7 + 0x201C0607, // 001A NE R7 R3 R7 + 0x781E0001, // 001B JMPF R7 #001E + 0x8C1C0707, // 001C GETMET R7 R3 K7 + 0x7C1C0200, // 001D CALL R7 1 + 0xB0040A06, // 001E RAISE 1 R5 R6 + 0x70020000, // 001F JMP #0021 + 0xB0080000, // 0020 RAISE 2 R0 R0 + 0x6014000F, // 0021 GETGBL R5 G15 + 0x5C180800, // 0022 MOVE R6 R4 + 0x601C0013, // 0023 GETGBL R7 G19 + 0x7C140400, // 0024 CALL R5 2 + 0x78160001, // 0025 JMPF R5 #0028 + 0x90021004, // 0026 SETMBR R0 K8 R4 + 0x70020002, // 0027 JMP #002B + 0x60140001, // 0028 GETGBL R5 G1 + 0x58180009, // 0029 LDCONST R6 K9 + 0x7C140200, // 002A CALL R5 1 + 0x50140000, // 002B LDBOOL R5 0 0 + 0x90021405, // 002C SETMBR R0 K10 R5 + 0x70020001, // 002D JMP #0030 + 0x8C14010B, // 002E GETMET R5 R0 K11 + 0x7C140200, // 002F CALL R5 1 + 0x80000000, // 0030 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: find +********************************************************************/ +be_local_closure(Persist_find, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(find), + }), + &be_const_str_find, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x5C180400, // 0003 MOVE R6 R2 + 0x7C0C0600, // 0004 CALL R3 3 + 0x80040600, // 0005 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Persist_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(_filename), + /* K1 */ be_nested_str(_persist_X2Ejson), + /* K2 */ be_nested_str(_p), + /* K3 */ be_nested_str(copy), + /* K4 */ be_nested_str(load), + /* K5 */ be_nested_str(_dirty), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x90020101, // 0000 SETMBR R0 K0 K1 + 0x6008000F, // 0001 GETGBL R2 G15 + 0x5C0C0200, // 0002 MOVE R3 R1 + 0x60100013, // 0003 GETGBL R4 G19 + 0x7C080400, // 0004 CALL R2 2 + 0x780A0003, // 0005 JMPF R2 #000A + 0x8C080303, // 0006 GETMET R2 R1 K3 + 0x7C080200, // 0007 CALL R2 1 + 0x90020402, // 0008 SETMBR R0 K2 R2 + 0x70020002, // 0009 JMP #000D + 0x60080013, // 000A GETGBL R2 G19 + 0x7C080000, // 000B CALL R2 0 + 0x90020402, // 000C SETMBR R0 K2 R2 + 0x8C080104, // 000D GETMET R2 R0 K4 + 0x88100102, // 000E GETMBR R4 R0 K2 + 0x88140100, // 000F GETMBR R5 R0 K0 + 0x7C080600, // 0010 CALL R2 3 + 0x50080000, // 0011 LDBOOL R2 0 0 + 0x90020A02, // 0012 SETMBR R0 K5 R2 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: json_fdump_list +********************************************************************/ +be_local_closure(Persist_json_fdump_list, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(json), + /* K1 */ be_nested_str(write), + /* K2 */ be_nested_str(_X5B), + /* K3 */ be_const_int(0), + /* K4 */ be_nested_str(_X2C), + /* K5 */ be_nested_str(json_fdump_any), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str(_X5D), + }), + &be_const_str_json_fdump_list, + &be_const_str_solidified, + ( &(const binstruction[25]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x8C100301, // 0001 GETMET R4 R1 K1 + 0x58180002, // 0002 LDCONST R6 K2 + 0x7C100400, // 0003 CALL R4 2 + 0x58100003, // 0004 LDCONST R4 K3 + 0x6014000C, // 0005 GETGBL R5 G12 + 0x5C180400, // 0006 MOVE R6 R2 + 0x7C140200, // 0007 CALL R5 1 + 0x14140805, // 0008 LT R5 R4 R5 + 0x7816000A, // 0009 JMPF R5 #0015 + 0x24140903, // 000A GT R5 R4 K3 + 0x78160002, // 000B JMPF R5 #000F + 0x8C140301, // 000C GETMET R5 R1 K1 + 0x581C0004, // 000D LDCONST R7 K4 + 0x7C140400, // 000E CALL R5 2 + 0x8C140105, // 000F GETMET R5 R0 K5 + 0x5C1C0200, // 0010 MOVE R7 R1 + 0x94200404, // 0011 GETIDX R8 R2 R4 + 0x7C140600, // 0012 CALL R5 3 + 0x00100906, // 0013 ADD R4 R4 K6 + 0x7001FFEF, // 0014 JMP #0005 + 0x8C140301, // 0015 GETMET R5 R1 K1 + 0x581C0007, // 0016 LDCONST R7 K7 + 0x7C140400, // 0017 CALL R5 2 + 0x80000000, // 0018 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: has +********************************************************************/ +be_local_closure(Persist_has, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_p), + /* K1 */ be_nested_str(has), + }), + &be_const_str_has, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Persist +********************************************************************/ +be_local_class(Persist, + 3, + NULL, + be_nested_map(16, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(has, 6), be_const_closure(Persist_has_closure) }, + { be_const_key(setmember, -1), be_const_closure(Persist_setmember_closure) }, + { be_const_key(remove, -1), be_const_closure(Persist_remove_closure) }, + { be_const_key(zero, 0), be_const_closure(Persist_zero_closure) }, + { be_const_key(json_fdump, -1), be_const_closure(Persist_json_fdump_closure) }, + { be_const_key(json_fdump_list, 2), be_const_closure(Persist_json_fdump_list_closure) }, + { be_const_key(init, 15), be_const_closure(Persist_init_closure) }, + { be_const_key(find, -1), be_const_closure(Persist_find_closure) }, + { be_const_key(save, -1), be_const_closure(Persist_save_closure) }, + { be_const_key(json_fdump_any, 12), be_const_closure(Persist_json_fdump_any_closure) }, + { be_const_key(_p, 7), be_const_var(1) }, + { be_const_key(_filename, -1), be_const_var(0) }, + { be_const_key(load, -1), be_const_closure(Persist_load_closure) }, + { be_const_key(json_fdump_map, 5), be_const_closure(Persist_json_fdump_map_closure) }, + { be_const_key(_dirty, -1), be_const_var(2) }, + { be_const_key(member, -1), be_const_closure(Persist_member_closure) }, + })), + be_str_literal("Persist") +); + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(persist__anonymous_, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_class(be_class_Persist), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0xB4000000, // 0001 CLASS K0 + 0x5C080200, // 0002 MOVE R2 R1 + 0x7C080000, // 0003 CALL R2 0 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: persist +********************************************************************/ +be_local_module(persist, + "persist", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(persist__anonymous__closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(persist); +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_port.cpp b/lib/libesp32/berry/default/be_port.cpp new file mode 100644 index 000000000..5da10f47e --- /dev/null +++ b/lib/libesp32/berry/default/be_port.cpp @@ -0,0 +1,574 @@ +/******************************************************************** +** Copyright (c) 2018-2020 Guan Wenliang +** This file is part of the Berry default interpreter. +** skiars@qq.com, https://github.com/Skiars/berry +** See Copyright Notice in the LICENSE file or at +** https://github.com/Skiars/berry/blob/master/LICENSE +********************************************************************/ +#include "berry.h" +#include "be_mem.h" +#include "be_sys.h" +// #include +#include +#include + +// from https://github.com/eyalroz/cpp-static-block +#include "static_block.hpp" + +// Local pointer for file managment +#ifdef USE_UFILESYS + #include + #include "ZipReadFS.h" + extern FS *ffsp; + FS zip_ufsp(ZipReadFSImplPtr(new ZipReadFSImpl(&ffsp))); +#endif // USE_UFILESYS + +/* this file contains configuration for the file system. */ + +/* standard input and output */ +extern "C" { + int strncmp_PP(const char * str1P, const char * str2P, size_t size) + { + int result = 0; + + while (size > 0) + { + char ch1 = pgm_read_byte(str1P++); + char ch2 = pgm_read_byte(str2P++); + result = ch1 - ch2; + if (result != 0 || ch2 == '\0') + { + break; + } + + size--; + } + + return result; + } + + // + char * strchr_P(const char *s, int c) { + do { + if (pgm_read_byte(s) == c) { + return (char*)s; + } + } while (pgm_read_byte(s++)); + return (0); + } +} + +// We need to create a local buffer, since we might mess up mqtt_data +#ifndef BERRY_LOGSZ +#define BERRY_LOGSZ 700 +#endif + +static char * log_berry_buffer = nullptr; +static_block { + log_berry_buffer = (char*) malloc(BERRY_LOGSZ); + if (log_berry_buffer) log_berry_buffer[0] = 0; +} +extern void berry_log(const char * berry_buf); + +BERRY_API void be_writebuffer(const char *buffer, size_t length) +{ + if (!log_berry_buffer) return; + if (buffer == nullptr || length == 0) { return; } + uint32_t idx = 0; + while (idx < length) { + int32_t cr_pos = -1; + // find next occurence of '\n' or '\r' + for (uint32_t i = idx; i < length; i++) { + if ((pgm_read_byte(&buffer[i]) == '\n') || (pgm_read_byte(&buffer[i]) == '\r')) { + cr_pos = i; + break; + } + } + uint32_t chars_to_append = (cr_pos >= 0) ? cr_pos - idx : length - idx; // note cr_pos < length + snprintf(log_berry_buffer, BERRY_LOGSZ, "%s%.*s", log_berry_buffer, chars_to_append, &buffer[idx]); // append at most `length` chars + if (cr_pos >= 0) { + // flush + berry_log(log_berry_buffer); + log_berry_buffer[0] = 0; // clear string + } + idx += chars_to_append + 1; // skip '\n' + } + // Serial.write(buffer, length); + // be_fwrite(stdout, buffer, length); +} + + +extern "C" { + int m_path_listdir(bvm *vm) + { + if (be_top(vm) >= 1 && be_isstring(vm, 1)) { + const char *path = be_tostring(vm, 1); + be_newobject(vm, "list"); + + File dir = ffsp->open(path, "r"); + if (dir) { + dir.rewindDirectory(); + while (1) { + File entry = dir.openNextFile(); + if (!entry) { + break; + } + const char * fn = entry.name(); + if (strcmp(fn, ".") && strcmp(fn, "..")) { + be_pushstring(vm, fn); + be_data_push(vm, -2); + be_pop(vm, 1); + } + + } + } + be_pop(vm, 1); + be_return(vm); + + } + be_return_nil(vm); + } +} + +BERRY_API char* be_readstring(char *buffer, size_t size) +{ + return be_fgets(stdin, buffer, (int)size); +} + +/* use the standard library implementation file API. */ + +void* be_fopen(const char *filename, const char *modes) +{ +#ifdef USE_UFILESYS + if (filename != nullptr && modes != nullptr) { + char fname2[strlen(filename) + 2]; + if (filename[0] == '/') { + strcpy(fname2, filename); // copy unchanged + } else { + fname2[0] = '/'; + strcpy(fname2 + 1, filename); // prepend with '/' + } + // Serial.printf("be_fopen filename=%s, modes=%s\n", filename, modes); + File f = zip_ufsp.open(fname2, modes); // returns an object, not a pointer + if (f) { + File * f_ptr = new File(f); // copy to dynamic object + *f_ptr = f; // TODO is this necessary? + return f_ptr; + } + } +#endif // USE_UFILESYS + return nullptr; + // return fopen(filename, modes); +} + +// Tasmota specific, get the underlying Arduino File +File * be_get_arduino_file(void *hfile) +{ +#ifdef USE_UFILESYS + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + return f_ptr; + } +#endif // USE_UFILESYS + return nullptr; + // return fopen(filename, modes); +} + +int be_fclose(void *hfile) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fclose\n"); + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + f_ptr->close(); + delete f_ptr; + return 0; + } +#endif // USE_UFILESYS + return -1; + // return fclose(hfile); +} + +size_t be_fwrite(void *hfile, const void *buffer, size_t length) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fwrite %d\n", length); + if (hfile != nullptr && buffer != nullptr) { + File * f_ptr = (File*) hfile; + return f_ptr->write((const uint8_t*) buffer, length); + } +#endif // USE_UFILESYS + return 0; + // return fwrite(buffer, 1, length, hfile); +} + +size_t be_fread(void *hfile, void *buffer, size_t length) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fread %d\n", length); + if (hfile != nullptr && buffer != nullptr) { + File * f_ptr = (File*) hfile; + int32_t ret = f_ptr->read((uint8_t*) buffer, length); + if (ret >= 0) { + // Serial.printf("be_fread ret = %d\n", ret); + return ret; + } + } +#endif // USE_UFILESYS + return 0; + // return fread(buffer, 1, length, hfile); +} + +char* be_fgets(void *hfile, void *buffer, int size) +{ +#ifdef USE_UFILESYS + if (size <= 2) { return nullptr; } // can't work if size is 2 or less + // Serial.printf("be_fgets size=%d hfile=%p buf=%p\n", size, hfile, buffer); + uint8_t * buf = (uint8_t*) buffer; + if (hfile != nullptr && buffer != nullptr && size > 0) { + File * f_ptr = (File*) hfile; + int ret = f_ptr->readBytesUntil('\n', buf, size - 2); + // Serial.printf("be_fgets ret=%d\n", ret); + if (ret >= 0) { + buf[ret] = 0; // add string terminator + if (ret > 0 && ret < size - 2) { + buf[ret] = '\n'; + buf[ret+1] = 0; + } + return (char*) buffer; + } + } +#endif // USE_UFILESYS + return nullptr; + // return fgets(buffer, size, hfile); +} + +int be_fseek(void *hfile, long offset) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fseek %d\n", offset); + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + if (f_ptr->seek(offset)) { + return 0; // success + } + } +#endif // USE_UFILESYS + return -1; + // return fseek(hfile, offset, SEEK_SET); +} + +long int be_ftell(void *hfile) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_ftell\n"); + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + return f_ptr->position(); + } +#endif // USE_UFILESYS + return 0; + // return ftell(hfile); +} + +long int be_fflush(void *hfile) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fflush\n"); + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + f_ptr->flush(); + } +#endif // USE_UFILESYS + return 0; + // return fflush(hfile); +} + +size_t be_fsize(void *hfile) +{ +#ifdef USE_UFILESYS + // Serial.printf("be_fsize\n"); + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + return f_ptr->size(); + } + // long int size, offset = be_ftell(hfile); + // fseek(hfile, 0L, SEEK_END); + // size = ftell(hfile); + // fseek(hfile, offset, SEEK_SET); + // return size; +#endif // USE_UFILESYS + return 0; +} + +extern "C" time_t be_last_modified(void *hfile) +{ +#ifdef USE_UFILESYS + if (hfile != nullptr) { + File * f_ptr = (File*) hfile; + return f_ptr->getLastWrite(); + } +#endif // USE_UFILESYS + return 0; +} + +int be_isexist(const char *filename) +{ +#ifdef USE_UFILESYS + char fname2[strlen(filename) + 2]; + if (filename[0] == '/') { + strcpy(fname2, filename); // copy unchanged + } else { + fname2[0] = '/'; + strcpy(fname2 + 1, filename); // prepend with '/' + } + return zip_ufsp.exists(fname2); +#endif // USE_UFILESYS + return 0; +} + +int be_unlink(const char *filename) +{ +#ifdef USE_UFILESYS + char fname2[strlen(filename) + 2]; + if (filename[0] == '/') { + strcpy(fname2, filename); // copy unchanged + } else { + fname2[0] = '/'; + strcpy(fname2 + 1, filename); // prepend with '/' + } + return zip_ufsp.remove(fname2); +#endif // USE_UFILESYS + return 0; +} + +#if BE_USE_FILE_SYSTEM +#if defined(USE_FATFS) /* FatFs */ + +int be_isdir(const char *path) +{ + FILINFO fno; + FRESULT fr = f_stat(path, &fno); + return fr == FR_OK && fno.fattrib & AM_DIR; +} + +int be_isfile(const char *path) +{ + FILINFO fno; + FRESULT fr = f_stat(path, &fno); + return fr == FR_OK && !(fno.fattrib & AM_DIR); +} + +int be_isexist(const char *path) +{ + FILINFO fno; + return f_stat(path, &fno) == FR_OK; +} + +char* be_getcwd(char *buf, size_t size) +{ + FRESULT fr = f_getcwd(buf, (UINT)size); + return fr == FR_OK ? buf : NULL; +} + +int be_chdir(const char *path) +{ + return f_chdir(path); +} + +int be_mkdir(const char *path) +{ + return f_mkdir(path); +} + +int be_unlink(const char *filename) +{ + return f_unlink(filename); +} + +int be_dirfirst(bdirinfo *info, const char *path) +{ + info->dir = be_os_malloc(sizeof(DIR)); + info->file = be_os_malloc(sizeof(FILINFO)); + if (info->dir && info->file) { + FRESULT fr = f_opendir(info->dir, path); + return fr == FR_OK ? be_dirnext(info) : 1; + } + be_os_free(info->dir); + be_os_free(info->file); + info->dir = NULL; + info->file = NULL; + return 1; +} + +int be_dirnext(bdirinfo *info) +{ + FRESULT fr = f_readdir(info->dir, info->file); + info->name = ((FILINFO *)info->file)->fname; + return fr != FR_OK || *info->name == '\0'; +} + +int be_dirclose(bdirinfo *info) +{ + if (info->dir) { + int res = f_closedir(info->dir) != FR_OK; + be_os_free(info->dir); + be_os_free(info->file); + return res; + } + return 1; +} + +#elif defined(_MSC_VER) /* MSVC*/ + +#include +#include +#include + +int be_isdir(const char *path) +{ + DWORD type = GetFileAttributes(path); + return type != INVALID_FILE_ATTRIBUTES + && (type & FILE_ATTRIBUTE_DIRECTORY) != 0; +} + +int be_isfile(const char *path) +{ + DWORD type = GetFileAttributes(path); + return type != INVALID_FILE_ATTRIBUTES + && (type & FILE_ATTRIBUTE_DIRECTORY) == 0; +} + +int be_isexist(const char *path) +{ + return GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES; +} + +char* be_getcwd(char *buf, size_t size) +{ + return _getcwd(buf, (int)size); +} + +int be_chdir(const char *path) +{ + return _chdir(path); +} + +int be_mkdir(const char *path) +{ + return _mkdir(path); +} + +int be_unlink(const char *filename) +{ + return remove(filename); +} + +int be_dirfirst(bdirinfo *info, const char *path) +{ + char *buf = be_os_malloc(strlen(path) + 3); + info->file = be_os_malloc(sizeof(struct _finddata_t)); + info->dir = NULL; + if (buf && info->file) { + struct _finddata_t *cfile = info->file; + strcat(strcpy(buf, path), "/*"); + info->dir = (void *)_findfirst(buf, cfile); + info->name = cfile->name; + be_os_free(buf); + return (intptr_t)info->dir == -1; + } + be_os_free(buf); + return 1; +} + +int be_dirnext(bdirinfo *info) +{ + struct _finddata_t *cfile = info->file; + int res = _findnext((intptr_t)info->dir, cfile) != 0; + info->name = cfile->name; + return res; +} + +int be_dirclose(bdirinfo *info) +{ + be_os_free(info->file); + return _findclose((intptr_t)info->dir) != 0; +} + +#else /* must be POSIX */ + +#include +#include +#include + +int be_isdir(const char *path) +{ + struct stat path_stat; + int res = stat(path, &path_stat); + return res == 0 && S_ISDIR(path_stat.st_mode); +} + +int be_isfile(const char *path) +{ + struct stat path_stat; + int res = stat(path, &path_stat); + return res == 0 && !S_ISDIR(path_stat.st_mode); +} + +int be_isexist(const char *path) +{ + struct stat path_stat; + return stat(path, &path_stat) == 0; +} + +char* be_getcwd(char *buf, size_t size) +{ + return getcwd(buf, size); +} + +int be_chdir(const char *path) +{ + return chdir(path); +} + +int be_mkdir(const char *path) +{ +#ifdef _WIN32 + return mkdir(path); +#else + return mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +#endif +} + +int be_unlink(const char *filename) +{ + return remove(filename); +} + +int be_dirfirst(bdirinfo *info, const char *path) +{ + info->dir = opendir(path); + if (info->dir) { + return be_dirnext(info); + } + return 1; +} + +int be_dirnext(bdirinfo *info) +{ + struct dirent *file; + info->file = file = readdir(info->dir); + if (file) { + info->name = file->d_name; + return 0; + } + return 1; +} + +int be_dirclose(bdirinfo *info) +{ + return closedir(info->dir) != 0; +} + +#endif /* POSIX */ +#endif /* BE_USE_OS_MODULE || BE_USE_FILE_SYSTEM */ diff --git a/lib/libesp32/berry/default/be_python_compat.c b/lib/libesp32/berry/default/be_python_compat.c new file mode 100644 index 000000000..5b3ec64d0 --- /dev/null +++ b/lib/libesp32/berry/default/be_python_compat.c @@ -0,0 +1,58 @@ +/******************************************************************** + * Berry python compatibility module + * + * `import python_compat` + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(python_compat__anonymous_, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(global), + /* K1 */ be_nested_str(True), + /* K2 */ be_nested_str(False), + /* K3 */ be_nested_str(None), + /* K4 */ be_nested_str(b), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x50080200, // 0001 LDBOOL R2 1 0 + 0x90060202, // 0002 SETMBR R1 K1 R2 + 0x50080000, // 0003 LDBOOL R2 0 0 + 0x90060402, // 0004 SETMBR R1 K2 R2 + 0x4C080000, // 0005 LDNIL R2 + 0x90060602, // 0006 SETMBR R1 K3 R2 + 0x60080015, // 0007 GETGBL R2 G21 + 0x90060802, // 0008 SETMBR R1 K4 R2 + 0x80040000, // 0009 RET 1 R0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: python_compat +********************************************************************/ +be_local_module(python_compat, + "python_compat", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(python_compat__anonymous__closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(python_compat); +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_re_lib.c b/lib/libesp32/berry/default/be_re_lib.c new file mode 100644 index 000000000..bc28c0e67 --- /dev/null +++ b/lib/libesp32/berry/default/be_re_lib.c @@ -0,0 +1,254 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import re` + * + * Regex using re1.5 + *******************************************************************/ +#include "be_constobj.h" +#include "be_mem.h" +#include "re1.5.h" + +/******************************************************************** +# Berry skeleton for `re` module +# + +class re_pattern + var _p # comobj containing the compiled bytecode for the pattern + + def search() end + def match() end + def split() end +end + +re = module("re") + +re.compile = def (regex_str) end # native +re.match = def (regex_str, str) end # native +re.search = def (regex_str, str) end # native +re.split = def (regex_str, str) end # native + + +*******************************************************************/ + +extern const bclass be_class_re_pattern; + +int be_free_comobj(bvm* vm) { + int argc = be_top(vm); + if (argc > 0) { + void * obj = be_tocomptr(vm, 1); + if (obj != NULL) { be_os_free(obj); } + } + be_return_nil(vm); +} + +// Native functions be_const_func() +// Berry: `re.compile(pattern:string) -> instance(be_pattern)` +int be_re_compile(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 1 && be_isstring(vm, 1)) { + const char * regex_str = be_tostring(vm, 1); + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { + be_raise(vm, "internal_error", "error in regex"); + } + + ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); + int ret = re1_5_compilecode(code, regex_str); + if (ret != 0) { + be_raise(vm, "internal_error", "error in regex"); + } + be_pushntvclass(vm, &be_class_re_pattern); + be_call(vm, 0); + be_newcomobj(vm, code, &be_free_comobj); + be_setmember(vm, -2, "_p"); + be_pop(vm, 1); + be_return(vm); + } + be_raise(vm, "type_error", NULL); +} + + +int be_re_match_search_run(bvm *vm, ByteProg *code, const char *hay, bbool is_anchored) { + Subject subj = {hay, hay + strlen(hay)}; + + int sub_els = (code->sub + 1) * 2; + const char *sub[sub_els]; + + if (!re1_5_recursiveloopprog(code, &subj, sub, sub_els, is_anchored)) { + be_return_nil(vm); // no match + } + + be_newobject(vm, "list"); + int k; + for(k = sub_els; k > 0; k--) + if(sub[k-1]) + break; + for (int i = 0; i < k; i += 2) { + be_pushnstring(vm, sub[i], sub[i+1] - sub[i]); + be_data_push(vm, -2); + be_pop(vm, 1); + } + be_pop(vm, 1); // remove list + be_return(vm); // return list object +} + +int be_re_match_search(bvm *vm, bbool is_anchored) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 2 && be_isstring(vm, 1) && be_isstring(vm, 2)) { + const char * regex_str = be_tostring(vm, 1); + const char * hay = be_tostring(vm, 2); + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { + be_raise(vm, "internal_error", "error in regex"); + } + + ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); + int ret = re1_5_compilecode(code, regex_str); + if (ret != 0) { + be_raise(vm, "internal_error", "error in regex"); + } + return be_re_match_search_run(vm, code, hay, is_anchored); + } + be_raise(vm, "type_error", NULL); +} + +// Berry: `re.match(value:int | s:string) -> nil` +int be_re_match(bvm *vm) { + return be_re_match_search(vm, btrue); +} +// Berry: `re.search(value:int | s:string) -> nil` +int be_re_search(bvm *vm) { + return be_re_match_search(vm, bfalse); +} + +// Berry: `re_pattern.search(s:string) -> list(string)` +int re_pattern_search(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 2 && be_isstring(vm, 2)) { + const char * hay = be_tostring(vm, 2); + be_getmember(vm, 1, "_p"); + ByteProg * code = (ByteProg*) be_tocomptr(vm, -1); + return be_re_match_search_run(vm, code, hay, bfalse); + } + be_raise(vm, "type_error", NULL); +} + +// Berry: `re_pattern.match(s:string) -> list(string)` +int re_pattern_match(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 2 && be_isstring(vm, 2)) { + const char * hay = be_tostring(vm, 2); + be_getmember(vm, 1, "_p"); + ByteProg * code = (ByteProg*) be_tocomptr(vm, -1); + return be_re_match_search_run(vm, code, hay, btrue); + } + be_raise(vm, "type_error", NULL); +} + + +int re_pattern_split_run(bvm *vm, ByteProg *code, const char *hay, int split_limit) { + Subject subj = {hay, hay + strlen(hay)}; + + int sub_els = (code->sub + 1) * 2; + const char *sub[sub_els]; + + be_newobject(vm, "list"); + while (1) { + if (split_limit == 0 || !re1_5_recursiveloopprog(code, &subj, sub, sub_els, bfalse)) { + be_pushnstring(vm, subj.begin, subj.end - subj.begin); + be_data_push(vm, -2); + be_pop(vm, 1); + break; + } + + if (sub[0] == NULL || sub[1] == NULL || sub[0] == sub[1]) { + be_raise(vm, "internal_error", "can't match"); + } + be_pushnstring(vm, subj.begin, sub[0] - subj.begin); + be_data_push(vm, -2); + be_pop(vm, 1); + subj.begin = sub[1]; + split_limit--; + } + be_pop(vm, 1); // remove list + be_return(vm); // return list object +} + +// Berry: `re_pattern.split(s:string [, split_limit:int]) -> list(string)` +int re_pattern_split(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 2 && be_isstring(vm, 2)) { + int split_limit = -1; + if (argc >= 3) { + split_limit = be_toint(vm, 3); + } + const char * hay = be_tostring(vm, 2); + be_getmember(vm, 1, "_p"); + ByteProg * code = (ByteProg*) be_tocomptr(vm, -1); + + return re_pattern_split_run(vm, code, hay, split_limit); + } + be_raise(vm, "type_error", NULL); +} + +// Berry: `re.split(pattern:string, s:string [, split_limit:int]) -> list(string)` +int be_re_split(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 2 && be_isstring(vm, 1) && be_isstring(vm, 2)) { + const char * regex_str = be_tostring(vm, 1); + const char * hay = be_tostring(vm, 2); + int split_limit = -1; + if (argc >= 3) { + split_limit = be_toint(vm, 3); + } + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { + be_raise(vm, "internal_error", "error in regex"); + } + + ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); + int ret = re1_5_compilecode(code, regex_str); + if (ret != 0) { + be_raise(vm, "internal_error", "error in regex"); + } + return re_pattern_split_run(vm, code, hay, split_limit); + } + be_raise(vm, "type_error", NULL); +} + +/******************************************************************** +** Solidified module: re +********************************************************************/ +be_local_module(re, + "re", + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("compile", 1000265118, 7, -1), be_const_func(be_re_compile) }, + { be_nested_key("search", -2144130903, 6, -1), be_const_func(be_re_search) }, + { be_nested_key("match", 2116038550, 5, 0), be_const_func(be_re_match) }, + { be_nested_key("split", -2017972765, 5, -1), be_const_func(be_re_split) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(re); +/********************************************************************/ + +// =================================================================== + +/******************************************************************** +** Solidified class: re_pattern +********************************************************************/ +be_local_class(re_pattern, + 1, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_nested_key("_p", 1594591802, 2, -1), be_const_var(0) }, + { be_nested_key("search", -2144130903, 6, -1), be_const_func(re_pattern_search) }, + { be_nested_key("match", 2116038550, 5, 0), be_const_func(re_pattern_match) }, + { be_nested_key("split", -2017972765, 5, -1), be_const_func(re_pattern_split) }, + })), + (be_nested_const_str("re_pattern", 2041968961, 10)) +); +/*******************************************************************/ + diff --git a/lib/libesp32/berry/default/be_serial_lib.c b/lib/libesp32/berry/default/be_serial_lib.c new file mode 100644 index 000000000..4f1c4b577 --- /dev/null +++ b/lib/libesp32/berry/default/be_serial_lib.c @@ -0,0 +1,66 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import wire` + * + * 2 wire communication - I2C + *******************************************************************/ +#include "be_constobj.h" + +#include "esp32-hal.h" + +extern int b_serial_init(bvm *vm); +extern int b_serial_deinit(bvm *vm); + +extern int b_serial_write(bvm *vm); +extern int b_serial_read(bvm *vm); +extern int b_serial_available(bvm *vm); +extern int b_serial_flush(bvm *vm); + +#include "../generate/be_fixed_be_class_tasmota_serial.h" + +void be_load_serial_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_tasmota_serial); + be_setglobal(vm, "serial"); + be_pop(vm, 1); +} + +/* @const_object_info_begin + +class be_class_tasmota_serial (scope: global, name: serial) { + .p, var + + SERIAL_5N1, int(SERIAL_5N1) + SERIAL_6N1, int(SERIAL_6N1) + SERIAL_7N1, int(SERIAL_7N1) + SERIAL_8N1, int(SERIAL_8N1) + SERIAL_5N2, int(SERIAL_5N2) + SERIAL_6N2, int(SERIAL_6N2) + SERIAL_7N2, int(SERIAL_7N2) + SERIAL_8N2, int(SERIAL_8N2) + SERIAL_5E1, int(SERIAL_5E1) + SERIAL_6E1, int(SERIAL_6E1) + SERIAL_7E1, int(SERIAL_7E1) + SERIAL_8E1, int(SERIAL_8E1) + SERIAL_5E2, int(SERIAL_5E2) + SERIAL_6E2, int(SERIAL_6E2) + SERIAL_7E2, int(SERIAL_7E2) + SERIAL_8E2, int(SERIAL_8E2) + SERIAL_5O1, int(SERIAL_5O1) + SERIAL_6O1, int(SERIAL_6O1) + SERIAL_7O1, int(SERIAL_7O1) + SERIAL_8O1, int(SERIAL_8O1) + SERIAL_5O2, int(SERIAL_5O2) + SERIAL_6O2, int(SERIAL_6O2) + SERIAL_7O2, int(SERIAL_7O2) + SERIAL_8O2, int(SERIAL_8O2) + + init, func(b_serial_init) + deinit, func(b_serial_deinit) + + write, func(b_serial_write) + read, func(b_serial_read) + available, func(b_serial_available) + flush, func(b_serial_flush) +} +@const_object_info_end */ diff --git a/lib/libesp32/berry/default/be_tapp_lib.c b/lib/libesp32/berry/default/be_tapp_lib.c new file mode 100644 index 000000000..1a312d110 --- /dev/null +++ b/lib/libesp32/berry/default/be_tapp_lib.c @@ -0,0 +1,168 @@ +/******************************************************************** + * Tasmota App manager + * + * To use: `import tapp` + * + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Tapp_init, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(add_driver), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: autoexec +********************************************************************/ +be_local_closure(Tapp_autoexec, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[15]) { /* constants */ + /* K0 */ be_nested_str(path), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(listdir), + /* K3 */ be_nested_str(_X2F), + /* K4 */ be_nested_str(find), + /* K5 */ be_nested_str(_X2Etapp), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str(tasmota), + /* K8 */ be_nested_str(log), + /* K9 */ be_nested_str(format), + /* K10 */ be_nested_str(TAP_X3A_X20found_X20Tasmota_X20App_X20_X27_X25s_X27), + /* K11 */ be_const_int(2), + /* K12 */ be_nested_str(load), + /* K13 */ be_nested_str(_X23autoexec_X2Ebe), + /* K14 */ be_nested_str(stop_iteration), + }), + &be_const_str_autoexec, + &be_const_str_solidified, + ( &(const binstruction[34]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x8C0C0302, // 0002 GETMET R3 R1 K2 + 0x58140003, // 0003 LDCONST R5 K3 + 0x7C0C0400, // 0004 CALL R3 2 + 0x60100010, // 0005 GETGBL R4 G16 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0xA8020014, // 0008 EXBLK 0 #001E + 0x5C140800, // 0009 MOVE R5 R4 + 0x7C140000, // 000A CALL R5 0 + 0x8C180504, // 000B GETMET R6 R2 K4 + 0x5C200A00, // 000C MOVE R8 R5 + 0x58240005, // 000D LDCONST R9 K5 + 0x7C180600, // 000E CALL R6 3 + 0x24180D06, // 000F GT R6 R6 K6 + 0x781A000B, // 0010 JMPF R6 #001D + 0xB81A0E00, // 0011 GETNGBL R6 K7 + 0x8C180D08, // 0012 GETMET R6 R6 K8 + 0x8C200509, // 0013 GETMET R8 R2 K9 + 0x5828000A, // 0014 LDCONST R10 K10 + 0x5C2C0A00, // 0015 MOVE R11 R5 + 0x7C200600, // 0016 CALL R8 3 + 0x5824000B, // 0017 LDCONST R9 K11 + 0x7C180600, // 0018 CALL R6 3 + 0xB81A0E00, // 0019 GETNGBL R6 K7 + 0x8C180D0C, // 001A GETMET R6 R6 K12 + 0x00200B0D, // 001B ADD R8 R5 K13 + 0x7C180400, // 001C CALL R6 2 + 0x7001FFEA, // 001D JMP #0009 + 0x5810000E, // 001E LDCONST R4 K14 + 0xAC100200, // 001F CATCH R4 1 0 + 0xB0080000, // 0020 RAISE 2 R0 R0 + 0x80000000, // 0021 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Tapp +********************************************************************/ +be_local_class(Tapp, + 0, + NULL, + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(autoexec, -1), be_const_closure(Tapp_autoexec_closure) }, + { be_const_key(init, 0), be_const_closure(Tapp_init_closure) }, + })), + be_str_literal("Tapp") +); + +/******************************************************************** +** Solidified function: _anonymous_ +********************************************************************/ +be_local_closure(tapp__anonymous_, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_class(be_class_Tapp), + }), + &be_const_str__anonymous_, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0xB4000000, // 0001 CLASS K0 + 0x5C080200, // 0002 MOVE R2 R1 + 0x7C080000, // 0003 CALL R2 0 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified module: tapp +********************************************************************/ +be_local_module(tapp, + "tapp", + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(tapp__anonymous__closure) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(tapp); +/********************************************************************/ diff --git a/lib/libesp32/berry/default/be_tasmotalib.c b/lib/libesp32/berry/default/be_tasmotalib.c new file mode 100644 index 000000000..6539b0de3 --- /dev/null +++ b/lib/libesp32/berry/default/be_tasmotalib.c @@ -0,0 +1,2079 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import tasmota` + *******************************************************************/ +#include "be_constobj.h" + +struct dummy_struct {}; // we need a struct name but don't need any meaningful content, we just take the address +extern struct TasmotaGlobal_t TasmotaGlobal; +extern struct TSettings * Settings; +extern struct dummy_struct be_tasmota_global_struct; +extern struct dummy_struct be_tasmota_settings_struct; + +extern int l_getFreeHeap(bvm *vm); +extern int l_arch(bvm *vm); +extern int l_publish(bvm *vm); +extern int l_publish_result(bvm *vm); +extern int l_cmd(bvm *vm); +extern int l_getoption(bvm *vm); +extern int l_millis(bvm *vm); +extern int l_timereached(bvm *vm); +extern int l_rtc(bvm *vm); +extern int l_time_dump(bvm *vm); +extern int l_strftime(bvm *vm); +extern int l_strptime(bvm *vm); +extern int l_memory(bvm *vm); +extern int l_wifi(bvm *vm); +extern int l_eth(bvm *vm); +extern int l_yield(bvm *vm); +extern int l_delay(bvm *vm); +extern int l_scaleuint(bvm *vm); +extern int l_logInfo(bvm *vm); +extern int l_save(bvm *vm); + +extern int l_read_sensors(bvm *vm); + +extern int l_respCmnd(bvm *vm); +extern int l_respCmndStr(bvm *vm); +extern int l_respCmndDone(bvm *vm); +extern int l_respCmndError(bvm *vm); +extern int l_respCmndFailed(bvm *vm); +extern int l_resolveCmnd(bvm *vm); + +extern int l_respAppend(bvm *vm); +extern int l_webSend(bvm *vm); +extern int l_webSendDecimal(bvm *vm); + +extern int l_getlight(bvm *vm); +extern int l_setlight(bvm *vm); +extern int l_getpower(bvm *vm); +extern int l_setpower(bvm *vm); +extern int l_getswitch(bvm *vm); + +extern int l_i2cenabled(bvm *vm); + + +/******************************************************************** +** Solidified function: add_driver +********************************************************************/ +be_local_closure(Tasmota_add_driver, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_drivers), + /* K1 */ be_nested_str(push), + }), + &be_const_str_add_driver, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A0004, // 0001 JMPF R2 #0007 + 0x88080100, // 0002 GETMBR R2 R0 K0 + 0x8C080501, // 0003 GETMET R2 R2 K1 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0x70020003, // 0006 JMP #000B + 0x60080012, // 0007 GETGBL R2 G18 + 0x7C080000, // 0008 CALL R2 0 + 0x400C0401, // 0009 CONNECT R3 R2 R1 + 0x90020002, // 000A SETMBR R0 K0 R2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: gc +********************************************************************/ +be_local_closure(Tasmota_gc, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(gc), + /* K1 */ be_nested_str(collect), + /* K2 */ be_nested_str(allocated), + }), + &be_const_str_gc, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x7C080200, // 0004 CALL R2 1 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: find_op +********************************************************************/ +be_local_closure(Tasmota_find_op, /* name */ + be_nested_proto( + 13, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(_X3D_X3C_X3E_X21), + /* K2 */ be_nested_str(chars_in_string), + /* K3 */ be_const_int(0), + /* K4 */ be_nested_str(split), + /* K5 */ be_const_int(1), + }), + &be_const_str_find_op, + &be_const_str_solidified, + ( &(const binstruction[42]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x8C100102, // 0002 GETMET R4 R0 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x5C1C0600, // 0004 MOVE R7 R3 + 0x7C100600, // 0005 CALL R4 3 + 0x28140903, // 0006 GE R5 R4 K3 + 0x78160019, // 0007 JMPF R5 #0022 + 0x8C140504, // 0008 GETMET R5 R2 K4 + 0x5C1C0200, // 0009 MOVE R7 R1 + 0x5C200800, // 000A MOVE R8 R4 + 0x7C140600, // 000B CALL R5 3 + 0x94180B03, // 000C GETIDX R6 R5 K3 + 0x941C0B05, // 000D GETIDX R7 R5 K5 + 0x8C200102, // 000E GETMET R8 R0 K2 + 0x5C280E00, // 000F MOVE R10 R7 + 0x5C2C0600, // 0010 MOVE R11 R3 + 0x50300200, // 0011 LDBOOL R12 1 0 + 0x7C200800, // 0012 CALL R8 4 + 0x5C101000, // 0013 MOVE R4 R8 + 0x28200903, // 0014 GE R8 R4 K3 + 0x7822000B, // 0015 JMPF R8 #0022 + 0x8C200504, // 0016 GETMET R8 R2 K4 + 0x5C280E00, // 0017 MOVE R10 R7 + 0x5C2C0800, // 0018 MOVE R11 R4 + 0x7C200600, // 0019 CALL R8 3 + 0x94241103, // 001A GETIDX R9 R8 K3 + 0x94281105, // 001B GETIDX R10 R8 K5 + 0x602C0012, // 001C GETGBL R11 G18 + 0x7C2C0000, // 001D CALL R11 0 + 0x40301606, // 001E CONNECT R12 R11 R6 + 0x40301609, // 001F CONNECT R12 R11 R9 + 0x4030160A, // 0020 CONNECT R12 R11 R10 + 0x80041600, // 0021 RET 1 R11 + 0x60140012, // 0022 GETGBL R5 G18 + 0x7C140000, // 0023 CALL R5 0 + 0x40180A01, // 0024 CONNECT R6 R5 R1 + 0x4C180000, // 0025 LDNIL R6 + 0x40180A06, // 0026 CONNECT R6 R5 R6 + 0x4C180000, // 0027 LDNIL R6 + 0x40180A06, // 0028 CONNECT R6 R5 R6 + 0x80040A00, // 0029 RET 1 R5 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: try_rule +********************************************************************/ +be_local_closure(Tasmota_try_rule, /* name */ + be_nested_proto( + 15, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[16]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(find_op), + /* K2 */ be_nested_str(split), + /* K3 */ be_const_int(0), + /* K4 */ be_nested_str(_X23), + /* K5 */ be_nested_str(find_key_i), + /* K6 */ be_const_int(1), + /* K7 */ be_const_int(2), + /* K8 */ be_nested_str(_X3D_X3D), + /* K9 */ be_nested_str(_X21_X3D_X3D), + /* K10 */ be_nested_str(_X3D), + /* K11 */ be_nested_str(_X21_X3D), + /* K12 */ be_nested_str(_X3E), + /* K13 */ be_nested_str(_X3E_X3D), + /* K14 */ be_nested_str(_X3C), + /* K15 */ be_nested_str(_X3C_X3D), + }), + &be_const_str_try_rule, + &be_const_str_solidified, + ( &(const binstruction[141]) { /* code */ + 0xA4120000, // 0000 IMPORT R4 K0 + 0x8C140101, // 0001 GETMET R5 R0 K1 + 0x5C1C0400, // 0002 MOVE R7 R2 + 0x7C140400, // 0003 CALL R5 2 + 0x5C180200, // 0004 MOVE R6 R1 + 0x8C1C0902, // 0005 GETMET R7 R4 K2 + 0x94240B03, // 0006 GETIDX R9 R5 K3 + 0x58280004, // 0007 LDCONST R10 K4 + 0x7C1C0600, // 0008 CALL R7 3 + 0x58200003, // 0009 LDCONST R8 K3 + 0x6024000C, // 000A GETGBL R9 G12 + 0x5C280E00, // 000B MOVE R10 R7 + 0x7C240200, // 000C CALL R9 1 + 0x14241009, // 000D LT R9 R8 R9 + 0x7826000C, // 000E JMPF R9 #001C + 0x94240E08, // 000F GETIDX R9 R7 R8 + 0x8C280105, // 0010 GETMET R10 R0 K5 + 0x5C300C00, // 0011 MOVE R12 R6 + 0x5C341200, // 0012 MOVE R13 R9 + 0x7C280600, // 0013 CALL R10 3 + 0x4C2C0000, // 0014 LDNIL R11 + 0x1C2C140B, // 0015 EQ R11 R10 R11 + 0x782E0001, // 0016 JMPF R11 #0019 + 0x502C0000, // 0017 LDBOOL R11 0 0 + 0x80041600, // 0018 RET 1 R11 + 0x94180C0A, // 0019 GETIDX R6 R6 R10 + 0x00201106, // 001A ADD R8 R8 K6 + 0x7001FFED, // 001B JMP #000A + 0x94240B06, // 001C GETIDX R9 R5 K6 + 0x94280B07, // 001D GETIDX R10 R5 K7 + 0x78260066, // 001E JMPF R9 #0086 + 0x1C2C1308, // 001F EQ R11 R9 K8 + 0x782E000A, // 0020 JMPF R11 #002C + 0x602C0008, // 0021 GETGBL R11 G8 + 0x5C300C00, // 0022 MOVE R12 R6 + 0x7C2C0200, // 0023 CALL R11 1 + 0x60300008, // 0024 GETGBL R12 G8 + 0x5C341400, // 0025 MOVE R13 R10 + 0x7C300200, // 0026 CALL R12 1 + 0x202C160C, // 0027 NE R11 R11 R12 + 0x782E0001, // 0028 JMPF R11 #002B + 0x502C0000, // 0029 LDBOOL R11 0 0 + 0x80041600, // 002A RET 1 R11 + 0x70020059, // 002B JMP #0086 + 0x1C2C1309, // 002C EQ R11 R9 K9 + 0x782E000A, // 002D JMPF R11 #0039 + 0x602C0008, // 002E GETGBL R11 G8 + 0x5C300C00, // 002F MOVE R12 R6 + 0x7C2C0200, // 0030 CALL R11 1 + 0x60300008, // 0031 GETGBL R12 G8 + 0x5C341400, // 0032 MOVE R13 R10 + 0x7C300200, // 0033 CALL R12 1 + 0x1C2C160C, // 0034 EQ R11 R11 R12 + 0x782E0001, // 0035 JMPF R11 #0038 + 0x502C0000, // 0036 LDBOOL R11 0 0 + 0x80041600, // 0037 RET 1 R11 + 0x7002004C, // 0038 JMP #0086 + 0x1C2C130A, // 0039 EQ R11 R9 K10 + 0x782E000A, // 003A JMPF R11 #0046 + 0x602C000A, // 003B GETGBL R11 G10 + 0x5C300C00, // 003C MOVE R12 R6 + 0x7C2C0200, // 003D CALL R11 1 + 0x6030000A, // 003E GETGBL R12 G10 + 0x5C341400, // 003F MOVE R13 R10 + 0x7C300200, // 0040 CALL R12 1 + 0x202C160C, // 0041 NE R11 R11 R12 + 0x782E0001, // 0042 JMPF R11 #0045 + 0x502C0000, // 0043 LDBOOL R11 0 0 + 0x80041600, // 0044 RET 1 R11 + 0x7002003F, // 0045 JMP #0086 + 0x1C2C130B, // 0046 EQ R11 R9 K11 + 0x782E000A, // 0047 JMPF R11 #0053 + 0x602C000A, // 0048 GETGBL R11 G10 + 0x5C300C00, // 0049 MOVE R12 R6 + 0x7C2C0200, // 004A CALL R11 1 + 0x6030000A, // 004B GETGBL R12 G10 + 0x5C341400, // 004C MOVE R13 R10 + 0x7C300200, // 004D CALL R12 1 + 0x1C2C160C, // 004E EQ R11 R11 R12 + 0x782E0001, // 004F JMPF R11 #0052 + 0x502C0000, // 0050 LDBOOL R11 0 0 + 0x80041600, // 0051 RET 1 R11 + 0x70020032, // 0052 JMP #0086 + 0x1C2C130C, // 0053 EQ R11 R9 K12 + 0x782E000A, // 0054 JMPF R11 #0060 + 0x602C000A, // 0055 GETGBL R11 G10 + 0x5C300C00, // 0056 MOVE R12 R6 + 0x7C2C0200, // 0057 CALL R11 1 + 0x6030000A, // 0058 GETGBL R12 G10 + 0x5C341400, // 0059 MOVE R13 R10 + 0x7C300200, // 005A CALL R12 1 + 0x182C160C, // 005B LE R11 R11 R12 + 0x782E0001, // 005C JMPF R11 #005F + 0x502C0000, // 005D LDBOOL R11 0 0 + 0x80041600, // 005E RET 1 R11 + 0x70020025, // 005F JMP #0086 + 0x1C2C130D, // 0060 EQ R11 R9 K13 + 0x782E000A, // 0061 JMPF R11 #006D + 0x602C000A, // 0062 GETGBL R11 G10 + 0x5C300C00, // 0063 MOVE R12 R6 + 0x7C2C0200, // 0064 CALL R11 1 + 0x6030000A, // 0065 GETGBL R12 G10 + 0x5C341400, // 0066 MOVE R13 R10 + 0x7C300200, // 0067 CALL R12 1 + 0x142C160C, // 0068 LT R11 R11 R12 + 0x782E0001, // 0069 JMPF R11 #006C + 0x502C0000, // 006A LDBOOL R11 0 0 + 0x80041600, // 006B RET 1 R11 + 0x70020018, // 006C JMP #0086 + 0x1C2C130E, // 006D EQ R11 R9 K14 + 0x782E000A, // 006E JMPF R11 #007A + 0x602C000A, // 006F GETGBL R11 G10 + 0x5C300C00, // 0070 MOVE R12 R6 + 0x7C2C0200, // 0071 CALL R11 1 + 0x6030000A, // 0072 GETGBL R12 G10 + 0x5C341400, // 0073 MOVE R13 R10 + 0x7C300200, // 0074 CALL R12 1 + 0x282C160C, // 0075 GE R11 R11 R12 + 0x782E0001, // 0076 JMPF R11 #0079 + 0x502C0000, // 0077 LDBOOL R11 0 0 + 0x80041600, // 0078 RET 1 R11 + 0x7002000B, // 0079 JMP #0086 + 0x1C2C130F, // 007A EQ R11 R9 K15 + 0x782E0009, // 007B JMPF R11 #0086 + 0x602C000A, // 007C GETGBL R11 G10 + 0x5C300C00, // 007D MOVE R12 R6 + 0x7C2C0200, // 007E CALL R11 1 + 0x6030000A, // 007F GETGBL R12 G10 + 0x5C341400, // 0080 MOVE R13 R10 + 0x7C300200, // 0081 CALL R12 1 + 0x242C160C, // 0082 GT R11 R11 R12 + 0x782E0001, // 0083 JMPF R11 #0086 + 0x502C0000, // 0084 LDBOOL R11 0 0 + 0x80041600, // 0085 RET 1 R11 + 0x5C2C0600, // 0086 MOVE R11 R3 + 0x5C300C00, // 0087 MOVE R12 R6 + 0x94340B03, // 0088 GETIDX R13 R5 K3 + 0x5C380200, // 0089 MOVE R14 R1 + 0x7C2C0600, // 008A CALL R11 3 + 0x502C0200, // 008B LDBOOL R11 1 0 + 0x80041600, // 008C RET 1 R11 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: gen_cb +********************************************************************/ +be_local_closure(Tasmota_gen_cb, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(cb), + /* K1 */ be_nested_str(gen_cb), + }), + &be_const_str_gen_cb, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x8C0C0501, // 0001 GETMET R3 R2 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C0C0400, // 0003 CALL R3 2 + 0x80040600, // 0004 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_light +********************************************************************/ +be_local_closure(Tasmota_set_light, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(tasmota_X2Eset_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eset_X28_X29), + /* K1 */ be_nested_str(light), + /* K2 */ be_nested_str(set), + }), + &be_const_str_set_light, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x600C0001, // 0000 GETGBL R3 G1 + 0x58100000, // 0001 LDCONST R4 K0 + 0x7C0C0200, // 0002 CALL R3 1 + 0xA40E0200, // 0003 IMPORT R3 K1 + 0x4C100000, // 0004 LDNIL R4 + 0x20100404, // 0005 NE R4 R2 R4 + 0x78120005, // 0006 JMPF R4 #000D + 0x8C100702, // 0007 GETMET R4 R3 K2 + 0x5C180200, // 0008 MOVE R6 R1 + 0x5C1C0400, // 0009 MOVE R7 R2 + 0x7C100600, // 000A CALL R4 3 + 0x80040800, // 000B RET 1 R4 + 0x70020003, // 000C JMP #0011 + 0x8C100702, // 000D GETMET R4 R3 K2 + 0x5C180200, // 000E MOVE R6 R1 + 0x7C100400, // 000F CALL R4 2 + 0x80040800, // 0010 RET 1 R4 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: exec_tele +********************************************************************/ +be_local_closure(Tasmota_exec_tele, /* name */ + be_nested_proto( + 12, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(_rules), + /* K1 */ be_nested_str(json), + /* K2 */ be_nested_str(load), + /* K3 */ be_nested_str(log), + /* K4 */ be_nested_str(BRY_X3A_X20ERROR_X2C_X20bad_X20json_X3A_X20), + /* K5 */ be_const_int(3), + /* K6 */ be_nested_str(Tele), + /* K7 */ be_const_int(0), + /* K8 */ be_nested_str(try_rule), + /* K9 */ be_nested_str(k), + /* K10 */ be_nested_str(v), + /* K11 */ be_const_int(1), + }), + &be_const_str_exec_tele, + &be_const_str_solidified, + ( &(const binstruction[41]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A0024, // 0001 JMPF R2 #0027 + 0xA40A0200, // 0002 IMPORT R2 K1 + 0x8C0C0502, // 0003 GETMET R3 R2 K2 + 0x5C140200, // 0004 MOVE R5 R1 + 0x7C0C0400, // 0005 CALL R3 2 + 0x50100000, // 0006 LDBOOL R4 0 0 + 0x4C140000, // 0007 LDNIL R5 + 0x1C140605, // 0008 EQ R5 R3 R5 + 0x78160004, // 0009 JMPF R5 #000F + 0x8C140103, // 000A GETMET R5 R0 K3 + 0x001E0801, // 000B ADD R7 K4 R1 + 0x58200005, // 000C LDCONST R8 K5 + 0x7C140600, // 000D CALL R5 3 + 0x5C0C0200, // 000E MOVE R3 R1 + 0x60140013, // 000F GETGBL R5 G19 + 0x7C140000, // 0010 CALL R5 0 + 0x98160C03, // 0011 SETIDX R5 K6 R3 + 0x5C0C0A00, // 0012 MOVE R3 R5 + 0x58140007, // 0013 LDCONST R5 K7 + 0x6018000C, // 0014 GETGBL R6 G12 + 0x881C0100, // 0015 GETMBR R7 R0 K0 + 0x7C180200, // 0016 CALL R6 1 + 0x14180A06, // 0017 LT R6 R5 R6 + 0x781A000C, // 0018 JMPF R6 #0026 + 0x88180100, // 0019 GETMBR R6 R0 K0 + 0x94180C05, // 001A GETIDX R6 R6 R5 + 0x8C1C0108, // 001B GETMET R7 R0 K8 + 0x5C240600, // 001C MOVE R9 R3 + 0x88280D09, // 001D GETMBR R10 R6 K9 + 0x882C0D0A, // 001E GETMBR R11 R6 K10 + 0x7C1C0800, // 001F CALL R7 4 + 0x741E0001, // 0020 JMPT R7 #0023 + 0x74120000, // 0021 JMPT R4 #0023 + 0x50100001, // 0022 LDBOOL R4 0 1 + 0x50100200, // 0023 LDBOOL R4 1 0 + 0x00140B0B, // 0024 ADD R5 R5 K11 + 0x7001FFED, // 0025 JMP #0014 + 0x80040800, // 0026 RET 1 R4 + 0x50080000, // 0027 LDBOOL R2 0 0 + 0x80040400, // 0028 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: run_deferred +********************************************************************/ +be_local_closure(Tasmota_run_deferred, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(_timers), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(size), + /* K3 */ be_nested_str(time_reached), + /* K4 */ be_nested_str(due), + /* K5 */ be_nested_str(f), + /* K6 */ be_nested_str(remove), + /* K7 */ be_const_int(1), + }), + &be_const_str_run_deferred, + &be_const_str_solidified, + ( &(const binstruction[27]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x78060017, // 0001 JMPF R1 #001A + 0x58040001, // 0002 LDCONST R1 K1 + 0x88080100, // 0003 GETMBR R2 R0 K0 + 0x8C080502, // 0004 GETMET R2 R2 K2 + 0x7C080200, // 0005 CALL R2 1 + 0x14080202, // 0006 LT R2 R1 R2 + 0x780A0011, // 0007 JMPF R2 #001A + 0x8C080103, // 0008 GETMET R2 R0 K3 + 0x88100100, // 0009 GETMBR R4 R0 K0 + 0x94100801, // 000A GETIDX R4 R4 R1 + 0x88100904, // 000B GETMBR R4 R4 K4 + 0x7C080400, // 000C CALL R2 2 + 0x780A0009, // 000D JMPF R2 #0018 + 0x88080100, // 000E GETMBR R2 R0 K0 + 0x94080401, // 000F GETIDX R2 R2 R1 + 0x88080505, // 0010 GETMBR R2 R2 K5 + 0x880C0100, // 0011 GETMBR R3 R0 K0 + 0x8C0C0706, // 0012 GETMET R3 R3 K6 + 0x5C140200, // 0013 MOVE R5 R1 + 0x7C0C0400, // 0014 CALL R3 2 + 0x5C0C0400, // 0015 MOVE R3 R2 + 0x7C0C0000, // 0016 CALL R3 0 + 0x70020000, // 0017 JMP #0019 + 0x00040307, // 0018 ADD R1 R1 K7 + 0x7001FFE8, // 0019 JMP #0003 + 0x80000000, // 001A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove_driver +********************************************************************/ +be_local_closure(Tasmota_remove_driver, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(_drivers), + /* K1 */ be_nested_str(find), + /* K2 */ be_nested_str(pop), + }), + &be_const_str_remove_driver, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A000A, // 0001 JMPF R2 #000D + 0x88080100, // 0002 GETMBR R2 R0 K0 + 0x8C080501, // 0003 GETMET R2 R2 K1 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0x4C0C0000, // 0006 LDNIL R3 + 0x200C0403, // 0007 NE R3 R2 R3 + 0x780E0003, // 0008 JMPF R3 #000D + 0x880C0100, // 0009 GETMBR R3 R0 K0 + 0x8C0C0702, // 000A GETMET R3 R3 K2 + 0x5C140400, // 000B MOVE R5 R2 + 0x7C0C0400, // 000C CALL R3 2 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: event +********************************************************************/ +be_local_closure(Tasmota_event, /* name */ + be_nested_proto( + 20, /* nstack */ + 6, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[23]) { /* constants */ + /* K0 */ be_nested_str(introspect), + /* K1 */ be_nested_str(string), + /* K2 */ be_nested_str(every_50ms), + /* K3 */ be_nested_str(run_deferred), + /* K4 */ be_nested_str(cmd), + /* K5 */ be_nested_str(exec_cmd), + /* K6 */ be_nested_str(tele), + /* K7 */ be_nested_str(exec_tele), + /* K8 */ be_nested_str(rule), + /* K9 */ be_nested_str(exec_rules), + /* K10 */ be_nested_str(gc), + /* K11 */ be_nested_str(_drivers), + /* K12 */ be_const_int(0), + /* K13 */ be_nested_str(get), + /* K14 */ be_nested_str(function), + /* K15 */ be_nested_str(format), + /* K16 */ be_nested_str(BRY_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s), + /* K17 */ be_nested_str(debug), + /* K18 */ be_nested_str(traceback), + /* K19 */ be_const_int(1), + /* K20 */ be_nested_str(save_before_restart), + /* K21 */ be_nested_str(persist), + /* K22 */ be_nested_str(save), + }), + &be_const_str_event, + &be_const_str_solidified, + ( &(const binstruction[91]) { /* code */ + 0xA41A0000, // 0000 IMPORT R6 K0 + 0xA41E0200, // 0001 IMPORT R7 K1 + 0x1C200302, // 0002 EQ R8 R1 K2 + 0x78220001, // 0003 JMPF R8 #0006 + 0x8C200103, // 0004 GETMET R8 R0 K3 + 0x7C200200, // 0005 CALL R8 1 + 0x50200000, // 0006 LDBOOL R8 0 0 + 0x1C240304, // 0007 EQ R9 R1 K4 + 0x78260006, // 0008 JMPF R9 #0010 + 0x8C240105, // 0009 GETMET R9 R0 K5 + 0x5C2C0400, // 000A MOVE R11 R2 + 0x5C300600, // 000B MOVE R12 R3 + 0x5C340800, // 000C MOVE R13 R4 + 0x7C240800, // 000D CALL R9 4 + 0x80041200, // 000E RET 1 R9 + 0x70020044, // 000F JMP #0055 + 0x1C240306, // 0010 EQ R9 R1 K6 + 0x78260004, // 0011 JMPF R9 #0017 + 0x8C240107, // 0012 GETMET R9 R0 K7 + 0x5C2C0800, // 0013 MOVE R11 R4 + 0x7C240400, // 0014 CALL R9 2 + 0x80041200, // 0015 RET 1 R9 + 0x7002003D, // 0016 JMP #0055 + 0x1C240308, // 0017 EQ R9 R1 K8 + 0x78260004, // 0018 JMPF R9 #001E + 0x8C240109, // 0019 GETMET R9 R0 K9 + 0x5C2C0800, // 001A MOVE R11 R4 + 0x7C240400, // 001B CALL R9 2 + 0x80041200, // 001C RET 1 R9 + 0x70020036, // 001D JMP #0055 + 0x1C24030A, // 001E EQ R9 R1 K10 + 0x78260003, // 001F JMPF R9 #0024 + 0x8C24010A, // 0020 GETMET R9 R0 K10 + 0x7C240200, // 0021 CALL R9 1 + 0x80041200, // 0022 RET 1 R9 + 0x70020030, // 0023 JMP #0055 + 0x8824010B, // 0024 GETMBR R9 R0 K11 + 0x7826002E, // 0025 JMPF R9 #0055 + 0x5824000C, // 0026 LDCONST R9 K12 + 0x6028000C, // 0027 GETGBL R10 G12 + 0x882C010B, // 0028 GETMBR R11 R0 K11 + 0x7C280200, // 0029 CALL R10 1 + 0x1428120A, // 002A LT R10 R9 R10 + 0x782A0028, // 002B JMPF R10 #0055 + 0x8828010B, // 002C GETMBR R10 R0 K11 + 0x94281409, // 002D GETIDX R10 R10 R9 + 0x8C2C0D0D, // 002E GETMET R11 R6 K13 + 0x5C341400, // 002F MOVE R13 R10 + 0x5C380200, // 0030 MOVE R14 R1 + 0x7C2C0600, // 0031 CALL R11 3 + 0x60300004, // 0032 GETGBL R12 G4 + 0x5C341600, // 0033 MOVE R13 R11 + 0x7C300200, // 0034 CALL R12 1 + 0x1C30190E, // 0035 EQ R12 R12 K14 + 0x7832001B, // 0036 JMPF R12 #0053 + 0xA802000C, // 0037 EXBLK 0 #0045 + 0x5C301600, // 0038 MOVE R12 R11 + 0x5C341400, // 0039 MOVE R13 R10 + 0x5C380400, // 003A MOVE R14 R2 + 0x5C3C0600, // 003B MOVE R15 R3 + 0x5C400800, // 003C MOVE R16 R4 + 0x5C440A00, // 003D MOVE R17 R5 + 0x7C300A00, // 003E CALL R12 5 + 0x5C201800, // 003F MOVE R8 R12 + 0x78220001, // 0040 JMPF R8 #0043 + 0xA8040001, // 0041 EXBLK 1 1 + 0x70020011, // 0042 JMP #0055 + 0xA8040001, // 0043 EXBLK 1 1 + 0x7002000D, // 0044 JMP #0053 + 0xAC300002, // 0045 CATCH R12 0 2 + 0x7002000A, // 0046 JMP #0052 + 0x60380001, // 0047 GETGBL R14 G1 + 0x8C3C0F0F, // 0048 GETMET R15 R7 K15 + 0x58440010, // 0049 LDCONST R17 K16 + 0x5C481800, // 004A MOVE R18 R12 + 0x5C4C1A00, // 004B MOVE R19 R13 + 0x7C3C0800, // 004C CALL R15 4 + 0x7C380200, // 004D CALL R14 1 + 0xA43A2200, // 004E IMPORT R14 K17 + 0x8C3C1D12, // 004F GETMET R15 R14 K18 + 0x7C3C0200, // 0050 CALL R15 1 + 0x70020000, // 0051 JMP #0053 + 0xB0080000, // 0052 RAISE 2 R0 R0 + 0x00241313, // 0053 ADD R9 R9 K19 + 0x7001FFD1, // 0054 JMP #0027 + 0x1C240314, // 0055 EQ R9 R1 K20 + 0x78260002, // 0056 JMPF R9 #005A + 0xA4262A00, // 0057 IMPORT R9 K21 + 0x8C281316, // 0058 GETMET R10 R9 K22 + 0x7C280200, // 0059 CALL R10 1 + 0x80041000, // 005A RET 1 R8 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: find_key_i +********************************************************************/ +be_local_closure(Tasmota_find_key_i, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(toupper), + /* K2 */ be_nested_str(keys), + /* K3 */ be_nested_str(_X3F), + /* K4 */ be_nested_str(stop_iteration), + }), + &be_const_str_find_key_i, + &be_const_str_solidified, + ( &(const binstruction[30]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0x8C100701, // 0001 GETMET R4 R3 K1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x7C100400, // 0003 CALL R4 2 + 0x6014000F, // 0004 GETGBL R5 G15 + 0x5C180200, // 0005 MOVE R6 R1 + 0x601C0013, // 0006 GETGBL R7 G19 + 0x7C140400, // 0007 CALL R5 2 + 0x78160013, // 0008 JMPF R5 #001D + 0x60140010, // 0009 GETGBL R5 G16 + 0x8C180302, // 000A GETMET R6 R1 K2 + 0x7C180200, // 000B CALL R6 1 + 0x7C140200, // 000C CALL R5 1 + 0xA802000B, // 000D EXBLK 0 #001A + 0x5C180A00, // 000E MOVE R6 R5 + 0x7C180000, // 000F CALL R6 0 + 0x8C1C0701, // 0010 GETMET R7 R3 K1 + 0x5C240C00, // 0011 MOVE R9 R6 + 0x7C1C0400, // 0012 CALL R7 2 + 0x1C1C0E04, // 0013 EQ R7 R7 R4 + 0x741E0001, // 0014 JMPT R7 #0017 + 0x1C1C0503, // 0015 EQ R7 R2 K3 + 0x781E0001, // 0016 JMPF R7 #0019 + 0xA8040001, // 0017 EXBLK 1 1 + 0x80040C00, // 0018 RET 1 R6 + 0x7001FFF3, // 0019 JMP #000E + 0x58140004, // 001A LDCONST R5 K4 + 0xAC140200, // 001B CATCH R5 1 0 + 0xB0080000, // 001C RAISE 2 R0 R0 + 0x80000000, // 001D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: wire_scan +********************************************************************/ +be_local_closure(Tasmota_wire_scan, /* name */ + be_nested_proto( + 6, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(i2c_enabled), + /* K1 */ be_nested_str(wire1), + /* K2 */ be_nested_str(enabled), + /* K3 */ be_nested_str(detect), + /* K4 */ be_nested_str(wire2), + }), + &be_const_str_wire_scan, + &be_const_str_solidified, + ( &(const binstruction[33]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x200C0403, // 0001 NE R3 R2 R3 + 0x780E0005, // 0002 JMPF R3 #0009 + 0x8C0C0100, // 0003 GETMET R3 R0 K0 + 0x5C140400, // 0004 MOVE R5 R2 + 0x7C0C0400, // 0005 CALL R3 2 + 0x740E0001, // 0006 JMPT R3 #0009 + 0x4C0C0000, // 0007 LDNIL R3 + 0x80040600, // 0008 RET 1 R3 + 0x880C0101, // 0009 GETMBR R3 R0 K1 + 0x8C0C0702, // 000A GETMET R3 R3 K2 + 0x7C0C0200, // 000B CALL R3 1 + 0x780E0006, // 000C JMPF R3 #0014 + 0x880C0101, // 000D GETMBR R3 R0 K1 + 0x8C0C0703, // 000E GETMET R3 R3 K3 + 0x5C140200, // 000F MOVE R5 R1 + 0x7C0C0400, // 0010 CALL R3 2 + 0x780E0001, // 0011 JMPF R3 #0014 + 0x880C0101, // 0012 GETMBR R3 R0 K1 + 0x80040600, // 0013 RET 1 R3 + 0x880C0104, // 0014 GETMBR R3 R0 K4 + 0x8C0C0702, // 0015 GETMET R3 R3 K2 + 0x7C0C0200, // 0016 CALL R3 1 + 0x780E0006, // 0017 JMPF R3 #001F + 0x880C0104, // 0018 GETMBR R3 R0 K4 + 0x8C0C0703, // 0019 GETMET R3 R3 K3 + 0x5C140200, // 001A MOVE R5 R1 + 0x7C0C0400, // 001B CALL R3 2 + 0x780E0001, // 001C JMPF R3 #001F + 0x880C0104, // 001D GETMBR R3 R0 K4 + 0x80040600, // 001E RET 1 R3 + 0x4C0C0000, // 001F LDNIL R3 + 0x80040600, // 0020 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Tasmota_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[15]) { /* constants */ + /* K0 */ be_nested_str(global), + /* K1 */ be_nested_str(ctypes_bytes_dyn), + /* K2 */ be_nested_str(_global_addr), + /* K3 */ be_nested_str(_global_def), + /* K4 */ be_nested_str(introspect), + /* K5 */ be_nested_str(_settings_ptr), + /* K6 */ be_nested_str(get), + /* K7 */ be_const_int(0), + /* K8 */ be_nested_str(settings), + /* K9 */ be_nested_str(toptr), + /* K10 */ be_nested_str(_settings_def), + /* K11 */ be_nested_str(wd), + /* K12 */ be_nested_str(), + /* K13 */ be_nested_str(_debug_present), + /* K14 */ be_nested_str(debug), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[36]) { /* code */ + 0xB8060200, // 0000 GETNGBL R1 K1 + 0x88080102, // 0001 GETMBR R2 R0 K2 + 0x880C0103, // 0002 GETMBR R3 R0 K3 + 0x7C040400, // 0003 CALL R1 2 + 0x90020001, // 0004 SETMBR R0 K0 R1 + 0xA4060800, // 0005 IMPORT R1 K4 + 0x60080015, // 0006 GETGBL R2 G21 + 0x880C0105, // 0007 GETMBR R3 R0 K5 + 0x54120003, // 0008 LDINT R4 4 + 0x7C080400, // 0009 CALL R2 2 + 0x8C080506, // 000A GETMET R2 R2 K6 + 0x58100007, // 000B LDCONST R4 K7 + 0x54160003, // 000C LDINT R5 4 + 0x7C080600, // 000D CALL R2 3 + 0x780A0006, // 000E JMPF R2 #0016 + 0xB80E0200, // 000F GETNGBL R3 K1 + 0x8C100309, // 0010 GETMET R4 R1 K9 + 0x5C180400, // 0011 MOVE R6 R2 + 0x7C100400, // 0012 CALL R4 2 + 0x8814010A, // 0013 GETMBR R5 R0 K10 + 0x7C0C0400, // 0014 CALL R3 2 + 0x90021003, // 0015 SETMBR R0 K8 R3 + 0x9002170C, // 0016 SETMBR R0 K11 K12 + 0x500C0000, // 0017 LDBOOL R3 0 0 + 0x90021A03, // 0018 SETMBR R0 K13 R3 + 0xA8020004, // 0019 EXBLK 0 #001F + 0xA40E1C00, // 001A IMPORT R3 K14 + 0x50100200, // 001B LDBOOL R4 1 0 + 0x90021A04, // 001C SETMBR R0 K13 R4 + 0xA8040001, // 001D EXBLK 1 1 + 0x70020003, // 001E JMP #0023 + 0xAC0C0000, // 001F CATCH R3 0 0 + 0x70020000, // 0020 JMP #0022 + 0x70020000, // 0021 JMP #0023 + 0xB0080000, // 0022 RAISE 2 R0 R0 + 0x80000000, // 0023 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: time_str +********************************************************************/ +be_local_closure(Tasmota_time_str, /* name */ + be_nested_proto( + 13, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(time_dump), + /* K2 */ be_nested_str(format), + /* K3 */ be_nested_str(_X2504d_X2D_X2502d_X2D_X2502dT_X2502d_X3A_X2502d_X3A_X2502d), + /* K4 */ be_nested_str(year), + /* K5 */ be_nested_str(month), + /* K6 */ be_nested_str(day), + /* K7 */ be_nested_str(hour), + /* K8 */ be_nested_str(min), + /* K9 */ be_nested_str(sec), + }), + &be_const_str_time_str, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x8C0C0101, // 0001 GETMET R3 R0 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C0C0400, // 0003 CALL R3 2 + 0x8C100502, // 0004 GETMET R4 R2 K2 + 0x58180003, // 0005 LDCONST R6 K3 + 0x941C0704, // 0006 GETIDX R7 R3 K4 + 0x94200705, // 0007 GETIDX R8 R3 K5 + 0x94240706, // 0008 GETIDX R9 R3 K6 + 0x94280707, // 0009 GETIDX R10 R3 K7 + 0x942C0708, // 000A GETIDX R11 R3 K8 + 0x94300709, // 000B GETIDX R12 R3 K9 + 0x7C101000, // 000C CALL R4 8 + 0x80040800, // 000D RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove_rule +********************************************************************/ +be_local_closure(Tasmota_remove_rule, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(_rules), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(k), + /* K3 */ be_nested_str(remove), + /* K4 */ be_const_int(1), + }), + &be_const_str_remove_rule, + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A0011, // 0001 JMPF R2 #0014 + 0x58080001, // 0002 LDCONST R2 K1 + 0x600C000C, // 0003 GETGBL R3 G12 + 0x88100100, // 0004 GETMBR R4 R0 K0 + 0x7C0C0200, // 0005 CALL R3 1 + 0x140C0403, // 0006 LT R3 R2 R3 + 0x780E000B, // 0007 JMPF R3 #0014 + 0x880C0100, // 0008 GETMBR R3 R0 K0 + 0x940C0602, // 0009 GETIDX R3 R3 R2 + 0x880C0702, // 000A GETMBR R3 R3 K2 + 0x1C0C0601, // 000B EQ R3 R3 R1 + 0x780E0004, // 000C JMPF R3 #0012 + 0x880C0100, // 000D GETMBR R3 R0 K0 + 0x8C0C0703, // 000E GETMET R3 R3 K3 + 0x5C140400, // 000F MOVE R5 R2 + 0x7C0C0400, // 0010 CALL R3 2 + 0x70020000, // 0011 JMP #0013 + 0x00080504, // 0012 ADD R2 R2 K4 + 0x7001FFEE, // 0013 JMP #0003 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: load +********************************************************************/ +be_local_closure(Tasmota_load, /* name */ + be_nested_proto( + 21, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(sys), + /* K1 */ be_nested_str(path), + /* K2 */ be_nested_str(find), + /* K3 */ be_nested_str(push), + }), + &be_const_str_push_path, + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C0C0502, // 0003 GETMET R3 R2 K2 + 0x5C140000, // 0004 MOVE R5 R0 + 0x7C0C0400, // 0005 CALL R3 2 + 0x4C100000, // 0006 LDNIL R4 + 0x1C0C0604, // 0007 EQ R3 R3 R4 + 0x780E0002, // 0008 JMPF R3 #000C + 0x8C0C0503, // 0009 GETMET R3 R2 K3 + 0x5C140000, // 000A MOVE R5 R0 + 0x7C0C0400, // 000B CALL R3 2 + 0x80000000, // 000C RET 0 + }) + ), + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(sys), + /* K1 */ be_nested_str(path), + /* K2 */ be_nested_str(find), + /* K3 */ be_nested_str(remove), + }), + &be_const_str_pop_path, + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C0C0502, // 0003 GETMET R3 R2 K2 + 0x5C140000, // 0004 MOVE R5 R0 + 0x7C0C0400, // 0005 CALL R3 2 + 0x4C100000, // 0006 LDNIL R4 + 0x20100604, // 0007 NE R4 R3 R4 + 0x78120002, // 0008 JMPF R4 #000C + 0x8C100503, // 0009 GETMET R4 R2 K3 + 0x5C180600, // 000A MOVE R6 R3 + 0x7C100400, // 000B CALL R4 2 + 0x80000000, // 000C RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[21]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(path), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str(_X2F), + /* K4 */ be_nested_str(split), + /* K5 */ be_nested_str(_X23), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str(find), + /* K8 */ be_nested_str(_X2E), + /* K9 */ be_nested_str(_X2Ebe), + /* K10 */ be_nested_str(_X2Ebec), + /* K11 */ be_nested_str(io_error), + /* K12 */ be_nested_str(file_X20extension_X20is_X20not_X20_X27_X2Ebe_X27_X20or_X20_X27_X2Ebec_X27), + /* K13 */ be_nested_str(last_modified), + /* K14 */ be_nested_str(c), + /* K15 */ be_nested_str(wd), + /* K16 */ be_nested_str(), + /* K17 */ be_nested_str(file), + /* K18 */ be_nested_str(save), + /* K19 */ be_nested_str(format), + /* K20 */ be_nested_str(BRY_X3A_X20could_X20not_X20save_X20compiled_X20file_X20_X25s_X20_X28_X25s_X29), + }), + &be_const_str_load, + &be_const_str_solidified, + ( &(const binstruction[121]) { /* code */ + 0x84080000, // 0000 CLOSURE R2 P0 + 0x840C0001, // 0001 CLOSURE R3 P1 + 0xA4120000, // 0002 IMPORT R4 K0 + 0xA4160200, // 0003 IMPORT R5 K1 + 0x6018000C, // 0004 GETGBL R6 G12 + 0x5C1C0200, // 0005 MOVE R7 R1 + 0x7C180200, // 0006 CALL R6 1 + 0x1C180D02, // 0007 EQ R6 R6 K2 + 0x781A0001, // 0008 JMPF R6 #000B + 0x50180000, // 0009 LDBOOL R6 0 0 + 0x80040C00, // 000A RET 1 R6 + 0x94180302, // 000B GETIDX R6 R1 K2 + 0x20180D03, // 000C NE R6 R6 K3 + 0x781A0000, // 000D JMPF R6 #000F + 0x00060601, // 000E ADD R1 K3 R1 + 0x8C180904, // 000F GETMET R6 R4 K4 + 0x5C200200, // 0010 MOVE R8 R1 + 0x58240005, // 0011 LDCONST R9 K5 + 0x7C180600, // 0012 CALL R6 3 + 0x941C0D02, // 0013 GETIDX R7 R6 K2 + 0x5421FFFE, // 0014 LDINT R8 -1 + 0x94200C08, // 0015 GETIDX R8 R6 R8 + 0x6024000C, // 0016 GETGBL R9 G12 + 0x5C280C00, // 0017 MOVE R10 R6 + 0x7C240200, // 0018 CALL R9 1 + 0x24241306, // 0019 GT R9 R9 K6 + 0x8C280907, // 001A GETMET R10 R4 K7 + 0x5C301000, // 001B MOVE R12 R8 + 0x58340008, // 001C LDCONST R13 K8 + 0x7C280600, // 001D CALL R10 3 + 0x14281502, // 001E LT R10 R10 K2 + 0x782A0001, // 001F JMPF R10 #0022 + 0x00040309, // 0020 ADD R1 R1 K9 + 0x00201109, // 0021 ADD R8 R8 K9 + 0x5429FFFC, // 0022 LDINT R10 -3 + 0x542DFFFE, // 0023 LDINT R11 -1 + 0x4028140B, // 0024 CONNECT R10 R10 R11 + 0x9428100A, // 0025 GETIDX R10 R8 R10 + 0x1C281509, // 0026 EQ R10 R10 K9 + 0x542DFFFB, // 0027 LDINT R11 -4 + 0x5431FFFE, // 0028 LDINT R12 -1 + 0x402C160C, // 0029 CONNECT R11 R11 R12 + 0x942C100B, // 002A GETIDX R11 R8 R11 + 0x1C2C170A, // 002B EQ R11 R11 K10 + 0x5C301400, // 002C MOVE R12 R10 + 0x74320002, // 002D JMPT R12 #0031 + 0x5C301600, // 002E MOVE R12 R11 + 0x74320000, // 002F JMPT R12 #0031 + 0xB006170C, // 0030 RAISE 1 K11 K12 + 0x8C300B0D, // 0031 GETMET R12 R5 K13 + 0x5C380E00, // 0032 MOVE R14 R7 + 0x7C300400, // 0033 CALL R12 2 + 0x782E0005, // 0034 JMPF R11 #003B + 0x4C340000, // 0035 LDNIL R13 + 0x1C34180D, // 0036 EQ R13 R12 R13 + 0x78360001, // 0037 JMPF R13 #003A + 0x50340000, // 0038 LDBOOL R13 0 0 + 0x80041A00, // 0039 RET 1 R13 + 0x70020013, // 003A JMP #004F + 0x8C340B0D, // 003B GETMET R13 R5 K13 + 0x003C030E, // 003C ADD R15 R1 K14 + 0x7C340400, // 003D CALL R13 2 + 0x4C380000, // 003E LDNIL R14 + 0x1C38180E, // 003F EQ R14 R12 R14 + 0x783A0004, // 0040 JMPF R14 #0046 + 0x4C380000, // 0041 LDNIL R14 + 0x1C381A0E, // 0042 EQ R14 R13 R14 + 0x783A0001, // 0043 JMPF R14 #0046 + 0x50380000, // 0044 LDBOOL R14 0 0 + 0x80041C00, // 0045 RET 1 R14 + 0x4C380000, // 0046 LDNIL R14 + 0x20381A0E, // 0047 NE R14 R13 R14 + 0x783A0005, // 0048 JMPF R14 #004F + 0x4C380000, // 0049 LDNIL R14 + 0x1C38180E, // 004A EQ R14 R12 R14 + 0x743A0001, // 004B JMPT R14 #004E + 0x28381A0C, // 004C GE R14 R13 R12 + 0x783A0000, // 004D JMPF R14 #004F + 0x502C0200, // 004E LDBOOL R11 1 0 + 0x78260005, // 004F JMPF R9 #0056 + 0x00340F05, // 0050 ADD R13 R7 K5 + 0x90021E0D, // 0051 SETMBR R0 K15 R13 + 0x5C340400, // 0052 MOVE R13 R2 + 0x8838010F, // 0053 GETMBR R14 R0 K15 + 0x7C340200, // 0054 CALL R13 1 + 0x70020000, // 0055 JMP #0057 + 0x90021F10, // 0056 SETMBR R0 K15 K16 + 0x6034000D, // 0057 GETGBL R13 G13 + 0x5C380200, // 0058 MOVE R14 R1 + 0x583C0011, // 0059 LDCONST R15 K17 + 0x7C340400, // 005A CALL R13 2 + 0x5C381600, // 005B MOVE R14 R11 + 0x743A0013, // 005C JMPT R14 #0071 + 0x5C381200, // 005D MOVE R14 R9 + 0x743A0011, // 005E JMPT R14 #0071 + 0xA8020005, // 005F EXBLK 0 #0066 + 0x8C380112, // 0060 GETMET R14 R0 K18 + 0x0040030E, // 0061 ADD R16 R1 K14 + 0x5C441A00, // 0062 MOVE R17 R13 + 0x7C380600, // 0063 CALL R14 3 + 0xA8040001, // 0064 EXBLK 1 1 + 0x7002000A, // 0065 JMP #0071 + 0xAC380001, // 0066 CATCH R14 0 1 + 0x70020007, // 0067 JMP #0070 + 0x603C0001, // 0068 GETGBL R15 G1 + 0x8C400913, // 0069 GETMET R16 R4 K19 + 0x58480014, // 006A LDCONST R18 K20 + 0x004C030E, // 006B ADD R19 R1 K14 + 0x5C501C00, // 006C MOVE R20 R14 + 0x7C400800, // 006D CALL R16 4 + 0x7C3C0200, // 006E CALL R15 1 + 0x70020000, // 006F JMP #0071 + 0xB0080000, // 0070 RAISE 2 R0 R0 + 0x5C381A00, // 0071 MOVE R14 R13 + 0x7C380000, // 0072 CALL R14 0 + 0x78260002, // 0073 JMPF R9 #0077 + 0x5C380600, // 0074 MOVE R14 R3 + 0x003C0F05, // 0075 ADD R15 R7 K5 + 0x7C380200, // 0076 CALL R14 1 + 0x50380200, // 0077 LDBOOL R14 1 0 + 0x80041C00, // 0078 RET 1 R14 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: chars_in_string +********************************************************************/ +be_local_closure(Tasmota_chars_in_string, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_const_int(1), + }), + &be_const_str_chars_in_string, + &be_const_str_solidified, + ( &(const binstruction[31]) { /* code */ + 0x780E0001, // 0000 JMPF R3 #0003 + 0x50100200, // 0001 LDBOOL R4 1 0 + 0x70020000, // 0002 JMP #0004 + 0x50100000, // 0003 LDBOOL R4 0 0 + 0x58140000, // 0004 LDCONST R5 K0 + 0x6018000C, // 0005 GETGBL R6 G12 + 0x5C1C0200, // 0006 MOVE R7 R1 + 0x7C180200, // 0007 CALL R6 1 + 0x14180A06, // 0008 LT R6 R5 R6 + 0x781A0012, // 0009 JMPF R6 #001D + 0x50180000, // 000A LDBOOL R6 0 0 + 0x581C0000, // 000B LDCONST R7 K0 + 0x6020000C, // 000C GETGBL R8 G12 + 0x5C240400, // 000D MOVE R9 R2 + 0x7C200200, // 000E CALL R8 1 + 0x14200E08, // 000F LT R8 R7 R8 + 0x78220006, // 0010 JMPF R8 #0018 + 0x94200205, // 0011 GETIDX R8 R1 R5 + 0x94240407, // 0012 GETIDX R9 R2 R7 + 0x1C201009, // 0013 EQ R8 R8 R9 + 0x78220000, // 0014 JMPF R8 #0016 + 0x50180200, // 0015 LDBOOL R6 1 0 + 0x001C0F01, // 0016 ADD R7 R7 K1 + 0x7001FFF3, // 0017 JMP #000C + 0x20200806, // 0018 NE R8 R4 R6 + 0x78220000, // 0019 JMPF R8 #001B + 0x80040A00, // 001A RET 1 R5 + 0x00140B01, // 001B ADD R5 R5 K1 + 0x7001FFE7, // 001C JMP #0005 + 0x5419FFFE, // 001D LDINT R6 -1 + 0x80040C00, // 001E RET 1 R6 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: cmd +********************************************************************/ +be_local_closure(Tasmota_cmd, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(cmd_res), + /* K1 */ be_nested_str(_cmd), + }), + &be_const_str_cmd, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x50080200, // 0000 LDBOOL R2 1 0 + 0x90020002, // 0001 SETMBR R0 K0 R2 + 0x8C080101, // 0002 GETMET R2 R0 K1 + 0x5C100200, // 0003 MOVE R4 R1 + 0x7C080400, // 0004 CALL R2 2 + 0x4C080000, // 0005 LDNIL R2 + 0x880C0100, // 0006 GETMBR R3 R0 K0 + 0x50100200, // 0007 LDBOOL R4 1 0 + 0x200C0604, // 0008 NE R3 R3 R4 + 0x780E0000, // 0009 JMPF R3 #000B + 0x88080100, // 000A GETMBR R2 R0 K0 + 0x4C0C0000, // 000B LDNIL R3 + 0x90020003, // 000C SETMBR R0 K0 R3 + 0x80040400, // 000D RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_cmd +********************************************************************/ +be_local_closure(Tasmota_add_cmd, /* name */ + be_nested_proto( + 5, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(_ccmd), + /* K1 */ be_nested_str(function), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(the_X20second_X20argument_X20is_X20not_X20a_X20function), + }), + &be_const_str_add_cmd, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x740E0002, // 0001 JMPT R3 #0005 + 0x600C0013, // 0002 GETGBL R3 G19 + 0x7C0C0000, // 0003 CALL R3 0 + 0x90020003, // 0004 SETMBR R0 K0 R3 + 0x600C0004, // 0005 GETGBL R3 G4 + 0x5C100400, // 0006 MOVE R4 R2 + 0x7C0C0200, // 0007 CALL R3 1 + 0x1C0C0701, // 0008 EQ R3 R3 K1 + 0x780E0002, // 0009 JMPF R3 #000D + 0x880C0100, // 000A GETMBR R3 R0 K0 + 0x980C0202, // 000B SETIDX R3 R1 R2 + 0x70020000, // 000C JMP #000E + 0xB0060503, // 000D RAISE 1 K2 K3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_rule +********************************************************************/ +be_local_closure(Tasmota_add_rule, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(_rules), + /* K1 */ be_nested_str(function), + /* K2 */ be_nested_str(push), + /* K3 */ be_nested_str(kv), + /* K4 */ be_nested_str(value_error), + /* K5 */ be_nested_str(the_X20second_X20argument_X20is_X20not_X20a_X20function), + }), + &be_const_str_add_rule, + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x740E0002, // 0001 JMPT R3 #0005 + 0x600C0012, // 0002 GETGBL R3 G18 + 0x7C0C0000, // 0003 CALL R3 0 + 0x90020003, // 0004 SETMBR R0 K0 R3 + 0x600C0004, // 0005 GETGBL R3 G4 + 0x5C100400, // 0006 MOVE R4 R2 + 0x7C0C0200, // 0007 CALL R3 1 + 0x1C0C0701, // 0008 EQ R3 R3 K1 + 0x780E0007, // 0009 JMPF R3 #0012 + 0x880C0100, // 000A GETMBR R3 R0 K0 + 0x8C0C0702, // 000B GETMET R3 R3 K2 + 0x8C140103, // 000C GETMET R5 R0 K3 + 0x5C1C0200, // 000D MOVE R7 R1 + 0x5C200400, // 000E MOVE R8 R2 + 0x7C140600, // 000F CALL R5 3 + 0x7C0C0400, // 0010 CALL R3 2 + 0x70020000, // 0011 JMP #0013 + 0xB0060905, // 0012 RAISE 1 K4 K5 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: exec_rules +********************************************************************/ +be_local_closure(Tasmota_exec_rules, /* name */ + be_nested_proto( + 12, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(_rules), + /* K1 */ be_nested_str(cmd_res), + /* K2 */ be_nested_str(json), + /* K3 */ be_nested_str(load), + /* K4 */ be_nested_str(log), + /* K5 */ be_nested_str(BRY_X3A_X20ERROR_X2C_X20bad_X20json_X3A_X20), + /* K6 */ be_const_int(3), + /* K7 */ be_const_int(0), + /* K8 */ be_nested_str(try_rule), + /* K9 */ be_nested_str(k), + /* K10 */ be_nested_str(v), + /* K11 */ be_const_int(1), + }), + &be_const_str_exec_rules, + &be_const_str_solidified, + ( &(const binstruction[48]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0003, // 0001 JMPT R2 #0006 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x4C0C0000, // 0003 LDNIL R3 + 0x20080403, // 0004 NE R2 R2 R3 + 0x780A0027, // 0005 JMPF R2 #002E + 0xA40A0400, // 0006 IMPORT R2 K2 + 0x8C0C0503, // 0007 GETMET R3 R2 K3 + 0x5C140200, // 0008 MOVE R5 R1 + 0x7C0C0400, // 0009 CALL R3 2 + 0x50100000, // 000A LDBOOL R4 0 0 + 0x4C140000, // 000B LDNIL R5 + 0x1C140605, // 000C EQ R5 R3 R5 + 0x78160004, // 000D JMPF R5 #0013 + 0x8C140104, // 000E GETMET R5 R0 K4 + 0x001E0A01, // 000F ADD R7 K5 R1 + 0x58200006, // 0010 LDCONST R8 K6 + 0x7C140600, // 0011 CALL R5 3 + 0x5C0C0200, // 0012 MOVE R3 R1 + 0x88140101, // 0013 GETMBR R5 R0 K1 + 0x4C180000, // 0014 LDNIL R6 + 0x20140A06, // 0015 NE R5 R5 R6 + 0x78160000, // 0016 JMPF R5 #0018 + 0x90020203, // 0017 SETMBR R0 K1 R3 + 0x88140100, // 0018 GETMBR R5 R0 K0 + 0x78160012, // 0019 JMPF R5 #002D + 0x58140007, // 001A LDCONST R5 K7 + 0x6018000C, // 001B GETGBL R6 G12 + 0x881C0100, // 001C GETMBR R7 R0 K0 + 0x7C180200, // 001D CALL R6 1 + 0x14180A06, // 001E LT R6 R5 R6 + 0x781A000C, // 001F JMPF R6 #002D + 0x88180100, // 0020 GETMBR R6 R0 K0 + 0x94180C05, // 0021 GETIDX R6 R6 R5 + 0x8C1C0108, // 0022 GETMET R7 R0 K8 + 0x5C240600, // 0023 MOVE R9 R3 + 0x88280D09, // 0024 GETMBR R10 R6 K9 + 0x882C0D0A, // 0025 GETMBR R11 R6 K10 + 0x7C1C0800, // 0026 CALL R7 4 + 0x741E0001, // 0027 JMPT R7 #002A + 0x74120000, // 0028 JMPT R4 #002A + 0x50100001, // 0029 LDBOOL R4 0 1 + 0x50100200, // 002A LDBOOL R4 1 0 + 0x00140B0B, // 002B ADD R5 R5 K11 + 0x7001FFED, // 002C JMP #001B + 0x80040800, // 002D RET 1 R4 + 0x50080000, // 002E LDBOOL R2 0 0 + 0x80040400, // 002F RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: hs2rgb +********************************************************************/ +be_local_closure(Tasmota_hs2rgb, /* name */ + be_nested_proto( + 17, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(tasmota), + /* K2 */ be_nested_str(scale_uint), + /* K3 */ be_const_int(1), + /* K4 */ be_const_int(2), + /* K5 */ be_const_int(3), + }), + &be_const_str_hs2rgb, + &be_const_str_solidified, + ( &(const binstruction[68]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0403, // 0001 EQ R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x540A00FE, // 0003 LDINT R2 255 + 0x540E00FE, // 0004 LDINT R3 255 + 0x541200FE, // 0005 LDINT R4 255 + 0x541600FE, // 0006 LDINT R5 255 + 0x541A0167, // 0007 LDINT R6 360 + 0x10040206, // 0008 MOD R1 R1 R6 + 0x24180500, // 0009 GT R6 R2 K0 + 0x781A0031, // 000A JMPF R6 #003D + 0x541A003B, // 000B LDINT R6 60 + 0x0C180206, // 000C DIV R6 R1 R6 + 0x541E003B, // 000D LDINT R7 60 + 0x101C0207, // 000E MOD R7 R1 R7 + 0x542200FE, // 000F LDINT R8 255 + 0x04201002, // 0010 SUB R8 R8 R2 + 0xB8260200, // 0011 GETNGBL R9 K1 + 0x8C241302, // 0012 GETMET R9 R9 K2 + 0x5C2C0E00, // 0013 MOVE R11 R7 + 0x58300000, // 0014 LDCONST R12 K0 + 0x5436003B, // 0015 LDINT R13 60 + 0x543A00FE, // 0016 LDINT R14 255 + 0x5C3C1000, // 0017 MOVE R15 R8 + 0x7C240C00, // 0018 CALL R9 6 + 0xB82A0200, // 0019 GETNGBL R10 K1 + 0x8C281502, // 001A GETMET R10 R10 K2 + 0x5C300E00, // 001B MOVE R12 R7 + 0x58340000, // 001C LDCONST R13 K0 + 0x543A003B, // 001D LDINT R14 60 + 0x5C3C1000, // 001E MOVE R15 R8 + 0x544200FE, // 001F LDINT R16 255 + 0x7C280C00, // 0020 CALL R10 6 + 0x1C2C0D00, // 0021 EQ R11 R6 K0 + 0x782E0002, // 0022 JMPF R11 #0026 + 0x5C141400, // 0023 MOVE R5 R10 + 0x5C101000, // 0024 MOVE R4 R8 + 0x70020016, // 0025 JMP #003D + 0x1C2C0D03, // 0026 EQ R11 R6 K3 + 0x782E0002, // 0027 JMPF R11 #002B + 0x5C0C1200, // 0028 MOVE R3 R9 + 0x5C101000, // 0029 MOVE R4 R8 + 0x70020011, // 002A JMP #003D + 0x1C2C0D04, // 002B EQ R11 R6 K4 + 0x782E0002, // 002C JMPF R11 #0030 + 0x5C0C1000, // 002D MOVE R3 R8 + 0x5C101400, // 002E MOVE R4 R10 + 0x7002000C, // 002F JMP #003D + 0x1C2C0D05, // 0030 EQ R11 R6 K5 + 0x782E0002, // 0031 JMPF R11 #0035 + 0x5C0C1000, // 0032 MOVE R3 R8 + 0x5C141200, // 0033 MOVE R5 R9 + 0x70020007, // 0034 JMP #003D + 0x542E0003, // 0035 LDINT R11 4 + 0x1C2C0C0B, // 0036 EQ R11 R6 R11 + 0x782E0002, // 0037 JMPF R11 #003B + 0x5C0C1400, // 0038 MOVE R3 R10 + 0x5C141000, // 0039 MOVE R5 R8 + 0x70020001, // 003A JMP #003D + 0x5C141000, // 003B MOVE R5 R8 + 0x5C101200, // 003C MOVE R4 R9 + 0x541A000F, // 003D LDINT R6 16 + 0x38180606, // 003E SHL R6 R3 R6 + 0x541E0007, // 003F LDINT R7 8 + 0x381C0A07, // 0040 SHL R7 R5 R7 + 0x30180C07, // 0041 OR R6 R6 R7 + 0x30180C04, // 0042 OR R6 R6 R4 + 0x80040C00, // 0043 RET 1 R6 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(KV_init, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(k), + /* K1 */ be_nested_str(v), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: KV +********************************************************************/ +be_local_class(KV, + 2, + NULL, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(k, 2), be_const_var(0) }, + { be_const_key(v, -1), be_const_var(1) }, + { be_const_key(init, -1), be_const_closure(KV_init_closure) }, + })), + be_str_literal("KV") +); + +/******************************************************************** +** Solidified function: kv +********************************************************************/ +be_local_closure(Tasmota_kv, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_class(be_class_KV), + }), + &be_const_str_kv, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x580C0000, // 0000 LDCONST R3 K0 + 0xB4000000, // 0001 CLASS K0 + 0x5C100600, // 0002 MOVE R4 R3 + 0x5C140200, // 0003 MOVE R5 R1 + 0x5C180400, // 0004 MOVE R6 R2 + 0x7C100400, // 0005 CALL R4 2 + 0x80040800, // 0006 RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove_cmd +********************************************************************/ +be_local_closure(Tasmota_remove_cmd, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(_ccmd), + /* K1 */ be_nested_str(remove), + }), + &be_const_str_remove_cmd, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A0003, // 0001 JMPF R2 #0006 + 0x88080100, // 0002 GETMBR R2 R0 K0 + 0x8C080501, // 0003 GETMET R2 R2 K1 + 0x5C100200, // 0004 MOVE R4 R1 + 0x7C080400, // 0005 CALL R2 2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_timer +********************************************************************/ +be_local_closure(Tasmota_set_timer, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(_timers), + /* K1 */ be_nested_str(push), + /* K2 */ be_nested_str(Timer), + /* K3 */ be_nested_str(millis), + }), + &be_const_str_set_timer, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x74120002, // 0001 JMPT R4 #0005 + 0x60100012, // 0002 GETGBL R4 G18 + 0x7C100000, // 0003 CALL R4 0 + 0x90020004, // 0004 SETMBR R0 K0 R4 + 0x88100100, // 0005 GETMBR R4 R0 K0 + 0x8C100901, // 0006 GETMET R4 R4 K1 + 0xB81A0400, // 0007 GETNGBL R6 K2 + 0x8C1C0103, // 0008 GETMET R7 R0 K3 + 0x5C240200, // 0009 MOVE R9 R1 + 0x7C1C0400, // 000A CALL R7 2 + 0x5C200400, // 000B MOVE R8 R2 + 0x5C240600, // 000C MOVE R9 R3 + 0x7C180600, // 000D CALL R6 3 + 0x7C100400, // 000E CALL R4 2 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove_timer +********************************************************************/ +be_local_closure(Tasmota_remove_timer, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(_timers), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str(size), + /* K4 */ be_nested_str(id), + /* K5 */ be_nested_str(remove), + /* K6 */ be_const_int(1), + }), + &be_const_str_remove_timer, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x88080501, // 0001 GETMBR R2 R2 K1 + 0x780A0012, // 0002 JMPF R2 #0016 + 0x58080002, // 0003 LDCONST R2 K2 + 0xB80E0000, // 0004 GETNGBL R3 K0 + 0x880C0701, // 0005 GETMBR R3 R3 K1 + 0x8C0C0703, // 0006 GETMET R3 R3 K3 + 0x7C0C0200, // 0007 CALL R3 1 + 0x140C0403, // 0008 LT R3 R2 R3 + 0x780E000B, // 0009 JMPF R3 #0016 + 0x880C0101, // 000A GETMBR R3 R0 K1 + 0x940C0602, // 000B GETIDX R3 R3 R2 + 0x880C0704, // 000C GETMBR R3 R3 K4 + 0x1C0C0601, // 000D EQ R3 R3 R1 + 0x780E0004, // 000E JMPF R3 #0014 + 0x880C0101, // 000F GETMBR R3 R0 K1 + 0x8C0C0705, // 0010 GETMET R3 R3 K5 + 0x5C140400, // 0011 MOVE R5 R2 + 0x7C0C0400, // 0012 CALL R3 2 + 0x70020000, // 0013 JMP #0015 + 0x00080506, // 0014 ADD R2 R2 K6 + 0x7001FFED, // 0015 JMP #0004 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: exec_cmd +********************************************************************/ +be_local_closure(Tasmota_exec_cmd, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(_ccmd), + /* K1 */ be_nested_str(json), + /* K2 */ be_nested_str(load), + /* K3 */ be_nested_str(find_key_i), + /* K4 */ be_nested_str(resolvecmnd), + }), + &be_const_str_exec_cmd, + &be_const_str_solidified, + ( &(const binstruction[27]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x78120016, // 0001 JMPF R4 #0019 + 0xA4120200, // 0002 IMPORT R4 K1 + 0x8C140902, // 0003 GETMET R5 R4 K2 + 0x5C1C0600, // 0004 MOVE R7 R3 + 0x7C140400, // 0005 CALL R5 2 + 0x8C180103, // 0006 GETMET R6 R0 K3 + 0x88200100, // 0007 GETMBR R8 R0 K0 + 0x5C240200, // 0008 MOVE R9 R1 + 0x7C180600, // 0009 CALL R6 3 + 0x4C1C0000, // 000A LDNIL R7 + 0x201C0C07, // 000B NE R7 R6 R7 + 0x781E000B, // 000C JMPF R7 #0019 + 0x8C1C0104, // 000D GETMET R7 R0 K4 + 0x5C240C00, // 000E MOVE R9 R6 + 0x7C1C0400, // 000F CALL R7 2 + 0x881C0100, // 0010 GETMBR R7 R0 K0 + 0x941C0E06, // 0011 GETIDX R7 R7 R6 + 0x5C200C00, // 0012 MOVE R8 R6 + 0x5C240400, // 0013 MOVE R9 R2 + 0x5C280600, // 0014 MOVE R10 R3 + 0x5C2C0A00, // 0015 MOVE R11 R5 + 0x7C1C0800, // 0016 CALL R7 4 + 0x501C0200, // 0017 LDBOOL R7 1 0 + 0x80040E00, // 0018 RET 1 R7 + 0x50100000, // 0019 LDBOOL R4 0 0 + 0x80040800, // 001A RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_light +********************************************************************/ +be_local_closure(Tasmota_get_light, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(tasmota_X2Eget_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eget_X28_X29), + /* K1 */ be_nested_str(light), + /* K2 */ be_nested_str(get), + }), + &be_const_str_get_light, + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x60080001, // 0000 GETGBL R2 G1 + 0x580C0000, // 0001 LDCONST R3 K0 + 0x7C080200, // 0002 CALL R2 1 + 0xA40A0200, // 0003 IMPORT R2 K1 + 0x4C0C0000, // 0004 LDNIL R3 + 0x200C0203, // 0005 NE R3 R1 R3 + 0x780E0004, // 0006 JMPF R3 #000C + 0x8C0C0502, // 0007 GETMET R3 R2 K2 + 0x5C140200, // 0008 MOVE R5 R1 + 0x7C0C0400, // 0009 CALL R3 2 + 0x80040600, // 000A RET 1 R3 + 0x70020002, // 000B JMP #000F + 0x8C0C0502, // 000C GETMET R3 R2 K2 + 0x7C0C0200, // 000D CALL R3 1 + 0x80040600, // 000E RET 1 R3 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + +#include "../generate/be_fixed_be_class_tasmota.h" + + +// Class definition +void be_load_tasmota_ntvlib(bvm *vm) +{ + be_pushntvclass(vm, &be_class_tasmota); + be_setglobal(vm, "Tasmota"); + be_pop(vm, 1); +} + +/* @const_object_info_begin +class be_class_tasmota (scope: global, name: Tasmota) { + _rules, var + _timers, var + _ccmd, var + _drivers, var + wire1, var + wire2, var + global, var + settings, var + cmd_res, var + wd, var + _debug_present, var + + _global_def, comptr(&be_tasmota_global_struct) + _settings_def, comptr(&be_tasmota_settings_struct) + _global_addr, comptr(&TasmotaGlobal) + _settings_ptr, comptr(&Settings) + + init, closure(Tasmota_init_closure) + kv, closure(Tasmota_kv_closure) + + get_free_heap, func(l_getFreeHeap) + arch, func(l_arch) + publish, func(l_publish) + publish_result, func(l_publish_result) + _cmd, func(l_cmd) + get_option, func(l_getoption) + millis, func(l_millis) + time_reached, func(l_timereached) + rtc, func(l_rtc) + time_dump, func(l_time_dump) + strftime, func(l_strftime) + strptime, func(l_strptime) + memory, func(l_memory) + wifi, func(l_wifi) + eth, func(l_eth) + yield, func(l_yield) + delay, func(l_delay) + scale_uint, func(l_scaleuint) + log, func(l_logInfo) + save, func(l_save) + + read_sensors, func(l_read_sensors) + + resp_cmnd, func(l_respCmnd) + resp_cmnd_str, func(l_respCmndStr) + resp_cmnd_done, func(l_respCmndDone) + resp_cmnd_error, func(l_respCmndError) + resp_cmnd_failed, func(l_respCmndFailed) + resolvecmnd, func(l_resolveCmnd) + + response_append, func(l_respAppend) + web_send, func(l_webSend) + web_send_decimal, func(l_webSendDecimal) + + get_power, func(l_getpower) + set_power, func(l_setpower) + get_switch, func(l_getswitch) + + i2c_enabled, func(l_i2cenabled) + + cmd, closure(Tasmota_cmd_closure) + chars_in_string, closure(Tasmota_chars_in_string_closure) + find_key_i, closure(Tasmota_find_key_i_closure) + find_op, closure(Tasmota_find_op_closure) + add_rule, closure(Tasmota_add_rule_closure) + remove_rule, closure(Tasmota_remove_rule_closure) + try_rule, closure(Tasmota_try_rule_closure) + exec_rules, closure(Tasmota_exec_rules_closure) + exec_tele, closure(Tasmota_exec_tele_closure) + set_timer, closure(Tasmota_set_timer_closure) + run_deferred, closure(Tasmota_run_deferred_closure) + remove_timer, closure(Tasmota_remove_timer_closure) + add_cmd, closure(Tasmota_add_cmd_closure) + remove_cmd, closure(Tasmota_remove_cmd_closure) + exec_cmd, closure(Tasmota_exec_cmd_closure) + gc, closure(Tasmota_gc_closure) + event, closure(Tasmota_event_closure) + add_driver, closure(Tasmota_add_driver_closure) + remove_driver, closure(Tasmota_remove_driver_closure) + load, closure(Tasmota_load_closure) + wire_scan, closure(Tasmota_wire_scan_closure) + time_str, closure(Tasmota_time_str_closure) + + hs2rgb, closure(Tasmota_hs2rgb_closure) + + gen_cb, closure(Tasmota_gen_cb_closure) + + get_light, closure(Tasmota_get_light_closure) + set_light, closure(Tasmota_set_light_closure) +} +@const_object_info_end */ diff --git a/lib/libesp32/berry/default/be_tcpclient_lib.c b/lib/libesp32/berry/default/be_tcpclient_lib.c new file mode 100644 index 000000000..b39db458e --- /dev/null +++ b/lib/libesp32/berry/default/be_tcpclient_lib.c @@ -0,0 +1,48 @@ +/******************************************************************** + * Webclient mapped to Arduino framework + * + * To use: `d = webclient()` + * + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_WEBCLIENT + +extern int wc_tcp_init(bvm *vm); +extern int wc_tcp_deinit(bvm *vm); + +extern int wc_tcp_connect(bvm *vm); +extern int wc_tcp_connected(bvm *vm); +extern int wc_tcp_close(bvm *vm); +extern int wc_tcp_available(bvm *vm); + +extern int wc_tcp_write(bvm *vm); +extern int wc_tcp_read(bvm *vm); +extern int wc_tcp_readbytes(bvm *vm); + +#include "../generate/be_fixed_be_class_tcpclient.h" + +void be_load_tcpclient_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_tcpclient); + be_setglobal(vm, "tcpclient"); + be_pop(vm, 1); +} +/* @const_object_info_begin + +class be_class_tcpclient (scope: global, name: tcpclient) { + .w, var + init, func(wc_tcp_init) + deinit, func(wc_tcp_deinit) + + connect, func(wc_tcp_connect) + connected, func(wc_tcp_connected) + close, func(wc_tcp_close) + available, func(wc_tcp_available) + + write, func(wc_tcp_write) + read, func(wc_tcp_read) + readbytes, func(wc_tcp_readbytes) +} +@const_object_info_end */ + +#endif // USE_WEBCLIENT diff --git a/lib/libesp32/berry/default/be_timer_class.c b/lib/libesp32/berry/default/be_timer_class.c new file mode 100644 index 000000000..6664e408e --- /dev/null +++ b/lib/libesp32/berry/default/be_timer_class.c @@ -0,0 +1,110 @@ +/******************************************************************** + * Tasmota lib + * + * class Timer + *******************************************************************/ +#include "be_constobj.h" + +/******************************************************************** +** Solidified function: tostring +********************************************************************/ +be_local_closure(Timer_tostring, /* name */ + be_nested_proto( + 10, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(string), + /* K1 */ be_nested_str(format), + /* K2 */ be_nested_str(_X3Cinstance_X3A_X20_X25s_X28_X25s_X2C_X20_X25s_X2C_X20_X25s_X29), + /* K3 */ be_nested_str(due), + /* K4 */ be_nested_str(f), + /* K5 */ be_nested_str(id), + }), + &be_const_str_tostring, + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080301, // 0001 GETMET R2 R1 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x60140008, // 0003 GETGBL R5 G8 + 0x60180006, // 0004 GETGBL R6 G6 + 0x5C1C0000, // 0005 MOVE R7 R0 + 0x7C180200, // 0006 CALL R6 1 + 0x7C140200, // 0007 CALL R5 1 + 0x60180008, // 0008 GETGBL R6 G8 + 0x881C0103, // 0009 GETMBR R7 R0 K3 + 0x7C180200, // 000A CALL R6 1 + 0x601C0008, // 000B GETGBL R7 G8 + 0x88200104, // 000C GETMBR R8 R0 K4 + 0x7C1C0200, // 000D CALL R7 1 + 0x60200008, // 000E GETGBL R8 G8 + 0x88240105, // 000F GETMBR R9 R0 K5 + 0x7C200200, // 0010 CALL R8 1 + 0x7C080C00, // 0011 CALL R2 6 + 0x80040400, // 0012 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Timer_init, /* name */ + be_nested_proto( + 4, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(due), + /* K1 */ be_nested_str(f), + /* K2 */ be_nested_str(id), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Timer +********************************************************************/ +be_local_class(Timer, + 3, + NULL, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(tostring, 4), be_const_closure(Timer_tostring_closure) }, + { be_const_key(id, 2), be_const_var(2) }, + { be_const_key(f, -1), be_const_var(1) }, + { be_const_key(due, -1), be_const_var(0) }, + { be_const_key(init, -1), be_const_closure(Timer_init_closure) }, + })), + be_str_literal("Timer") +); +/*******************************************************************/ + +void be_load_Timer_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Timer); + be_setglobal(vm, "Timer"); + be_pop(vm, 1); +} diff --git a/lib/libesp32/berry/default/be_unishox_lib.c b/lib/libesp32/berry/default/be_unishox_lib.c new file mode 100644 index 000000000..971f4c9e0 --- /dev/null +++ b/lib/libesp32/berry/default/be_unishox_lib.c @@ -0,0 +1,28 @@ +/******************************************************************** + * Berry module `unishox` + * + * To use: `import unishox` + * + * Allows to respond to HTTP request + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_UNISHOX_COMPRESSION + +extern int be_ntv_unishox_decompress(bvm *vm); +extern int be_ntv_unishox_compress(bvm *vm); + +/******************************************************************** +** Solidified module: unishox +********************************************************************/ +be_local_module(unishox, + "unishox", + be_nested_map(2, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(decompress, -1), be_const_func(be_ntv_unishox_decompress) }, + { be_const_key(compress, -1), be_const_func(be_ntv_unishox_compress) }, + })) +); +BE_EXPORT_VARIABLE be_define_const_native_module(unishox); + +#endif // USE_UNISHOX_COMPRESSION diff --git a/lib/libesp32/berry/default/be_webclient_lib.c b/lib/libesp32/berry/default/be_webclient_lib.c new file mode 100644 index 000000000..0e4b66e90 --- /dev/null +++ b/lib/libesp32/berry/default/be_webclient_lib.c @@ -0,0 +1,57 @@ +/******************************************************************** + * Webclient mapped to Arduino framework + * + * To use: `d = webclient()` + * + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_WEBCLIENT + +extern int wc_init(bvm *vm); +extern int wc_deinit(bvm *vm); +extern int wc_urlencode(bvm *vm); +extern int wc_begin(bvm *vm); +extern int wc_set_timeouts(bvm *vm); +extern int wc_set_useragent(bvm *vm); +extern int wc_set_auth(bvm *vm); +extern int wc_connected(bvm *vm); +extern int wc_close(bvm *vm); +extern int wc_addheader(bvm *vm); +extern int wc_GET(bvm *vm); +extern int wc_POST(bvm *vm); +extern int wc_getstring(bvm *vm); +extern int wc_writefile(bvm *vm); +extern int wc_getsize(bvm *vm); + +#include "../generate/be_fixed_be_class_webclient.h" + +void be_load_webclient_lib(bvm *vm) { + be_pushntvclass(vm, &be_class_webclient); + be_setglobal(vm, "webclient"); + be_pop(vm, 1); +} +/* @const_object_info_begin + +class be_class_webclient (scope: global, name: webclient) { + .p, var + .w, var + init, func(wc_init) + deinit, func(wc_deinit) + url_encode, func(wc_urlencode) + + begin, func(wc_begin) + set_timeouts, func(wc_set_timeouts) + set_useragent, func(wc_set_useragent) + set_auth, func(wc_set_auth) + close, func(wc_close) + add_header, func(wc_addheader) + GET, func(wc_GET) + POST, func(wc_POST) + get_string, func(wc_getstring) + write_file, func(wc_writefile) + get_size, func(wc_getsize) +} +@const_object_info_end */ + +#endif // USE_WEBCLIENT diff --git a/lib/libesp32/berry/default/be_webserver_lib.c b/lib/libesp32/berry/default/be_webserver_lib.c new file mode 100644 index 000000000..0f3e45d05 --- /dev/null +++ b/lib/libesp32/berry/default/be_webserver_lib.c @@ -0,0 +1,55 @@ +/******************************************************************** + * Berry module `webserver` + * + * To use: `import webserver` + * + * Allows to respond to HTTP request + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_WEBSERVER + +extern int w_webserver_member(bvm *vm); +extern int w_webserver_on(bvm *vm); +extern int w_webserver_state(bvm *vm); + +extern int w_webserver_check_privileged_access(bvm *vm); +extern int w_webserver_redirect(bvm *vm); +extern int w_webserver_content_start(bvm *vm); +extern int w_webserver_content_send(bvm *vm); +extern int w_webserver_content_send_style(bvm *vm); +extern int w_webserver_content_flush(bvm *vm); +extern int w_webserver_content_stop(bvm *vm); +extern int w_webserver_content_button(bvm *vm); + +extern int w_webserver_argsize(bvm *vm); +extern int w_webserver_arg(bvm *vm); +extern int w_webserver_arg_name(bvm *vm); +extern int w_webserver_has_arg(bvm *vm); + + +/* @const_object_info_begin +module webserver (scope: global) { + member, func(w_webserver_member) + + on, func(w_webserver_on) + state, func(w_webserver_state) + + check_privileged_access, func(w_webserver_check_privileged_access) + redirect, func(w_webserver_redirect) + content_send, func(w_webserver_content_send) + content_send_style, func(w_webserver_content_send_style) + content_flush, func(w_webserver_content_flush) + content_start, func(w_webserver_content_start) + content_stop, func(w_webserver_content_stop) + content_button, func(w_webserver_content_button) + + arg_size, func(w_webserver_argsize) + arg, func(w_webserver_arg) + arg_name, func(w_webserver_arg_name) + has_arg, func(w_webserver_has_arg) +} +@const_object_info_end */ +#include "../generate/be_fixed_webserver.h" + +#endif // USE_WEBSERVER diff --git a/lib/libesp32/berry/default/be_wirelib.c b/lib/libesp32/berry/default/be_wirelib.c new file mode 100644 index 000000000..38f345553 --- /dev/null +++ b/lib/libesp32/berry/default/be_wirelib.c @@ -0,0 +1,151 @@ +/******************************************************************** + * Tasmota lib + * + * To use: `import wire` + * + * 2 wire communication - I2C + *******************************************************************/ +#include "be_constobj.h" + +#ifdef USE_I2C + +extern int b_wire_init(bvm *vm); + +extern int b_wire_begintransmission(bvm *vm); +extern int b_wire_endtransmission(bvm *vm); +extern int b_wire_requestfrom(bvm *vm); +extern int b_wire_available(bvm *vm); +extern int b_wire_write(bvm *vm); +extern int b_wire_read(bvm *vm); + +extern int b_wire_scan(bvm *vm); + +extern int b_wire_validwrite(bvm *vm); +extern int b_wire_validread(bvm *vm); +extern int b_wire_detect(bvm *vm); +extern int b_wire_enabled(bvm *vm); + +/******************************************************************** +** Solidified function: write_bytes +********************************************************************/ +be_local_closure(write_bytes, /* name */ + be_nested_proto( + 7, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(_begin_transmission), + /* K1 */ be_nested_str(_write), + /* K2 */ be_nested_str(_end_transmission), + }), + &be_const_str_write_bytes, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x5C180200, // 0001 MOVE R6 R1 + 0x7C100400, // 0002 CALL R4 2 + 0x8C100101, // 0003 GETMET R4 R0 K1 + 0x5C180400, // 0004 MOVE R6 R2 + 0x7C100400, // 0005 CALL R4 2 + 0x8C100101, // 0006 GETMET R4 R0 K1 + 0x5C180600, // 0007 MOVE R6 R3 + 0x7C100400, // 0008 CALL R4 2 + 0x8C100102, // 0009 GETMET R4 R0 K2 + 0x7C100200, // 000A CALL R4 1 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_bytes +********************************************************************/ +be_local_closure(read_bytes, /* name */ + be_nested_proto( + 8, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(_begin_transmission), + /* K1 */ be_nested_str(_write), + /* K2 */ be_nested_str(_end_transmission), + /* K3 */ be_nested_str(_request_from), + /* K4 */ be_nested_str(_available), + /* K5 */ be_nested_str(_read), + }), + &be_const_str_read_bytes, + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x5C180200, // 0001 MOVE R6 R1 + 0x7C100400, // 0002 CALL R4 2 + 0x8C100101, // 0003 GETMET R4 R0 K1 + 0x5C180400, // 0004 MOVE R6 R2 + 0x7C100400, // 0005 CALL R4 2 + 0x8C100102, // 0006 GETMET R4 R0 K2 + 0x50180000, // 0007 LDBOOL R6 0 0 + 0x7C100400, // 0008 CALL R4 2 + 0x8C100103, // 0009 GETMET R4 R0 K3 + 0x5C180200, // 000A MOVE R6 R1 + 0x5C1C0600, // 000B MOVE R7 R3 + 0x7C100600, // 000C CALL R4 3 + 0x60100015, // 000D GETGBL R4 G21 + 0x5C140600, // 000E MOVE R5 R3 + 0x7C100200, // 000F CALL R4 1 + 0x8C140104, // 0010 GETMET R5 R0 K4 + 0x7C140200, // 0011 CALL R5 1 + 0x78160003, // 0012 JMPF R5 #0017 + 0x8C140105, // 0013 GETMET R5 R0 K5 + 0x7C140200, // 0014 CALL R5 1 + 0x40140805, // 0015 CONNECT R5 R4 R5 + 0x7001FFF8, // 0016 JMP #0010 + 0x80040800, // 0017 RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +#include "../generate/be_fixed_be_class_tasmota_wire.h" + +void be_load_wirelib(bvm *vm) { + be_pushntvclass(vm, &be_class_tasmota_wire); + be_setglobal(vm, "Wire"); + be_pop(vm, 1); +} +/* @const_object_info_begin + +class be_class_tasmota_wire (scope: global, name: Wire) { + bus, var + + init, func(b_wire_init) + _begin_transmission, func(b_wire_begintransmission) + _end_transmission, func(b_wire_endtransmission) + _request_from, func(b_wire_requestfrom) + _available, func(b_wire_available) + _write, func(b_wire_write) + _read, func(b_wire_read) + scan, func(b_wire_scan) + write, func(b_wire_validwrite) + read, func(b_wire_validread) + detect, func(b_wire_detect) + enabled, func(b_wire_enabled) + + read_bytes, closure(read_bytes_closure) + write_bytes, closure(write_bytes_closure) +} +@const_object_info_end */ + +#endif // USE_I2C \ No newline at end of file diff --git a/lib/libesp32/berry/default/berry_conf.h b/lib/libesp32/berry/default/berry_conf.h new file mode 100644 index 000000000..607a9c612 --- /dev/null +++ b/lib/libesp32/berry/default/berry_conf.h @@ -0,0 +1,247 @@ +/******************************************************************** +** Copyright (c) 2018-2020 Guan Wenliang +** This file is part of the Berry default interpreter. +** skiars@qq.com, https://github.com/Skiars/berry +** See Copyright Notice in the LICENSE file or at +** https://github.com/Skiars/berry/blob/master/LICENSE +********************************************************************/ +#ifndef BERRY_CONF_H +#define BERRY_CONF_H + +#include + +#ifdef COMPILE_BERRY_LIB + #include "my_user_config.h" + #include "tasmota_configurations.h" +#endif + +/* Macro: BE_DEBUG + * Berry interpreter debug switch. + * Default: 0 + **/ +#ifndef BE_DEBUG +#define BE_DEBUG 0 +#endif + +/* Macro: BE_LONGLONG_INT + * Select integer length. + * If the value is 0, use an integer of type int, use a long + * integer type when the value is 1, and use a long long integer + * type when the value is 2. + * Default: 2 + */ +#define BE_INTGER_TYPE 1 // use long int = uint32_t + +/* Macro: BE_USE_SINGLE_FLOAT + * Select floating point precision. + * Use double-precision floating-point numbers when the value + * is 0 (default), otherwise use single-precision floating-point + * numbers. + * Default: 0 + **/ +#define BE_USE_SINGLE_FLOAT 1 // use `float` not `double` + +/* Macro: BE_USE_PRECOMPILED_OBJECT + * Use precompiled objects to avoid creating these objects at + * runtime. Enable this macro can greatly optimize RAM usage. + * Default: 1 + **/ +#define BE_USE_PRECOMPILED_OBJECT 1 + +/* Macro: BE_DEBUG_RUNTIME_INFO + * Set runtime error debugging information. + * 0: unable to output source file and line number at runtime. + * 1: output source file and line number information at runtime. + * 2: the information use uint16_t type (save space). + * Default: 1 + **/ +#define BE_DEBUG_RUNTIME_INFO 0 + +/* Macro: BE_DEBUG_VAR_INFO + * Set variable debugging tracking information. + * 0: disable variable debugging tracking information at runtime. + * 1: enable variable debugging tracking information at runtime. + * Default: 1 + **/ +#define BE_DEBUG_VAR_INFO 0 + +/* Macro: BE_USE_PERF_COUNTERS + * Use the obshook function to report low-level actions. + * Default: 0 + **/ +#define BE_USE_PERF_COUNTERS 1 + +/* Macro: BE_VM_OBSERVABILITY_SAMPLING + * If BE_USE_PERF_COUNTERS == 1 + * then the observability hook is called regularly in the VM loop + * allowing to stop infinite loops or too-long running code. + * The value is a power of 2. + * Default: 20 - which translates to 2^20 or ~1 million instructions + **/ +#define BE_VM_OBSERVABILITY_SAMPLING 20 + +/* Macro: BE_STACK_TOTAL_MAX + * Set the maximum total stack size. + * Default: 20000 + **/ +#define BE_STACK_TOTAL_MAX 8000 + +/* Macro: BE_STACK_FREE_MIN + * Set the minimum free count of the stack. The stack idles will + * be checked when a function is called, and the stack will be + * expanded if the number of free is less than BE_STACK_FREE_MIN. + * Default: 10 + **/ +#define BE_STACK_FREE_MIN 20 + +/* Macro: BE_STACK_START + * Set the starting size of the stack at VM creation. + * Default: 50 + **/ +#define BE_STACK_START 100 + +/* Macro: BE_CONST_SEARCH_SIZE + * Constants in function are limited to 255. However the compiler + * will look for a maximum of pre-existing constants to avoid + * performance degradation. This may cause the number of constants + * to be higher than required. + * Increase is you need to solidify functions. + * Default: 50 + **/ +#define BE_CONST_SEARCH_SIZE 150 + +/* Macro: BE_STACK_FREE_MIN + * The short string will hold the hash value when the value is + * true. It may be faster but requires more RAM. + * Default: 0 + **/ +#define BE_USE_STR_HASH_CACHE 0 + +/* Macro: BE_USE_FILE_SYSTEM + * The file system interface will be used when this macro is true + * or when using the OS module. Otherwise the file system interface + * will not be used. + * Default: 0 + **/ +#define BE_USE_FILE_SYSTEM 0 + +/* Macro: BE_USE_SCRIPT_COMPILER + * Enable compiler when BE_USE_SCRIPT_COMPILER is not 0, otherwise + * disable the compiler. + * Default: 1 + **/ +#define BE_USE_SCRIPT_COMPILER 1 + +/* Macro: BE_USE_BYTECODE_SAVER + * Enable save bytecode to file when BE_USE_BYTECODE_SAVER is not 0, + * otherwise disable the feature. + * Default: 1 + **/ +#define BE_USE_BYTECODE_SAVER 1 + +/* Macro: BE_USE_BYTECODE_LOADER + * Enable load bytecode from file when BE_USE_BYTECODE_LOADER is not 0, + * otherwise disable the feature. + * Default: 1 + **/ +#define BE_USE_BYTECODE_LOADER 1 + +/* Macro: BE_USE_SHARED_LIB + * Enable shared library when BE_USE_SHARED_LIB is not 0, + * otherwise disable the feature. + * Default: 1 + **/ +#define BE_USE_SHARED_LIB 0 + +/* Macro: BE_USE_OVERLOAD_HASH + * Allows instances to overload hash methods for use in the + * built-in Map class. Disable this feature to crop the code + * size. + * Default: 1 + **/ +#define BE_USE_OVERLOAD_HASH 1 + +/* Macro: BE_USE_DEBUG_HOOK + * Berry debug hook switch. + * Default: 0 + **/ +#define BE_USE_DEBUG_HOOK 0 + +/* Macro: BE_USE_DEBUG_GC + * Enable GC debug mode. This causes an actual gc after each + * allocation. It's much slower and should not be used + * in production code. + * Default: 0 + **/ +#define BE_USE_DEBUG_GC 0 + +/* Macro: BE_USE_XXX_MODULE + * These macros control whether the related module is compiled. + * When they are true, they will enable related modules. At this + * point you can use the import statement to import the module. + * They will not compile related modules when they are false. + **/ +#define BE_USE_STRING_MODULE 1 +#define BE_USE_JSON_MODULE 1 +#define BE_USE_MATH_MODULE 1 +#define BE_USE_TIME_MODULE 0 +#define BE_USE_OS_MODULE 0 +#define BE_USE_GLOBAL_MODULE 1 +#define BE_USE_SYS_MODULE 1 +#define BE_USE_DEBUG_MODULE 0 +#define BE_USE_GC_MODULE 1 +#define BE_USE_SOLIDIFY_MODULE 0 +#define BE_USE_INTROSPECT_MODULE 1 +#define BE_USE_STRICT_MODULE 1 + +#ifdef USE_BERRY_DEBUG + #undef BE_USE_DEBUG_MODULE + #undef BE_USE_SOLIDIFY_MODULE + #define BE_USE_DEBUG_MODULE 1 + #define BE_USE_SOLIDIFY_MODULE 1 +#endif // USE_BERRY_DEBUG + +/* Macro: BE_EXPLICIT_XXX + * If these macros are defined, the corresponding function will + * use the version defined by these macros. These macro definitions + * are not required. + * The default is to use the functions in the standard library. + **/ +#ifdef USE_BERRY_PSRAM +#ifdef __cplusplus +extern "C" { +#endif + extern void *berry_malloc(size_t size); + extern void berry_free(void *ptr); + extern void *berry_realloc(void *ptr, size_t size); +#ifdef __cplusplus +} +#endif + #define BE_EXPLICIT_MALLOC berry_malloc + #define BE_EXPLICIT_FREE berry_free + #define BE_EXPLICIT_REALLOC berry_realloc +#else + #define BE_EXPLICIT_MALLOC malloc + #define BE_EXPLICIT_FREE free + #define BE_EXPLICIT_REALLOC realloc +#endif // USE_BERRY_PSRAM + +#define BE_EXPLICIT_ABORT abort +#define BE_EXPLICIT_EXIT exit +// #define BE_EXPLICIT_MALLOC malloc +// #define BE_EXPLICIT_FREE free +// #define BE_EXPLICIT_REALLOC realloc + +/* Macro: be_assert + * Berry debug assertion. Only enabled when BE_DEBUG is active. + * Default: use the assert() function of the standard library. + **/ +#define be_assert(expr) assert(expr) + +/* Tasmota debug specific */ +#ifdef USE_BERRY_DEBUG + #undef BE_DEBUG_RUNTIME_INFO + #define BE_DEBUG_RUNTIME_INFO 2 /* record line information in 16 bits */ +#endif // USE_BERRY_DEBUG + +#endif diff --git a/lib/libesp32/berry/default/embedded/Animate.be b/lib/libesp32/berry/default/embedded/Animate.be new file mode 100644 index 000000000..279fd39ed --- /dev/null +++ b/lib/libesp32/berry/default/embedded/Animate.be @@ -0,0 +1,189 @@ +# +# class Animate +# +# Animation framework +# + +animate = module("animate") + +# state-machine: from val a to b +class Animate_ins_ramp + var a # starting value + var b # end value + var duration # duration in milliseconds + + def init(a,b,duration) + self.a = a + self.b = b + self.duration = duration + end +end +animate.ins_ramp = Animate_ins_ramp + +# state-machine: pause and goto +class Animate_ins_goto + var pc_rel # relative PC, -1 previous instruction, 1 next instruction, 0 means see pc_abs + var pc_abs # absolute PC, only if pc_rel == 0, address if next instruction + var duration # pause in milliseconds before goto, -1 means infinite (state-machine can be changed externally) + + def init(pc_rel, pc_abs, duration) + self.pc_rel = pc_rel + self.pc_abs = pc_abs + self.duration = duration + end +end +animate.ins_goto = Animate_ins_goto + +class Animate_engine + var code # array of state-machine instructions + var closure # closure to call with the new value + var pc # program-counter + var ins_time # absolute time when the current instruction started + var running # is the animation running? allows fast return + var value # current value + + def init() + self.code = [] + self.pc = 0 # start at instruction 0 + self.ins_time = 0 + self.running = false # not running by default + # + end + + # run but needs external calls to `animate()` + # cur_time:int (opt) current timestamp in ms, defaults to `tasmota.millis()` + # val:int (opt) starting value, default to `nil` + def run(cur_time, val) + if cur_time == nil cur_time = tasmota.millis() end + if (val != nil) self.value = val end + self.ins_time = cur_time + + self.running = true + tasmota.add_driver(self) + end + + # runs autonomously in the Tasmota event loop + def autorun(cur_time, val) + self.run(cur_time, val) + tasmota.add_driver(self) + end + + def stop() + self.running = false + tasmota.remove_driver(self) + end + + def is_running() + return self.running + end + + def every_50ms() + self.animate() + end + + def animate(cur_time) # time in milliseconds, optional, defaults to `tasmota.millis()` + if !self.running return end + if cur_time == nil cur_time = tasmota.millis() end + # run through instructions + while true + var sub_index = cur_time - self.ins_time # time since the beginning of current instruction + # + # make sure PC is valid + if self.pc >= size(self.code) + self.running = false + break + end + # + if self.pc < 0 raise "internal_error", "Animate pc is out of range" end + var ins = self.code[self.pc] + + # Instruction Ramp + if isinstance(ins, animate.ins_ramp) + var f = self.closure # assign to a local variable to not call a method + if sub_index < ins.duration + # we're still in the ramp + self.value = tasmota.scale_uint(sub_index, 0, ins.duration, ins.a, ins.b) + # call closure + if f f(self.value) end # call closure, need try? TODO + break + else + self.value = ins.b + if f f(self.value) end # set to last value + self.pc += 1 # next instruction + self.ins_time = cur_time - (sub_index - ins.duration) + end + + # Instruction Goto + elif isinstance(ins, animate.ins_goto) + if sub_index < ins.duration + break + else + if ins.pc_rel != 0 + self.pc += ins.pc_rel + else + self.pc = ins.pc_abs + end + self.ins_time = cur_time - (sub_index - ins.duration) + end + + # Invalid + else + raise "internal_error", "unknown instruction" + end + end + return self.value + + end +end +animate.engine = Animate_engine + +class Animate_from_to : Animate_engine + + def init(closure, from, to, duration) + super(self).init() + self.closure = closure + self.code.push(animate.ins_ramp(from, to, duration)) + end + +end +animate.from_to = Animate_from_to + +#- +a=Animate_from_to(nil, 0, 100, 5000) +a.autorun() +-# + +class Animate_rotate : Animate_engine + + def init(closure, from, to, duration) + super(self).init() + self.closure = closure + self.code.push(animate.ins_ramp(from, to, duration)) + self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause + end + +end +animate.rotate = Animate_rotate + +#- +a=Animate_rotate(nil, 0, 100, 5000) +a.autorun() +-# + +class Animate_back_forth : Animate_engine + + def init(closure, from, to, duration) + super(self).init() + self.closure = closure + self.code.push(animate.ins_ramp(from, to, duration / 2)) + self.code.push(animate.ins_ramp(to, from, duration / 2)) + self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause + end + +end +animate.back_forth = Animate_back_forth + +#- +a=Animate_back_forth(nil, 0, 100, 5000) +a.autorun() +-# diff --git a/lib/libesp32/berry/default/embedded/Driver.be b/lib/libesp32/berry/default/embedded/Driver.be new file mode 100644 index 000000000..d0782f024 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/Driver.be @@ -0,0 +1,29 @@ +#- Native code used for testing and code solidification -# +#- Do not use it -# + +class Driver + var every_second + var every_100ms + var web_add_handler + var web_add_button + var web_add_main_button + var web_add_management_button + var web_add_config_button + var web_add_console_button + var save_before_restart + var web_sensor + var json_append + var button_pressed + var display + + def init() + end + + def get_tasmota() + return tasmota + end + + def add_cmd(c, f) + tasmota.add_cmd(c, / cmd, idx, payload, payload_json -> f(self, cmd, idx, payload, payload_json)) + end +end diff --git a/lib/libesp32/berry/default/embedded/Tasmota.be b/lib/libesp32/berry/default/embedded/Tasmota.be new file mode 100644 index 000000000..22752a47d --- /dev/null +++ b/lib/libesp32/berry/default/embedded/Tasmota.be @@ -0,0 +1,577 @@ +#- Native code used for testing and code solidification -# +#- Do not use it -# + +class Timer + var due, f, id + def init(due, f, id) + self.due = due + self.f = f + self.id = id + end + def tostring() + import string + return string.format(" closure + # Classs KV has two members k and v + def kv(k, v) + class KV + var k, v + def init(k,v) + self.k = k + self.v = v + end + end + + return KV(k, v) + end + + # add `chars_in_string(s:string,c:string) -> int`` + # looks for any char in c, and return the position of the first char + # or -1 if not found + # inv is optional and inverses the behavior, i.e. look for chars not in the list + def chars_in_string(s,c,inv) + var inverted = inv ? true : false + var i = 0 + while i < size(s) + # for i:0..size(s)-1 + var found = false + var j = 0 + while j < size(c) + # for j:0..size(c)-1 + if s[i] == c[j] found = true end + j += 1 + end + if inverted != found return i end + i += 1 + end + return -1 + end + + # find a key in map, case insensitive, return actual key or nil if not found + def find_key_i(m,keyi) + import string + var keyu = string.toupper(keyi) + if isinstance(m, map) + for k:m.keys() + if string.toupper(k)==keyu || keyi=='?' + return k + end + end + end + end + + + # split the item when there is an operator, returns a list of (left,op,right) + # ex: "Dimmer>50" -> ["Dimmer",tasmota_gt,"50"] + def find_op(item) + import string + var op_chars = '=<>!' + var pos = self.chars_in_string(item, op_chars) + if pos >= 0 + var op_split = string.split(item,pos) + var op_left = op_split[0] + var op_rest = op_split[1] + pos = self.chars_in_string(op_rest, op_chars, true) + if pos >= 0 + var op_split2 = string.split(op_rest,pos) + var op_middle = op_split2[0] + var op_right = op_split2[1] + return [op_left,op_middle,op_right] + end + end + return [item, nil, nil] + end + + # Rules + def add_rule(pat,f) + if !self._rules + self._rules=[] + end + if type(f) == 'function' + self._rules.push(self.kv(pat, f)) + else + raise 'value_error', 'the second argument is not a function' + end + end + + def remove_rule(pat) + if self._rules + var i = 0 + while i < size(self._rules) + if self._rules[i].k == pat + self._rules.remove(i) #- don't increment i since we removed the object -# + else + i += 1 + end + end + end + end + + # Rules trigger if match. return true if match, false if not + def try_rule(event, rule, f) + import string + var rl_list = self.find_op(rule) + var sub_event = event + var rl = string.split(rl_list[0],'#') + var i = 0 + while i < size(rl) + # for it:rl + var it = rl[i] + var found=self.find_key_i(sub_event,it) + if found == nil return false end + sub_event = sub_event[found] + i += 1 + end + var op=rl_list[1] + var op2=rl_list[2] + if op + if op=='==' + if str(sub_event) != str(op2) return false end + elif op=='!==' + if str(sub_event) == str(op2) return false end + elif op=='=' + if real(sub_event) != real(op2) return false end + elif op=='!=' + if real(sub_event) == real(op2) return false end + elif op=='>' + if real(sub_event) <= real(op2) return false end + elif op=='>=' + if real(sub_event) < real(op2) return false end + elif op=='<' + if real(sub_event) >= real(op2) return false end + elif op=='<=' + if real(sub_event) > real(op2) return false end + end + end + f(sub_event, rl_list[0], event) + return true + end + + # Run rules, i.e. check each individual rule + # Returns true if at least one rule matched, false if none + def exec_rules(ev_json) + if self._rules || self.cmd_res != nil # if there is a rule handler, or we record rule results + import json + var ev = json.load(ev_json) # returns nil if invalid JSON + var ret = false + if ev == nil + self.log('BRY: ERROR, bad json: '+ev_json, 3) + ev = ev_json # revert to string + end + # record the rule payload for tasmota.cmd() + if self.cmd_res != nil + self.cmd_res = ev + end + # try all rule handlers + if self._rules + var i = 0 + while i < size(self._rules) + var kv = self._rules[i] + ret = self.try_rule(ev,kv.k,kv.v) || ret #- call should be first to avoid evaluation shortcut if ret is already true -# + i += 1 + end + end + return ret + end + return false + end + + # Run tele rules + def exec_tele(ev_json) + if self._rules + import json + var ev = json.load(ev_json) # returns nil if invalid JSON + var ret = false + if ev == nil + self.log('BRY: ERROR, bad json: '+ev_json, 3) + ev = ev_json # revert to string + end + # insert tele prefix + ev = { "Tele": ev } + + var i = 0 + while i < size(self._rules) + var kv = self._rules[i] + ret = self.try_rule(ev,kv.k,kv.v) || ret #- call should be first to avoid evaluation shortcut -# + i += 1 + end + return ret + end + return false + end + + def set_timer(delay,f,id) + if !self._timers self._timers=[] end + self._timers.push(Timer(self.millis(delay),f,id)) + end + + # run every 50ms tick + def run_deferred() + if self._timers + var i=0 + while i wire1 or wire2 or nil + # scan for the first occurrence of the addr, starting with bus1 then bus2 + # optional: skip if index is disabled via I2CEnable + def wire_scan(addr,idx) + # skip if the I2C index is disabled + if idx != nil && !self.i2c_enabled(idx) return nil end + if self.wire1.enabled() && self.wire1.detect(addr) return self.wire1 end + if self.wire2.enabled() && self.wire2.detect(addr) return self.wire2 end + return nil + end + + def time_str(time) + import string + var tm = self.time_dump(time) + return string.format("%04d-%02d-%02dT%02d:%02d:%02d", tm['year'], tm['month'], tm['day'], tm['hour'], tm['min'], tm['sec']) + end + + def load(f) + # embedded functions + # puth_path: adds the current archive to sys.path + def push_path(p) + import sys + var path = sys.path() + if path.find(p) == nil # append only if it's not already there + path.push(p) + end + end + # pop_path: removes the path + def pop_path(p) + import sys + var path = sys.path() + var idx = path.find(p) + if idx != nil + path.remove(idx) + end + end + + import string + import path + + # fail if empty string + if size(f) == 0 return false end + # Ex: f = 'app.zip#autoexec' + + # add leading '/' if absent + if f[0] != '/' f = '/' + f end + # Ex: f = '/app.zip#autoexec' + + var f_items = string.split(f, '#') + var f_prefix = f_items[0] + var f_suffix = f_items[-1] # last token + var f_archive = size(f_items) > 1 # is the file in an archive + + # if no dot, add the default '.be' extension + if string.find(f_suffix, '.') < 0 # does the final file has a '.' + f += ".be" + f_suffix += ".be" + end + # Ex: f = '/app.zip#autoexec.be' + + # if the filename has no '.' append '.be' + var suffix_be = f_suffix[-3..-1] == '.be' + var suffix_bec = f_suffix[-4..-1] == '.bec' + # Ex: f = '/app.zip#autoexec.be', f_suffix = 'autoexec.be', suffix_be = true, suffix_bec = false + + # check that the file ends with '.be' of '.bec' + if !suffix_be && !suffix_bec + raise "io_error", "file extension is not '.be' or '.bec'" + end + + var f_time = path.last_modified(f_prefix) + + if suffix_bec + if f_time == nil return false end # file does not exist + # f is the right file, continue + else + var f_time_bc = path.last_modified(f + "c") # timestamp for bytecode + if f_time == nil && f_time_bc == nil return false end + if f_time_bc != nil && (f_time == nil || f_time_bc >= f_time) + # bytecode exists and is more recent than berry source, use bytecode + ##### temporarily disable loading from bec file + # f = f + "c" # use bytecode name + suffix_bec = true + end + end + + # recall the working directory + if f_archive + self.wd = f_prefix + "#" + push_path(self.wd) + else + self.wd = "" + end + + var c = compile(f, 'file') + # save the compiled bytecode + if !suffix_bec && !f_archive + try + self.save(f + 'c', c) + except .. as e + print(string.format('BRY: could not save compiled file %s (%s)',f+'c',e)) + end + end + # call the compiled code + c() + # call successfuls + + # remove path prefix + if f_archive + pop_path(f_prefix + "#") + end + + return true + end + + def event(event_type, cmd, idx, payload, raw) + import introspect + import string + if event_type=='every_50ms' self.run_deferred() end #- first run deferred events -# + + var done = false + if event_type=='cmd' return self.exec_cmd(cmd, idx, payload) + elif event_type=='tele' return self.exec_tele(payload) + elif event_type=='rule' return self.exec_rules(payload) + elif event_type=='gc' return self.gc() + elif self._drivers + var i = 0 + while i < size(self._drivers) + #for d:self._drivers + var d = self._drivers[i] + var f = introspect.get(d, event_type) # try to match a function or method with the same name + if type(f) == 'function' + try + done = f(d, cmd, idx, payload, raw) + if done break end + except .. as e,m + print(string.format("BRY: Exception> '%s' - %s", e, m)) + if self._debug_present + import debug + debug.traceback() + end + end + end + i += 1 + end + end + + # save persist + if event_type=='save_before_restart' + import persist + persist.save() + end + + return done + end + + def add_driver(d) + if self._drivers + self._drivers.push(d) + else + self._drivers = [d] + end + end + + def remove_driver(d) + if self._drivers + var idx = self._drivers.find(d) + if idx != nil + self._drivers.pop(idx) + end + end + end + + # cmd high-level function + def cmd(command) + self.cmd_res = true # signal buffer capture + + self._cmd(command) + + var ret = nil + if self.cmd_res != true # unchanged + ret = self.cmd_res + end + self.cmd_res = nil # clear buffer + + return ret + end + + # set_light and get_light deprecetaion + def get_light(l) + print('tasmota.get_light() is deprecated, use light.get()') + import light + if l != nil + return light.get(l) + else + return light.get() + end + end + def set_light(v,l) + print('tasmota.set_light() is deprecated, use light.set()') + import light + if l != nil + return light.set(v,l) + else + return light.set(v) + end + end + + #- generate a new C callback and record the associated Berry closure -# + def gen_cb(f) + # DEPRECATED + import cb + return cb.gen_cb(f) + end + + #- convert hue/sat to rgb -# + #- hue:int in range 0..359 -# + #- sat:int (optional) in range 0..255 -# + #- returns int: 0xRRGGBB -# + def hs2rgb(hue,sat) + if sat == nil sat = 255 end + var r = 255 # default to white + var b = 255 + var g = 255 + # we take brightness at 100%, brightness should be set separately + hue = hue % 360 # normalize to 0..359 + + if sat > 0 + var i = hue / 60 # quadrant 0..5 + var f = hue % 60 # 0..59 + var p = 255 - sat + var q = tasmota.scale_uint(f, 0, 60, 255, p) # 0..59 + var t = tasmota.scale_uint(f, 0, 60, p, 255) + + if i == 0 + # r = 255 + g = t + b = p + elif i == 1 + r = q + # g = 255 + b = p + elif i == 2 + r = p + #g = 255 + b = t + elif i == 3 + r = p + g = q + #b = 255 + elif i == 4 + r = t + g = p + #b = 255 + else + #r = 255 + g = p + b = q + end + end + + return (r << 16) | (g << 8) | b + end +end diff --git a/lib/libesp32/berry/default/embedded/Wire.be b/lib/libesp32/berry/default/embedded/Wire.be new file mode 100644 index 000000000..a5e28ddd8 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/Wire.be @@ -0,0 +1,25 @@ +#- Native code used for testing and code solidification -# +#- Do not use it -# + +class Wire + var bus + + def read_bytes(addr,reg,size) + self._begin_transmission(addr) + self._write(reg) + self._end_transmission(false) + self._request_from(addr,size) + var ret=bytes(size) + while (self._available()) + ret..self._read() + end + return ret + end + + def write_bytes(addr,reg,b) + self._begin_transmission(addr) + self._write(reg) + self._write(b) + self._end_transmission() + end +end diff --git a/lib/libesp32/berry/default/embedded/autoconf.be b/lib/libesp32/berry/default/embedded/autoconf.be new file mode 100644 index 000000000..8489c7447 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/autoconf.be @@ -0,0 +1,389 @@ +#- autocong module for Berry -# +#- -# +#- To solidify: -# +#- + # load only persis_module and persist_module.init + import autoconf + solidify.dump(autoconf_module) + # copy and paste into `be_autoconf_lib.c` +-# +#- + +# For external compile: + +display = module("display") +self = nil +tasmota = nil +def load() end + +-# + +var autoconf_module = module("autoconf") + +autoconf_module.init = def (m) + + class Autoconf + var _archive + var _error + + def init() + import path + import string + + var dir = path.listdir("/") + var entry + tasmota.add_driver(self) + + var i = 0 + while i < size(dir) + if string.find(dir[i], ".autoconf") > 0 # does the file contain '*.autoconf', >0 to skip `.autoconf` + if entry != nil + # we have multiple configuration files, not allowed + print(string.format("CFG: multiple autoconf files found, aborting ('%s' + '%s')", entry, dir[i])) + self._error = true + return nil + end + entry = dir[i] + end + i += 1 + end + + if entry == nil + tasmota.log("CFG: no '*.autoconf' file found", 2) + return nil + end + + self._archive = entry + end + + + # #################################################################################################### + # Manage first time marker + # #################################################################################################### + def is_first_time() + import path + return !path.exists("/.autoconf") + end + def set_first_time() + var f = open("/.autoconf", "w") + f.close() + end + def clear_first_time() + import path + path.remove("/.autoconf") + end + + # #################################################################################################### + # Delete all autoconfig files present + # #################################################################################################### + def delete_all_configs() + import path + import string + var dir = path.listdir("/") + + for d:dir + if string.find(d, ".autoconf") > 0 # does the file contain '*.autoconf' + path.remove(d) + end + end + end + + # #################################################################################################### + # Get current module + # contains the name of the archive without leading `/`, ex: `M5Stack_Fire.autoconf` + # or `nil` if none + # #################################################################################################### + def get_current_module_path() + return self._archive + end + def get_current_module_name() + return self._archive[0..-10] + end + + # #################################################################################################### + # Load templates from Github + # #################################################################################################### + def load_templates() + import string + import json + try + var url = string.format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s_manifest.json", tasmota.arch()) + tasmota.log(string.format("CFG: loading '%s'", url), 3) + # load the template + var cl = webclient() + cl.begin(url) + var r = cl.GET() + if r != 200 + tasmota.log(string.format("CFG: return_code=%i", r), 2) + return nil + end + var s = cl.get_string() + cl.close() + # convert to json + var j = json.load(s) + tasmota.log(string.format("CFG: loaded '%s'", str(j)), 3) + + var t = j.find("files") + if isinstance(t, list) + return t + end + + return nil + except .. as e, m + tasmota.log(string.format("CFG: exception '%s' - '%s'", e, m), 2) + return nil + end + end + + # #################################################################################################### + # Init web handlers + # #################################################################################################### + # Displays a "Autocong" button on the configuration page + def web_add_config_button() + import webserver + webserver.content_send("

") + end + + + # This HTTP GET manager controls which web controls are displayed + def page_autoconf_mgr() + import webserver + import string + if !webserver.check_privileged_access() return nil end + + webserver.content_start('Auto-configuration') + webserver.content_send_style() + webserver.content_send("

 (This feature requires an internet connection)

") + + var cur_module = self.get_current_module_path() + var cur_module_display = cur_module ? string.tr(self.get_current_module_name(), "_", " ") : self._error ? "<Error: apply new or remove>" : "<None>" + + webserver.content_send("
") + webserver.content_send(string.format(" Current auto-configuration")) + webserver.content_send(string.format("

Current configuration:

%s

", cur_module_display)) + + if cur_module + # add button to reapply template + webserver.content_send("

") + webserver.content_send("") + webserver.content_send("

") + end + webserver.content_send("

") + + webserver.content_send("
") + webserver.content_send(string.format(" Select new auto-configuration")) + + webserver.content_send("

") + webserver.content_send("
") + webserver.content_send("

") + + webserver.content_send("") + # webserver.content_send(string.format("", ota_num)) + webserver.content_send("

") + + + webserver.content_send("

") + webserver.content_button(webserver.BUTTON_CONFIGURATION) + webserver.content_stop() + end + + # #################################################################################################### + # Web controller + # + # Applies the changes and restart + # #################################################################################################### + # This HTTP POST manager handles the submitted web form data + def page_autoconf_ctl() + import webserver + import string + import path + if !webserver.check_privileged_access() return nil end + + try + if webserver.has_arg("reapply") + tasmota.log("CFG: removing first time marker", 2); + # print("CFG: removing first time marker") + self.clear_first_time() + #- and force restart -# + webserver.redirect("/?rst=") + + elif webserver.has_arg("zip") + # remove any remaining autoconf file + tasmota.log("CFG: removing autoconf files", 2); + # print("CFG: removing autoconf files") + self.delete_all_configs() + + # get the name of the configuration file + var arch_name = webserver.arg("zip") + + if arch_name != "reset" + var url = string.format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s/%s.autoconf", tasmota.arch(), arch_name) + tasmota.log(string.format("CFG: downloading '%s'", url), 2); + + var local_file = string.format("%s.autoconf", arch_name) + + # download file and write directly to file system + var cl = webclient() + cl.begin(url) + var r = cl.GET() + if r != 200 raise "connection_error", string.format("return code=%i", r) end + cl.write_file(local_file) + cl.close() + end + + # remove marker to reapply template + self.clear_first_time() + + #- and force restart -# + webserver.redirect("/?rst=") + else + raise "value_error", "Unknown command" + end + except .. as e, m + print(string.format("CFG: Exception> '%s' - %s", e, m)) + #- display error page -# + webserver.content_start("Parameter error") #- title of the web page -# + webserver.content_send_style() #- send standard Tasmota styles -# + + webserver.content_send(string.format("

Exception:
'%s'
%s

", e, m)) + + webserver.content_button(webserver.BUTTON_CONFIGURATION) #- button back to management page -# + webserver.content_stop() #- end of web page -# + end + end + + # Add HTTP POST and GET handlers + def web_add_handler() + import webserver + webserver.on('/ac', / -> self.page_autoconf_mgr(), webserver.HTTP_GET) + webserver.on('/ac', / -> self.page_autoconf_ctl(), webserver.HTTP_POST) + end + + + # reset the configuration information (but don't restart) + # i.e. remove any autoconf file + def reset() + import path + import string + + var dir = path.listdir("/") + var entry + + var i = 0 + while i < size(dir) + var fname = dir[i] + if string.find(fname, ".autoconf") > 0 # does the file contain '*.autoconf' + path.remove(fname) + print(string.format("CFG: removed file '%s'", fname)) + end + i += 1 + end + + self._archive = nil + self._error = nil + end + + # called by the synthetic event `preinit` + def preinit() + if self._archive == nil return end + # try to launch `preinit.be` + import path + + var fname = self._archive + '#preinit.be' + if path.exists(fname) + tasmota.log("CFG: loading "+fname, 3) + load(fname) + tasmota.log("CFG: loaded "+fname, 3) + end + end + + def run_bat(fname) # read a '*.bat' file and run each command + import string + var f + try + f = open(fname, "r") # open file in read-only mode, it is expected to exist + while true + var line = f.readline() # read each line, can contain a terminal '\n', empty if end of file + if size(line) == 0 break end # end of file + + if line[-1] == "\n" line = line[0..-2] end # remove any trailing '\n' + if size(line) > 0 + tasmota.cmd(line) # run the command + end + end + f.close() # close, we don't expect exception with read-only, could be added later though + except .. as e, m + print(string.format('CFG: could not run %s (%s - %s)', fname, e, m)) + f.close() + end + end + + # called by the synthetic event `autoexec` + def autoexec() + if self._archive == nil return end + # try to launch `preinit.be` + import path + + # Step 1. if first run, only apply `init.bat` + var fname = self._archive + '#init.bat' + if self.is_first_time() && path.exists(fname) + # create the '.autoconf' file to avoid running it again, even if it crashed + self.set_first_time() + + # if path.exists(fname) # we know it exists from initial test + self.run_bat(fname) + tasmota.log("CFG: 'init.bat' done, restarting", 2) + tasmota.cmd("Restart 1") + return # if init was run, force a restart anyways and don't run the remaining code + # end + end + + # Step 2. if 'display.ini' is present, launch Universal Display + fname = self._archive + '#display.ini' + if gpio.pin_used(gpio.OPTION_A, 2) && path.exists(fname) + if path.exists("display.ini") + tasmota.log("CFG: skipping 'display.ini' because already present in file-system", 2) + else + import display + var f = open(fname,"r") + var desc = f.read() + f.close() + display.start(desc) + end + end + + # Step 3. if 'autoexec.bat' is present, run it + fname = self._archive + '#autoexec.bat' + if path.exists(fname) + tasmota.log("CFG: running "+fname, 3) + self.run_bat(fname) + tasmota.log("CFG: ran "+fname, 3) + end + + # Step 4. if 'autoexec.be' is present, load it + fname = self._archive + '#autoexec.be' + if path.exists(fname) + tasmota.log("CFG: loading "+fname, 3) + load(fname) + tasmota.log("CFG: loaded "+fname, 3) + end + end + end + + return Autoconf() # return an instance of this class +end + +aa = autoconf_module.init(autoconf_module) +import webserver +webserver.on('/ac2', / -> aa.page_autoconf_mgr(), webserver.HTTP_GET) +return autoconf_module diff --git a/lib/libesp32/berry/default/embedded/i2c_axp192.be b/lib/libesp32/berry/default/embedded/i2c_axp192.be new file mode 100644 index 000000000..3d958334f --- /dev/null +++ b/lib/libesp32/berry/default/embedded/i2c_axp192.be @@ -0,0 +1,176 @@ +#------------------------------------------------------------- + - Generic driver for AXP192 - solidified + -------------------------------------------------------------# +class AXP192 : I2C_Driver + def init() + super(self, I2C_Driver).init("AXP192", 0x34) + end + + # Return True = Battery Exist + def battery_present() + if self.wire.read(self.addr, 0x01, 1) & 0x20 return true + else return false + end + end + + # Input Power Status ??? + def get_input_power_status() + return self.wire.read(self.addr, 0x00, 1) + end + + # Battery Charging Status + def get_battery_chargin_status() + return self.wire.read(self.addr, 0x01, 1) + end + + # AXP chip temperature in °C + def get_temp() + return self.read12(0x5E) * 0.1 - 144.7 + end + + def get_bat_power() + return self.read24(0x70) * 0.00055 + end + + def get_bat_voltage() + return self.read12(0x78) * 0.0011 + end + def get_bat_current() + return (self.read13(0x7A) - self.read13(0x7C)) * 0.5 + end + def get_bat_charge_current() + return self.read13(0x7A) * 0.5 + end + def get_aps_voltage() + return self.read12(0x7E) * 0.0014 + end + def get_vbus_voltage() + return self.read12(0x5A) * 0.0017 + end + def get_vbus_current() + return self.read12(0x5C) * 0.375 + end + + # set LDO voltage + # ldo: 2/3 + # voltage: (mV) 1800mV - 3300mV in 100mV steps + def set_ldo_voltage(ldo, voltage) + if voltage > 3300 voltage = 15 + else voltage = (voltage / 100) - 18 + end + + if ldo == 2 + self.write8(0x28, self.read8(0x28) & 0x0F | ((voltage & 0x0F) << 4)) + end + if ldo == 3 + self.write8(0x28, self.read8(0x28) & 0xF0 | (voltage & 0x0F)) + end + end + + # set DCDC enable, 1/2/3 + def set_dcdc_enable(dcdc, state) + if dcdc == 1 self.write_bit(0x12, 0, state) end + if dcdc == 2 self.write_bit(0x12, 4, state) end + if dcdc == 3 self.write_bit(0x12, 1, state) end + end + + # set LDO enable, 2/3 (LDO 1 is always on) + def set_ldo_enable(ldo, state) + if ldo == 2 self.write_bit(0x12, 2, state) end + if ldo == 3 self.write_bit(0x12, 3, state) end + end + + # set GPIO output state 0/1/2 and 3/4 + def write_gpio(gpio, state) + if gpio >= 0 && gpio <= 2 + self.write_bit(0x94, gpio, state) + elif gpio >= 3 && gpio <= 4 + self.write_bit(0x96, gpio - 3, state) + end + end + + # Set voltage on DC-DC1/2/3 + # dcdc: 1/2/3 (warning some C libs start at 0) + # voltage: + def set_dc_voltage(dcdc, voltage) + if dcdc < 1 || dcdc > 3 return end + var v + if voltage < 700 v = 0 + elif voltage > 3500 v = 112 + elif dcdc == 2 && voltage > 2275 v = 63 # dcdc2 is limited to 2.275V + else v = (voltage - 700) / 25 + end + + var addr = 0x26 + if dcdc == 3 addr = 0x27 + elif dcdc == 2 addr = 0x23 + end + + self.write8(addr, self.read8(addr) & 0x80 | (v & 0x7F)) + end + + # Set charging current + # 100mA = 0 + # 190mA = 1 + # 280mA = 2 + # 360mA = 3 + # 450mA = 4 + # 550mA = 5 + # 630mA = 6 + # 700mA = 7 + # 780mA = 8 + # 880mA = 9 + # 960mA = 10 + # 1000mA = 11 + # 1080mA = 12 + # 1160mA = 13 + # 1240mA = 14 + # 1320mA = 15 + def set_chg_current(current_code) + self.write8(0x33, self.read8(0x33) & 0xF0 | (current_code & 0x0F)) + end + + # // Low Volt Level 1, when APS Volt Output < 3.4496 V + # // Low Volt Level 2, when APS Volt Output < 3.3992 V, then this flag is SET (0x01) + # // Flag will reset once battery volt is charged above Low Volt Level 1 + # // Note: now AXP192 have the Shutdown Voltage of 3.0V (B100) Def in REG 31H + def get_warning_level() + return self.read12(0x47) & 1 + end + + #- trigger a read every second -# + # def every_second() + # if !self.wire return nil end #- exit if not initialized -# + # end + + #- display sensor value in the web UI -# + def web_sensor() + if !self.wire return nil end #- exit if not initialized -# + import string + var msg = string.format( + "{s}VBus Voltage{m}%.3f V{e}".. + "{s}VBus Current{m}%.1f mA{e}".. + "{s}Batt Voltage{m}%.3f V{e}".. + "{s}Batt Current{m}%.1f mA{e}".. + #"{s}Batt Power{m}%.3f{e}".. + "{s}Temp AXP{m}%.1f °C{e}", + self.get_vbus_voltage(), self.get_vbus_voltage(), + self.get_bat_voltage(), self.get_bat_current(), + #self.get_bat_power(), + self.get_temp() + ) + tasmota.web_send_decimal(msg) + end + + #- add sensor value to teleperiod -# + def json_append() + if !self.wire return nil end #- exit if not initialized -# + # import string + # var ax = int(self.accel[0] * 1000) + # var ay = int(self.accel[1] * 1000) + # var az = int(self.accel[2] * 1000) + # var msg = string.format(",\"MPU6886\":{\"AX\":%i,\"AY\":%i,\"AZ\":%i,\"GX\":%i,\"GY\":%i,\"GZ\":%i}", + # ax, ay, az, self.gyro[0], self.gyro[1], self.gyro[2]) + # tasmota.response_append(msg) + end +end diff --git a/lib/libesp32/berry/default/embedded/i2c_driver.be b/lib/libesp32/berry/default/embedded/i2c_driver.be new file mode 100644 index 000000000..a66afa5ad --- /dev/null +++ b/lib/libesp32/berry/default/embedded/i2c_driver.be @@ -0,0 +1,104 @@ +#------------------------------------------------------------- + - IMPORTANT + - THIS CLASS IS ALREADY BAKED IN TASMOTA + - + - It is here for debugging and documentation purpose only + -------------------------------------------------------------# + +#------------------------------------------------------------- + - I2C_Driver class to simplify development of I2C drivers + - + - I2C_Driver(name, addr [, i2c_index]) -> nil + - name: name of I2C device for logging, or function to detect the model + - addr: I2C address of device, will probe all I2C buses for it + - i2c_index: (optional) check is the device is not disabled + -------------------------------------------------------------# + +class I2C_Driver + var wire #- wire object to reach the device, if nil then the module is not initialized -# + var addr #- I2C address of the device -# + var name #- model namme of the device, cannot be nil -# + + #- Init and look for device + - Input: + - name_or_detect : name of the device (if string) + or function to detect the precise model(if function) + the function is passed a single argument `self` + and must return a string, or `nil` if the device is invalid + - addr : I2C address of device (int 0..255) + - i2c_index : Tasmota I2C index, see `I2CDEVICES.md` (int) + --# + def init(name_or_detect, addr, i2c_index) + var tasmota = self.get_tasmota() #- retrieve the 'tasmota' singleton -# + + #- check if the i2c index is disabled by Tasmota configuration -# + if i2c_index != nil && !tasmota.i2c_enabled(i2c_index) return end + + self.addr = addr #- address for AXP192 -# + self.wire = tasmota.wire_scan(self.addr) #- get the right I2C bus -# + + if self.wire + #- find name of device, can be a string or a method -# + if type(name_or_detect) == 'function' + self.name = name_or_detect(self) + else + self.name = name_or_detect + end + #- if name is invalid, it means we can't detect device, abort -# + if self.name == nil self.wire = nil end + + if self.wire + print("I2C:", self.name, "detected on bus", self.wire.bus) + end + end + end + + #- write register with 8 bits value -# + def write8(reg, val) + return self.wire.write(self.addr, reg, val, 1) + end + + # Set or clear a specific bit in a register + # write_bit(reg:int, bit:int, state:bool) -> nil + # reg: I2C register number (0..255) + # bit: bit of I2C register to change (0..7) + # state: boolean value to write to specified bit + def write_bit(reg, bit, state) + if bit < 0 || bit > 7 return end + var mark = 1 << bit + if state self.write8(reg, self.read8(reg) | mark) + else self.write8(reg, self.read8(reg) & (0xFF - mark)) + end + end + + # read 8 bits + def read8(reg) + return self.wire.read(self.addr, reg, 1) + end + # read 12 bits + def read12(reg) + var buf = self.wire.read_bytes(self.addr, reg, 2) + return (buf[0] << 4) + buf[1] + end + # read 13 bits + def read13(reg) + var buf = self.wire.read_bytes(self.addr, reg, 2) + return (buf[0] << 5) + buf[1] + end + # read 24 bits + def read24(reg) + var buf = self.wire.read_bytes(self.addr, reg, 3) + return (buf[0] << 16) + (buf[1] << 8) + buf[2] + end + # read 32 bits + def read32(reg) + var buf = self.wire.read_bytes(self.addr, reg, 4) + return (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3] + end +end + +#- Example + +d = I2C_Driver("MPU", 0x68, 58) + +-# \ No newline at end of file diff --git a/lib/libesp32/berry/default/embedded/leds.be b/lib/libesp32/berry/default/embedded/leds.be new file mode 100644 index 000000000..11a0489af --- /dev/null +++ b/lib/libesp32/berry/default/embedded/leds.be @@ -0,0 +1,338 @@ +# class Leds +# +# for adressable leds like NoePixel + + +# Native commands +# 00 : ctor (leds:int, gpio:int) -> void +# 01 : begin void -> void +# 02 : show void -> void +# 03 : CanShow void -> bool +# 04 : IsDirty void -> bool +# 05 : Dirty void -> void +# 06 : Pixels void -> bytes() (mapped to the buffer) +# 07 : PixelSize void -> int +# 08 : PixelCount void -> int +# 09 : ClearTo (color:??) -> void +# 10 : SetPixelColor (idx:int, color:??) -> void +# 11 : GetPixelColor (idx:int) -> color:?? +# 20 : RotateLeft (rot:int [, first:int, last:int]) -> void +# 21 : RotateRight (rot:int [, first:int, last:int]) -> void +# 22 : ShiftLeft (rot:int [, first:int, last:int]) -> void +# 23 : ShiftRight (rot:int [, first:int, last:int]) -> void + + +class Leds : Leds_ntv + var gamma # if true, apply gamma (true is default) + var leds # number of leds + # leds:int = number of leds of the strip + # gpio:int (optional) = GPIO for NeoPixel. If not specified, takes the WS2812 gpio + # type:int (optional) = Type of LED, defaults to WS2812 RGB + # rmt:int (optional) = RMT hardware channel to use, leave default unless you have a good reason + def init(leds, gpio, type, rmt) # rmt is optional + self.gamma = true # gamma is enabled by default, it should be disabled explicitly if needed + self.leds = int(leds) + + if gpio == nil && gpio.pin(gpio.WS2812) >= 0 + gpio = gpio.pin(gpio.WS2812) + end + + # if no GPIO, abort + if gpio == nil + raise "valuer_error", "no GPIO specified for neopixelbus" + end + + # initialize the structure + self.ctor(self.leds, gpio, type, rmt) + + if self._p == nil raise "internal_error", "couldn't not initialize noepixelbus" end + + # call begin + self.begin() + + end + + def clear() + self.clear_to(0x000000) + self.show() + end + + def ctor(leds, gpio, rmt) + if rmt == nil + self.call_native(0, leds, gpio) + else + self.call_native(0, leds, gpio, rmt) + end + end + def begin() + self.call_native(1) + end + def show() + self.call_native(2) + end + def can_show() + return self.call_native(3) + end + def is_dirty() + return self.call_native(4) + end + def dirty() + self.call_native(5) + end + def pixels_buffer() + return self.call_native(6) + end + def pixel_size() + return self.call_native(7) + end + def pixel_count() + return self.call_native(8) + end + def clear_to(col, bri) + self.call_native(9, self.to_gamma(col, bri)) + end + def set_pixel_color(idx, col, bri) + self.call_native(10, idx, self.to_gamma(col, bri)) + end + def get_pixel_color(idx) + return self.call_native(11, idx) + end + # def rotate_left(rot, first, last) + # self.call_native(20, rot, first, last) + # end + # def rotate_right(rot, first, last) + # self.call_native(21, rot, first, last) + # end + # def shift_left(rot, first, last) + # self.call_native(22, rot, first, last) + # end + # def shift_right(rot, first, last) + # self.call_native(22, rot, first, last) + # end + + # apply gamma and bri + def to_gamma(rgbw, bri) + bri = (bri != nil) ? bri : 100 + var r = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0xFF0000) >> 16) + var g = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x00FF00) >> 8) + var b = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x0000FF)) + if self.gamma + return light.gamma8(r) << 16 | + light.gamma8(g) << 8 | + light.gamma8(b) + else + return r << 16 | + g << 8 | + b + end + end + + # `segment` + # create a new `strip` object that maps a part of the current strip + def create_segment(offset, leds) + if int(offset) + int(leds) > self.leds || offset < 0 || leds < 0 + raise "value_error", "out of range" + end + + # inner class + class Leds_segment + var strip + var offset, leds + + def init(strip, offset, leds) + self.strip = strip + self.offset = int(offset) + self.leds = int(leds) + end + + def clear() + self.clear_to(0x000000) + self.show() + end + + def begin() + # do nothing, already being handled by physical strip + end + def show(force) + # don't trigger on segment, you will need to trigger on full strip instead + if bool(force) || (self.offset == 0 && self.leds == self.strip.leds) + self.strip.show() + end + end + def can_show() + return self.strip.can_show() + end + def is_dirty() + return self.strip.is_dirty() + end + def dirty() + self.strip.dirty() + end + def pixels_buffer() + return nil + end + def pixel_size() + return self.strip.pixel_size() + end + def pixel_count() + return self.leds + end + def clear_to(col, bri) + var i = 0 + while i < self.leds + self.strip.set_pixel_color(i + self.offset, col, bri) + i += 1 + end + end + def set_pixel_color(idx, col, bri) + self.strip.set_pixel_color(idx + self.offset, col, bri) + end + def get_pixel_color(idx) + return self.strip.get_pixel_color(idx + self.offseta) + end + end + + return Leds_segment(self, offset, leds) + + end + + def create_matrix(w, h, offset) + offset = int(offset) + w = int(w) + h = int(h) + if offset == nil offset = 0 end + if w * h + offset > self.leds || h < 0 || w < 0 || offset < 0 + raise "value_error", "out of range" + end + + # inner class + class Leds_matrix + var strip + var offset + var h, w + var alternate # are rows in alternate mode (even/odd are reversed) + + def init(strip, w, h, offset) + self.strip = strip + self.offset = offset + self.h = h + self.w = w + self.alternate = false + end + + def clear() + self.clear_to(0x000000) + self.show() + end + + def begin() + # do nothing, already being handled by physical strip + end + def show(force) + # don't trigger on segment, you will need to trigger on full strip instead + if bool(force) || (self.offset == 0 && self.w * self.h == self.strip.leds) + self.strip.show() + end + end + def can_show() + return self.strip.can_show() + end + def is_dirty() + return self.strip.is_dirty() + end + def dirty() + self.strip.dirty() + end + def pixels_buffer() + return nil + end + def pixel_size() + return self.strip.pixel_size() + end + def pixel_count() + return self.w * self.h + end + def clear_to(col, bri) + var i = 0 + while i < self.w * self.h + self.strip.set_pixel_color(i + self.offset, col, bri) + i += 1 + end + end + def set_pixel_color(idx, col, bri) + self.strip.set_pixel_color(idx + self.offset, col, bri) + end + def get_pixel_color(idx) + return self.strip.get_pixel_color(idx + self.offseta) + end + + # Leds_matrix specific + def set_alternate(alt) + self.alternate = alt + end + def get_alternate() + return self.alternate + end + + def set_matrix_pixel_color(x, y, col, bri) + if self.alternate && x % 2 + # reversed line + self.strip.set_pixel_color(x * self.w + self.h - y - 1 + self.offset, col, bri) + else + self.strip.set_pixel_color(x * self.w + y + self.offset, col, bri) + end + end + end + + return Leds_matrix(self, w, h, offset) + + end + + static def matrix(w, h, gpio, rmt) + var strip = Leds(w * h, gpio, rmt) + var matrix = strip.create_matrix(w, h, 0) + return matrix + end +end + + +#- + +var s = Leds(25, gpio.pin(gpio.WS2812, 1)) +s.clear_to(0x300000) +s.show() +i = 0 + +def anim() + s.clear_to(0x300000) + s.set_pixel_color(i, 0x004000) + s.show() + i = (i + 1) % 25 + tasmota.set_timer(200, anim) +end +anim() + +-# + +#- + +var s = Leds_matrix(5, 5, gpio.pin(gpio.WS2812, 1)) +s.set_alternate(true) +s.clear_to(0x300000) +s.show() +x = 0 +y = 0 + +def anim() + s.clear_to(0x300000) + s.set_matrix_pixel_color(x, y, 0x004000) + s.show() + y = (y + 1) % 5 + if y == 0 + x = (x + 1) % 5 + end + tasmota.set_timer(200, anim) +end +anim() + +-# diff --git a/lib/libesp32/berry/default/embedded/leds_animator.be b/lib/libesp32/berry/default/embedded/leds_animator.be new file mode 100644 index 000000000..1ed25b491 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/leds_animator.be @@ -0,0 +1,70 @@ +# class Leds_animator + +class Leds_animator + var strip # neopixelbus object + var pixel_count # number of pixels in the strip + var bri # brightness of the animation, 0..100, default 50 + var running # is the animation running + var animators # animators list + + def init(strip) + self.strip = strip + self.bri = 50 # percentage of brightness 0..100 + self.running = false + self.pixel_count = strip.pixel_count() + self.animators = [] + # + self.clear() # clear all leds first + # + tasmota.add_driver(self) + end + + def add_anim(anim) + self.animators.push(anim) + anim.run() # start the animator + end + + def clear() + self.stop() + self.strip.clear() + end + def start() + self.running = true + end + def stop() + self.running = false + end + + def set_bri(bri) + self.bri = bri + end + def get_bri(bri) + return self.bri + end + + def every_50ms() + if self.running + # run animators first + var i = 0 + while i < size(self.animators) + var anim = self.animators[i] + if anim.is_running() + anim.animate() + i += 1 + else + self.animators.remove(i) # remove any finished animator + end + end + # tirgger animate and display + self.animate() + end + end + + def animate() + # placeholder - do nothing by default + end + + def remove() + tasmota.remove_driver(self) + end +end diff --git a/lib/libesp32/berry/default/embedded/lv_clock_icon.be b/lib/libesp32/berry/default/embedded/lv_clock_icon.be new file mode 100644 index 000000000..f5d19ca11 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/lv_clock_icon.be @@ -0,0 +1,54 @@ +#- LVGL lv_clock_icon + - +--# + +class lv_clock_icon: lv.label + var hour, minute, sec + + def init(parent) + super(self).init(parent) + var f_s7_16 = lv.seg7_font(16) + if f_s7_16 != nil self.set_style_text_font(f_s7_16, lv.PART_MAIN | lv.STATE_DEFAULT) end + + if parent != nil + var parent_height = parent.get_height() + + self.set_text("--:--") + self.refr_size() + var w = self.get_width() + self.set_y((parent.get_height() - self.get_height()) / 2) # center vertically + + var pad_right = parent.get_style_pad_right(lv.PART_MAIN | lv.STATE_DEFAULT) + self.set_x(parent.get_width() - w - pad_right - 3) + parent.set_style_pad_right(pad_right + w + 6, lv.PART_MAIN | lv.STATE_DEFAULT) + + self.set_style_bg_color(lv.color(lv.COLOR_BLACK), lv.PART_MAIN | lv.STATE_DEFAULT) + end + + tasmota.add_driver(self) + end + + def set_time(hour, minute, sec) + import string + if hour != self.hour || minute != self.minute || sec != self.sec + var txt = string.format("%02d%s%02d", hour, sec % 2 ? ":" : " ", minute) + self.hour = hour + self.minute = minute + self.sec = sec + #if txt[0] == '0' txt = '!' .. string.split(txt,1)[1] end # replace first char with '!' + self.set_text(txt) + end + end + + def every_second() + var now = tasmota.time_dump(tasmota.rtc()['local']) + if now['year'] != 1970 + self.set_time(now['hour'], now['min'], now['sec']) + end + end + + def del() + super(self).del() + tasmota.remove_driver(self) + end +end \ No newline at end of file diff --git a/lib/libesp32/berry/default/embedded/lv_signal_arcs.be b/lib/libesp32/berry/default/embedded/lv_signal_arcs.be new file mode 100644 index 000000000..7dd924e90 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/lv_signal_arcs.be @@ -0,0 +1,133 @@ +#- LVGL lv_signal_bars and lv_wifi_bars + - +--# + +class lv_signal_arcs : lv.obj + var percentage # value to display, range 0..100 + var p1, p2, area, line_dsc # instances of objects kept to avoid re-instanciating at each call + + def init(parent) + # init custom widget (don't call super constructor) + _lvgl.create_custom_widget(self, parent) + # own values + self.percentage = 100 + # pre-allocate buffers + self.p1 = lv.point() + self.p2 = lv.point() + self.area = lv.area() + self.line_dsc = lv.draw_line_dsc() + end + + def widget_event(cl, event) + # Call the ancestor's event handler + if lv.obj_event_base(cl, event) != lv.RES_OK return end + var code = event.code + + import math + def atleast1(x) if x >= 1 return x else return 1 end end + # the model is that we have 4 bars and inter-bar (1/4 of width) + var height = self.get_height() + var width = self.get_width() + + var inter_bar = atleast1(height / 8) + var bar = atleast1((height - inter_bar * 2) / 3) + var bar_offset = bar / 2 + #print("inter_bar", inter_bar, "bar", bar, "bar_offset", bar_offset) + + if code == lv.EVENT_DRAW_MAIN + var clip_area = lv.area(event.param) + + # get coordinates of object + self.get_coords(self.area) + var x_ofs = self.area.x1 + var y_ofs = self.area.y1 + + lv.draw_line_dsc_init(self.line_dsc) # initialize lv.draw_line_dsc structure + self.init_draw_line_dsc(lv.PART_MAIN, self.line_dsc) # copy the current values + + self.line_dsc.round_start = 1 + self.line_dsc.round_end = 1 + self.line_dsc.width = (bar * 3 + 1) / 4 + var on_color = self.get_style_line_color(lv.PART_MAIN | lv.STATE_DEFAULT) + var off_color = self.get_style_bg_color(lv.PART_MAIN | lv.STATE_DEFAULT) + + # initial calculation, but does not take into account bounding box + # var angle = int(math.deg(math.atan2(width / 2, height))) + + # better calculation + var hypotenuse = height - bar # center if at bar/2 from bottom and circle stops at bar/2 from top + var adjacent = width / 2 - bar_offset # stop at bar_offset from side + var angle = int(90 - math.deg(math.acos(real(adjacent) / real(hypotenuse)))) + if (angle > 45) angle = 45 end + + # print("hypotenuse",hypotenuse,"adjacent",adjacent,"angle",angle) + self.p1.x = x_ofs + width / 2 + self.p1.y = y_ofs + height - 1 - bar_offset + + self.line_dsc.color = self.percentage >= 25 ? on_color : off_color + lv.draw_arc(self.p1.x, self.p1.y, 0 * (bar + inter_bar) + bar_offset, 0, 360, clip_area, self.line_dsc) + self.line_dsc.color = self.percentage >= 50 ? on_color : off_color + lv.draw_arc(self.p1.x, self.p1.y, 1 * (bar + inter_bar) + bar_offset - 1, 270 - angle, 270 + angle, clip_area, self.line_dsc) + self.line_dsc.color = self.percentage >= 75 ? on_color : off_color + lv.draw_arc(self.p1.x, self.p1.y, 2 * (bar + inter_bar) + bar_offset - 2, 270 - angle, 270 + angle, clip_area, self.line_dsc) + + #elif mode == lv.DESIGN_DRAW_POST # commented since we don't want a frame around this object + # self.ancestor_design.call(self, clip_area, mode) + end + end + + def set_percentage(v) + var old_bars = self.percentage / 25 + if v > 100 v = 100 end + if v < 0 v = 0 end + self.percentage = v + if old_bars != v / 25 + self.invalidate() # be frugal and avoid updating the widget if it's not needed + end + end + + def get_percentage() + return self.percentage + end +end + +class lv_wifi_arcs: lv_signal_arcs + def init(parent) + super(self).init(parent) + tasmota.add_driver(self) + self.set_percentage(0) # we generally start with 0, meaning not connected + end + + def every_second() + var wifi = tasmota.wifi() + var quality = wifi.find("quality") + var ip = wifi.find("ip") + if ip == nil + self.set_percentage(0) + elif quality != nil + self.set_percentage(quality) + end + end + + def del() + super(self).del() + tasmota.remove_driver(self) + end +end + +class lv_wifi_arcs_icon: lv_wifi_arcs + def init(parent) + super(self).init(parent) + self.set_style_line_color(lv.color(lv.COLOR_WHITE), lv.PART_MAIN | lv.STATE_DEFAULT) + self.set_style_bg_color(lv.color(lv.COLOR_BLACK), lv.PART_MAIN | lv.STATE_DEFAULT) + if parent != nil + var parent_height = parent.get_height() + var pad_right = parent.get_style_pad_right(lv.PART_MAIN | lv.STATE_DEFAULT) + self.set_height(parent_height) + var w = (parent_height*4)/3 + self.set_width(w) # 130% + self.set_x(parent.get_width() - w - pad_right) + parent.set_style_pad_right(pad_right + w + 1, lv.PART_MAIN | lv.STATE_DEFAULT) + end + end +end \ No newline at end of file diff --git a/lib/libesp32/berry/default/embedded/lv_signal_bars.be b/lib/libesp32/berry/default/embedded/lv_signal_bars.be new file mode 100644 index 000000000..f548457b9 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/lv_signal_bars.be @@ -0,0 +1,118 @@ +#- LVGL lv_signal_bars and lv_wifi_bars + - +--# + +class lv_signal_bars : lv.obj + var percentage # value to display, range 0..100 + var p1, p2, area, line_dsc # instances of objects kept to avoid re-instanciating at each call + + def init(parent) + # init custom widget (don't call super constructor) + _lvgl.create_custom_widget(self, parent) + # own values + self.percentage = 100 + # pre-allocate buffers + self.p1 = lv.point() + self.p2 = lv.point() + self.area = lv.area() + self.line_dsc = lv.draw_line_dsc() + end + + def widget_event(cl, event) + # Call the ancestor's event handler + if lv.obj_event_base(cl, event) != lv.RES_OK return end + var code = event.code + + def atleast1(x) if x >= 1 return x else return 1 end end + # the model is that we have 4 bars and inter-bar (1/4 of width) + var height = self.get_height() + var width = self.get_width() + + var inter_bar = atleast1(width / 15) + var bar = atleast1((width - inter_bar * 3) / 4) + var bar_offset = bar / 2 + + if code == lv.EVENT_DRAW_MAIN + var clip_area = lv.area(event.param) + + # get coordinates of object + self.get_coords(self.area) + var x_ofs = self.area.x1 + var y_ofs = self.area.y1 + + lv.draw_line_dsc_init(self.line_dsc) # initialize lv_draw_line_dsc structure + self.init_draw_line_dsc(lv.PART_MAIN, self.line_dsc) # copy the current values + + self.line_dsc.round_start = 1 + self.line_dsc.round_end = 1 + self.line_dsc.width = bar + var on_color = self.get_style_line_color(lv.PART_MAIN | lv.STATE_DEFAULT) + var off_color = self.get_style_bg_color(lv.PART_MAIN | lv.STATE_DEFAULT) + + lv.event_send(self, lv.EVENT_DRAW_PART_BEGIN, self.line_dsc) + for i:0..3 # 4 bars + self.line_dsc.color = self.percentage >= (i+1)*20 ? on_color : off_color + self.p1.y = y_ofs + height - 1 - bar_offset + self.p1.x = x_ofs + i * (bar + inter_bar) + bar_offset + self.p2.y = y_ofs + ((3 - i) * (height - bar)) / 4 + bar_offset + self.p2.x = self.p1.x + lv.draw_line(self.p1, self.p2, clip_area, self.line_dsc) + end + lv.event_send(self, lv.EVENT_DRAW_PART_END, self.line_dsc) + end + end + + def set_percentage(v) + var old_bars = self.percentage / 20 + if v > 100 v = 100 end + if v < 0 v = 0 end + self.percentage = v + if old_bars != v / 20 + self.invalidate() # be frugal and avoid updating the widget if it's not needed + end + end + + def get_percentage() + return self.percentage + end +end + +class lv_wifi_bars: lv_signal_bars + def init(parent) + super(self).init(parent) + tasmota.add_driver(self) + self.set_percentage(0) # we generally start with 0, meaning not connected + end + + def every_second() + var wifi = tasmota.wifi() + var quality = wifi.find("quality") + var ip = wifi.find("ip") + if ip == nil + self.set_percentage(0) + elif quality != nil + self.set_percentage(quality) + end + end + + def del() + super(self).del() + tasmota.remove_driver(self) + end +end + +class lv_wifi_bars_icon: lv_wifi_bars + def init(parent) + super(self).init(parent) + self.set_style_line_color(lv.color(lv.COLOR_WHITE), lv.PART_MAIN | lv.STATE_DEFAULT) + self.set_style_bg_color(lv.color(lv.COLOR_BLACK), lv.PART_MAIN | lv.STATE_DEFAULT) + if parent != nil + var parent_height = parent.get_height() + var pad_right = parent.get_style_pad_right(lv.PART_MAIN | lv.STATE_DEFAULT) + self.set_height(parent_height) + self.set_width(parent_height) + self.set_x(parent.get_width() - parent_height - pad_right) + parent.set_style_pad_right(pad_right + parent_height + 1, lv.PART_MAIN | lv.STATE_DEFAULT) + end + end +end diff --git a/lib/libesp32/berry/default/embedded/lvgl_glob.be b/lib/libesp32/berry/default/embedded/lvgl_glob.be new file mode 100644 index 000000000..04250ff54 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/lvgl_glob.be @@ -0,0 +1,256 @@ +#- embedded class for LVGL globals -# + +#- This class stores all globals used by LVGL and cannot be stored in the solidified module -# +#- this limits the globals to a single value '_lvgl' -# +class LVGL_glob + # all variables are lazily initialized to reduce the memory pressure. Until they are used, they consume zero memory + var cb_obj # map between a native C pointer (as int) and the corresponding lv.lv_* berry object, also helps marking the objects as non-gc-able + var cb_event_closure # mapping for event closures per LVGL native pointer (int) + var event_cb # native callback for lv.lv_event + + #- below are native callbacks mapped to a closure to a method of this instance -# + var null_cb # cb called if type is not supported + var widget_ctor_cb + var widget_dtor_cb + var widget_event_cb + + var widget_struct_default + var widget_struct_by_class + + #- this is the fallback callback, if the event is unknown or unsupported -# + static cb_do_nothing = def() print("LVG: call to unsupported callback") end + + #- register an lv.lv_* object in the mapping -# + def register_obj(obj) + if self.cb_obj == nil self.cb_obj = {} end + self.cb_obj[obj._p] = obj + end + + def get_object_from_ptr(ptr) + if self.cb_obj != nil + return self.cb_obj.find(ptr) # raise an exception if something is wrong + end + end + + def lvgl_event_dispatch(event_ptr) + import introspect + + var event = lv.lv_event(introspect.toptr(event_ptr)) + + var target = event.target + var f = self.cb_event_closure[target] + var obj = self.get_object_from_ptr(target) + #print('>> lvgl_event_dispatch', f, obj, event) + f(obj, event) + end + + def gen_cb(name, f, obj, ptr) + #print('>> gen_cb', name, obj, ptr) + # record the object, whatever the callback + + if name == "lv_event_cb" + if self.cb_event_closure == nil self.cb_event_closure = {} end + if self.event_cb == nil self.event_cb = tasmota.gen_cb(/ event_ptr -> self.lvgl_event_dispatch(event_ptr)) end # encapsulate 'self' in closure + + self.register_obj(obj) + self.cb_event_closure[ptr] = f + return self.event_cb + # elif name == "" + else + if self.null_cb == nil self.null_cb = tasmota.gen_cb(self.cb_do_nothing) end + return self.null_cb + end + end + + def widget_ctor_impl(cl_ptr, obj_ptr) + import introspect + var cl = lv.lv_obj_class(cl_ptr) + var obj = self.get_object_from_ptr(obj_ptr) + if self.cb_obj.find(obj) obj = self.cb_obj[obj] end + # print("widget_ctor_impl", cl, obj) + if type(obj) == 'instance' && introspect.get(obj, 'widget_constructor') + obj.widget_constructor(cl) + end + end + def widget_dtor_impl(cl_ptr, obj_ptr) + import introspect + var cl = lv.lv_obj_class(cl_ptr) + var obj = self.get_object_from_ptr(obj_ptr) + # print("widget_dtor_impl", cl, obj) + if type(obj) == 'instance' && introspect.get(obj, 'widget_destructor') + obj.widget_destructor(cl) + end + end + def widget_event_impl(cl_ptr, e_ptr) + import introspect + var cl = lv.lv_obj_class(cl_ptr) + var event = lv.lv_event(e_ptr) + var obj_ptr = event.target + var obj = self.get_object_from_ptr(obj_ptr) + if type(obj) == 'instance' && introspect.get(obj, 'widget_event') + obj.widget_event(cl, event) + end + # print("widget_event_impl", cl, obj_ptr, obj, event) + end + + + def widget_cb() + if self.widget_ctor_cb == nil self.widget_ctor_cb = tasmota.gen_cb(/ cl, obj -> self.widget_ctor_impl(cl, obj)) end + if self.widget_dtor_cb == nil self.widget_dtor_cb = tasmota.gen_cb(/ cl, obj -> self.widget_dtor_impl(cl, obj)) end + if self.widget_event_cb == nil self.widget_event_cb = tasmota.gen_cb(/ cl, e -> self.widget_event_impl(cl, e)) end + + if self.widget_struct_default == nil + self.widget_struct_default = lv.lv_obj_class(lv.lv_obj._class).copy() + self.widget_struct_default.base_class = lv.lv_obj._class # by default, inherit from base class `lv_obj`, this can be overriden + self.widget_struct_default.constructor_cb = self.widget_ctor_cb # set the berry cb dispatchers + self.widget_struct_default.destructor_cb = self.widget_dtor_cb + self.widget_struct_default.event_cb = self.widget_event_cb + end + end + + #- deregister_obj all information linked to a specific LVGL native object (int) -# + def deregister_obj(obj) + if self.cb_obj != nil self.cb_obj.remove(obj) end + if self.cb_event_closure != nil self.cb_event_closure.remove(obj) end + end + + #- initialize a custom widget -# + #- arg must be a subclass of lv.lv_obj -# + def create_custom_widget(obj, parent) + import introspect + + if !isinstance(obj, lv.lv_obj) raise "value_error", "arg must be a subclass of lv_obj" end + if self.widget_struct_by_class == nil self.widget_struct_by_class = {} end + + var obj_classname = classname(obj) + var obj_class_struct = self.widget_struct_by_class.find(obj_classname) + # print("classname=",obj_classname,"_class",super(obj)._class) + #- not already built, create a new one for this class -# + if obj_class_struct == nil + self.widget_cb() # set up all structures + obj_class_struct = self.widget_struct_default.copy() # get a copy of the structure with pre-defined callbacks + obj_class_struct.base_class = super(obj)._class + if introspect.get(obj, 'widget_width_def') obj_class_struct.width_def = obj.widget_width_def end + if introspect.get(obj, 'widget_height_def') obj_class_struct.height_def = obj.widget_height_def end + if introspect.get(obj, 'widget_editable') obj_class_struct.editable = obj.widget_editable end + if introspect.get(obj, 'widget_group_def') obj_class_struct.group_def = obj.widget_group_def end + if introspect.get(obj, 'widget_instance_size') obj_class_struct.instance_size = obj.widget_instance_size end + + #- keep a copy of the structure to avoid GC and reuse if needed -# + self.widget_struct_by_class[obj_classname] = obj_class_struct + end + + var lv_obj_ptr = lv.obj_class_create_obj(obj_class_struct, parent) + obj._p = lv_obj_ptr._p + self.register_obj(obj) + obj.class_init_obj() + end +end + +_lvgl = LVGL_glob() + +# class lv_custom_widget : lv.lv_obj +# # static widget_width_def +# # static widget_height_def +# # static widget_editable +# # static widget_group_def +# # static widget_instance_size +# # +# var percentage # value to display, range 0..100 +# var p1, p2, area, line_dsc # instances of objects kept to avoid re-instanciating at each call + +# def init(parent) +# _lvgl.create_custom_widget(self, parent) +# # own values +# self.percentage = 100 +# # pre-allocate buffers +# self.p1 = lv.lv_point() +# self.p2 = lv.lv_point() +# self.area = lv.lv_area() +# self.line_dsc = lv.lv_draw_line_dsc() +# end + +# # def widget_constructor(cl) +# # print("widget_constructor", cl) +# # end + +# # def widget_destructor(cl) +# # print("widget_destructor", cl) +# # end + +# def widget_event(cl, event) +# var res = lv.obj_event_base(cl, event) +# if res != lv.RES_OK return end + +# def atleast1(x) if x >= 1 return x else return 1 end end +# # the model is that we have 4 bars and inter-bar (1/4 of width) +# var height = self.get_height() +# var width = self.get_width() + +# var inter_bar = atleast1(width / 15) +# var bar = atleast1((width - inter_bar * 3) / 4) +# var bar_offset = bar / 2 + +# var code = event.code +# if code == lv.EVENT_DRAW_MAIN +# var clip_area = lv.lv_area(event.param) +# print("widget_event DRAW", clip_area.tomap()) +# # lv.event_send(self, lv.EVENT_DRAW_MAIN, clip_area) + +# # get coordinates of object +# self.get_coords(self.area) +# var x_ofs = self.area.x1 +# var y_ofs = self.area.y1 + +# lv.draw_line_dsc_init(self.line_dsc) # initialize lv.lv_draw_line_dsc structure +# self.init_draw_line_dsc(lv.PART_MAIN, self.line_dsc) + +# self.line_dsc.round_start = 1 +# self.line_dsc.round_end = 1 +# self.line_dsc.width = bar + +# var on_color = self.get_style_line_color(lv.PART_MAIN | lv.STATE_DEFAULT) +# var off_color = self.get_style_bg_color(lv.PART_MAIN | lv.STATE_DEFAULT) + +# lv.event_send(self, lv.EVENT_DRAW_PART_BEGIN, self.line_dsc) +# for i:0..3 # 4 bars +# self.line_dsc.color = self.percentage >= (i+1)*20 ? on_color : off_color +# self.p1.y = y_ofs + height - 1 - bar_offset +# self.p1.x = x_ofs + i * (bar + inter_bar) + bar_offset +# self.p2.y = y_ofs + ((3 - i) * (height - bar)) / 4 + bar_offset +# self.p2.x = self.p1.x +# lv.draw_line(self.p1, self.p2, clip_area, self.line_dsc) +# end +# lv.event_send(self, lv.EVENT_DRAW_PART_END, self.line_dsc) + +# end +# end + +# def set_percentage(v) +# var old_bars = self.percentage / 5 +# if v > 100 v = 100 end +# if v < 0 v = 0 end +# self.percentage = v +# if old_bars != v / 5 +# self.invalidate() # be frugal and avoid updating the widget if it's not needed +# end +# end + +# def get_percentage() +# return self.percentage +# end +# end + +# ########## ########## ########## ########## ########## ########## ########## ########## + +# lv.start() + +# hres = lv.get_hor_res() # should be 320 +# vres = lv.get_ver_res() # should be 240 + +# scr = lv.scr_act() # default screean object +# f20 = lv.montserrat_font(20) # load embedded Montserrat 20 + +# scr.set_style_bg_color(lv.lv_color(0x0000A0), lv.PART_MAIN | lv.STATE_DEFAULT) + +# w = lv_custom_widget(scr) \ No newline at end of file diff --git a/lib/libesp32/berry/default/embedded/openhasp.be b/lib/libesp32/berry/default/embedded/openhasp.be new file mode 100644 index 000000000..4232a605b --- /dev/null +++ b/lib/libesp32/berry/default/embedded/openhasp.be @@ -0,0 +1,764 @@ +import string +import json + +# lv.start() +# scr = lv.scr_act() # default screean object +# scr.set_style_bg_color(lv.color(0x0000A0), lv.PART_MAIN | lv.STATE_DEFAULT) + +lv.start() + +hres = lv.get_hor_res() # should be 320 +vres = lv.get_ver_res() # should be 240 + +scr = lv.scr_act() # default screean object +#f20 = lv.montserrat_font(20) # load embedded Montserrat 20 +r20 = lv.font_robotocondensed_latin1(20) +r16 = lv.font_robotocondensed_latin1(16) + +th2 = lv.theme_openhasp_init(0, lv.color(0xFF00FF), lv.color(0x303030), false, r16) +scr.get_disp().set_theme(th2) +# TODO +scr.set_style_bg_color(lv.color(lv.COLOR_WHITE),0) + +# apply theme to layer_top, but keep it transparent +lv.theme_apply(lv.layer_top()) +lv.layer_top().set_style_bg_opa(0,0) + + +# takes an attribute name and responds if it needs color conversion +def is_color_attribute(t) + import string + t = str(t) + # contains `color` but does not contain `color_` + return (string.find(t, "color") >= 0) && (string.find(t, "color_") < 0) +end + +# parse hex string +def parse_hex(s) + import string + s = string.toupper(s) # turn to uppercase + var val = 0 + for i:0..size(s)-1 + var c = s[i] + # var c_int = string.byte(c) + if c == "#" continue end # skip '#' prefix if any + if c == "x" || c == "X" continue end # skip 'x' or 'X' + + if c >= "A" && c <= "F" + val = (val << 4) | string.byte(c) - 55 + elif c >= "0" && c <= "9" + val = (val << 4) | string.byte(c) - 48 + end + end + return val +end + +def parse_color(s) + s = str(s) + if s[0] == '#' + return lv.color(parse_hex(s)) + else + import string + import introspect + var col_name = "COLOR_" + string.toupper(s) + var col_try = introspect.get(lv, col_name) + if col_try != nil + return lv.color(col_try) + end + end + # fail safe with black color + return lv.color(0x000000) +end + +#- ------------------------------------------------------------ + Class `lvh_obj` encapsulating `lv_obj`` + + Provide a mapping for virtual members + Stores the associated page and object id + + Adds specific virtual members used by OpenHASP +- ------------------------------------------------------------ -# +class lvh_obj + # _lv_class refers to the lvgl class encapsulated, and is overriden by subclasses + static _lv_class = lv.obj + static _lv_part2_selector # selector for secondary part (like knob of arc) + + # attributes to ignore when set at object level (they are managed by page) + static _attr_ignore = [ + "id", + "obj", + "page", + "comment", + "parentid", + "auto_size", # TODO not sure it's still needed in LVGL8 + ] + #- mapping from OpenHASP attribute to LVGL attribute -# + #- if mapping is null, we use set_X and get_X from our own class -# + static _attr_map = { + "x": "x", + "y": "y", + "w": "width", + "h": "height", + # arc + "asjustable": nil, + "mode": nil, + "start_angle": "bg_start_angle", + "start_angle1": "start_angle", + "end_angle": "bg_end_angle", + "end_angle1": "end_angle", + "radius": "style_radius", + "border_side": "style_border_side", + "bg_opa": "style_bg_opa", + "border_width": "style_border_width", + "line_width": nil, # depebds on class + "line_width1": nil, # depebds on class + "action": nil, # store the action in self._action + "hidden": nil, # apply to self + "enabled": nil, # apply to self + "click": nil, # synonym to enabled + "toggle": nil, + "bg_color": "style_bg_color", + "bg_grad_color": "style_bg_grad_color", + "type": nil, + # below automatically create a sub-label + "text": nil, # apply to self + "value_str": nil, # synonym to 'text' + "align": nil, + "text_font": nil, + "value_font": nil, # synonym to text_font + "text_color": nil, + "value_color": nil, # synonym to text_color + "value_ofs_x": nil, + "value_ofs_y": nil, + # + "min": nil, + "max": nil, + "val": "value", + "rotation": "rotation", + # img + "src": "src", + "image_recolor": "style_img_recolor", + "image_recolor_opa": "style_img_recolor_opa", + # spinner + "angle": nil, + "speed": nil, + # padding of knob + "pad_top2": nil, + "pad_bottom2": nil, + "pad_left2": nil, + "pad_right2": nil, + "pad_all2": nil, + "radius2": nil, + } + + var _lv_obj # native lvgl object + var _lv_label # sub-label if exists + var _action # action for OpenHASP + + # init + # - create the LVGL encapsulated object + # arg1: parent object + # arg2: json line object + def init(parent, jline) + var obj_class = self._lv_class # need to assign to a var to distinguish from method call + self._lv_obj = obj_class(parent) # instanciate LVGL object + self.post_init() + end + + # post-init, to be overriden + def post_init() + end + + # get LVGL encapsulated object + def get_obj() + return self._lv_obj + end + + def set_action(t) + self._action = str(t) + end + def get_action() + return self._action() + end + + def set_line_width(t) + self._lv_obj.set_style_line_width(int(t), lv.PART_MAIN | lv.STATE_DEFAULT) + end + def get_line_width() + return self._lv_obj.get_style_line_width(lv.PART_MAIN | lv.STATE_DEFAULT) + end + + #- ------------------------------------------------------------ + Mapping of synthetic attributes + - text + - hidden + - enabled + - ------------------------------------------------------------ -# + #- `hidden` attributes mapped to OBJ_FLAG_HIDDEN -# + def set_hidden(h) + if h + self._lv_obj.add_flag(lv.OBJ_FLAG_HIDDEN) + else + self._lv_obj.clear_flag(lv.OBJ_FLAG_HIDDEN) + end + end + + def get_hidden() + return self._lv_obj.has_flag(lv.OBJ_FLAG_HIDDEN) + end + + #- `enabled` attributes mapped to OBJ_FLAG_CLICKABLE -# + def set_enabled(h) + if h + self._lv_obj.add_flag(lv.OBJ_FLAG_CLICKABLE) + else + self._lv_obj.clear_flag(lv.OBJ_FLAG_CLICKABLE) + end + end + + def get_enabled() + return self._lv_obj.has_flag(lv.OBJ_FLAG_CLICKABLE) + end + # click is synonym to enabled + def set_click(t) self.set_enabled(t) end + def get_click() return self.get_enabled() end + + #- `toggle` attributes mapped to STATE_CHECKED -# + def set_toggle(t) + if t == "TRUE" t = true end + if t == "FALSE" t = false end + if t + self._lv_obj.add_state(lv.STATE_CHECKED) + else + self._lv_obj.clear_state(lv.STATE_CHECKED) + end + end + + def get_toggle() + return self._lv_obj.has_state(lv.STATE_CHECKED) + end + + def set_adjustable(t) + if t + self._lv_obj.add_flag(lv.OBJ_FLAG_CLICKABLE) + else + self._lv_obj.clear_flag(lv.OBJ_FLAG_CLICKABLE) + end + end + def get_adjustable() + return self._lv_obj.has_flag(lv.OBJ_FLAG_CLICKABLE) + end + + #- set_text: create a `lv_label` sub object to the current object -# + #- (default case, may be overriden by object that directly take text) -# + def check_label() + if self._lv_label == nil + self._lv_label = lv.label(self.get_obj()) + self._lv_label.set_align(lv.ALIGN_CENTER); + end + end + + def set_text(t) + self.check_label() + self._lv_label.set_text(str(t)) + end + def set_value_str(t) self.set_text(t) end + + def get_text() + if self._lv_label == nil return nil end + return self._lv_label.get_text() + end + def get_value_str() return self.get_text() end + + def set_align(t) + var align + self.check_label() + if t == 0 || t == "left" + align = lv.TEXT_ALIGN_LEFT + elif t == 1 || t == "center" + align = lv.TEXT_ALIGN_CENTER + elif t == 2 || t == "right" + align = lv.TEXT_ALIGN_RIGHT + end + self._lv_label.set_style_text_align(align, lv.PART_MAIN | lv.STATE_DEFAULT) + end + + def get_align() + if self._lv_label == nil return nil end + var align self._lv_label.get_style_text_align(lv.PART_MAIN | lv.STATE_DEFAULT) + if align == lv.TEXT_ALIGN_LEFT + return "left" + elif align == lv.TEXT_ALIGN_CENTER + return "center" + elif align == lv.TEXT_ALIGN_RIGHT + return "right" + else + return nil + end + end + + def set_text_font(t) + self.check_label() + var f = lv.font_robotocondensed_latin1(int(t)) + if f != nil + self._lv_label.set_style_text_font(f, lv.PART_MAIN | lv.STATE_DEFAULT) + else + print("HSP: Unsupported font size: robotocondensed-latin1", t) + end + end + def get_text_font() + end + def set_value_font(t) self.set_text_font(t) end + def get_value_font() return self.get_text_font() end + + def set_text_color(t) + self.check_label() + self._lv_label.set_style_text_color(parse_color(t), lv.PART_MAIN | lv.STATE_DEFAULT) + end + def get_text_color() + return self._text_color + end + def set_value_color(t) self.set_text_color(t) end + def get_value_color() return self.get_value_color() end + + def set_value_ofs_x(t) + self.check_label() + self._lv_label.set_x(int(t)) + end + def get_value_ofs_x() + return self._lv_label.get_x() + end + def set_value_ofs_y(t) + self.check_label() + self._lv_label.set_y(int(t)) + end + def get_value_ofs_y() + return self._lv_label.get_y() + end + + # secondary element + def set_pad_top2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_pad_top(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def set_pad_bottom2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_pad_bottom(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def set_pad_left2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_pad_left(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def set_pad_right2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_pad_right(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def set_pad_all2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_pad_all(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + + def get_pad_top() + if self._lv_part2_selector != nil + return self._lv_obj.get_style_pad_top(self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def get_pad_bottomo() + if self._lv_part2_selector != nil + return self._lv_obj.get_style_pad_bottom(self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def get_pad_left() + if self._lv_part2_selector != nil + return self._lv_obj.get_style_pad_left(self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def get_pad_right() + if self._lv_part2_selector != nil + return self._lv_obj.get_style_pad_right(self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def get_pad_all() + end + + def set_radius2(t) + if self._lv_part2_selector != nil + self._lv_obj.set_style_radius(int(t), self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + def get_radius2() + if self._lv_part2_selector != nil + return self._lv_obj.get_style_radius(self._lv_part2_selector | lv.STATE_DEFAULT) + end + end + + #- ------------------------------------------------------------ + Mapping of virtual attributes + - ------------------------------------------------------------ -# + def member(k) + # tostring is a special case, we shouldn't raise an exception for it + if k == 'tostring' return nil end + # + if self._attr_map.has(k) + import introspect + var kv = self._attr_map[k] + if kv + var f = introspect.get(self._lv_obj, "get_" + kv) + if type(f) == 'function' + return f(self._lv_obj) + end + else + # call self method + var f = introspect.get(self, "get_" + k) + if type(f) == 'function' + return f(self, k) + end + end + end + raise "value_error", "unknown attribute " + str(k) + end + + def setmember(k, v) + import string + # print(">> setmember", k, v) + # print(">>", classname(self), self._attr_map) + if self._attr_ignore.find(k) != nil + return + elif self._attr_map.has(k) + import introspect + var kv = self._attr_map[k] + if kv + var f = introspect.get(self._lv_obj, "set_" + kv) + # if the attribute contains 'color', convert to lv_color + if type(kv) == 'string' && is_color_attribute(kv) + v = parse_color(v) + end + # print("f=", f, v, kv, self._lv_obj, self) + if type(f) == 'function' + if string.find(kv, "style_") == 0 + # style function need a selector as second parameter + f(self._lv_obj, v, lv.PART_MAIN | lv.STATE_DEFAULT) + else + f(self._lv_obj, v) + end + return + else + print("HSP: Could not find function set_"+kv) + end + else + # call self method + var f = introspect.get(self, "set_" + k) + # print("f==",f) + if type(f) == 'function' + f(self, v) + return + end + end + + else + print("HSP: unknown attribute:", k) + end + # silently ignore if the attribute name is not supported + end +end + +#- ------------------------------------------------------------ + Other widgets +- ------------------------------------------------------------ -# + +#- ------------------------------------------------------------ + label +#- ------------------------------------------------------------# +class lvh_label : lvh_obj + static _lv_class = lv.label + # label do not need a sub-label + def post_init() + self._lv_label = self._lv_obj + end +end + +#- ------------------------------------------------------------ + arc +#- ------------------------------------------------------------# +class lvh_arc : lvh_obj + static _lv_class = lv.arc + static _lv_part2_selector = lv.PART_KNOB + + # line_width converts to arc_width + def set_line_width(t) + self._lv_obj.set_style_arc_width(int(t), lv.PART_MAIN | lv.STATE_DEFAULT) + end + def get_line_width() + return self._lv_obj.get_arc_line_width(lv.PART_MAIN | lv.STATE_DEFAULT) + end + def set_line_width1(t) + self._lv_obj.set_style_arc_width(int(t), lv.PART_INDICATOR | lv.STATE_DEFAULT) + end + def get_line_width1() + return self._lv_obj.get_arc_line_width(lv.PART_INDICATOR | lv.STATE_DEFAULT) + end + + def set_min(t) + self._lv_obj.set_range(int(t), self.get_max()) + end + def set_max(t) + self._lv_obj.set_range(self.get_min(), int(t)) + end + def get_min() + return self._lv_obj.get_min_value() + end + def get_max() + return self._lv_obj.get_max_value() + end + def set_type(t) + var mode + if t == 0 mode = lv.ARC_MODE_NORMAL + elif t == 1 mode = lv.ARC_MODE_REVERSE + elif t == 2 mode = lv.ARC_MODE_SYMMETRICAL + end + if mode != nil + self._lv_obj.set_mode(mode) + end + end + def get_type() + return self._lv_obj.get_mode() + end + # mode + def set_mode(t) + var mode + if mode == "expand" self._lv_obj.set_width(lv.SIZE_CONTENT) + elif mode == "break" mode = lv.LABEL_LONG_WRAP + elif mode == "dots" mode = lv.LABEL_LONG_DOT + elif mode == "scroll" mode = lv.LABEL_LONG_SCROLL + elif mode == "loop" mode = lv.LABEL_LONG_SCROLL_CIRCULAR + elif mode == "crop" mode = lv.LABEL_LONG_CLIP + end + if mode != nil + self._lv_obj.lv_label_set_long_mode(mode) + end + end + def get_mode() + end + +end + +#- ------------------------------------------------------------ + switch +#- ------------------------------------------------------------# +class lvh_switch : lvh_obj + static _lv_class = lv.switch + static _lv_part2_selector = lv.PART_KNOB +end + +#- ------------------------------------------------------------ + spinner +#- ------------------------------------------------------------# +class lvh_spinner : lvh_arc + static _lv_class = lv.spinner + + # init + # - create the LVGL encapsulated object + # arg1: parent object + # arg2: json line object + def init(parent, jline) + var angle = jline.find("angle", 60) + var speed = jline.find("speed", 1000) + self._lv_obj = lv.spinner(parent, speed, angle) + self.post_init() + end + + # ignore attributes, spinner can't be changed once created + def set_angle(t) end + def get_angle() end + def set_speed(t) end + def get_speed() end +end + +#- creat sub-classes of lvh_obj and map the LVGL class in static '_lv_class' attribute -# +class lvh_bar : lvh_obj static _lv_class = lv.bar end +class lvh_btn : lvh_obj static _lv_class = lv.btn end +class lvh_btnmatrix : lvh_obj static _lv_class = lv.btnmatrix end +class lvh_checkbox : lvh_obj static _lv_class = lv.checkbox end +class lvh_dropdown : lvh_obj static _lv_class = lv.dropdown end +class lvh_img : lvh_obj static _lv_class = lv.img end +class lvh_line : lvh_obj static _lv_class = lv.line end +class lvh_roller : lvh_obj static _lv_class = lv.roller end +class lvh_slider : lvh_obj static _lv_class = lv.slider end +class lvh_textarea : lvh_obj static _lv_class = lv.textarea end + +#- ---------------------------------------------------------------------------- + Class `lvh_page` encapsulating `lv_obj` as screen (created with lv.obj(0)) +- ----------------------------------------------------------------------------- -# +# ex of transition: lv.scr_load_anim(scr, lv.SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0, false) +class lvh_page + var _obj_id # (map) of objects by id numbers + var _page_id # (int) id number of the page + var _lv_scr # (lv_obj) lvgl screen object + + #- init(page_number) -# + def init(page_number) + import global + + # if no parameter, default to page #1 + if page_number == nil page_number = 1 end + + self._page_id = page_number # remember our page_number + self._obj_id = {} # init list of objects + if page_number == 1 + self._lv_scr = lv.scr_act() # default screen + elif page_number == 0 + self._lv_scr = lv.layer_top() # top layer, visible over all screens + else + self._lv_scr = lv.obj(0) # allocate a new screen + # self._lv_scr.set_style_bg_color(lv.color(0x000000), lv.PART_MAIN | lv.STATE_DEFAULT) # set black background + self._lv_scr.set_style_bg_color(lv.color(0xFFFFFF), lv.PART_MAIN | lv.STATE_DEFAULT) # set white background + end + + # create a global for this page of form p, ex p1 + var glob_name = string.format("p%i", self._page_id) + global.(glob_name) = self + end + + #- retrieve lvgl screen object for this page -# + def get_scr() + return self._lv_scr + end + + #- add an object to this page -# + def set_obj(id, o) + self._obj_id[id] = o + end + def get_obj(id) + return self._obj_id.find(id) + end + + #- return id of this page -# + def id() + return self._page_id + end + + #- show this page, with animation -# + def show(anim, duration) + # ignore if there is no screen, like for id 0 + if self._lv_scr == nil return nil end + # ignore if the screen is already active + if self._lv_scr._p == lv.scr_act()._p return end # do nothing + + # default animation is lv.SCR_LOAD_ANIM_MOVE_RIGHT + if anim == nil anim = lv.SCR_LOAD_ANIM_MOVE_RIGHT end + # default duration of 500ms + if duration == nil duration = 500 end + + # load new screen with anumation, no delay, 500ms transition time, no auto-delete + lv.scr_load_anim(self._lv_scr, lv.SCR_LOAD_ANIM_MOVE_RIGHT, duration, 0, false) + end +end + +#- pages -# +var lvh_page_cur = lvh_page(1) +var lvh_pages = { 1: lvh_page_cur } # always create page #1 + +f = open("pages.jsonl","r") +var jsonl = string.split(f.read(), "\n") +f.close() + +#- ------------------------------------------------------------ + Parse page information + + Create a new page object if required + Change the active page +- ------------------------------------------------------------ -# +def parse_page(jline) + if jline.has("page") && type(jline["page"]) == 'int' + var page = int(jline["page"]) + # does the page already exist? + if lvh_pages.has(page) + # yes, just change the current page + lvh_page_cur = lvh_pages[page] + else + # no, create a new page + lvh_page_cur = lvh_page(page) + lvh_pages[page] = lvh_page_cur + end + end +end + +#- ------------------------------------------------------------ + Parse single object + +- ------------------------------------------------------------ -# +def parse_obj(jline, page) + import global + import introspect + + # line must contain 'obj' and 'id', otherwise it is ignored + if jline.has("obj") && jline.has("id") && type(jline["id"]) == 'int' + # 'obj_id' must be between 1 and 254 + var obj_id = int(jline["id"]) + if obj_id < 1 || obj_id > 254 + raise "value error", "invalid id " + str(obj_id) + end + + # extract openhasp class, prefix with `lvh_`. Ex: `btn` becomes `lvh_btn` + var obj_type = jline["obj"] + + # extract parent + var parent + var parent_id = int(jline.find("parentid")) + if parent_id != nil + var parent_obj = lvh_page_cur.get_obj(parent_id) + if parent_obj != nil + parent = parent_obj._lv_obj + end + end + if parent == nil + parent = page.get_scr() + end + + # check if a class with the requested name exists + var obj_class = introspect.get(global, "lvh_" + obj_type) + if obj_class == nil + raise "value error", "cannot find object of type " + str(obj_type) + end + + # instanciate the object, passing the lvgl screen as paren object + var obj = obj_class(parent, jline) + + # add object to page object + lvh_page_cur.set_obj(obj_id, obj) + # set attributes + # try every attribute, if not supported it is silently ignored + for k:jline.keys() + # introspect.set(obj, k, jline[k]) + obj.(k) = jline[k] + end + + # create a global variable for this object of form pb, ex p1b2 + var glob_name = string.format("p%ib%i", lvh_page_cur.id(), obj_id) + global.(glob_name) = obj + end +end + +# ex: +# {'page': 1, 'h': 50, 'obj': 'label', 'hidden': false, 'text': 'Hello', 'x': 5, 'id': 1, 'enabled': true, 'y': 5, 'w': 50} +# {"page":1,"id":2,"obj":"btn","x":5,"y":90,"h":90,"w":50,"text":"World","enabled":false,"hidden":false} + +#- ------------------------------------------------------------ + Parse jsonl file line by line + +- ------------------------------------------------------------ -# +tasmota.yield() +for j:jsonl + var jline = json.load(j) + + # parse page first + if type(jline) == 'instance' + parse_page(jline) + parse_obj(jline, lvh_page_cur) + end +end diff --git a/lib/libesp32/berry/default/embedded/openhasp/demo-all.jsonl b/lib/libesp32/berry/default/embedded/openhasp/demo-all.jsonl new file mode 100644 index 000000000..76d3ed810 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/openhasp/demo-all.jsonl @@ -0,0 +1,61 @@ +{"page":1,"comment":"---------- Page 1 ----------"} +{"page":1,"id":0,"bg_color":"#FFFFFF","bg_grad_color":"#FFFFFF","text_color":"#000000","radius":0,"border_side":0} +{"page":1,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"LIVING ROOM","value_font":24,"bg_color":"#2C3E50","bg_grad_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0} + +{"page":1,"id":2,"obj":"arc","x":20,"y":65,"w":80,"h":100,"max":40,"border_side":0,"type":0,"rotation":0,"start_angle":180,"end_angle":0,"start_angle1":180,"value_font":12,"value_ofs_x":0,"value_ofs_y":-14,"bg_opa":0,"text":"21.2°C","min":-20,"max":50,"val":21} + +{"page":1,"id":3,"obj":"arc","x":140,"y":65,"w":80,"h":100,"max":100,"border_side":0,"type":0,"start_angle":180,"end_angle":0,"start_angle1":180,"value_font":12,"value_color":"#000000","value_ofs_x":0,"value_ofs_y":-14,"bg_opa":0,"text":"44%","val":44} + +{"page":1,"id":4,"obj":"label","x":0,"y":120,"w":240,"h":20,"text":"CO2 levels: 1483 ppm","radius":0,"border_side":0,"align":1} +{"page":1,"id":5,"obj":"label","x":2,"y":35,"w":140,"text":"Temperature","align":1} +{"page":1,"id":6,"obj":"label","x":140,"y":35,"w":95,"text":"Humidity","align":1} +{"page":1,"id":7,"obj":"btn","x":0,"y":160,"w":240,"h":20,"text":"LIGHTS","bg_color":"#F1C40F","text_color":"#FFFFFF","radius":0,"border_side":0} +{"page":1,"id":8,"obj":"label","x":20,"y":190,"w":140,"h":20,"text":"Ceiling Light"} +{"page":1,"id":9,"obj":"switch","x":160,"y":190,"w":40,"h":20,"toggle":"TRUE"} +{"page":1,"id":10,"obj":"label","x":20,"y":215,"w":140,"h":20,"text":"Wall Light"} +{"page":1,"id":11,"obj":"switch","x":160,"y":215,"w":40,"h":20,"toggle":"TRUE"} +{"page":1,"id":12,"obj":"label","x":20,"y":240,"w":200,"h":20,"text":"Ambient Light"} +{"page":1,"id":13,"obj":"slider","x":30,"y":265,"w":200,"h":10} + +{"page":2,"comment":"---------- Page 2 ----------"} +{"page":2,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"ENTITIES","value_font":24,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0,"click":0} +{"page":2,"id":2,"obj":"obj","x":5,"y":35,"w":230,"h":250,"click":0} + +{"page":2,"id":11,"obj":"label","x":8,"y":33,"w":35,"h":35,"text":"\uE004","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":12,"obj":"label","x":48,"y":43,"w":130,"h":30,"text":"Presence override","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":13,"obj":"switch","x":177,"y":40,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":2,"id":21,"obj":"label","x":8,"y":69,"w":35,"h":35,"text":"\uF020","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":22,"obj":"label","x":48,"y":79,"w":130,"h":30,"text":"Front door light","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":23,"obj":"switch","x":177,"y":74,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":2,"id":31,"obj":"label","x":8,"y":103,"w":35,"h":35,"text":"\uF054","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":32,"obj":"label","x":48,"y":113,"w":130,"h":30,"text":"Back yard lights","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":33,"obj":"switch","x":177,"y":110,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":2,"id":41,"obj":"label","x":8,"y":138,"w":35,"h":35,"text":"\uEA7A","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":42,"obj":"label","x":48,"y":148,"w":130,"h":30,"text":"Trash service","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":43,"obj":"label","x":97,"y":148,"w":130,"h":30,"text":"in 6 days","align":2,"text_color":"black"} + +{"page":2,"id":51,"obj":"label","x":8,"y":173,"w":35,"h":35,"text":"\uF39D","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":52,"obj":"label","x":48,"y":183,"w":130,"h":30,"text":"Selective trash","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":53,"obj":"label","x":97,"y":183,"w":130,"h":30,"text":"in 10 days","align":2,"text_color":"black"} + +{"page":2,"id":61,"obj":"label","x":8,"y":208,"w":35,"h":35,"text":"\uE32A","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":62,"obj":"label","x":48,"y":218,"w":130,"h":30,"text":"Green energy active","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":63,"obj":"label","x":97,"y":218,"w":130,"h":30,"text":"Yes :)","align":2,"text_color":"black"} + +{"page":2,"id":71,"obj":"label","x":8,"y":243,"w":35,"h":35,"text":"\uE957","align":1,"text_font":32,"text_color":"black"} +{"page":2,"id":72,"obj":"label","x":48,"y":253,"w":130,"h":30,"text":"Air quality","align":0,"text_font":16,"text_color":"black"} +{"page":2,"id":73,"obj":"label","x":97,"y":253,"w":130,"h":30,"text":"OK (29.58 µg/m³)","align":2,"text_color":"black"} + +{"page":3,"comment":"---------- Page 3 ----------"} +{"page":3,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"FAN STATUS","text_font":16,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0,"click":0} + +{"page":3,"id":11,"obj":"img","src":"A:/noun_Fan_35097_140.png","auto_size":1,"w":140,"h":140,"x":50,"y":75,"image_recolor":"lime","image_recolor_opa":150} +{"page":3,"id":12,"obj":"spinner","parentid":11,"x":7,"y":6,"w":126,"h":126,"bg_opa":0,"border_width":0,"line_width":7,"line_width1":7,"type":2,"angle":120,"speed":1000,"value_str":3,"value_font":24} + +{"page":0,"comment":"---------- All pages ----------"} +{"page":0,"id":11,"obj":"btn","action":"prev","x":0,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE141","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} +{"page":0,"id":12,"obj":"btn","action":"back","x":80,"y":290,"w":80,"h":32,"bg_color":"#34495E","text":"\uE2DC","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":24} +{"page":0,"id":13,"obj":"btn","action":"next","x":161,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE142","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} diff --git a/lib/libesp32/berry/default/embedded/openhasp/demo1.jsonl b/lib/libesp32/berry/default/embedded/openhasp/demo1.jsonl new file mode 100644 index 000000000..684e0d324 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/openhasp/demo1.jsonl @@ -0,0 +1,23 @@ +{"page":1,"comment":"---------- Page 1 ----------"} +{"page":1,"id":0,"bg_color":"#FFFFFF","bg_grad_color":"#FFFFFF","text_color":"#000000","radius":0,"border_side":0} +{"page":1,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"LIVING ROOM","value_font":22,"bg_color":"#2C3E50","bg_grad_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0} + +{"page":1,"id":2,"obj":"arc","x":20,"y":65,"w":80,"h":100,"max":40,"border_side":0,"type":0,"rotation":0,"start_angle":180,"end_angle":0,"start_angle1":180,"value_font":12,"value_ofs_x":0,"value_ofs_y":-14,"bg_opa":0,"text":"21.2°C","min":-20,"max":50,"val":21} + +{"page":1,"id":3,"obj":"arc","x":140,"y":65,"w":80,"h":100,"max":100,"border_side":0,"type":0,"start_angle":180,"end_angle":0,"start_angle1":180,"value_font":12,"value_color":"#000000","value_ofs_x":0,"value_ofs_y":-14,"bg_opa":0,"text":"44%","val":44} + +{"page":1,"id":4,"obj":"label","x":0,"y":120,"w":240,"h":20,"text":"CO2 levels: 1483 ppm","radius":0,"border_side":0,"align":1} +{"page":1,"id":5,"obj":"label","x":2,"y":35,"w":140,"text":"Temperature","align":1} +{"page":1,"id":6,"obj":"label","x":140,"y":35,"w":95,"text":"Humidity","align":1} +{"page":1,"id":7,"obj":"btn","x":0,"y":160,"w":240,"h":20,"text":"LIGHTS","bg_color":"#F1C40F","text_color":"#FFFFFF","radius":0,"border_side":0} +{"page":1,"id":8,"obj":"label","x":20,"y":190,"w":140,"h":20,"text":"Ceiling Light"} +{"page":1,"id":9,"obj":"switch","x":160,"y":190,"w":40,"h":20,"toggle":"TRUE"} +{"page":1,"id":10,"obj":"label","x":20,"y":215,"w":140,"h":20,"text":"Wall Light"} +{"page":1,"id":11,"obj":"switch","x":160,"y":215,"w":40,"h":20,"toggle":"TRUE"} +{"page":1,"id":12,"obj":"label","x":20,"y":240,"w":200,"h":20,"text":"Ambient Light"} +{"page":1,"id":13,"obj":"slider","x":30,"y":265,"w":200,"h":10} + +{"page":0,"comment":"---------- All pages ----------"} +{"page":0,"id":11,"obj":"btn","action":"prev","x":0,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE141","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} +{"page":0,"id":12,"obj":"btn","action":"back","x":80,"y":290,"w":80,"h":32,"bg_color":"#34495E","text":"\uE2DC","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":24} +{"page":0,"id":13,"obj":"btn","action":"next","x":161,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE142","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} diff --git a/lib/libesp32/berry/default/embedded/openhasp/demo2.jsonl b/lib/libesp32/berry/default/embedded/openhasp/demo2.jsonl new file mode 100644 index 000000000..b1d6efc34 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/openhasp/demo2.jsonl @@ -0,0 +1,35 @@ +{"page":1,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"ENTITIES","value_font":22,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0,"click":0} +{"page":1,"id":2,"obj":"obj","x":5,"y":35,"w":230,"h":250,"click":0} + +{"page":1,"id":11,"obj":"label","x":8,"y":33,"w":35,"h":35,"text":"\uE004","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":12,"obj":"label","x":48,"y":43,"w":130,"h":30,"text":"Presence override","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":13,"obj":"switch","x":177,"y":40,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":1,"id":21,"obj":"label","x":8,"y":69,"w":35,"h":35,"text":"\uF020","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":22,"obj":"label","x":48,"y":79,"w":130,"h":30,"text":"Front door light","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":23,"obj":"switch","x":177,"y":74,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":1,"id":31,"obj":"label","x":8,"y":103,"w":35,"h":35,"text":"\uF054","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":32,"obj":"label","x":48,"y":113,"w":130,"h":30,"text":"Back yard lights","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":33,"obj":"switch","x":177,"y":110,"w":50,"h":25,"radius":25,"radius2":15} + +{"page":1,"id":41,"obj":"label","x":8,"y":138,"w":35,"h":35,"text":"\uEA7A","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":42,"obj":"label","x":48,"y":148,"w":130,"h":30,"text":"Trash service","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":43,"obj":"label","x":97,"y":148,"w":130,"h":30,"text":"in 6 days","align":2,"text_color":"black"} + +{"page":1,"id":51,"obj":"label","x":8,"y":173,"w":35,"h":35,"text":"\uF39D","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":52,"obj":"label","x":48,"y":183,"w":130,"h":30,"text":"Selective trash","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":53,"obj":"label","x":97,"y":183,"w":130,"h":30,"text":"in 10 days","align":2,"text_color":"black"} + +{"page":1,"id":61,"obj":"label","x":8,"y":208,"w":35,"h":35,"text":"\uE32A","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":62,"obj":"label","x":48,"y":218,"w":130,"h":30,"text":"Green energy active","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":63,"obj":"label","x":97,"y":218,"w":130,"h":30,"text":"Yes :)","align":2,"text_color":"black"} + +{"page":1,"id":71,"obj":"label","x":8,"y":243,"w":35,"h":35,"text":"\uE957","align":1,"text_font":32,"text_color":"black"} +{"page":1,"id":72,"obj":"label","x":48,"y":253,"w":130,"h":30,"text":"Air quality","align":0,"text_font":16,"text_color":"black"} +{"page":1,"id":73,"obj":"label","x":97,"y":253,"w":130,"h":30,"text":"OK (29.58 µg/m³)","align":2,"text_color":"black"} + +{"page":0,"comment":"---------- All pages ----------"} +{"page":0,"id":11,"obj":"btn","action":"prev","x":0,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE141","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} +{"page":0,"id":12,"obj":"btn","action":"back","x":80,"y":290,"w":80,"h":32,"bg_color":"#34495E","text":"\uE2DC","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":24} +{"page":0,"id":13,"obj":"btn","action":"next","x":161,"y":290,"w":79,"h":32,"bg_color":"#34495E","text":"\uE142","text_color":"#CCCCCC","radius":0,"border_side":0,"text_font":32} diff --git a/lib/libesp32/berry/default/embedded/openhasp/demo3.jsonl b/lib/libesp32/berry/default/embedded/openhasp/demo3.jsonl new file mode 100644 index 000000000..f8b952f81 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/openhasp/demo3.jsonl @@ -0,0 +1,4 @@ +{"page":1,"id":1,"obj":"btn","x":0,"y":0,"w":240,"h":30,"text":"FAN STATUS","text_font":16,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0,"click":0} + +{"page":1,"id":11,"obj":"img","src":"A:/noun_Fan_35097_140.png","auto_size":1,"w":140,"h":140,"x":50,"y":75,"image_recolor":"lime","image_recolor_opa":150} +{"page":1,"id":12,"obj":"spinner","parentid":11,"x":7,"y":6,"w":126,"h":126,"bg_opa":0,"border_width":0,"line_width":7,"line_width1":7,"type":2,"angle":120,"speed":1000,"value_str":3,"value_font":24} \ No newline at end of file diff --git a/lib/libesp32/berry/default/embedded/persist.be b/lib/libesp32/berry/default/embedded/persist.be new file mode 100644 index 000000000..164a1dd7b --- /dev/null +++ b/lib/libesp32/berry/default/embedded/persist.be @@ -0,0 +1,161 @@ +#- persistance module for Berry -# +#- -# +#- To solidify: -# +#- + # load only persis_module and persist_module.init + import solidify + solidify.dump(persist_module.init) + # copy and paste into `be_persist_lib.c` +-# +var persist_module = module("persist") + +persist_module.init = def (m) + + class Persist + var _filename + var _p + var _dirty + + #- persist can be initialized with pre-existing values. The map is not copied so any change will be reflected -# + def init(m) + # print("Persist init") + self._filename = '_persist.json' + if isinstance(m,map) + self._p = m.copy() # need to copy instead? + else + self._p = {} + end + self.load(self._p, self._filename) + self._dirty = false + # print("Persist init") + end + + #- virtual member getter, if a key does not exists return `nil`-# + def member(key) + return self._p.find(key) + end + + #- virtual member setter -# + def setmember(key, value) + self._p[key] = value + self._dirty = true + end + + #- clear all entries -# + def zero() + self._p = {} + self._dirty = true + end + + def remove(k) + self._p.remove(k) + self._dirty = true + end + + def has(k) + return self._p.has(k) + end + + def find(k, d) + return self._p.find(k, d) + end + + def load() + import json + import path + var f # file object + var val # values loaded from json + + if path.exists(self._filename) + try + f = open(self._filename, "r") + val = json.load(f.read()) + f.close() + except .. as e, m + if f != nil f.close() end + raise e, m + end + if isinstance(val, map) + self._p = val # sucess + else + print("BRY: failed to load _persist.json") + end + self._dirty = false + else + self.save() + end + + # print("Loading") + end + + def save() + var f # file object + try + f = open(self._filename, "w") + self.json_fdump(f) + f.close() + except .. as e, m + if f != nil f.close() end + f = open(self._filename, "w") + f.write('{}') # fallback write empty map + f.close() + raise e, m + end + self._dirty = false + # print("Saving") + end + + def json_fdump_any(f, v) + import json + if isinstance(v, map) + self.json_fdump_map(f, v) + elif isinstance(v, list)v + self.json_fdump_list(f, v) + else + f.write(json.dump(v)) + end + end + + def json_fdump_map(f, v) + import json + f.write('{') + var sep = nil + for k:v.keys() + if sep != nil f.write(sep) end + + f.write(json.dump(str(k))) + f.write(':') + self.json_fdump_any(f, v[k]) + + sep = "," + end + f.write('}') + end + + def json_fdump_list(f, v) + import json + f.write('[') + var i = 0 + while i < size(v) + if i > 0 f.write(',') end + self.json_fdump_any(f, v[i]) + i += 1 + end + f.write(']') + end + + def json_fdump(f) + import json + if isinstance(self._p, map) + self.json_fdump_map(f, self._p) + else + raise "internal_error", "persist._p is not a map" + end + end + end + + + return Persist() # return an instance of this class +end + +return persist_module diff --git a/lib/libesp32/berry/default/embedded/tapp.be b/lib/libesp32/berry/default/embedded/tapp.be new file mode 100644 index 000000000..30aa1f740 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/tapp.be @@ -0,0 +1,35 @@ +#- Tasmota apps module for Berry -# +#- -# + +var tapp_module = module("tapp") + +tapp_module.init = def (m) + + class Tapp + + def init() + tasmota.add_driver(self) + end + + def autoexec() + import path + import string + + var dir = path.listdir("/") + + for d: dir + if string.find(d, ".tapp") > 0 + tasmota.log(string.format("TAP: found Tasmota App '%s'", d), 2) + tasmota.load(d + "#autoexec.be") + end + end + end + end + + return Tapp() # return an instance of this class +end + +# aa = autoconf_module.init(autoconf_module) +# import webserver +# webserver.on('/ac2', / -> aa.page_autoconf_mgr(), webserver.HTTP_GET) +return tapp_module diff --git a/lib/libesp32/berry/default/embedded/test_crypto.be b/lib/libesp32/berry/default/embedded/test_crypto.be new file mode 100644 index 000000000..f2edbfee5 --- /dev/null +++ b/lib/libesp32/berry/default/embedded/test_crypto.be @@ -0,0 +1,30 @@ +ec = crypto.EC_C25519() + +# Alice +sk_A = bytes('77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a') +pk_A = ec.public_key(sk_A) +assert(pk_A == bytes('8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a')) + +# Bob +sk_B = bytes('5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb') +pk_B = ec.public_key(sk_B) +assert(pk_B == bytes('de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f')) + +psk = ec.shared_key(sk_A, pk_B) +assert(psk == bytes('4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742')) +psk2 = ec.shared_key(sk_B, pk_A) +assert(psk2 == bytes('4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742')) + +#- test vectors from RFC77748 + + Alice's private key, a: + 77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a + Alice's public key, X25519(a, 9): + 8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a + Bob's private key, b: + 5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb + Bob's public key, X25519(b, 9): + de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f + Their shared secret, K: + 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742 +-# diff --git a/lib/libesp32/berry/default/static_block.hpp b/lib/libesp32/berry/default/static_block.hpp new file mode 100644 index 000000000..152dda130 --- /dev/null +++ b/lib/libesp32/berry/default/static_block.hpp @@ -0,0 +1,80 @@ +/** + * static_block.hpp + * + * An implementation of a Java-style static block, in C++ (and potentially a + * GCC/clang extension to avoid warnings). Almost, but not quite, valid C. + * Partially inspired by Andrei Alexandrescu's Scope Guard and + * discussions on stackoverflow.com + * + * By Eyal Rozenberg + * + * Licensed under the Apache License v2.0: + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +#pragma once +#ifndef STATIC_BLOCK_HPP_ +#define STATIC_BLOCK_HPP_ + +#ifndef CONCATENATE +#define CONCATENATE(s1, s2) s1##s2 +#define EXPAND_THEN_CONCATENATE(s1, s2) CONCATENATE(s1, s2) +#endif /* CONCATENATE */ + +#ifndef UNIQUE_IDENTIFIER +/** + * This macro expands into a different identifier in every expansion. + * Note that you _can_ clash with an invocation of UNIQUE_IDENTIFIER + * by manually using the same identifier elsewhere; or by carefully + * choosing another prefix etc. + */ +#ifdef __COUNTER__ +#define UNIQUE_IDENTIFIER(prefix) EXPAND_THEN_CONCATENATE(prefix, __COUNTER__) +#else +#define UNIQUE_IDENTIFIER(prefix) EXPAND_THEN_CONCATENATE(prefix, __LINE__) +#endif /* COUNTER */ +#else +#endif /* UNIQUE_IDENTIFIER */ + +/** + * Following is a mechanism for executing code statically. + * + * @note Caveats: + * - Your static block must be surround by curly braces. + * - No need for a semicolon after the block (but it won't hurt). + * - Do not put static blocks in files, as it might get compiled multiple + * times ane execute multiple times. + * - A static_block can only be used in file scope - not within any other block etc. + * - Templated static blocks will probably not work. Avoid them. + * - No other funny business, this is fragile. + * - This does not having any threading issues (AFAICT) - as it has no static + * initialization order issue. Of course, you have to _keep_ it safe with + * your static code. + * - Execution of the code is guaranteed to occur before main() executes, + * but the relative order of statics being initialized is unknown/unclear. So, + * do not call any method of an instance of a class which you expect to have been + * constructed; it may not have been. Instead, you can use a static getInstance() method + * (look this idiom up on the web, it's safe). + * - Variables defined within the static block are not global; they will + * go out of scope as soon as its execution concludes. + * + * Usage example: + * + * static_block { + * do_stuff(); + * std::cout << "in the static block!\n"; + * } + * + */ +#define static_block STATIC_BLOCK_IMPL1(UNIQUE_IDENTIFIER(_static_block_)) + +#define STATIC_BLOCK_IMPL1(prefix) \ + STATIC_BLOCK_IMPL2(CONCATENATE(prefix,_fn),CONCATENATE(prefix,_var)) + +#define STATIC_BLOCK_IMPL2(function_name,var_name) \ +static void function_name(); \ +static int var_name __attribute((unused)) = (function_name(), 0) ; \ +static void function_name() + + +#endif // STATIC_BLOCK_HPP_ diff --git a/lib/libesp32/berry/examples/anon_func.be b/lib/libesp32/berry/examples/anon_func.be new file mode 100644 index 000000000..78854ce64 --- /dev/null +++ b/lib/libesp32/berry/examples/anon_func.be @@ -0,0 +1,20 @@ +# anonymous function and closure +def count(x) + var arr = [] + for i : 0 .. x + arr.push( + def (n) # loop variable cannot be used directly as free variable + return def () + return n * n + end + end (i) # define and call anonymous function + ) + end + return arr +end + +for xx : count(6) + print(xx()) # 0, 1, 4 ... n * n +end + +return count diff --git a/lib/libesp32/berry/examples/bigloop.be b/lib/libesp32/berry/examples/bigloop.be new file mode 100644 index 000000000..a3a77768b --- /dev/null +++ b/lib/libesp32/berry/examples/bigloop.be @@ -0,0 +1,15 @@ +import time + +c = time.clock() +do + i = 0 + while i < 100000000 + i += 1 + end +end +print('while iteration 100000000 times', time.clock() - c, 's') + +c = time.clock() +for i : 1 .. 100000000 +end +print('for iteration 100000000 times', time.clock() - c, 's') diff --git a/lib/libesp32/berry/examples/bintree.be b/lib/libesp32/berry/examples/bintree.be new file mode 100644 index 000000000..81936f8a0 --- /dev/null +++ b/lib/libesp32/berry/examples/bintree.be @@ -0,0 +1,60 @@ +# Reference from https://github.com/BerryMathDevelopmentTeam/BerryMath/blob/master/testscript/BinaryTree.bm + +class node + var v, l, r + def init(v, l, r) + self.v = v + self.l = l + self.r = r + end + def insert(v) + if v < self.v + if self.l + self.l.insert(v) + else + self.l = node(v) + end + else + if self.r + self.r.insert(v) + else + self.r = node (v) + end + end + end + def sort(l) + if (self.l) self.l.sort(l) end + l.push(self.v) + if (self.r) self.r.sort(l) end + end +end + +class btree + var root + def insert(v) + if self.root + self.root.insert(v) + else + self.root = node(v) + end + end + def sort() + var l = [] + if self.root + self.root.sort(l) + end + return l + end +end + +var tree = btree() +tree.insert(-100) +tree.insert(5); +tree.insert(3); +tree.insert(9); +tree.insert(10); +tree.insert(10000000); +tree.insert(1); +tree.insert(-1); +tree.insert(-10); +print(tree.sort()); diff --git a/lib/libesp32/berry/examples/calcpi.be b/lib/libesp32/berry/examples/calcpi.be new file mode 100644 index 000000000..053f87875 --- /dev/null +++ b/lib/libesp32/berry/examples/calcpi.be @@ -0,0 +1,16 @@ +def cpi(n) + i = 2 + pi = 3 + while i <= n + term = 4.0 / (i * (i + 1) * (i + 2)) + if i % 4 + pi = pi + term + else + pi = pi - term + end + i = i + 2 + end + return pi +end + +print("pi =", cpi(100)) diff --git a/lib/libesp32/berry/examples/exception.be b/lib/libesp32/berry/examples/exception.be new file mode 100644 index 000000000..3a3098dce --- /dev/null +++ b/lib/libesp32/berry/examples/exception.be @@ -0,0 +1,12 @@ +import debug + +def test_func() + try + compile('def +() end')() + except .. as e, v + print('catch execption:', str(e) + ' >>>\n ' + str(v)) + debug.traceback() + end +end + +test_func() diff --git a/lib/libesp32/berry/examples/fib_rec.be b/lib/libesp32/berry/examples/fib_rec.be new file mode 100644 index 000000000..31ed3817b --- /dev/null +++ b/lib/libesp32/berry/examples/fib_rec.be @@ -0,0 +1,12 @@ +import time + +def fib(x) + if x <= 2 + return 1 + end + return fib(x - 1) + fib(x - 2) +end + +c = time.clock() +print("fib:", fib(38)) # minimum stack size: 78!! +print("time:", time.clock() - c, 's') diff --git a/lib/libesp32/berry/examples/guess_number.be b/lib/libesp32/berry/examples/guess_number.be new file mode 100644 index 000000000..6cbd07e7c --- /dev/null +++ b/lib/libesp32/berry/examples/guess_number.be @@ -0,0 +1,26 @@ +import time +import math + +math.srand(time.time()) +res = math.rand() % 100 +max_test = 7 +test = -1 +idx = 1 +print('Guess a number between 0 and 99. You have', max_test, 'chances.') +while test != res && idx <= max_test + test = number(input(str(idx) + ': enter the number you guessed: ')) + if type(test) != 'int' + print('This is not an integer. Continue!') + continue + elif test > res + print('This number is too large.') + elif test < res + print('This number is too small.') + end + idx = idx + 1 +end +if test == res + print('You win!') +else + print('You failed, the correct answer is', res) +end diff --git a/lib/libesp32/berry/examples/json.be b/lib/libesp32/berry/examples/json.be new file mode 100644 index 000000000..d98dff8bb --- /dev/null +++ b/lib/libesp32/berry/examples/json.be @@ -0,0 +1,4 @@ +import json +print(json.load('{"key": "value"}')) +print(json.dump({'test key': nil})) +print(json.dump({'key1': nil, 45: true}, 'format')) diff --git a/lib/libesp32/berry/examples/lambda.be b/lib/libesp32/berry/examples/lambda.be new file mode 100644 index 000000000..1d0b709bb --- /dev/null +++ b/lib/libesp32/berry/examples/lambda.be @@ -0,0 +1,8 @@ +# simple lambda example +print((/a b c-> a * b + c)(2, 3, 4)) + +# Y-Combinator and factorial functions +Y = /f-> (/x-> f(/n-> x(x)(n)))(/x-> f(/n-> x(x)(n))) +F = /f-> /x-> x ? f(x - 1) * x : 1 +fact = Y(F) +print('fact(10) == ' .. fact(10)) diff --git a/lib/libesp32/berry/examples/listdir.be b/lib/libesp32/berry/examples/listdir.be new file mode 100644 index 000000000..2dd880118 --- /dev/null +++ b/lib/libesp32/berry/examples/listdir.be @@ -0,0 +1,16 @@ +import os + +def scandir(path) + print('path: ' + path) + for name : os.listdir(path) + var fullname = os.path.join(path, name) + if os.path.isfile(fullname) + print('file: ' + fullname) + else + print('path: ' + fullname) + scandir(fullname) + end + end +end + +scandir('.') diff --git a/lib/libesp32/berry/examples/qsort.be b/lib/libesp32/berry/examples/qsort.be new file mode 100644 index 000000000..b09b65672 --- /dev/null +++ b/lib/libesp32/berry/examples/qsort.be @@ -0,0 +1,42 @@ +def qsort(data) + # do once sort + def once(left, right) + var pivot = data[left] # use the 0th value as the pivot + while left < right # check if sort is complete + # put the value less than the pivot to the left + while left < right && data[right] >= pivot + right -= 1 # skip values greater than pivot + end + data[left] = data[right] + # put the value greater than the pivot on the right + while left < right && data[left] <= pivot + left += 1 # skip values less than pivot + end + data[right] = data[left] + end + # now we have the index of the pivot, store it + data[left] = pivot + return left # return the index of the pivot + end + # recursive quick sort algorithm + def _sort(left, right) + if left < right # executed when the array is not empty + var index = once(left, right) # get index of pivot for divide and conquer + _sort(left, index - 1) # sort the data on the left + _sort(index + 1, right) # sort the data on the right + end + end + # start quick sort + _sort(0, data.size() - 1) + return data +end + +import time, math +math.srand(time.time()) # sse system time as a random seed +data = [] +# put 20 random numbers into the array +for i : 1 .. 20 + data.push(math.rand() % 100) +end +# sort and print +print(qsort(data)) diff --git a/lib/libesp32/berry/examples/repl.be b/lib/libesp32/berry/examples/repl.be new file mode 100644 index 000000000..aac26b0a1 --- /dev/null +++ b/lib/libesp32/berry/examples/repl.be @@ -0,0 +1,61 @@ +do + def ismult(msg) + import string + return string.split(msg, -5)[1] == '\'EOS\'' + end + + def multline(src, msg) + if !ismult(msg) + print('syntax_error: ' + msg) + return + end + while true + try + src += '\n' + input('>> ') + return compile(src) + except 'syntax_error' as e, m + if !ismult(m) + print('syntax_error: ' + m) + return + end + end + end + end + + def parse() + var fun, src = input('> ') + try + fun = compile('return (' + src + ')') + except 'syntax_error' as e, m + try + fun = compile(src) + except 'syntax_error' as e, m + fun = multline(src, m) + end + end + return fun + end + + def run(fun) + try + var res = fun() + if res print(res) end + except .. as e, m + import debug + print(e .. ': ' .. m) + debug.traceback() + end + end + + def repl() + while true + var fun = parse() + if fun != nil + run(fun) + end + end + end + + print("Berry Berry REPL!") + repl() +end diff --git a/lib/libesp32/berry/examples/string.be b/lib/libesp32/berry/examples/string.be new file mode 100644 index 000000000..299834e21 --- /dev/null +++ b/lib/libesp32/berry/examples/string.be @@ -0,0 +1,32 @@ +s = "This is a long string test. 0123456789 abcdefg ABCDEFG" +print(s) + +a = .5 +print(a) + +import string as s + +print(s.hex(0x45678ABCD, 16)) + +def bin(x, num) + assert(type(x) == 'int', 'the type of \'x\' must be integer') + # test the 'x' bits + var bits = 1 + for i : 0 .. 62 + if x & (1 << 63 - i) + bits = 64 - i + break + end + end + if type(num) == 'int' && num > 0 && num <= 64 + bits = bits < num ? num : bits + end + var result = '' + bits -= 1 + for i : 0 .. bits + result += x & (1 << (bits - i)) ? '1' : '0' + end + return result +end + +print(bin(33)) diff --git a/lib/libesp32/berry/examples/strmod.be b/lib/libesp32/berry/examples/strmod.be new file mode 100644 index 000000000..8660f5b4e --- /dev/null +++ b/lib/libesp32/berry/examples/strmod.be @@ -0,0 +1,7 @@ +import string + +print(string.format('%.3d', 12)) +print(string.format('%.3f', 12)) +print(string.format('%20.7f', 14.5)) +print(string.format('-- %-40s ---', 'this is a string format test')) +print(string.format('-- %40s ---', 'this is a string format test')) diff --git a/lib/libesp32/berry/gen.sh b/lib/libesp32/berry/gen.sh new file mode 100755 index 000000000..303a62c95 --- /dev/null +++ b/lib/libesp32/berry/gen.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 tools/pycoc/main.py -o generate src default ../berry_mapping/src -c default/berry_conf.h diff --git a/lib/libesp32/berry/generate/be_const_strtab.h b/lib/libesp32/berry/generate/be_const_strtab.h new file mode 100644 index 000000000..50198eb8f --- /dev/null +++ b/lib/libesp32/berry/generate/be_const_strtab.h @@ -0,0 +1,741 @@ +extern const bcstring be_const_str_; +extern const bcstring be_const_str_AES_GCM; +extern const bcstring be_const_str_AXP192; +extern const bcstring be_const_str_Animate_X20pc_X20is_X20out_X20of_X20range; +extern const bcstring be_const_str_AudioFileSource; +extern const bcstring be_const_str_AudioFileSourceFS; +extern const bcstring be_const_str_AudioGenerator; +extern const bcstring be_const_str_AudioGeneratorMP3; +extern const bcstring be_const_str_AudioGeneratorWAV; +extern const bcstring be_const_str_AudioOutput; +extern const bcstring be_const_str_AudioOutputI2S; +extern const bcstring be_const_str_Auto_X2Dconfiguration; +extern const bcstring be_const_str_BRY_X3A_X20ERROR_X2C_X20bad_X20json_X3A_X20; +extern const bcstring be_const_str_BRY_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s; +extern const bcstring be_const_str_BRY_X3A_X20could_X20not_X20save_X20compiled_X20file_X20_X25s_X20_X28_X25s_X29; +extern const bcstring be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson; +extern const bcstring be_const_str_BUTTON_CONFIGURATION; +extern const bcstring be_const_str_CFG_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s; +extern const bcstring be_const_str_CFG_X3A_X20_X27init_X2Ebat_X27_X20done_X2C_X20restarting; +extern const bcstring be_const_str_CFG_X3A_X20could_X20not_X20run_X20_X25s_X20_X28_X25s_X20_X2D_X20_X25s_X29; +extern const bcstring be_const_str_CFG_X3A_X20downloading_X20_X27_X25s_X27; +extern const bcstring be_const_str_CFG_X3A_X20exception_X20_X27_X25s_X27_X20_X2D_X20_X27_X25s_X27; +extern const bcstring be_const_str_CFG_X3A_X20loaded_X20_X20; +extern const bcstring be_const_str_CFG_X3A_X20loaded_X20_X27_X25s_X27; +extern const bcstring be_const_str_CFG_X3A_X20loading_X20; +extern const bcstring be_const_str_CFG_X3A_X20loading_X20_X27_X25s_X27; +extern const bcstring be_const_str_CFG_X3A_X20multiple_X20autoconf_X20files_X20found_X2C_X20aborting_X20_X28_X27_X25s_X27_X20_X2B_X20_X27_X25s_X27_X29; +extern const bcstring be_const_str_CFG_X3A_X20no_X20_X27_X2A_X2Eautoconf_X27_X20file_X20found; +extern const bcstring be_const_str_CFG_X3A_X20ran_X20_X20; +extern const bcstring be_const_str_CFG_X3A_X20removed_X20file_X20_X27_X25s_X27; +extern const bcstring be_const_str_CFG_X3A_X20removing_X20autoconf_X20files; +extern const bcstring be_const_str_CFG_X3A_X20removing_X20first_X20time_X20marker; +extern const bcstring be_const_str_CFG_X3A_X20return_code_X3D_X25i; +extern const bcstring be_const_str_CFG_X3A_X20running_X20; +extern const bcstring be_const_str_CFG_X3A_X20skipping_X20_X27display_X2Eini_X27_X20because_X20already_X20present_X20in_X20file_X2Dsystem; +extern const bcstring be_const_str_COLOR_BLACK; +extern const bcstring be_const_str_COLOR_WHITE; +extern const bcstring be_const_str_EC_C25519; +extern const bcstring be_const_str_EVENT_DRAW_MAIN; +extern const bcstring be_const_str_EVENT_DRAW_PART_BEGIN; +extern const bcstring be_const_str_EVENT_DRAW_PART_END; +extern const bcstring be_const_str_False; +extern const bcstring be_const_str_GET; +extern const bcstring be_const_str_HTTP_GET; +extern const bcstring be_const_str_HTTP_POST; +extern const bcstring be_const_str_I2C_Driver; +extern const bcstring be_const_str_I2C_X3A; +extern const bcstring be_const_str_LVG_X3A_X20call_X20to_X20unsupported_X20callback; +extern const bcstring be_const_str_Leds; +extern const bcstring be_const_str_MD5; +extern const bcstring be_const_str_None; +extern const bcstring be_const_str_OPTION_A; +extern const bcstring be_const_str_OneWire; +extern const bcstring be_const_str_PART_MAIN; +extern const bcstring be_const_str_POST; +extern const bcstring be_const_str_Parameter_X20error; +extern const bcstring be_const_str_RES_OK; +extern const bcstring be_const_str_Restart_X201; +extern const bcstring be_const_str_SERIAL_5E1; +extern const bcstring be_const_str_SERIAL_5E2; +extern const bcstring be_const_str_SERIAL_5N1; +extern const bcstring be_const_str_SERIAL_5N2; +extern const bcstring be_const_str_SERIAL_5O1; +extern const bcstring be_const_str_SERIAL_5O2; +extern const bcstring be_const_str_SERIAL_6E1; +extern const bcstring be_const_str_SERIAL_6E2; +extern const bcstring be_const_str_SERIAL_6N1; +extern const bcstring be_const_str_SERIAL_6N2; +extern const bcstring be_const_str_SERIAL_6O1; +extern const bcstring be_const_str_SERIAL_6O2; +extern const bcstring be_const_str_SERIAL_7E1; +extern const bcstring be_const_str_SERIAL_7E2; +extern const bcstring be_const_str_SERIAL_7N1; +extern const bcstring be_const_str_SERIAL_7N2; +extern const bcstring be_const_str_SERIAL_7O1; +extern const bcstring be_const_str_SERIAL_7O2; +extern const bcstring be_const_str_SERIAL_8E1; +extern const bcstring be_const_str_SERIAL_8E2; +extern const bcstring be_const_str_SERIAL_8N1; +extern const bcstring be_const_str_SERIAL_8N2; +extern const bcstring be_const_str_SERIAL_8O1; +extern const bcstring be_const_str_SERIAL_8O2; +extern const bcstring be_const_str_SK6812_GRBW; +extern const bcstring be_const_str_STATE_DEFAULT; +extern const bcstring be_const_str_TAP_X3A_X20found_X20Tasmota_X20App_X20_X27_X25s_X27; +extern const bcstring be_const_str_Tasmota; +extern const bcstring be_const_str_Tele; +extern const bcstring be_const_str_Timer; +extern const bcstring be_const_str_True; +extern const bcstring be_const_str_Unknown_X20command; +extern const bcstring be_const_str_WS2812; +extern const bcstring be_const_str_WS2812_GRB; +extern const bcstring be_const_str_Wire; +extern const bcstring be_const_str__; +extern const bcstring be_const_str__X0A; +extern const bcstring be_const_str__X20; +extern const bcstring be_const_str__X21_X3D; +extern const bcstring be_const_str__X21_X3D_X3D; +extern const bcstring be_const_str__X23; +extern const bcstring be_const_str__X23autoexec_X2Ebat; +extern const bcstring be_const_str__X23autoexec_X2Ebe; +extern const bcstring be_const_str__X23display_X2Eini; +extern const bcstring be_const_str__X23init_X2Ebat; +extern const bcstring be_const_str__X23preinit_X2Ebe; +extern const bcstring be_const_str__X2502d_X25s_X2502d; +extern const bcstring be_const_str__X2504d_X2D_X2502d_X2D_X2502dT_X2502d_X3A_X2502d_X3A_X2502d; +extern const bcstring be_const_str__X25s_X2Eautoconf; +extern const bcstring be_const_str__X26lt_X3BError_X3A_X20apply_X20new_X20or_X20remove_X26gt_X3B; +extern const bcstring be_const_str__X26lt_X3BNone_X26gt_X3B; +extern const bcstring be_const_str__X28_X29; +extern const bcstring be_const_str__X2B; +extern const bcstring be_const_str__X2C; +extern const bcstring be_const_str__X2D_X2D_X3A_X2D_X2D; +extern const bcstring be_const_str__X2E; +extern const bcstring be_const_str__X2E_X2E; +extern const bcstring be_const_str__X2Eautoconf; +extern const bcstring be_const_str__X2Ebe; +extern const bcstring be_const_str__X2Ebec; +extern const bcstring be_const_str__X2Elen; +extern const bcstring be_const_str__X2Ep; +extern const bcstring be_const_str__X2Ep1; +extern const bcstring be_const_str__X2Ep2; +extern const bcstring be_const_str__X2Esize; +extern const bcstring be_const_str__X2Etapp; +extern const bcstring be_const_str__X2Ew; +extern const bcstring be_const_str__X2F; +extern const bcstring be_const_str__X2F_X2Eautoconf; +extern const bcstring be_const_str__X2F_X3Frst_X3D; +extern const bcstring be_const_str__X2Fac; +extern const bcstring be_const_str__X3A; +extern const bcstring be_const_str__X3C; +extern const bcstring be_const_str__X3C_X2Fform_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3C_X2Fselect_X3E_X3Cp_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3C_X3D; +extern const bcstring be_const_str__X3Cbutton_X20name_X3D_X27reapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3ERe_X2Dapply_X20current_X20configuration_X3C_X2Fbutton_X3E; +extern const bcstring be_const_str__X3Cbutton_X20name_X3D_X27zipapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3EApply_X20configuration_X3C_X2Fbutton_X3E; +extern const bcstring be_const_str__X3Cfieldset_X3E_X3Cstyle_X3E_X2Ebdis_X7Bbackground_X3A_X23888_X3B_X7D_X2Ebdis_X3Ahover_X7Bbackground_X3A_X23888_X3B_X7D_X3C_X2Fstyle_X3E; +extern const bcstring be_const_str__X3Cinstance_X3A_X20_X25s_X28_X25s_X2C_X20_X25s_X2C_X20_X25s_X29; +extern const bcstring be_const_str__X3Clabel_X3EChoose_X20a_X20device_X20configuration_X3A_X3C_X2Flabel_X3E_X3Cbr_X3E; +extern const bcstring be_const_str__X3Clambda_X3E; +extern const bcstring be_const_str__X3Clegend_X3E_X3Cb_X20title_X3D_X27Autoconfiguration_X27_X3E_X26nbsp_X3BCurrent_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E; +extern const bcstring be_const_str__X3Clegend_X3E_X3Cb_X20title_X3D_X27New_X20autoconf_X27_X3E_X26nbsp_X3BSelect_X20new_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E; +extern const bcstring be_const_str__X3Coption_X20value_X3D_X27_X25s_X27_X3E_X25s_X3C_X2Foption_X3E; +extern const bcstring be_const_str__X3Coption_X20value_X3D_X27reset_X27_X3E_X26lt_X3BRemove_X20autoconf_X26gt_X3B_X3C_X2Foption_X3E; +extern const bcstring be_const_str__X3Cp_X20style_X3D_X27width_X3A340px_X3B_X27_X3E_X3Cb_X3EException_X3A_X3C_X2Fb_X3E_X3Cbr_X3E_X27_X25s_X27_X3Cbr_X3E_X25s_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cp_X3ECurrent_X20configuration_X3A_X20_X3C_X2Fp_X3E_X3Cp_X3E_X3Cb_X3E_X25s_X3C_X2Fb_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cp_X3E_X3C_X2Fp_X3E_X3C_X2Ffieldset_X3E_X3Cp_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dreapply_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20; +extern const bcstring be_const_str__X3Cp_X3E_X3Cform_X20id_X3Dzip_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20; +extern const bcstring be_const_str__X3Cp_X3E_X3Csmall_X3E_X26nbsp_X3B_X28This_X20feature_X20requires_X20an_X20internet_X20connection_X29_X3C_X2Fsmall_X3E_X3C_X2Fp_X3E; +extern const bcstring be_const_str__X3Cselect_X20name_X3D_X27zip_X27_X3E; +extern const bcstring be_const_str__X3D; +extern const bcstring be_const_str__X3D_X3C_X3E_X21; +extern const bcstring be_const_str__X3D_X3D; +extern const bcstring be_const_str__X3E; +extern const bcstring be_const_str__X3E_X3D; +extern const bcstring be_const_str__X3F; +extern const bcstring be_const_str__X5B; +extern const bcstring be_const_str__X5D; +extern const bcstring be_const_str__X7B; +extern const bcstring be_const_str__X7B_X7D; +extern const bcstring be_const_str__X7Bs_X7DBatt_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D; +extern const bcstring be_const_str__X7Bs_X7DBatt_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D; +extern const bcstring be_const_str__X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_XB0C_X7Be_X7D; +extern const bcstring be_const_str__X7Bs_X7DVBus_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D; +extern const bcstring be_const_str__X7Bs_X7DVBus_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D; +extern const bcstring be_const_str__X7D; +extern const bcstring be_const_str___iterator__; +extern const bcstring be_const_str___lower__; +extern const bcstring be_const_str___upper__; +extern const bcstring be_const_str__anonymous_; +extern const bcstring be_const_str__archive; +extern const bcstring be_const_str__available; +extern const bcstring be_const_str__begin_transmission; +extern const bcstring be_const_str__buffer; +extern const bcstring be_const_str__ccmd; +extern const bcstring be_const_str__class; +extern const bcstring be_const_str__cmd; +extern const bcstring be_const_str__debug_present; +extern const bcstring be_const_str__def; +extern const bcstring be_const_str__dirty; +extern const bcstring be_const_str__drivers; +extern const bcstring be_const_str__end_transmission; +extern const bcstring be_const_str__energy; +extern const bcstring be_const_str__error; +extern const bcstring be_const_str__filename; +extern const bcstring be_const_str__global_addr; +extern const bcstring be_const_str__global_def; +extern const bcstring be_const_str__lvgl; +extern const bcstring be_const_str__p; +extern const bcstring be_const_str__persist_X2Ejson; +extern const bcstring be_const_str__ptr; +extern const bcstring be_const_str__read; +extern const bcstring be_const_str__request_from; +extern const bcstring be_const_str__rules; +extern const bcstring be_const_str__settings_def; +extern const bcstring be_const_str__settings_ptr; +extern const bcstring be_const_str__t; +extern const bcstring be_const_str__timers; +extern const bcstring be_const_str__write; +extern const bcstring be_const_str_a; +extern const bcstring be_const_str_abs; +extern const bcstring be_const_str_acos; +extern const bcstring be_const_str_add; +extern const bcstring be_const_str_add_anim; +extern const bcstring be_const_str_add_cmd; +extern const bcstring be_const_str_add_driver; +extern const bcstring be_const_str_add_header; +extern const bcstring be_const_str_add_rule; +extern const bcstring be_const_str_addr; +extern const bcstring be_const_str_allocated; +extern const bcstring be_const_str_alternate; +extern const bcstring be_const_str_animate; +extern const bcstring be_const_str_animators; +extern const bcstring be_const_str_arch; +extern const bcstring be_const_str_area; +extern const bcstring be_const_str_arg; +extern const bcstring be_const_str_arg_X20must_X20be_X20a_X20subclass_X20of_X20lv_obj; +extern const bcstring be_const_str_arg_name; +extern const bcstring be_const_str_arg_size; +extern const bcstring be_const_str_as; +extern const bcstring be_const_str_asin; +extern const bcstring be_const_str_assert; +extern const bcstring be_const_str_asstring; +extern const bcstring be_const_str_atan; +extern const bcstring be_const_str_atan2; +extern const bcstring be_const_str_atleast1; +extern const bcstring be_const_str_attrdump; +extern const bcstring be_const_str_autoexec; +extern const bcstring be_const_str_autorun; +extern const bcstring be_const_str_available; +extern const bcstring be_const_str_b; +extern const bcstring be_const_str_back_forth; +extern const bcstring be_const_str_base_class; +extern const bcstring be_const_str_battery_present; +extern const bcstring be_const_str_begin; +extern const bcstring be_const_str_bool; +extern const bcstring be_const_str_break; +extern const bcstring be_const_str_bri; +extern const bcstring be_const_str_bus; +extern const bcstring be_const_str_button_pressed; +extern const bcstring be_const_str_byte; +extern const bcstring be_const_str_bytes; +extern const bcstring be_const_str_c; +extern const bcstring be_const_str_call; +extern const bcstring be_const_str_call_native; +extern const bcstring be_const_str_calldepth; +extern const bcstring be_const_str_can_show; +extern const bcstring be_const_str_cb; +extern const bcstring be_const_str_cb_do_nothing; +extern const bcstring be_const_str_cb_event_closure; +extern const bcstring be_const_str_cb_obj; +extern const bcstring be_const_str_ceil; +extern const bcstring be_const_str_char; +extern const bcstring be_const_str_chars_in_string; +extern const bcstring be_const_str_check_privileged_access; +extern const bcstring be_const_str_class; +extern const bcstring be_const_str_class_init_obj; +extern const bcstring be_const_str_classname; +extern const bcstring be_const_str_classof; +extern const bcstring be_const_str_clear; +extern const bcstring be_const_str_clear_first_time; +extern const bcstring be_const_str_clear_to; +extern const bcstring be_const_str_close; +extern const bcstring be_const_str_closure; +extern const bcstring be_const_str_cmd; +extern const bcstring be_const_str_cmd_res; +extern const bcstring be_const_str_code; +extern const bcstring be_const_str_codedump; +extern const bcstring be_const_str_collect; +extern const bcstring be_const_str_color; +extern const bcstring be_const_str_compile; +extern const bcstring be_const_str_compress; +extern const bcstring be_const_str_concat; +extern const bcstring be_const_str_connect; +extern const bcstring be_const_str_connected; +extern const bcstring be_const_str_connection_error; +extern const bcstring be_const_str_constructor_cb; +extern const bcstring be_const_str_contains; +extern const bcstring be_const_str_content_button; +extern const bcstring be_const_str_content_flush; +extern const bcstring be_const_str_content_send; +extern const bcstring be_const_str_content_send_style; +extern const bcstring be_const_str_content_start; +extern const bcstring be_const_str_content_stop; +extern const bcstring be_const_str_continue; +extern const bcstring be_const_str_copy; +extern const bcstring be_const_str_cos; +extern const bcstring be_const_str_cosh; +extern const bcstring be_const_str_couldn_X27t_X20not_X20initialize_X20noepixelbus; +extern const bcstring be_const_str_count; +extern const bcstring be_const_str_counters; +extern const bcstring be_const_str_create_custom_widget; +extern const bcstring be_const_str_create_matrix; +extern const bcstring be_const_str_create_segment; +extern const bcstring be_const_str_ctor; +extern const bcstring be_const_str_ctypes_bytes; +extern const bcstring be_const_str_ctypes_bytes_dyn; +extern const bcstring be_const_str_dac_voltage; +extern const bcstring be_const_str_day; +extern const bcstring be_const_str_debug; +extern const bcstring be_const_str_decompress; +extern const bcstring be_const_str_decrypt; +extern const bcstring be_const_str_def; +extern const bcstring be_const_str_deg; +extern const bcstring be_const_str_deinit; +extern const bcstring be_const_str_del; +extern const bcstring be_const_str_delay; +extern const bcstring be_const_str_delete_all_configs; +extern const bcstring be_const_str_depower; +extern const bcstring be_const_str_deregister_obj; +extern const bcstring be_const_str_destructor_cb; +extern const bcstring be_const_str_detect; +extern const bcstring be_const_str_detected_X20on_X20bus; +extern const bcstring be_const_str_digital_read; +extern const bcstring be_const_str_digital_write; +extern const bcstring be_const_str_dirty; +extern const bcstring be_const_str_display; +extern const bcstring be_const_str_display_X2Eini; +extern const bcstring be_const_str_do; +extern const bcstring be_const_str_draw_arc; +extern const bcstring be_const_str_draw_line; +extern const bcstring be_const_str_draw_line_dsc; +extern const bcstring be_const_str_draw_line_dsc_init; +extern const bcstring be_const_str_due; +extern const bcstring be_const_str_dump; +extern const bcstring be_const_str_duration; +extern const bcstring be_const_str_editable; +extern const bcstring be_const_str_elif; +extern const bcstring be_const_str_else; +extern const bcstring be_const_str_enabled; +extern const bcstring be_const_str_encrypt; +extern const bcstring be_const_str_end; +extern const bcstring be_const_str_energy_struct; +extern const bcstring be_const_str_engine; +extern const bcstring be_const_str_erase; +extern const bcstring be_const_str_escape; +extern const bcstring be_const_str_eth; +extern const bcstring be_const_str_event; +extern const bcstring be_const_str_event_cb; +extern const bcstring be_const_str_event_send; +extern const bcstring be_const_str_every_100ms; +extern const bcstring be_const_str_every_50ms; +extern const bcstring be_const_str_every_second; +extern const bcstring be_const_str_except; +extern const bcstring be_const_str_exec_cmd; +extern const bcstring be_const_str_exec_rules; +extern const bcstring be_const_str_exec_tele; +extern const bcstring be_const_str_exists; +extern const bcstring be_const_str_exp; +extern const bcstring be_const_str_f; +extern const bcstring be_const_str_false; +extern const bcstring be_const_str_file; +extern const bcstring be_const_str_file_X20extension_X20is_X20not_X20_X27_X2Ebe_X27_X20or_X20_X27_X2Ebec_X27; +extern const bcstring be_const_str_files; +extern const bcstring be_const_str_find; +extern const bcstring be_const_str_find_key_i; +extern const bcstring be_const_str_find_op; +extern const bcstring be_const_str_finish; +extern const bcstring be_const_str_floor; +extern const bcstring be_const_str_flush; +extern const bcstring be_const_str_for; +extern const bcstring be_const_str_format; +extern const bcstring be_const_str_from_to; +extern const bcstring be_const_str_fromb64; +extern const bcstring be_const_str_fromptr; +extern const bcstring be_const_str_fromstring; +extern const bcstring be_const_str_function; +extern const bcstring be_const_str_gamma; +extern const bcstring be_const_str_gamma10; +extern const bcstring be_const_str_gamma8; +extern const bcstring be_const_str_gc; +extern const bcstring be_const_str_gen_cb; +extern const bcstring be_const_str_get; +extern const bcstring be_const_str_get_alternate; +extern const bcstring be_const_str_get_aps_voltage; +extern const bcstring be_const_str_get_bat_charge_current; +extern const bcstring be_const_str_get_bat_current; +extern const bcstring be_const_str_get_bat_power; +extern const bcstring be_const_str_get_bat_voltage; +extern const bcstring be_const_str_get_battery_chargin_status; +extern const bcstring be_const_str_get_bri; +extern const bcstring be_const_str_get_cb_list; +extern const bcstring be_const_str_get_coords; +extern const bcstring be_const_str_get_current_module_name; +extern const bcstring be_const_str_get_current_module_path; +extern const bcstring be_const_str_get_free_heap; +extern const bcstring be_const_str_get_height; +extern const bcstring be_const_str_get_input_power_status; +extern const bcstring be_const_str_get_light; +extern const bcstring be_const_str_get_object_from_ptr; +extern const bcstring be_const_str_get_option; +extern const bcstring be_const_str_get_percentage; +extern const bcstring be_const_str_get_pixel_color; +extern const bcstring be_const_str_get_power; +extern const bcstring be_const_str_get_size; +extern const bcstring be_const_str_get_string; +extern const bcstring be_const_str_get_style_bg_color; +extern const bcstring be_const_str_get_style_line_color; +extern const bcstring be_const_str_get_style_pad_right; +extern const bcstring be_const_str_get_switch; +extern const bcstring be_const_str_get_tasmota; +extern const bcstring be_const_str_get_temp; +extern const bcstring be_const_str_get_vbus_current; +extern const bcstring be_const_str_get_vbus_voltage; +extern const bcstring be_const_str_get_warning_level; +extern const bcstring be_const_str_get_width; +extern const bcstring be_const_str_getbits; +extern const bcstring be_const_str_geti; +extern const bcstring be_const_str_global; +extern const bcstring be_const_str_gpio; +extern const bcstring be_const_str_group_def; +extern const bcstring be_const_str_h; +extern const bcstring be_const_str_has; +extern const bcstring be_const_str_has_arg; +extern const bcstring be_const_str_height_def; +extern const bcstring be_const_str_hex; +extern const bcstring be_const_str_hour; +extern const bcstring be_const_str_hs2rgb; +extern const bcstring be_const_str_https_X3A_X2F_X2Fraw_X2Egithubusercontent_X2Ecom_X2Ftasmota_X2Fautoconf_X2Fmain_X2F_X25s_X2F_X25s_X2Eautoconf; +extern const bcstring be_const_str_https_X3A_X2F_X2Fraw_X2Egithubusercontent_X2Ecom_X2Ftasmota_X2Fautoconf_X2Fmain_X2F_X25s_manifest_X2Ejson; +extern const bcstring be_const_str_i2c_enabled; +extern const bcstring be_const_str_id; +extern const bcstring be_const_str_if; +extern const bcstring be_const_str_imax; +extern const bcstring be_const_str_imin; +extern const bcstring be_const_str_import; +extern const bcstring be_const_str_init; +extern const bcstring be_const_str_init_draw_line_dsc; +extern const bcstring be_const_str_input; +extern const bcstring be_const_str_ins_goto; +extern const bcstring be_const_str_ins_ramp; +extern const bcstring be_const_str_ins_time; +extern const bcstring be_const_str_insert; +extern const bcstring be_const_str_instance; +extern const bcstring be_const_str_instance_size; +extern const bcstring be_const_str_int; +extern const bcstring be_const_str_internal_error; +extern const bcstring be_const_str_introspect; +extern const bcstring be_const_str_invalidate; +extern const bcstring be_const_str_io_error; +extern const bcstring be_const_str_ip; +extern const bcstring be_const_str_is_dirty; +extern const bcstring be_const_str_is_first_time; +extern const bcstring be_const_str_is_running; +extern const bcstring be_const_str_isinstance; +extern const bcstring be_const_str_isnan; +extern const bcstring be_const_str_isrunning; +extern const bcstring be_const_str_issubclass; +extern const bcstring be_const_str_item; +extern const bcstring be_const_str_iter; +extern const bcstring be_const_str_json; +extern const bcstring be_const_str_json_append; +extern const bcstring be_const_str_json_fdump; +extern const bcstring be_const_str_json_fdump_any; +extern const bcstring be_const_str_json_fdump_list; +extern const bcstring be_const_str_json_fdump_map; +extern const bcstring be_const_str_k; +extern const bcstring be_const_str_keys; +extern const bcstring be_const_str_kv; +extern const bcstring be_const_str_last_modified; +extern const bcstring be_const_str_leds; +extern const bcstring be_const_str_length_X20in_X20bits_X20must_X20be_X20between_X200_X20and_X2032; +extern const bcstring be_const_str_light; +extern const bcstring be_const_str_line_dsc; +extern const bcstring be_const_str_list; +extern const bcstring be_const_str_listdir; +extern const bcstring be_const_str_load; +extern const bcstring be_const_str_load_templates; +extern const bcstring be_const_str_local; +extern const bcstring be_const_str_log; +extern const bcstring be_const_str_log10; +extern const bcstring be_const_str_loop; +extern const bcstring be_const_str_lower; +extern const bcstring be_const_str_lv; +extern const bcstring be_const_str_lv_event; +extern const bcstring be_const_str_lv_event_cb; +extern const bcstring be_const_str_lv_obj; +extern const bcstring be_const_str_lv_obj_class; +extern const bcstring be_const_str_lvgl_event_dispatch; +extern const bcstring be_const_str_map; +extern const bcstring be_const_str_math; +extern const bcstring be_const_str_matrix; +extern const bcstring be_const_str_member; +extern const bcstring be_const_str_members; +extern const bcstring be_const_str_memory; +extern const bcstring be_const_str_millis; +extern const bcstring be_const_str_min; +extern const bcstring be_const_str_minute; +extern const bcstring be_const_str_module; +extern const bcstring be_const_str_month; +extern const bcstring be_const_str_name; +extern const bcstring be_const_str_nan; +extern const bcstring be_const_str_nil; +extern const bcstring be_const_str_no_X20GPIO_X20specified_X20for_X20neopixelbus; +extern const bcstring be_const_str_null_cb; +extern const bcstring be_const_str_number; +extern const bcstring be_const_str_obj_class_create_obj; +extern const bcstring be_const_str_obj_event_base; +extern const bcstring be_const_str_offset; +extern const bcstring be_const_str_offseta; +extern const bcstring be_const_str_on; +extern const bcstring be_const_str_onsubmit_X3D_X27return_X20confirm_X28_X22This_X20will_X20cause_X20a_X20restart_X2E_X22_X29_X3B_X27_X3E; +extern const bcstring be_const_str_onsubmit_X3D_X27return_X20confirm_X28_X22This_X20will_X20change_X20the_X20current_X20configuration_X20and_X20cause_X20a_X20restart_X2E_X22_X29_X3B_X27_X3E; +extern const bcstring be_const_str_open; +extern const bcstring be_const_str_out_X20of_X20range; +extern const bcstring be_const_str_p1; +extern const bcstring be_const_str_p2; +extern const bcstring be_const_str_page_autoconf_ctl; +extern const bcstring be_const_str_page_autoconf_mgr; +extern const bcstring be_const_str_param; +extern const bcstring be_const_str_path; +extern const bcstring be_const_str_pc; +extern const bcstring be_const_str_pc_abs; +extern const bcstring be_const_str_pc_rel; +extern const bcstring be_const_str_percentage; +extern const bcstring be_const_str_persist; +extern const bcstring be_const_str_persist_X2E_p_X20is_X20not_X20a_X20map; +extern const bcstring be_const_str_pi; +extern const bcstring be_const_str_pin; +extern const bcstring be_const_str_pin_mode; +extern const bcstring be_const_str_pin_used; +extern const bcstring be_const_str_pixel_count; +extern const bcstring be_const_str_pixel_size; +extern const bcstring be_const_str_pixels_buffer; +extern const bcstring be_const_str_point; +extern const bcstring be_const_str_pop; +extern const bcstring be_const_str_pop_path; +extern const bcstring be_const_str_pow; +extern const bcstring be_const_str_preinit; +extern const bcstring be_const_str_print; +extern const bcstring be_const_str_public_key; +extern const bcstring be_const_str_publish; +extern const bcstring be_const_str_publish_result; +extern const bcstring be_const_str_push; +extern const bcstring be_const_str_push_path; +extern const bcstring be_const_str_quality; +extern const bcstring be_const_str_r; +extern const bcstring be_const_str_rad; +extern const bcstring be_const_str_raise; +extern const bcstring be_const_str_rand; +extern const bcstring be_const_str_range; +extern const bcstring be_const_str_read; +extern const bcstring be_const_str_read12; +extern const bcstring be_const_str_read13; +extern const bcstring be_const_str_read24; +extern const bcstring be_const_str_read32; +extern const bcstring be_const_str_read8; +extern const bcstring be_const_str_read_bytes; +extern const bcstring be_const_str_read_sensors; +extern const bcstring be_const_str_readbytes; +extern const bcstring be_const_str_readline; +extern const bcstring be_const_str_real; +extern const bcstring be_const_str_reapply; +extern const bcstring be_const_str_redirect; +extern const bcstring be_const_str_reduce; +extern const bcstring be_const_str_refr_size; +extern const bcstring be_const_str_register_obj; +extern const bcstring be_const_str_remove; +extern const bcstring be_const_str_remove_cmd; +extern const bcstring be_const_str_remove_driver; +extern const bcstring be_const_str_remove_rule; +extern const bcstring be_const_str_remove_timer; +extern const bcstring be_const_str_reset; +extern const bcstring be_const_str_reset_search; +extern const bcstring be_const_str_resize; +extern const bcstring be_const_str_resolvecmnd; +extern const bcstring be_const_str_resp_cmnd; +extern const bcstring be_const_str_resp_cmnd_done; +extern const bcstring be_const_str_resp_cmnd_error; +extern const bcstring be_const_str_resp_cmnd_failed; +extern const bcstring be_const_str_resp_cmnd_str; +extern const bcstring be_const_str_response_append; +extern const bcstring be_const_str_return; +extern const bcstring be_const_str_return_X20code_X3D_X25i; +extern const bcstring be_const_str_reverse; +extern const bcstring be_const_str_reverse_gamma10; +extern const bcstring be_const_str_rotate; +extern const bcstring be_const_str_round_end; +extern const bcstring be_const_str_round_start; +extern const bcstring be_const_str_rtc; +extern const bcstring be_const_str_rule; +extern const bcstring be_const_str_run; +extern const bcstring be_const_str_run_bat; +extern const bcstring be_const_str_run_deferred; +extern const bcstring be_const_str_running; +extern const bcstring be_const_str_save; +extern const bcstring be_const_str_save_before_restart; +extern const bcstring be_const_str_scale_uint; +extern const bcstring be_const_str_scan; +extern const bcstring be_const_str_search; +extern const bcstring be_const_str_sec; +extern const bcstring be_const_str_seg7_font; +extern const bcstring be_const_str_select; +extern const bcstring be_const_str_serial; +extern const bcstring be_const_str_set; +extern const bcstring be_const_str_set_alternate; +extern const bcstring be_const_str_set_auth; +extern const bcstring be_const_str_set_bri; +extern const bcstring be_const_str_set_chg_current; +extern const bcstring be_const_str_set_dc_voltage; +extern const bcstring be_const_str_set_dcdc_enable; +extern const bcstring be_const_str_set_first_time; +extern const bcstring be_const_str_set_height; +extern const bcstring be_const_str_set_ldo_enable; +extern const bcstring be_const_str_set_ldo_voltage; +extern const bcstring be_const_str_set_light; +extern const bcstring be_const_str_set_matrix_pixel_color; +extern const bcstring be_const_str_set_percentage; +extern const bcstring be_const_str_set_pixel_color; +extern const bcstring be_const_str_set_power; +extern const bcstring be_const_str_set_style_bg_color; +extern const bcstring be_const_str_set_style_line_color; +extern const bcstring be_const_str_set_style_pad_right; +extern const bcstring be_const_str_set_style_text_font; +extern const bcstring be_const_str_set_text; +extern const bcstring be_const_str_set_time; +extern const bcstring be_const_str_set_timeouts; +extern const bcstring be_const_str_set_timer; +extern const bcstring be_const_str_set_useragent; +extern const bcstring be_const_str_set_width; +extern const bcstring be_const_str_set_x; +extern const bcstring be_const_str_set_y; +extern const bcstring be_const_str_setbits; +extern const bcstring be_const_str_seti; +extern const bcstring be_const_str_setitem; +extern const bcstring be_const_str_setmember; +extern const bcstring be_const_str_setrange; +extern const bcstring be_const_str_settings; +extern const bcstring be_const_str_shared_key; +extern const bcstring be_const_str_show; +extern const bcstring be_const_str_sin; +extern const bcstring be_const_str_sinh; +extern const bcstring be_const_str_size; +extern const bcstring be_const_str_skip; +extern const bcstring be_const_str_solidified; +extern const bcstring be_const_str_split; +extern const bcstring be_const_str_sqrt; +extern const bcstring be_const_str_srand; +extern const bcstring be_const_str_start; +extern const bcstring be_const_str_state; +extern const bcstring be_const_str_static; +extern const bcstring be_const_str_stop; +extern const bcstring be_const_str_stop_iteration; +extern const bcstring be_const_str_str; +extern const bcstring be_const_str_strftime; +extern const bcstring be_const_str_string; +extern const bcstring be_const_str_strip; +extern const bcstring be_const_str_strptime; +extern const bcstring be_const_str_super; +extern const bcstring be_const_str_sys; +extern const bcstring be_const_str_tag; +extern const bcstring be_const_str_tan; +extern const bcstring be_const_str_tanh; +extern const bcstring be_const_str_target; +extern const bcstring be_const_str_target_search; +extern const bcstring be_const_str_tasmota; +extern const bcstring be_const_str_tasmota_X2Eget_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eget_X28_X29; +extern const bcstring be_const_str_tasmota_X2Eset_light_X28_X29_X20is_X20deprecated_X2C_X20use_X20light_X2Eset_X28_X29; +extern const bcstring be_const_str_tcpclient; +extern const bcstring be_const_str_tele; +extern const bcstring be_const_str_the_X20second_X20argument_X20is_X20not_X20a_X20function; +extern const bcstring be_const_str_time_dump; +extern const bcstring be_const_str_time_reached; +extern const bcstring be_const_str_time_str; +extern const bcstring be_const_str_to_gamma; +extern const bcstring be_const_str_tob64; +extern const bcstring be_const_str_tolower; +extern const bcstring be_const_str_tomap; +extern const bcstring be_const_str_top; +extern const bcstring be_const_str_toptr; +extern const bcstring be_const_str_tostring; +extern const bcstring be_const_str_toupper; +extern const bcstring be_const_str_tr; +extern const bcstring be_const_str_traceback; +extern const bcstring be_const_str_true; +extern const bcstring be_const_str_try; +extern const bcstring be_const_str_try_rule; +extern const bcstring be_const_str_type; +extern const bcstring be_const_str_unknown_X20instruction; +extern const bcstring be_const_str_update; +extern const bcstring be_const_str_upper; +extern const bcstring be_const_str_url_encode; +extern const bcstring be_const_str_v; +extern const bcstring be_const_str_value; +extern const bcstring be_const_str_value_error; +extern const bcstring be_const_str_valuer_error; +extern const bcstring be_const_str_var; +extern const bcstring be_const_str_w; +extern const bcstring be_const_str_wd; +extern const bcstring be_const_str_web_add_button; +extern const bcstring be_const_str_web_add_config_button; +extern const bcstring be_const_str_web_add_console_button; +extern const bcstring be_const_str_web_add_handler; +extern const bcstring be_const_str_web_add_main_button; +extern const bcstring be_const_str_web_add_management_button; +extern const bcstring be_const_str_web_send; +extern const bcstring be_const_str_web_send_decimal; +extern const bcstring be_const_str_web_sensor; +extern const bcstring be_const_str_webclient; +extern const bcstring be_const_str_webserver; +extern const bcstring be_const_str_while; +extern const bcstring be_const_str_widget_cb; +extern const bcstring be_const_str_widget_constructor; +extern const bcstring be_const_str_widget_ctor_cb; +extern const bcstring be_const_str_widget_ctor_impl; +extern const bcstring be_const_str_widget_destructor; +extern const bcstring be_const_str_widget_dtor_cb; +extern const bcstring be_const_str_widget_dtor_impl; +extern const bcstring be_const_str_widget_editable; +extern const bcstring be_const_str_widget_event; +extern const bcstring be_const_str_widget_event_cb; +extern const bcstring be_const_str_widget_event_impl; +extern const bcstring be_const_str_widget_group_def; +extern const bcstring be_const_str_widget_height_def; +extern const bcstring be_const_str_widget_instance_size; +extern const bcstring be_const_str_widget_struct_by_class; +extern const bcstring be_const_str_widget_struct_default; +extern const bcstring be_const_str_widget_width_def; +extern const bcstring be_const_str_width; +extern const bcstring be_const_str_width_def; +extern const bcstring be_const_str_wifi; +extern const bcstring be_const_str_wire; +extern const bcstring be_const_str_wire1; +extern const bcstring be_const_str_wire2; +extern const bcstring be_const_str_wire_scan; +extern const bcstring be_const_str_write; +extern const bcstring be_const_str_write8; +extern const bcstring be_const_str_write_bit; +extern const bcstring be_const_str_write_bytes; +extern const bcstring be_const_str_write_file; +extern const bcstring be_const_str_write_gpio; +extern const bcstring be_const_str_x; +extern const bcstring be_const_str_x1; +extern const bcstring be_const_str_y; +extern const bcstring be_const_str_y1; +extern const bcstring be_const_str_year; +extern const bcstring be_const_str_yield; +extern const bcstring be_const_str_zero; +extern const bcstring be_const_str_zip; diff --git a/lib/libesp32/berry/generate/be_const_strtab_def.h b/lib/libesp32/berry/generate/be_const_strtab_def.h new file mode 100644 index 000000000..4c195c96b --- /dev/null +++ b/lib/libesp32/berry/generate/be_const_strtab_def.h @@ -0,0 +1,1109 @@ +be_define_const_str(, "", 2166136261u, 0, 0, NULL); +be_define_const_str(_X0A, "\n", 252472541u, 0, 1, &be_const_str_Unknown_X20command); +be_define_const_str(_X20, " ", 621580159u, 0, 1, &be_const_str_geti); +be_define_const_str(_X21_X3D, "!=", 2428715011u, 0, 2, &be_const_str_asstring); +be_define_const_str(_X21_X3D_X3D, "!==", 559817114u, 0, 3, &be_const_str_type); +be_define_const_str(_X23, "#", 638357778u, 0, 1, &be_const_str_CFG_X3A_X20no_X20_X27_X2A_X2Eautoconf_X27_X20file_X20found); +be_define_const_str(_X23autoexec_X2Ebat, "#autoexec.bat", 3382890497u, 0, 13, &be_const_str_arg_size); +be_define_const_str(_X23autoexec_X2Ebe, "#autoexec.be", 1181757091u, 0, 12, &be_const_str_file_X20extension_X20is_X20not_X20_X27_X2Ebe_X27_X20or_X20_X27_X2Ebec_X27); +be_define_const_str(_X23display_X2Eini, "#display.ini", 182218220u, 0, 12, &be_const_str___lower__); +be_define_const_str(_X23init_X2Ebat, "#init.bat", 3297595077u, 0, 9, &be_const_str_SERIAL_7O2); +be_define_const_str(_X23preinit_X2Ebe, "#preinit.be", 687035716u, 0, 11, &be_const_str_SERIAL_8O2); +be_define_const_str(_X2502d_X25s_X2502d, "%02d%s%02d", 1587999717u, 0, 10, &be_const_str_yield); +be_define_const_str(_X2504d_X2D_X2502d_X2D_X2502dT_X2502d_X3A_X2502d_X3A_X2502d, "%04d-%02d-%02dT%02d:%02d:%02d", 3425528601u, 0, 29, &be_const_str__global_def); +be_define_const_str(_X25s_X2Eautoconf, "%s.autoconf", 3560383524u, 0, 11, &be_const_str_every_second); +be_define_const_str(_X26lt_X3BError_X3A_X20apply_X20new_X20or_X20remove_X26gt_X3B, "<Error: apply new or remove>", 2855507949u, 0, 34, &be_const_str_add_driver); +be_define_const_str(_X26lt_X3BNone_X26gt_X3B, "<None>", 2602165498u, 0, 12, &be_const_str_rand); +be_define_const_str(_X28_X29, "()", 685372826u, 0, 2, &be_const_str__X3Cinstance_X3A_X20_X25s_X28_X25s_X2C_X20_X25s_X2C_X20_X25s_X29); +be_define_const_str(_X2B, "+", 772578730u, 0, 1, &be_const_str_gpio); +be_define_const_str(_X2C, ",", 688690635u, 0, 1, &be_const_str_add_cmd); +be_define_const_str(_X2D_X2D_X3A_X2D_X2D, "--:--", 1370615441u, 0, 5, &be_const_str_AudioOutputI2S); +be_define_const_str(_X2E, ".", 722245873u, 0, 1, NULL); +be_define_const_str(_X2E_X2E, "..", 2748622605u, 0, 2, &be_const_str__X2Ep2); +be_define_const_str(_X2Eautoconf, ".autoconf", 2524679088u, 0, 9, NULL); +be_define_const_str(_X2Ebe, ".be", 1325797348u, 0, 3, &be_const_str_sinh); +be_define_const_str(_X2Ebec, ".bec", 3985273221u, 0, 4, &be_const_str__debug_present); +be_define_const_str(_X2Elen, ".len", 850842136u, 0, 4, NULL); +be_define_const_str(_X2Ep, ".p", 1171526419u, 0, 2, &be_const_str_COLOR_WHITE); +be_define_const_str(_X2Ep1, ".p1", 249175686u, 0, 3, &be_const_str_sin); +be_define_const_str(_X2Ep2, ".p2", 232398067u, 0, 3, &be_const_str_json_fdump_map); +be_define_const_str(_X2Esize, ".size", 1965188224u, 0, 5, &be_const_str__X2Fac); +be_define_const_str(_X2Etapp, ".tapp", 1363391594u, 0, 5, NULL); +be_define_const_str(_X2Ew, ".w", 1255414514u, 0, 2, &be_const_str_member); +be_define_const_str(_X2F, "/", 705468254u, 0, 1, &be_const_str_None); +be_define_const_str(_X2F_X2Eautoconf, "/.autoconf", 2212074393u, 0, 10, &be_const_str_set_dc_voltage); +be_define_const_str(_X2F_X3Frst_X3D, "/?rst=", 580074707u, 0, 6, &be_const_str_AES_GCM); +be_define_const_str(_X2Fac, "/ac", 3904651978u, 0, 3, &be_const_str_get_current_module_path); +be_define_const_str(_X3A, ":", 1057798253u, 0, 1, &be_const_str_json_fdump); +be_define_const_str(_X3C, "<", 957132539u, 0, 1, NULL); +be_define_const_str(_X3C_X2Fform_X3E_X3C_X2Fp_X3E, "

", 3546571739u, 0, 11, &be_const_str_atan); +be_define_const_str(_X3C_X2Fselect_X3E_X3Cp_X3E_X3C_X2Fp_X3E, "

", 1863865923u, 0, 16, NULL); +be_define_const_str(_X3C_X3D, "<=", 2499223986u, 0, 2, &be_const_str_HTTP_POST); +be_define_const_str(_X3Cbutton_X20name_X3D_X27reapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3ERe_X2Dapply_X20current_X20configuration_X3C_X2Fbutton_X3E, "", 3147934216u, 0, 82, &be_const_str_Wire); +be_define_const_str(_X3Cbutton_X20name_X3D_X27zipapply_X27_X20class_X3D_X27button_X20bgrn_X27_X3EApply_X20configuration_X3C_X2Fbutton_X3E, "", 1205771629u, 0, 72, &be_const_str_color); +be_define_const_str(_X3Cfieldset_X3E_X3Cstyle_X3E_X2Ebdis_X7Bbackground_X3A_X23888_X3B_X7D_X2Ebdis_X3Ahover_X7Bbackground_X3A_X23888_X3B_X7D_X3C_X2Fstyle_X3E, "
", 842307168u, 0, 77, &be_const_str_set_power); +be_define_const_str(_X3Cinstance_X3A_X20_X25s_X28_X25s_X2C_X20_X25s_X2C_X20_X25s_X29, "Choose a device configuration:
", 1336654704u, 0, 49, &be_const_str_bus); +be_define_const_str(_X3Clambda_X3E, "", 607256038u, 0, 8, &be_const_str_point); +be_define_const_str(_X3Clegend_X3E_X3Cb_X20title_X3D_X27Autoconfiguration_X27_X3E_X26nbsp_X3BCurrent_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E, " Current auto-configuration", 4212500780u, 0, 82, &be_const_str_get_warning_level); +be_define_const_str(_X3Clegend_X3E_X3Cb_X20title_X3D_X27New_X20autoconf_X27_X3E_X26nbsp_X3BSelect_X20new_X20auto_X2Dconfiguration_X3C_X2Fb_X3E_X3C_X2Flegend_X3E, " Select new auto-configuration", 1926223891u, 0, 80, &be_const_str_get_vbus_current); +be_define_const_str(_X3Coption_X20value_X3D_X27_X25s_X27_X3E_X25s_X3C_X2Foption_X3E, "", 510303524u, 0, 30, &be_const_str_cb_event_closure); +be_define_const_str(_X3Coption_X20value_X3D_X27reset_X27_X3E_X26lt_X3BRemove_X20autoconf_X26gt_X3B_X3C_X2Foption_X3E, "", 3994619755u, 0, 54, NULL); +be_define_const_str(_X3Cp_X20style_X3D_X27width_X3A340px_X3B_X27_X3E_X3Cb_X3EException_X3A_X3C_X2Fb_X3E_X3Cbr_X3E_X27_X25s_X27_X3Cbr_X3E_X25s_X3C_X2Fp_X3E, "

Exception:
'%s'
%s

", 4252565082u, 0, 59, &be_const_str_arg); +be_define_const_str(_X3Cp_X3E_X3C_X2Fp_X3E_X3C_X2Ffieldset_X3E_X3Cp_X3E_X3C_X2Fp_X3E, "

", 2052843416u, 0, 25, &be_const_str_area); +be_define_const_str(_X3Cp_X3E_X3Cform_X20id_X3Dac_X20action_X3D_X27ac_X27_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20method_X3D_X27get_X27_X3E_X3Cbutton_X3E_X26_X23129668_X3B_X20Auto_X2Dconfiguration_X3C_X2Fbutton_X3E_X3C_X2Fform_X3E_X3C_X2Fp_X3E, "

", 452285201u, 0, 120, NULL); +be_define_const_str(_X3Cp_X3E_X3Cform_X20id_X3Dreapply_X20style_X3D_X27display_X3A_X20block_X3B_X27_X20action_X3D_X27_X2Fac_X27_X20method_X3D_X27post_X27_X20, "

 (This feature requires an internet connection)

", 2719266486u, 0, 74, &be_const_str_register_obj); +be_define_const_str(_X3Cp_X3ECurrent_X20configuration_X3A_X20_X3C_X2Fp_X3E_X3Cp_X3E_X3Cb_X3E_X25s_X3C_X2Fb_X3E_X3C_X2Fp_X3E, "

Current configuration:

%s

", 4115655761u, 0, 46, &be_const_str_get_cb_list); +be_define_const_str(_X3Cselect_X20name_X3D_X27zip_X27_X3E, "