diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c index 684174821..6051d11d8 100644 --- a/lib/libesp32/berry/default/be_modtab.c +++ b/lib/libesp32/berry/default/be_modtab.c @@ -146,51 +146,113 @@ BERRY_LOCAL const bntvmodule* const be_module_table[] = { #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_tasmota_log_reader_class(bvm *vm); -extern void be_load_light_state_class(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_Trigger_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_udp_lib(bvm *vm); -extern void be_load_crypto_lib(bvm *vm); -extern void be_load_ccronexpr_class(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); +be_extern_native_class(tasmota); +be_extern_native_class(Trigger); +be_extern_native_class(Driver); +be_extern_native_class(ctypes_bytes); +be_extern_native_class(ctypes_bytes_dyn); +be_extern_native_class(serial); +be_extern_native_class(ccronexpr); +be_extern_native_class(tasmota_log_reader); +be_extern_native_class(light_state); +be_extern_native_class(Wire); +be_extern_native_class(I2C_Driver); +be_extern_native_class(AXP192); +be_extern_native_class(OneWire); +be_extern_native_class(Leds_ntv); +be_extern_native_class(Leds); +be_extern_native_class(Leds_animator); +be_extern_native_class(AudioOutput); +be_extern_native_class(AudioGenerator); +be_extern_native_class(AudioFileSource); +be_extern_native_class(AudioOutputI2S); +be_extern_native_class(AudioGeneratorWAV); +be_extern_native_class(AudioGeneratorMP3); +be_extern_native_class(AudioFileSourceFS); +be_extern_native_class(AudioOpusDecoder); +be_extern_native_class(md5); +be_extern_native_class(udp); +be_extern_native_class(webclient); +be_extern_native_class(tcpclient); +// LVGL core classes +be_extern_native_class(lv_color); +be_extern_native_class(lv_font); +be_extern_native_class(LVGL_glob); +// LVGL custom classes +be_extern_native_class(lv_signal_bars); +be_extern_native_class(lv_wifi_bars); +be_extern_native_class(lv_wifi_bars_icon); +be_extern_native_class(lv_signal_arcs); +be_extern_native_class(lv_wifi_arcs); +be_extern_native_class(lv_wifi_arcs_icon); +be_extern_native_class(lv_clock_icon); -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); -extern void be_load_driver_audio_opus_decoder(bvm *vm); +BERRY_LOCAL bclass_array be_class_table = { + /* first list are direct classes */ + &be_native_class(tasmota), + &be_native_class(Trigger), + &be_native_class(Driver), + &be_native_class(serial), + &be_native_class(ccronexpr), + &be_native_class(ctypes_bytes), + &be_native_class(ctypes_bytes_dyn), + &be_native_class(tasmota_log_reader), +#ifdef USE_LIGHT + &be_native_class(light_state), #endif +#if defined(USE_ONEWIRE) || defined(USE_DS18x20) + &be_native_class(OneWire), +#endif +#ifdef USE_I2C + &be_native_class(Wire), + &be_native_class(I2C_Driver), + &be_native_class(AXP192), +#endif // USE_I2C + &be_native_class(md5), +#ifdef USE_WEBCLIENT + &be_native_class(udp), + &be_native_class(webclient), + &be_native_class(tcpclient), +#endif // USE_WEBCLIENT +#ifdef USE_WS2812 + &be_native_class(Leds_ntv), + &be_native_class(Leds), + &be_native_class(Leds_animator), +#endif // USE_WS2812 #ifdef USE_LVGL -#include "lv_berry.h" -// 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 + &be_native_class(LVGL_glob), + + &be_native_class(lv_signal_bars), + &be_native_class(lv_wifi_bars), + &be_native_class(lv_wifi_bars_icon), + &be_native_class(lv_signal_arcs), + &be_native_class(lv_wifi_arcs), + &be_native_class(lv_wifi_arcs_icon), + &be_native_class(lv_clock_icon), +#endif // USE_LVGL + +#ifdef USE_I2S_AUDIO_BERRY + &be_native_class(AudioOutput), + &be_native_class(AudioGenerator), + &be_native_class(AudioFileSource), + &be_native_class(AudioOutputI2S), + &be_native_class(AudioGeneratorWAV), + &be_native_class(AudioGeneratorMP3), +#ifdef USE_UFILESYS + &be_native_class(AudioFileSourceFS), +#endif // USE_UFILESYS + &be_native_class(AudioOpusDecoder), +#endif // USE_I2S_AUDIO_BERRY + NULL, /* do not remove */ +}; + +extern void be_load_crypto_lib(bvm *vm); +extern void be_load_ctypes_energy_definitions_lib(bvm *vm); /* this code loads the native class definitions */ BERRY_API void be_load_custom_libs(bvm *vm) @@ -200,61 +262,15 @@ BERRY_API void be_load_custom_libs(bvm *vm) /* add here custom libs */ #if !BE_USE_PRECOMPILED_OBJECT /* be_load_xxxlib(vm); */ -#endif - be_load_Trigger_class(vm); - be_load_tasmota_ntvlib(vm); - be_load_tasmota_log_reader_class(vm); - be_load_Driver_class(vm); - be_load_md5_lib(vm); - be_load_serial_lib(vm); - be_load_ctypes_lib(vm); - be_load_ccronexpr_class(vm); -#ifdef USE_LIGHT - be_load_light_state_class(vm); #endif #ifdef USE_ALEXA_AVS - be_load_crypto_lib(vm); + be_load_crypto_lib(vm); // sub-module #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); + be_load_ctypes_energy_definitions_lib(vm); // ctype class #endif // USE_ENERGY_SENSOR -#ifdef USE_WEBCLIENT - be_load_webclient_lib(vm); - be_load_tcpclient_lib(vm); - be_load_udp_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); - be_load_driver_audio_opus_decoder(vm); -#endif -#ifdef USE_LVGL - // LVGL - be_load_lvgl_classes(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 #if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32) be_load_MI32_class(vm); be_load_BLE_class(vm); #endif //USE_MI_ESP32 } -#endif diff --git a/lib/libesp32/berry/generate/be_const_strtab.h b/lib/libesp32/berry/generate/be_const_strtab.h index fa357f293..2076be670 100644 --- a/lib/libesp32/berry/generate/be_const_strtab.h +++ b/lib/libesp32/berry/generate/be_const_strtab.h @@ -9,6 +9,7 @@ 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_AudioOpusDecoder; extern const bcstring be_const_str_AudioOutput; extern const bcstring be_const_str_AudioOutputI2S; extern const bcstring be_const_str_Auto_X2Dconfiguration; @@ -70,7 +71,6 @@ 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_OpusDecoder; extern const bcstring be_const_str_PART_MAIN; extern const bcstring be_const_str_POST; extern const bcstring be_const_str_Parameter_X20error; diff --git a/lib/libesp32/berry/generate/be_const_strtab_def.h b/lib/libesp32/berry/generate/be_const_strtab_def.h index e4ee06877..4f9fea259 100644 --- a/lib/libesp32/berry/generate/be_const_strtab_def.h +++ b/lib/libesp32/berry/generate/be_const_strtab_def.h @@ -79,6 +79,7 @@ be_define_const_str(AudioFileSourceFS, "AudioFileSourceFS", 1839147653u, 0, 17, be_define_const_str(AudioGenerator, "AudioGenerator", 1839297342u, 0, 14, &be_const_str_full_state); be_define_const_str(AudioGeneratorMP3, "AudioGeneratorMP3", 2199818488u, 0, 17, &be_const_str_files); be_define_const_str(AudioGeneratorWAV, "AudioGeneratorWAV", 2746509368u, 0, 17, &be_const_str_EVENT_DRAW_PART_BEGIN); +be_define_const_str(AudioOpusDecoder, "AudioOpusDecoder", 1187272062u, 0, 16, &be_const_str_coord_arr); be_define_const_str(AudioOutput, "AudioOutput", 3257792048u, 0, 11, NULL); be_define_const_str(AudioOutputI2S, "AudioOutputI2S", 638031784u, 0, 14, &be_const_str_obj_class_create_obj); be_define_const_str(Auto_X2Dconfiguration, "Auto-configuration", 1665006109u, 0, 18, &be_const_str_EXTERNAL_I2S); @@ -140,7 +141,6 @@ be_define_const_str(MD5, "MD5", 1935726387u, 0, 3, &be_const_str_ctypes_bytes_dy be_define_const_str(None, "None", 810547195u, 0, 4, &be_const_str_dump); be_define_const_str(OPTION_A, "OPTION_A", 1133299440u, 0, 8, &be_const_str_signal_bars); be_define_const_str(OneWire, "OneWire", 2298990722u, 0, 7, &be_const_str_font_montserrat); -be_define_const_str(OpusDecoder, "OpusDecoder", 3618742074u, 0, 11, &be_const_str_get_style_pad_right); be_define_const_str(PART_MAIN, "PART_MAIN", 2473491508u, 0, 9, &be_const_str_Tasmota); be_define_const_str(POST, "POST", 1929554311u, 0, 4, NULL); be_define_const_str(Parameter_X20error, "Parameter error", 3840042038u, 0, 15, &be_const_str_find); @@ -974,7 +974,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str_set_mode_ct, (const bstring *)&be_const_str__X3Coption_X20value_X3D_X27_X25s_X27_X3E_X25s_X3C_X2Foption_X3E, (const bstring *)&be_const_str__X2504d_X2D_X2502d_X2D_X2502dT_X2502d_X3A_X2502d_X3A_X2502d, - (const bstring *)&be_const_str_coord_arr, + (const bstring *)&be_const_str_AudioOpusDecoder, (const bstring *)&be_const_str_sat, (const bstring *)&be_const_str__X2Elen, (const bstring *)&be_const_str_ALIGN_BOTTOM_MID, @@ -1170,7 +1170,7 @@ static const bstring* const m_string_table[] = { (const bstring *)&be_const_str__settings_def, (const bstring *)&be_const_str_AudioOutput, (const bstring *)&be_const_str_BRY_X3A_X20failed_X20to_X20load_X20_persist_X2Ejson, - (const bstring *)&be_const_str_OpusDecoder, + (const bstring *)&be_const_str_get_style_pad_right, (const bstring *)&be_const_str_content_stop, NULL, NULL, diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSource.h similarity index 59% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSource.h index f3d59effc..e2d14eba6 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSource.h @@ -1,16 +1,16 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_file_source_map) { +static be_define_const_map_slots(be_class_AudioFileSource_map) { { be_const_key(_X2Ep, -1), be_const_var(0) }, }; static be_define_const_map( - be_class_audio_file_source_map, + be_class_AudioFileSource_map, 1 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_file_source, + be_class_AudioFileSource, 1, NULL, AudioFileSource diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source_fs.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSourceFS.h similarity index 60% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source_fs.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSourceFS.h index 6605ba27e..146d06390 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_file_source_fs.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioFileSourceFS.h @@ -1,18 +1,18 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_file_source_fs_map) { +static be_define_const_map_slots(be_class_AudioFileSourceFS_map) { { be_const_key(deinit, -1), be_const_func(i2s_file_source_fs_deinit) }, { be_const_key(init, -1), be_const_func(i2s_file_source_fs_init) }, }; static be_define_const_map( - be_class_audio_file_source_fs_map, + be_class_AudioFileSourceFS_map, 2 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_file_source_fs, + be_class_AudioFileSourceFS, 0, - (bclass *)&be_class_audio_file_source, + (bclass *)&be_class_AudioFileSource, AudioFileSourceFS ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGenerator.h similarity index 60% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_generator.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioGenerator.h index 41b50f180..db45e74cf 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGenerator.h @@ -1,16 +1,16 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_generator_map) { +static be_define_const_map_slots(be_class_AudioGenerator_map) { { be_const_key(_X2Ep, -1), be_const_var(0) }, }; static be_define_const_map( - be_class_audio_generator_map, + be_class_AudioGenerator_map, 1 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_generator, + be_class_AudioGenerator, 1, NULL, AudioGenerator diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_mp3.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorMP3.h similarity index 76% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_mp3.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorMP3.h index dbe5f0d4f..b5bd80aa5 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_mp3.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorMP3.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_generator_mp3_map) { +static be_define_const_map_slots(be_class_AudioGeneratorMP3_map) { { be_const_key(begin, -1), be_const_func(i2s_generator_mp3_begin) }, { be_const_key(loop, -1), be_const_func(i2s_generator_mp3_loop) }, { be_const_key(isrunning, -1), be_const_func(i2s_generator_mp3_isrunning) }, @@ -10,13 +10,13 @@ static be_define_const_map_slots(be_class_audio_generator_mp3_map) { }; static be_define_const_map( - be_class_audio_generator_mp3_map, + be_class_AudioGeneratorMP3_map, 6 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_generator_mp3, + be_class_AudioGeneratorMP3, 0, - (bclass *)&be_class_audio_generator, + (bclass *)&be_class_AudioGenerator, AudioGeneratorMP3 ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_wav.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorWAV.h similarity index 76% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_wav.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorWAV.h index f08522407..23d2136fe 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_generator_wav.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioGeneratorWAV.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_generator_wav_map) { +static be_define_const_map_slots(be_class_AudioGeneratorWAV_map) { { be_const_key(begin, -1), be_const_func(i2s_generator_wav_begin) }, { be_const_key(loop, -1), be_const_func(i2s_generator_wav_loop) }, { be_const_key(isrunning, -1), be_const_func(i2s_generator_wav_isrunning) }, @@ -10,13 +10,13 @@ static be_define_const_map_slots(be_class_audio_generator_wav_map) { }; static be_define_const_map( - be_class_audio_generator_wav_map, + be_class_AudioGeneratorWAV_map, 6 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_generator_wav, + be_class_AudioGeneratorWAV, 0, - (bclass *)&be_class_audio_generator, + (bclass *)&be_class_AudioGenerator, AudioGeneratorWAV ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_opus_decoder.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOpusDecoder.h similarity index 72% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_opus_decoder.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioOpusDecoder.h index cf6611e28..1c3c67640 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_opus_decoder.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOpusDecoder.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_opus_decoder_map) { +static be_define_const_map_slots(be_class_AudioOpusDecoder_map) { { be_const_key(deinit, -1), be_const_func(be_audio_opus_decoder_deinit) }, { be_const_key(decode, 2), be_const_func(be_audio_opus_decoder_decode) }, { be_const_key(_X2Ep, -1), be_const_var(0) }, @@ -8,13 +8,13 @@ static be_define_const_map_slots(be_class_audio_opus_decoder_map) { }; static be_define_const_map( - be_class_audio_opus_decoder_map, + be_class_AudioOpusDecoder_map, 4 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_opus_decoder, + be_class_AudioOpusDecoder, 1, NULL, - OpusDecoder + AudioOpusDecoder ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_output.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOutput.h similarity index 89% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_output.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioOutput.h index 7cf34b574..4a43b2e18 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_output.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOutput.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_output_map) { +static be_define_const_map_slots(be_class_AudioOutput_map) { { be_const_key(set_bits_per_sample, -1), be_const_func(be_audio_output_set_bits_per_sample) }, { be_const_key(flush, -1), be_const_func(be_audio_output_flush) }, { be_const_key(consume_stereo, -1), be_const_func(be_audio_output_consume_stereo) }, @@ -16,12 +16,12 @@ static be_define_const_map_slots(be_class_audio_output_map) { }; static be_define_const_map( - be_class_audio_output_map, + be_class_AudioOutput_map, 12 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_output, + be_class_AudioOutput, 1, NULL, AudioOutput diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_audio_output_i2s.h b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOutputI2S.h similarity index 77% rename from lib/libesp32/berry/generate/be_fixed_be_class_audio_output_i2s.h rename to lib/libesp32/berry/generate/be_fixed_be_class_AudioOutputI2S.h index 73d8f5954..4fce2f802 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_audio_output_i2s.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_AudioOutputI2S.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_audio_output_i2s_map) { +static be_define_const_map_slots(be_class_AudioOutputI2S_map) { { be_const_key(INTERNAL_PDM, -1), be_const_int(AudioOutputI2S::INTERNAL_PDM) }, { be_const_key(INTERNAL_DAC, 2), be_const_int(AudioOutputI2S::INTERNAL_DAC) }, { be_const_key(init, -1), be_const_func(i2s_output_i2s_init) }, @@ -10,13 +10,13 @@ static be_define_const_map_slots(be_class_audio_output_i2s_map) { }; static be_define_const_map( - be_class_audio_output_i2s_map, + be_class_AudioOutputI2S_map, 6 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_audio_output_i2s, + be_class_AudioOutputI2S, 0, - (bclass *)&be_class_audio_output, + (bclass *)&be_class_AudioOutput, AudioOutputI2S ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_onewire.h b/lib/libesp32/berry/generate/be_fixed_be_class_OneWire.h similarity index 87% rename from lib/libesp32/berry/generate/be_fixed_be_class_tasmota_onewire.h rename to lib/libesp32/berry/generate/be_fixed_be_class_OneWire.h index a2619941b..c0cd49893 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_onewire.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_OneWire.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_tasmota_onewire_map) { +static be_define_const_map_slots(be_class_OneWire_map) { { be_const_key(reset, -1), be_const_func(b_onewire_reset) }, { be_const_key(search, 10), be_const_func(b_onewire_search) }, { be_const_key(depower, -1), be_const_func(b_onewire_depower) }, @@ -16,12 +16,12 @@ static be_define_const_map_slots(be_class_tasmota_onewire_map) { }; static be_define_const_map( - be_class_tasmota_onewire_map, + be_class_OneWire_map, 12 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_tasmota_onewire, + be_class_OneWire, 1, NULL, OneWire diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_wire.h b/lib/libesp32/berry/generate/be_fixed_be_class_Wire.h similarity index 90% rename from lib/libesp32/berry/generate/be_fixed_be_class_tasmota_wire.h rename to lib/libesp32/berry/generate/be_fixed_be_class_Wire.h index be34d40b0..5d2b8812e 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_wire.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_Wire.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_tasmota_wire_map) { +static be_define_const_map_slots(be_class_Wire_map) { { be_const_key(init, -1), be_const_func(b_wire_init) }, { be_const_key(_available, -1), be_const_func(b_wire_available) }, { be_const_key(bus, -1), be_const_var(0) }, @@ -19,12 +19,12 @@ static be_define_const_map_slots(be_class_tasmota_wire_map) { }; static be_define_const_map( - be_class_tasmota_wire_map, + be_class_Wire_map, 15 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_tasmota_wire, + be_class_Wire, 1, NULL, Wire diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_ctypes.h b/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes.h similarity index 81% rename from lib/libesp32/berry/generate/be_fixed_be_class_ctypes.h rename to lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes.h index cf75e6d9a..1e2f409c6 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_ctypes.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_ctypes_map) { +static be_define_const_map_slots(be_class_ctypes_bytes_map) { { be_const_key(_def, 5), be_const_nil() }, { be_const_key(setmember, 0), be_const_func(be_ctypes_setmember) }, { be_const_key(copy, -1), be_const_func(be_ctypes_copy) }, @@ -10,12 +10,12 @@ static be_define_const_map_slots(be_class_ctypes_map) { }; static be_define_const_map( - be_class_ctypes_map, + be_class_ctypes_bytes_map, 6 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_ctypes, + be_class_ctypes_bytes, 0, (bclass *)&be_class_bytes, ctypes_bytes diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_dyn.h b/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes_dyn.h similarity index 60% rename from lib/libesp32/berry/generate/be_fixed_be_class_ctypes_dyn.h rename to lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes_dyn.h index 101f9d66a..1214f7d1f 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_dyn.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_ctypes_bytes_dyn.h @@ -1,18 +1,18 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_ctypes_dyn_map) { +static be_define_const_map_slots(be_class_ctypes_bytes_dyn_map) { { be_const_key(_def, -1), be_const_var(0) }, { be_const_key(init, 0), be_const_func(be_ctypes_dyn_init) }, }; static be_define_const_map( - be_class_ctypes_dyn_map, + be_class_ctypes_bytes_dyn_map, 2 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_ctypes_dyn, + be_class_ctypes_bytes_dyn, 1, - (bclass *)&be_class_ctypes, + (bclass *)&be_class_ctypes_bytes, ctypes_bytes_dyn ); diff --git a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_serial.h b/lib/libesp32/berry/generate/be_fixed_be_class_serial.h similarity index 94% rename from lib/libesp32/berry/generate/be_fixed_be_class_tasmota_serial.h rename to lib/libesp32/berry/generate/be_fixed_be_class_serial.h index fab58e1f6..cf3db5156 100644 --- a/lib/libesp32/berry/generate/be_fixed_be_class_tasmota_serial.h +++ b/lib/libesp32/berry/generate/be_fixed_be_class_serial.h @@ -1,6 +1,6 @@ #include "be_constobj.h" -static be_define_const_map_slots(be_class_tasmota_serial_map) { +static be_define_const_map_slots(be_class_serial_map) { { be_const_key(SERIAL_5E2, 3), be_const_int(SERIAL_5E2) }, { be_const_key(SERIAL_8E1, -1), be_const_int(SERIAL_8E1) }, { be_const_key(SERIAL_8O1, 22), be_const_int(SERIAL_8O1) }, @@ -35,12 +35,12 @@ static be_define_const_map_slots(be_class_tasmota_serial_map) { }; static be_define_const_map( - be_class_tasmota_serial_map, + be_class_serial_map, 31 ); BE_EXPORT_VARIABLE be_define_const_class( - be_class_tasmota_serial, + be_class_serial, 1, NULL, serial diff --git a/lib/libesp32/berry/src/be_var.c b/lib/libesp32/berry/src/be_var.c index 4fee144cd..59f50f28b 100644 --- a/lib/libesp32/berry/src/be_var.c +++ b/lib/libesp32/berry/src/be_var.c @@ -11,10 +11,13 @@ #include "be_string.h" #include "be_map.h" #include "be_gc.h" +#include "be_class.h" #define global(vm) ((vm)->gbldesc.global) #define builtin(vm) ((vm)->gbldesc.builtin) +extern BERRY_LOCAL bclass_array be_class_table; + void be_globalvar_init(bvm *vm) { global(vm).vtab = be_map_new(vm); @@ -37,6 +40,28 @@ void be_globalvar_deinit(bvm *vm) #endif } +/* This function is called when the global was not found */ +/* If the name looked for matches a static class, a global with the class name is created lazily */ +/* Pre: no global exists with name `name`*/ +/* Returns: idx of newly created global, or -1 if not found */ +static int global_native_class_find(bvm *vm, bstring *name) +{ + const char* cl_name = str(name); + bclass_ptr* class_p = &be_class_table[0]; + for (; *class_p; class_p++) { + const bclass* cl = *class_p; + + if (!strcmp(str(cl->name), cl_name)) { + /* class name matches */ + int idx = be_global_new(vm, name); + bvalue *v = be_global_var(vm, idx); + var_setclass(v, cl); + return idx; + } + } + return -1; +} + static int global_find(bvm *vm, bstring *name) { bvalue *res = be_map_findstr(vm, global(vm).vtab, name); @@ -49,7 +74,13 @@ static int global_find(bvm *vm, bstring *name) int be_global_find(bvm *vm, bstring *name) { int res = global_find(vm, name); - return res != -1 ? res : be_builtin_find(vm, name); + if (res < 0) { + res = be_builtin_find(vm, name); + } + if (res < 0) { + res = global_native_class_find(vm, name); + } + return res; } static int global_new_anonymous(bvm *vm) diff --git a/lib/libesp32/berry/src/berry.h b/lib/libesp32/berry/src/berry.h index 41619aa10..a7e1d1315 100644 --- a/lib/libesp32/berry/src/berry.h +++ b/lib/libesp32/berry/src/berry.h @@ -174,6 +174,11 @@ typedef struct bntvmodule { const struct bmodule *module; /* const module object */ } bntvmodule; +/* native class object */ +struct bclass; /* we need only the pointer to `bclass` here */ +typedef const struct bclass *bclass_ptr; +typedef bclass_ptr bclass_array[]; /* array of bclass* pointers, NULL terminated */ + /* native module node definition macro */ #ifndef __cplusplus #define be_native_module_nil(_name) \ @@ -223,11 +228,16 @@ typedef struct bntvmodule { static const bntvmodobj name##_attrs[] = #define be_native_module(name) be_native_module_##name +#define be_native_class(name) be_class_##name /* native module declaration macro */ #define be_extern_native_module(name) \ extern const bntvmodule be_native_module(name) +/* native class declaration macro */ +#define be_extern_native_class(name) \ + extern const struct bclass be_native_class(name) + /* native module definition macro */ #ifndef __cplusplus #define be_define_native_module(_name, _init) \ diff --git a/lib/libesp32/berry_tasmota/include/be_ctypes.h b/lib/libesp32/berry_tasmota/include/be_ctypes.h index d0be5dd9d..889e4138f 100644 --- a/lib/libesp32/berry_tasmota/include/be_ctypes.h +++ b/lib/libesp32/berry_tasmota/include/be_ctypes.h @@ -60,7 +60,7 @@ typedef struct be_ctypes_classes_t { const be_ctypes_class_t * classes; } be_ctypes_classes_t; -BE_EXPORT_VARIABLE const bclass be_class_ctypes; +BE_EXPORT_VARIABLE const bclass be_class_ctypes_bytes; static void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes_structure_t * definitions) { be_pushntvclass(vm, ctypes_class); diff --git a/lib/libesp32/berry_tasmota/src/be_audio_opus_lib.c b/lib/libesp32/berry_tasmota/src/be_audio_opus_lib.c index 02b6d9af4..2d2a4fd07 100644 --- a/lib/libesp32/berry_tasmota/src/be_audio_opus_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_audio_opus_lib.c @@ -74,17 +74,11 @@ int32_t be_audio_opus_decoder_decode(struct bvm *vm) { be_return(vm); } -#include "be_fixed_be_class_audio_opus_decoder.h" - -void be_load_driver_audio_opus_decoder(bvm *vm) { - be_pushntvclass(vm, &be_class_audio_opus_decoder); - be_setglobal(vm, "OpusDecoder"); - be_pop(vm, 1); -} +#include "be_fixed_be_class_AudioOpusDecoder.h" /* @const_object_info_begin -class be_class_audio_opus_decoder (scope: global, name: OpusDecoder) { +class be_class_AudioOpusDecoder (scope: global, name: AudioOpusDecoder) { .p, var init, func(be_audio_opus_decoder_init) deinit, func(be_audio_opus_decoder_deinit) diff --git a/lib/libesp32/berry_tasmota/src/be_cron_class.cpp b/lib/libesp32/berry_tasmota/src/be_cron_class.cpp index 9184a39e7..033dc81e7 100644 --- a/lib/libesp32/berry_tasmota/src/be_cron_class.cpp +++ b/lib/libesp32/berry_tasmota/src/be_cron_class.cpp @@ -60,11 +60,6 @@ BE_FUNC_CTYPE_DECLARE(ccronexpr_now, "i", "") #include "be_fixed_be_class_ccronexpr.h" -extern "C" void be_load_ccronexpr_class(bvm *vm) { - be_pushntvclass(vm, &be_class_ccronexpr); - be_setglobal(vm, "ccronexpr"); - be_pop(vm, 1); -} /* @const_object_info_begin class be_class_ccronexpr (scope: global, name: ccronexpr) { diff --git a/lib/libesp32/berry_tasmota/src/be_ctypes.c b/lib/libesp32/berry_tasmota/src/be_ctypes.c index 69811e583..7970356d8 100644 --- a/lib/libesp32/berry_tasmota/src/be_ctypes.c +++ b/lib/libesp32/berry_tasmota/src/be_ctypes.c @@ -467,20 +467,11 @@ int be_ctypes_dyn_init(bvm *vm) { BE_EXPORT_VARIABLE extern const bclass be_class_bytes; -#include "be_fixed_be_class_ctypes.h" -#include "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); -} +#include "be_fixed_be_class_ctypes_bytes.h" +#include "be_fixed_be_class_ctypes_bytes_dyn.h" /* @const_object_info_begin -class be_class_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) { +class be_class_ctypes_bytes (scope: global, name: ctypes_bytes, super: be_class_bytes) { _def, nil() copy, func(be_ctypes_copy) init, func(be_ctypes_init) @@ -492,7 +483,7 @@ class be_class_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) @const_object_info_end */ /* @const_object_info_begin -class be_class_ctypes_dyn (scope: global, name: ctypes_bytes_dyn, super: be_class_ctypes) { +class be_class_ctypes_bytes_dyn (scope: global, name: ctypes_bytes_dyn, super: be_class_ctypes_bytes) { _def, var init, func(be_ctypes_dyn_init) } diff --git a/lib/libesp32/berry_tasmota/src/be_energy_ctypes_definitions.c b/lib/libesp32/berry_tasmota/src/be_energy_ctypes_definitions.c index 86f84ef64..5fabb9425 100644 --- a/lib/libesp32/berry_tasmota/src/be_energy_ctypes_definitions.c +++ b/lib/libesp32/berry_tasmota/src/be_energy_ctypes_definitions.c @@ -107,7 +107,7 @@ static const char * be_ctypes_instance_mappings[] = { NULL }; -static be_define_ctypes_class(energy_struct, &be_energy_struct, &be_class_ctypes, "energy_struct"); +static be_define_ctypes_class(energy_struct, &be_energy_struct, &be_class_ctypes_bytes, "energy_struct"); void be_load_ctypes_energy_definitions_lib(bvm *vm) { ctypes_register_class(vm, &be_class_energy_struct, &be_energy_struct); diff --git a/lib/libesp32/berry_tasmota/src/be_i2s_audio_lib.cpp b/lib/libesp32/berry_tasmota/src/be_i2s_audio_lib.cpp index 16d7508c4..2d500f3ba 100644 --- a/lib/libesp32/berry_tasmota/src/be_i2s_audio_lib.cpp +++ b/lib/libesp32/berry_tasmota/src/be_i2s_audio_lib.cpp @@ -151,42 +151,18 @@ int32_t be_audio_output_consume_silence(struct bvm *vm) { extern "C" { -#include "be_fixed_be_class_audio_output.h" -#include "be_fixed_be_class_audio_output_i2s.h" -#include "be_fixed_be_class_audio_generator.h" -#include "be_fixed_be_class_audio_generator_wav.h" -#include "be_fixed_be_class_audio_generator_mp3.h" -#include "be_fixed_be_class_audio_file_source.h" -#include "be_fixed_be_class_audio_file_source_fs.h" +#include "be_fixed_be_class_AudioOutput.h" +#include "be_fixed_be_class_AudioOutputI2S.h" +#include "be_fixed_be_class_AudioGenerator.h" +#include "be_fixed_be_class_AudioGeneratorWAV.h" +#include "be_fixed_be_class_AudioGeneratorMP3.h" +#include "be_fixed_be_class_AudioFileSource.h" +#include "be_fixed_be_class_AudioFileSourceFS.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) { +class be_class_AudioOutput (scope: global, name: AudioOutput) { .p, var init, func(be_audio_output_init) @@ -204,15 +180,15 @@ class be_class_audio_output (scope: global, name: AudioOutput) { set_gain, func(be_audio_output_set_gain) } -class be_class_audio_generator (scope: global, name: AudioGenerator) { +class be_class_AudioGenerator (scope: global, name: AudioGenerator) { .p, var } -class be_class_audio_file_source (scope: global, name: AudioFileSource) { +class be_class_AudioFileSource (scope: global, name: AudioFileSource) { .p, var } -class be_class_audio_output_i2s (scope: global, name: AudioOutputI2S, super: be_class_audio_output) { +class be_class_AudioOutputI2S (scope: global, name: AudioOutputI2S, super: be_class_AudioOutput) { EXTERNAL_I2S, int(AudioOutputI2S::EXTERNAL_I2S) INTERNAL_DAC, int(AudioOutputI2S::INTERNAL_DAC) INTERNAL_PDM, int(AudioOutputI2S::INTERNAL_PDM) @@ -222,7 +198,7 @@ class be_class_audio_output_i2s (scope: global, name: AudioOutputI2S, super: be_ stop, func(i2s_output_i2s_stop) } -class be_class_audio_generator_wav (scope: global, name: AudioGeneratorWAV, super: be_class_audio_generator) { +class be_class_AudioGeneratorWAV (scope: global, name: AudioGeneratorWAV, super: be_class_AudioGenerator) { init, func(i2s_generator_wav_init) deinit, func(i2s_generator_wav_deinit) begin, func(i2s_generator_wav_begin) @@ -231,7 +207,7 @@ class be_class_audio_generator_wav (scope: global, name: AudioGeneratorWAV, supe isrunning, func(i2s_generator_wav_isrunning) } -class be_class_audio_generator_mp3 (scope: global, name: AudioGeneratorMP3, super: be_class_audio_generator) { +class be_class_AudioGeneratorMP3 (scope: global, name: AudioGeneratorMP3, super: be_class_AudioGenerator) { init, func(i2s_generator_mp3_init) deinit, func(i2s_generator_mp3_deinit) begin, func(i2s_generator_mp3_begin) @@ -240,7 +216,7 @@ class be_class_audio_generator_mp3 (scope: global, name: AudioGeneratorMP3, supe isrunning, func(i2s_generator_mp3_isrunning) } -class be_class_audio_file_source_fs (scope: global, name: AudioFileSourceFS, super: be_class_audio_file_source) { +class be_class_AudioFileSourceFS (scope: global, name: AudioFileSourceFS, super: be_class_AudioFileSource) { init, func(i2s_file_source_fs_init) deinit, func(i2s_file_source_fs_deinit) } diff --git a/lib/libesp32/berry_tasmota/src/be_md5_lib.c b/lib/libesp32/berry_tasmota/src/be_md5_lib.c index baa200747..a4bcb23f4 100644 --- a/lib/libesp32/berry_tasmota/src/be_md5_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_md5_lib.c @@ -83,11 +83,6 @@ int32_t m_md5_finish(struct bvm *vm) { #include "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) { diff --git a/lib/libesp32/berry_tasmota/src/be_onewire_lib.c b/lib/libesp32/berry_tasmota/src/be_onewire_lib.c index e43fcf7c1..f3558c55e 100644 --- a/lib/libesp32/berry_tasmota/src/be_onewire_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_onewire_lib.c @@ -24,17 +24,11 @@ extern int b_onewire_reset_search(bvm *vm); extern int b_onewire_target_search(bvm *vm); extern int b_onewire_search(bvm *vm); -#include "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); -} +#include "be_fixed_be_class_OneWire.h" /* @const_object_info_begin -class be_class_tasmota_onewire (scope: global, name: OneWire) { +class be_class_OneWire (scope: global, name: OneWire) { .p, var init, func(b_onewire_init) diff --git a/lib/libesp32/berry_tasmota/src/be_serial_lib.c b/lib/libesp32/berry_tasmota/src/be_serial_lib.c index 1a5f6fd96..504afe0d2 100644 --- a/lib/libesp32/berry_tasmota/src/be_serial_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_serial_lib.c @@ -17,17 +17,11 @@ extern int b_serial_read(bvm *vm); extern int b_serial_available(bvm *vm); extern int b_serial_flush(bvm *vm); -#include "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); -} +#include "be_fixed_be_class_serial.h" /* @const_object_info_begin -class be_class_tasmota_serial (scope: global, name: serial) { +class be_class_serial (scope: global, name: serial) { .p, var SERIAL_5N1, int(SERIAL_5N1) diff --git a/lib/libesp32/berry_tasmota/src/be_tasmotalib.c b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c similarity index 99% rename from lib/libesp32/berry_tasmota/src/be_tasmotalib.c rename to lib/libesp32/berry_tasmota/src/be_tasmota_lib.c index 8f67b7690..7295eae3a 100644 --- a/lib/libesp32/berry_tasmota/src/be_tasmotalib.c +++ b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c @@ -2530,14 +2530,6 @@ be_local_closure(Tasmota_check_not_method, /* name */ #include "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) { _fl, var diff --git a/lib/libesp32/berry_tasmota/src/be_wirelib.c b/lib/libesp32/berry_tasmota/src/be_wire_lib.c similarity index 95% rename from lib/libesp32/berry_tasmota/src/be_wirelib.c rename to lib/libesp32/berry_tasmota/src/be_wire_lib.c index 6dd1fd6a8..d582fc477 100644 --- a/lib/libesp32/berry_tasmota/src/be_wirelib.c +++ b/lib/libesp32/berry_tasmota/src/be_wire_lib.c @@ -118,16 +118,11 @@ be_local_closure(read_bytes, /* name */ /*******************************************************************/ -#include "be_fixed_be_class_tasmota_wire.h" +#include "be_fixed_be_class_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) { +class be_class_Wire (scope: global, name: Wire) { bus, var init, func(b_wire_init) diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c index 216f9390c..6629dcc78 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c @@ -1177,30 +1177,6 @@ be_local_class(lv_color, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1217,36 +1193,6 @@ be_local_class(lv_img, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1263,12 +1209,6 @@ be_local_class(lv_chart, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1285,12 +1225,6 @@ be_local_class(lv_colorwheel, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1307,12 +1241,6 @@ be_local_class(lv_imgbtn, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1329,12 +1257,6 @@ be_local_class(lv_led, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1351,12 +1273,6 @@ be_local_class(lv_meter, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1373,12 +1289,6 @@ be_local_class(lv_msgbox, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1395,12 +1305,6 @@ be_local_class(lv_spinbox, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1417,24 +1321,6 @@ be_local_class(lv_spinner, ); /*******************************************************************/ -void be_load_lv_spinner_class(bvm *vm) { - be_pushntvclass(vm, &be_class_lv_spinner); - be_setglobal(vm, "lv_spinner"); - be_pop(vm, 1); -} - -void be_load_lv_anim_class(bvm *vm) { - be_pushntvclass(vm, &be_class_lv_anim); - be_setglobal(vm, "lv_anim"); - be_pop(vm, 1); -} - -void be_load_lv_timer_class(bvm *vm) { - be_pushntvclass(vm, &be_class_lv_timer); - be_setglobal(vm, "lv_timer"); - be_pop(vm, 1); -} - /******************************************************************** ** Solidified class: lv_arc ********************************************************************/ @@ -1451,12 +1337,6 @@ be_local_class(lv_arc, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1473,12 +1353,6 @@ be_local_class(lv_bar, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1495,12 +1369,6 @@ be_local_class(lv_btn, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1517,12 +1385,6 @@ be_local_class(lv_btnmatrix, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1539,12 +1401,6 @@ be_local_class(lv_canvas, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1561,12 +1417,6 @@ be_local_class(lv_checkbox, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1583,12 +1433,6 @@ be_local_class(lv_dropdown, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1605,12 +1449,6 @@ be_local_class(lv_label, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1627,12 +1465,6 @@ be_local_class(lv_line, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1649,12 +1481,6 @@ be_local_class(lv_roller, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1671,12 +1497,6 @@ be_local_class(lv_slider, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1693,12 +1513,6 @@ be_local_class(lv_switch, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1715,12 +1529,6 @@ be_local_class(lv_table, ); /*******************************************************************/ -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 ********************************************************************/ @@ -1737,9 +1545,3 @@ be_local_class(lv_textarea, ); /*******************************************************************/ -void be_load_lv_textarea_class(bvm *vm) { - be_pushntvclass(vm, &be_class_lv_textarea); - be_setglobal(vm, "lv_textarea"); - be_pop(vm, 1); -} - diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c index 26252dae9..eee1f5c79 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c +++ b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c @@ -696,50 +696,50 @@ static const char * be_ctypes_instance_mappings[] = { NULL }; -static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes, "lv_area"); -static be_define_ctypes_class(lv_chart_cursor, &be_lv_chart_cursor, &be_class_ctypes, "lv_chart_cursor"); -static be_define_ctypes_class(lv_chart_series, &be_lv_chart_series, &be_class_ctypes, "lv_chart_series"); -static be_define_ctypes_class(lv_chart_tick_dsc, &be_lv_chart_tick_dsc, &be_class_ctypes, "lv_chart_tick_dsc"); -static be_define_ctypes_class(lv_color_filter_dsc, &be_lv_color_filter_dsc, &be_class_ctypes, "lv_color_filter_dsc"); -static be_define_ctypes_class(lv_coord, &be_lv_coord, &be_class_ctypes, "lv_coord"); -static be_define_ctypes_class(lv_draw_arc_dsc, &be_lv_draw_arc_dsc, &be_class_ctypes, "lv_draw_arc_dsc"); -static be_define_ctypes_class(lv_draw_ctx, &be_lv_draw_ctx, &be_class_ctypes, "lv_draw_ctx"); -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_polygon_param, &be_lv_draw_mask_polygon_param, &be_class_ctypes, "lv_draw_mask_polygon_param"); -static be_define_ctypes_class(lv_draw_mask_polygon_param_cfg, &be_lv_draw_mask_polygon_param_cfg, &be_class_ctypes, "lv_draw_mask_polygon_param_cfg"); -static be_define_ctypes_class(lv_draw_mask_radius_circle_dsc, &be_lv_draw_mask_radius_circle_dsc, &be_class_ctypes, "lv_draw_mask_radius_circle_dsc"); -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_grad_dsc, &be_lv_grad_dsc, &be_class_ctypes, "lv_grad_dsc"); -static be_define_ctypes_class(lv_gradient_stop, &be_lv_gradient_stop, &be_class_ctypes, "lv_gradient_stop"); -static be_define_ctypes_class(lv_img_dsc, &be_lv_img_dsc, &be_class_ctypes, "lv_img_dsc"); -static be_define_ctypes_class(lv_img_header, &be_lv_img_header, &be_class_ctypes, "lv_img_header"); -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_obj_draw_part_dsc, &be_lv_obj_draw_part_dsc, &be_class_ctypes, "lv_obj_draw_part_dsc"); -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"); -static be_define_ctypes_class(lv_style_transition_dsc, &be_lv_style_transition_dsc, &be_class_ctypes, "lv_style_transition_dsc"); -static be_define_ctypes_class(lv_timer, &be_lv_timer, &be_class_ctypes, "lv_timer"); -static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes, "lv_ts_calibration"); +static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes_bytes, "lv_area"); +static be_define_ctypes_class(lv_chart_cursor, &be_lv_chart_cursor, &be_class_ctypes_bytes, "lv_chart_cursor"); +static be_define_ctypes_class(lv_chart_series, &be_lv_chart_series, &be_class_ctypes_bytes, "lv_chart_series"); +static be_define_ctypes_class(lv_chart_tick_dsc, &be_lv_chart_tick_dsc, &be_class_ctypes_bytes, "lv_chart_tick_dsc"); +static be_define_ctypes_class(lv_color_filter_dsc, &be_lv_color_filter_dsc, &be_class_ctypes_bytes, "lv_color_filter_dsc"); +static be_define_ctypes_class(lv_coord, &be_lv_coord, &be_class_ctypes_bytes, "lv_coord"); +static be_define_ctypes_class(lv_draw_arc_dsc, &be_lv_draw_arc_dsc, &be_class_ctypes_bytes, "lv_draw_arc_dsc"); +static be_define_ctypes_class(lv_draw_ctx, &be_lv_draw_ctx, &be_class_ctypes_bytes, "lv_draw_ctx"); +static be_define_ctypes_class(lv_draw_img_dsc, &be_lv_draw_img_dsc, &be_class_ctypes_bytes, "lv_draw_img_dsc"); +static be_define_ctypes_class(lv_draw_line_dsc, &be_lv_draw_line_dsc, &be_class_ctypes_bytes, "lv_draw_line_dsc"); +static be_define_ctypes_class(lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param, &be_class_ctypes_bytes, "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_bytes, "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_bytes, "lv_draw_mask_common_dsc"); +static be_define_ctypes_class(lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param, &be_class_ctypes_bytes, "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_bytes, "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_bytes, "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_bytes, "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_bytes, "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_bytes, "lv_draw_mask_map_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_polygon_param, &be_lv_draw_mask_polygon_param, &be_class_ctypes_bytes, "lv_draw_mask_polygon_param"); +static be_define_ctypes_class(lv_draw_mask_polygon_param_cfg, &be_lv_draw_mask_polygon_param_cfg, &be_class_ctypes_bytes, "lv_draw_mask_polygon_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_radius_circle_dsc, &be_lv_draw_mask_radius_circle_dsc, &be_class_ctypes_bytes, "lv_draw_mask_radius_circle_dsc"); +static be_define_ctypes_class(lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param, &be_class_ctypes_bytes, "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_bytes, "lv_draw_mask_radius_param_cfg"); +static be_define_ctypes_class(lv_draw_mask_saved, &be_lv_draw_mask_saved, &be_class_ctypes_bytes, "lv_draw_mask_saved"); +static be_define_ctypes_class(lv_draw_rect_dsc, &be_lv_draw_rect_dsc, &be_class_ctypes_bytes, "lv_draw_rect_dsc"); +static be_define_ctypes_class(lv_event, &be_lv_event, &be_class_ctypes_bytes, "lv_event"); +static be_define_ctypes_class(lv_grad_dsc, &be_lv_grad_dsc, &be_class_ctypes_bytes, "lv_grad_dsc"); +static be_define_ctypes_class(lv_gradient_stop, &be_lv_gradient_stop, &be_class_ctypes_bytes, "lv_gradient_stop"); +static be_define_ctypes_class(lv_img_dsc, &be_lv_img_dsc, &be_class_ctypes_bytes, "lv_img_dsc"); +static be_define_ctypes_class(lv_img_header, &be_lv_img_header, &be_class_ctypes_bytes, "lv_img_header"); +static be_define_ctypes_class(lv_meter_indicator, &be_lv_meter_indicator, &be_class_ctypes_bytes, "lv_meter_indicator"); +static be_define_ctypes_class(lv_meter_indicator_arc, &be_lv_meter_indicator_arc, &be_class_ctypes_bytes, "lv_meter_indicator_arc"); +static be_define_ctypes_class(lv_meter_indicator_needle_img, &be_lv_meter_indicator_needle_img, &be_class_ctypes_bytes, "lv_meter_indicator_needle_img"); +static be_define_ctypes_class(lv_meter_indicator_needle_line, &be_lv_meter_indicator_needle_line, &be_class_ctypes_bytes, "lv_meter_indicator_needle_line"); +static be_define_ctypes_class(lv_meter_indicator_scale_lines, &be_lv_meter_indicator_scale_lines, &be_class_ctypes_bytes, "lv_meter_indicator_scale_lines"); +static be_define_ctypes_class(lv_meter_scale, &be_lv_meter_scale, &be_class_ctypes_bytes, "lv_meter_scale"); +static be_define_ctypes_class(lv_obj_class, &be_lv_obj_class, &be_class_ctypes_bytes, "lv_obj_class"); +static be_define_ctypes_class(lv_obj_draw_part_dsc, &be_lv_obj_draw_part_dsc, &be_class_ctypes_bytes, "lv_obj_draw_part_dsc"); +static be_define_ctypes_class(lv_point, &be_lv_point, &be_class_ctypes_bytes, "lv_point"); +static be_define_ctypes_class(lv_sqrt_res, &be_lv_sqrt_res, &be_class_ctypes_bytes, "lv_sqrt_res"); +static be_define_ctypes_class(lv_style_transition_dsc, &be_lv_style_transition_dsc, &be_class_ctypes_bytes, "lv_style_transition_dsc"); +static be_define_ctypes_class(lv_timer, &be_lv_timer, &be_class_ctypes_bytes, "lv_timer"); +static be_define_ctypes_class(lv_ts_calibration, &be_lv_ts_calibration, &be_class_ctypes_bytes, "lv_ts_calibration"); void be_load_ctypes_lvgl_definitions_lib(bvm *vm) { ctypes_register_class(vm, &be_class_lv_area, &be_lv_area); diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c index 42c901cd6..3223c475f 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c +++ b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_glob_lib.c @@ -1037,9 +1037,3 @@ be_local_class(LVGL_glob, 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); -} diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/ctypes.be b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/ctypes.be index 9e163cdd1..0bd2e0695 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/ctypes.be +++ b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/ctypes.be @@ -225,7 +225,7 @@ ctypes.print_classes = def (module_name) ctypes.sort(global_classes) for elt:global_classes - print(string.format("static be_define_ctypes_class(%s, &be_%s, &be_class_ctypes, \"%s\");", elt, elt, elt)) + print(string.format("static be_define_ctypes_class(%s, &be_%s, &be_class_ctypes_bytes, \"%s\");", elt, elt, elt)) end print() diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/lv_berry.c b/lib/libesp32_lvgl/lv_binding_berry/src/lv_berry.c index 2295d3dde..8235cccb5 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/lv_berry.c +++ b/lib/libesp32_lvgl/lv_binding_berry/src/lv_berry.c @@ -9,19 +9,6 @@ #include "../generate/be_lv_c_mapping.h" -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); - -/*********************************************************************************************\ - * Load all LVGL classes, including widgets -\*********************************************************************************************/ -void be_load_lvgl_classes(bvm *vm) { - be_load_lv_color_class(vm); - be_load_lv_font_class(vm); - be_load_LVGL_glob_class(vm); -} - /*********************************************************************************************\ * Retrieve the value of `self._p` \*********************************************************************************************/ diff --git a/lib/libesp32_lvgl/lv_binding_berry/tools/convert.py b/lib/libesp32_lvgl/lv_binding_berry/tools/convert.py index 63ad26edb..10d303e4e 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/tools/convert.py +++ b/lib/libesp32_lvgl/lv_binding_berry/tools/convert.py @@ -715,13 +715,6 @@ be_local_class(lv_{subtype}, (be_str_literal("lv_{subtype}")) ); /*******************************************************************/ -""") - # class definitions - print(f"""void be_load_lv_{subtype}_class(bvm *vm) {{ - be_pushntvclass(vm, &be_class_lv_{subtype}); - be_setglobal(vm, \"lv_{subtype}\"); - be_pop(vm, 1); -}} """) sys.stdout.close() diff --git a/tasmota/berry/modules/ctypes.be b/tasmota/berry/modules/ctypes.be index 08886ec50..56cf1289e 100644 --- a/tasmota/berry/modules/ctypes.be +++ b/tasmota/berry/modules/ctypes.be @@ -225,7 +225,7 @@ ctypes.print_classes = def (module_name) ctypes.sort(global_classes) for elt:global_classes - print(string.format("static be_define_ctypes_class(%s, &be_%s, &be_class_ctypes, \"%s\");", elt, elt, elt)) + print(string.format("static be_define_ctypes_class(%s, &be_%s, &be_class_ctypes_bytes, \"%s\");", elt, elt, elt)) end print()