Example #1
0
void init_v7() {
  struct v7_create_opts opts = {0, 0, 0};

  v7 = v7_create_opt(opts);

  sj_init_v7_ext(v7);
  init_conf(v7);
}
Example #2
0
struct v7 *init_v7(void *stack_base) {
  struct v7_create_opts opts;

  opts.object_arena_size = 164;
  opts.function_arena_size = 26;
  opts.property_arena_size = 400;
  opts.c_stack_base = stack_base;

  return v7_create_opt(opts);
}
Example #3
0
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);
}
Example #4
0
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);
}
Example #5
0
struct v7 *init_v7(void *stack_base) {
  struct v7_create_opts opts;

#ifdef V7_THAW
  opts.object_arena_size = 85;
  opts.function_arena_size = 16;
  opts.property_arena_size = 100;
#else
  opts.object_arena_size = 164;
  opts.function_arena_size = 26;
  opts.property_arena_size = 400;
#endif
  opts.c_stack_base = stack_base;

  return v7_create_opt(opts);
}
Example #6
0
ICACHE_FLASH_ATTR void init_v7() {
  struct v7_create_opts opts;
  v7_val_t wifi, gpio, dht11, gc, debug;

  opts.object_arena_size = 94;
  opts.function_arena_size = 17;
  opts.property_arena_size = 340;

  v7 = v7_create_opt(opts);

  v7_set_method(v7, v7_get_global_object(v7), "usleep", usleep);
  v7_set_method(v7, v7_get_global_object(v7), "setTimeout", set_timeout);

  gpio = v7_create_object(v7);
  v7_set(v7, v7_get_global_object(v7), "GPIO", 4, 0, gpio);
  v7_set_method(v7, gpio, "in", GPIO_in);
  v7_set_method(v7, gpio, "out", GPIO_out);

  wifi = v7_create_object(v7);
  v7_set(v7, v7_get_global_object(v7), "Wifi", 4, 0, wifi);
  v7_set_method(v7, wifi, "setup", Wifi_setup);
  v7_set_method(v7, wifi, "disconnect", Wifi_disconnect);
  v7_set_method(v7, wifi, "connect", Wifi_connect);
  v7_set_method(v7, wifi, "status", Wifi_status);
  v7_set_method(v7, wifi, "ip", Wifi_ip);
  v7_set(v7, wifi, "STATION", 7, 0, v7_create_number(0));
  v7_set(v7, wifi, "SOFTAP", 6, 0, v7_create_number(1));

#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);
#endif /* V7_ESP_ENABLE__DHT11 */

  gc = v7_create_object(v7);
  v7_set(v7, v7_get_global_object(v7), "GC", 2, 0, gc);
  v7_set_method(v7, gc, "stat", GC_stat);
  v7_set_method(v7, gc, "collect", GC_collect);

  debug = v7_create_object(v7);
  v7_set(v7, v7_get_global_object(v7), "Debug", 5, 0, debug);
  v7_set_method(v7, debug, "setOutput", Debug_set_output);
  v7_set_method(v7, debug, "print", Debug_print);

  v7_init_http_client(v7);
}
Example #7
0
void init_v7(void *stack_base) {
  struct v7_mk_opts opts;

#ifdef V7_THAW
  opts.object_arena_size = 85;
  opts.function_arena_size = 16;
  opts.property_arena_size = 170;
#else
  opts.object_arena_size = 164;
  opts.function_arena_size = 26;
  opts.property_arena_size = 400;
#endif
  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);
}