Merge pull request #15203 from s-hadinger/berry_ble_new_mapping

Berry move BLE MI32 to simplest C mapping
This commit is contained in:
s-hadinger 2022-03-21 19:26:04 +01:00 committed by GitHub
commit 1c8875025c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1244 additions and 1193 deletions

View File

@ -52,11 +52,6 @@ be_extern_native_module(lv_extra);
be_extern_native_module(lv_tasmota);
#endif // USE_LVGL
#if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32)
extern void be_load_MI32_class(bvm *vm);
extern void be_load_BLE_class(bvm *vm);
#endif //USE_MI_ESP32
/* user-defined modules declare start */
/* user-defined modules declare end */
@ -178,6 +173,9 @@ be_extern_native_class(md5);
be_extern_native_class(udp);
be_extern_native_class(webclient);
be_extern_native_class(tcpclient);
// BLE
be_extern_native_class(MI32);
be_extern_native_class(BLE);
// LVGL core classes
be_extern_native_class(lv_color);
be_extern_native_class(lv_font);
@ -248,6 +246,10 @@ BERRY_LOCAL bclass_array be_class_table = {
#endif // USE_UFILESYS
&be_native_class(AudioOpusDecoder),
#endif // USE_I2S_AUDIO_BERRY
#if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32)
&be_native_class(MI32),
&be_native_class(BLE),
#endif //USE_MI_ESP32
NULL, /* do not remove */
};
@ -269,8 +271,4 @@ BERRY_API void be_load_custom_libs(bvm *vm)
#ifdef USE_ENERGY_SENSOR
be_load_ctypes_energy_definitions_lib(vm); // ctype class
#endif // USE_ENERGY_SENSOR
#if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32)
be_load_MI32_class(vm);
be_load_BLE_class(vm);
#endif //USE_MI_ESP32
}

View File

@ -14,6 +14,7 @@ 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_BECDFE;
extern const bcstring be_const_str_BLE;
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_X20argument_X20must_X20be_X20a_X20function;
@ -68,6 +69,7 @@ extern const bcstring be_const_str_LVG_X3A_X20object_X3A;
extern const bcstring be_const_str_Leds;
extern const bcstring be_const_str_MAX_RMT;
extern const bcstring be_const_str_MD5;
extern const bcstring be_const_str_MI32;
extern const bcstring be_const_str_None;
extern const bcstring be_const_str_OPTION_A;
extern const bcstring be_const_str_OneWire;
@ -251,6 +253,7 @@ extern const bcstring be_const_str_add_header;
extern const bcstring be_const_str_add_light;
extern const bcstring be_const_str_add_rule;
extern const bcstring be_const_str_addr;
extern const bcstring be_const_str_adv_cb;
extern const bcstring be_const_str_allocated;
extern const bcstring be_const_str_alternate;
extern const bcstring be_const_str_animate;
@ -325,6 +328,7 @@ 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_conn_cb;
extern const bcstring be_const_str_connect;
extern const bcstring be_const_str_connected;
extern const bcstring be_const_str_connection_error;
@ -371,6 +375,7 @@ 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_devices;
extern const bcstring be_const_str_digital_read;
extern const bcstring be_const_str_digital_write;
extern const bcstring be_const_str_dim;
@ -446,6 +451,7 @@ 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_MAC;
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;
@ -464,6 +470,7 @@ extern const bcstring be_const_str_get_hor_res;
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_log;
extern const bcstring be_const_str_get_name;
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;
@ -731,13 +738,16 @@ extern const bcstring be_const_str_send;
extern const bcstring be_const_str_send_multicast;
extern const bcstring be_const_str_serial;
extern const bcstring be_const_str_set;
extern const bcstring be_const_str_set_MAC;
extern const bcstring be_const_str_set_align;
extern const bcstring be_const_str_set_alternate;
extern const bcstring be_const_str_set_auth;
extern const bcstring be_const_str_set_bat;
extern const bcstring be_const_str_set_bits_per_sample;
extern const bcstring be_const_str_set_bri;
extern const bcstring be_const_str_set_channels;
extern const bcstring be_const_str_set_chg_current;
extern const bcstring be_const_str_set_chr;
extern const bcstring be_const_str_set_ct;
extern const bcstring be_const_str_set_dc_voltage;
extern const bcstring be_const_str_set_dcdc_enable;
@ -747,6 +757,7 @@ extern const bcstring be_const_str_set_gain;
extern const bcstring be_const_str_set_height;
extern const bcstring be_const_str_set_hue16sat;
extern const bcstring be_const_str_set_huesat;
extern const bcstring be_const_str_set_hum;
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;
@ -771,7 +782,9 @@ extern const bcstring be_const_str_set_style_pad_right;
extern const bcstring be_const_str_set_style_radius;
extern const bcstring be_const_str_set_style_text_color;
extern const bcstring be_const_str_set_style_text_font;
extern const bcstring be_const_str_set_svc;
extern const bcstring be_const_str_set_tasmota_logo;
extern const bcstring be_const_str_set_temp;
extern const bcstring be_const_str_set_text;
extern const bcstring be_const_str_set_time;
extern const bcstring be_const_str_set_timeouts;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_BLE_map) {
{ be_const_key(set_chr, -1), be_const_func(be_BLE_set_characteristic) },
{ be_const_key(set_svc, -1), be_const_func(be_BLE_set_service) },
{ be_const_key(run, -1), be_const_func(be_BLE_run) },
{ be_const_key(conn_cb, 0), be_const_func(be_BLE_reg_conn_cb) },
{ be_const_key(adv_cb, 1), be_const_func(be_BLE_reg_adv_cb) },
{ be_const_key(set_MAC, -1), be_const_func(be_BLE_set_MAC) },
};
static be_define_const_map(
be_class_BLE_map,
6
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_BLE,
0,
NULL,
BLE
);

View File

@ -0,0 +1,22 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_MI32_map) {
{ be_const_key(devices, -1), be_const_func(be_MI32_devices) },
{ be_const_key(set_bat, -1), be_const_func(be_MI32_set_bat) },
{ be_const_key(set_hum, 4), be_const_func(be_MI32_set_hum) },
{ be_const_key(get_MAC, -1), be_const_func(be_MI32_get_MAC) },
{ be_const_key(set_temp, -1), be_const_func(be_MI32_set_temp) },
{ be_const_key(get_name, 3), be_const_func(be_MI32_get_name) },
};
static be_define_const_map(
be_class_MI32_map,
6
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_MI32,
0,
NULL,
MI32
);

View File

@ -13,30 +13,18 @@ extern int be_MI32_get_MAC(bvm *vm);
extern int be_MI32_set_hum(bvm *vm);
extern int be_MI32_set_temp(bvm *vm);
/********************************************************************
** Solidified class: MI32
********************************************************************/
be_local_class(MI32,
0,
NULL,
be_nested_map(6,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("devices", -1593144448, 7, -1), be_const_func(be_MI32_devices) },
{ be_nested_key("set_bat", -1558299945, 7, -1), be_const_func(be_MI32_set_bat) },
{ be_nested_key("set_hum", 964296026, 7, 4), be_const_func(be_MI32_set_hum) },
{ be_nested_key("get_MAC", 2091521771, 7, -1), be_const_func(be_MI32_get_MAC) },
{ be_nested_key("set_temp", 1952131250, 8, -1), be_const_func(be_MI32_set_temp) },
{ be_nested_key("get_name", 1616902907, 8, 3), be_const_func(be_MI32_get_name) },
})),
(be_nested_const_str("MI32", -220693882, 4))
);
/*******************************************************************/
#include "be_fixed_be_class_MI32.h"
void be_load_MI32_class(bvm *vm) {
be_pushntvclass(vm, &be_class_MI32);
be_setglobal(vm, "MI32");
be_pop(vm, 1);
/* @const_object_info_begin
class be_class_MI32 (scope: global, name: MI32) {
devices, func(be_MI32_devices)
get_name, func(be_MI32_get_name)
get_MAC, func(be_MI32_get_MAC)
set_bat, func(be_MI32_set_bat)
set_hum, func(be_MI32_set_hum)
set_temp, func(be_MI32_set_temp)
}
@const_object_info_end */
extern int be_BLE_reg_conn_cb(bvm *vm);
extern int be_BLE_reg_adv_cb(bvm *vm);
@ -44,29 +32,18 @@ extern int be_BLE_set_MAC(bvm *vm);
extern int be_BLE_set_characteristic(bvm *vm);
extern int be_BLE_run(bvm *vm);
extern int be_BLE_set_service(bvm *vm);
/********************************************************************
** Solidified class: BLE
********************************************************************/
be_local_class(BLE,
0,
NULL,
be_nested_map(6,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_nested_key("conn_cb", 1381122945, 7, -1), be_const_func(be_BLE_reg_conn_cb) },
{ be_nested_key("set_svc", 752734654, 7, -1), be_const_func(be_BLE_set_service) },
{ be_nested_key("run", 718098122, 3, -1), be_const_func(be_BLE_run) },
{ be_nested_key("set_chr", 102133743, 7, 0), be_const_func(be_BLE_set_characteristic) },
{ be_nested_key("adv_cb", 1957890034, 6, 1), be_const_func(be_BLE_reg_adv_cb) },
{ be_nested_key("set_MAC", 1617581015, 7, -1), be_const_func(be_BLE_set_MAC) },
})),
(be_nested_const_str("BLE", -361123990, 3))
);
/*******************************************************************/
void be_load_BLE_class(bvm *vm) {
be_pushntvclass(vm, &be_class_BLE);
be_setglobal(vm, "BLE");
be_pop(vm, 1);
#include "be_fixed_be_class_BLE.h"
/* @const_object_info_begin
class be_class_BLE (scope: global, name: BLE) {
conn_cb, func(be_BLE_reg_conn_cb)
set_svc, func(be_BLE_set_service)
run, func(be_BLE_run)
set_chr, func(be_BLE_set_characteristic)
adv_cb, func(be_BLE_reg_adv_cb)
set_MAC, func(be_BLE_set_MAC)
}
@const_object_info_end */
#endif //USE_MI_ESP32