void init_v7(void *stack_base) { struct v7_create_opts opts; v7_val_t dht11, debug; opts.object_arena_size = 164; opts.function_arena_size = 26; opts.property_arena_size = 400; opts.c_stack_base = stack_base; v7 = v7_create_opt(opts); v7_set_method(v7, v7_get_global(v7), "dsleep", dsleep); v7_set_method(v7, v7_get_global(v7), "crash", crash); #if V7_ESP_ENABLE__DHT11 dht11 = v7_create_object(v7); v7_set(v7, v7_get_global(v7), "DHT11", 5, 0, dht11); v7_set_method(v7, dht11, "read", DHT11_read); #else (void) dht11; #endif /* V7_ESP_ENABLE__DHT11 */ debug = v7_create_object(v7); v7_set(v7, v7_get_global(v7), "Debug", 5, 0, debug); v7_set_method(v7, debug, "mode", Debug_mode); v7_set_method(v7, debug, "print", Debug_print); sj_init_timers(v7); sj_init_v7_ext(v7); init_gpiojs(v7); init_adcjs(v7); init_i2cjs(v7); init_pwm(v7); init_spijs(v7); init_wifi(v7); mongoose_init(); sj_init_http(v7); sj_init_ws_client(v7); /* NOTE(lsm): must be done after mongoose_init(). */ init_device(v7); #ifndef DISABLE_OTA init_updater(v7); #endif #ifndef DISABLE_C_CLUBBY sj_init_clubby(v7); #endif v7_gc(v7, 1); }
void init_v7(void *stack_base) { struct v7_create_opts opts; v7_val_t dht11, debug; opts.object_arena_size = 164; opts.function_arena_size = 26; opts.property_arena_size = 400; opts.c_stack_base = stack_base; v7 = v7_create_opt(opts); v7_set_method(v7, v7_get_global_object(v7), "dsleep", dsleep); v7_set_method(v7, v7_get_global_object(v7), "crash", crash); #if V7_ESP_ENABLE__DHT11 dht11 = v7_create_object(v7); v7_set(v7, v7_get_global_object(v7), "DHT11", 5, 0, dht11); v7_set_method(v7, dht11, "read", DHT11_read); #else (void) dht11; #endif /* V7_ESP_ENABLE__DHT11 */ debug = v7_create_object(v7); v7_set(v7, v7_get_global_object(v7), "Debug", 5, 0, debug); v7_set_method(v7, debug, "mode", Debug_mode); v7_set_method(v7, debug, "print", Debug_print); sj_init_timers(v7); sj_init_v7_ext(v7); init_gpiojs(v7); init_i2cjs(v7); init_spijs(v7); init_wifi(v7); #ifndef RTOS_TODO init_data_gen_server(v7); #endif esp_init_conf(v7); #ifdef RTOS_SDK mongoose_init(); #endif sj_init_simple_http_client(v7); #ifdef RTOS_SDK sj_init_ws_client(v7); #endif v7_gc(v7, 1); }