/** @brief Init for InvnBridge * @return none */ void InvnBridge::init(void) { // open serial port TX0/RX0 with FTDI cable to communicate to TestApp INVN_BRIDGE_SERIAL.begin(2000000); // Init bridge bridge_init(invn_bridge_send_data, &DeviceIoHalCallback); }
int main(int argc, char *argv[]) { struct unixctl_server *unixctl; struct signal *sighup; char *remote; bool exiting; int retval; proctitle_init(argc, argv); set_program_name(argv[0]); stress_init_command(); remote = parse_options(argc, argv); signal(SIGPIPE, SIG_IGN); sighup = signal_register(SIGHUP); process_init(); ovsrec_init(); daemonize_start(); retval = unixctl_server_create(NULL, &unixctl); if (retval) { exit(EXIT_FAILURE); } unixctl_command_register("exit", "", 0, 0, ovs_vswitchd_exit, &exiting); bridge_init(remote); free(remote); exiting = false; while (!exiting) { if (signal_poll(sighup)) { vlog_reopen_log_file(); } bridge_run_fast(); bridge_run(); bridge_run_fast(); unixctl_server_run(unixctl); netdev_run(); signal_wait(sighup); bridge_wait(); unixctl_server_wait(unixctl); netdev_wait(); if (exiting) { poll_immediate_wake(); } poll_block(); } bridge_exit(); unixctl_server_destroy(unixctl); signal_unregister(sighup); return 0; }
static THD_FUNCTION(uart_thread, arg) { (void)arg; chRegSetThreadName("UART thread"); // KPA. event_listener_t kpa_event_listener; chEvtRegisterMaskWithFlags((event_source_t*)chnGetEventSource(&SD1), &kpa_event_listener, EVENT_MASK(1), CHN_INPUT_AVAILABLE); struct writer kpa_writer; writer_init(&kpa_writer, &SD1, uart_write); // FBV. event_listener_t fbv_event_listener; chEvtRegisterMaskWithFlags((event_source_t*)chnGetEventSource(&SD6), &fbv_event_listener, EVENT_MASK(2), CHN_INPUT_AVAILABLE); struct writer fbv_writer; writer_init(&fbv_writer, &SD6, uart_write); // Bridge- struct bridge bridge; bridge_init(&bridge, &kpa_writer, &fbv_writer); uint8_t byte = 0; while (true) { eventflags_t evt = chEvtWaitAnyTimeout(EVENT_MASK(1) | EVENT_MASK(2), MS2ST(1)); if (evt & EVENT_MASK(1)) { chEvtGetAndClearFlags(&kpa_event_listener); while (readByte(&SD1, &byte)) bridge_update_kpa(&bridge, byte); } if (evt & EVENT_MASK(2)) { chEvtGetAndClearFlags(&fbv_event_listener); while (readByte(&SD6, &byte)) bridge_update_fbv(&bridge, byte); } bridge_update_time(&bridge, clock_get_ms()); } }
int main(int argc, char *argv[]) { char *unixctl_path = NULL; struct unixctl_server *unixctl; char *remote; bool exiting; int retval; set_program_name(argv[0]); retval = dpdk_init(argc,argv); argc -= retval; argv += retval; ovs_cmdl_proctitle_init(argc, argv); service_start(&argc, &argv); remote = parse_options(argc, argv, &unixctl_path); fatal_ignore_sigpipe(); ovsrec_init(); daemonize_start(); if (want_mlockall) { #ifdef HAVE_MLOCKALL if (mlockall(MCL_CURRENT | MCL_FUTURE)) { VLOG_ERR("mlockall failed: %s", ovs_strerror(errno)); } #else VLOG_ERR("mlockall not supported on this system"); #endif } retval = unixctl_server_create(unixctl_path, &unixctl); if (retval) { exit(EXIT_FAILURE); } unixctl_command_register("exit", "", 0, 0, ovs_vswitchd_exit, &exiting); bridge_init(remote); free(remote); exiting = false; while (!exiting) { memory_run(); if (memory_should_report()) { struct simap usage; simap_init(&usage); bridge_get_memory_usage(&usage); memory_report(&usage); simap_destroy(&usage); } bridge_run(); unixctl_server_run(unixctl); netdev_run(); memory_wait(); bridge_wait(); unixctl_server_wait(unixctl); netdev_wait(); if (exiting) { poll_immediate_wake(); } poll_block(); if (should_service_stop()) { exiting = true; } } bridge_exit(); unixctl_server_destroy(unixctl); service_stop(); return 0; }
int main(int argc, char *argv[]) { char *unixctl_path = NULL; struct unixctl_server *unixctl; struct signal *sighup; char *remote; bool exiting; int retval; proctitle_init(argc, argv); set_program_name(argv[0]); stress_init_command(); remote = parse_options(argc, argv, &unixctl_path); signal(SIGPIPE, SIG_IGN); sighup = signal_register(SIGHUP); process_init(); ovsrec_init(); daemonize_start(); if (want_mlockall) { #ifdef HAVE_MLOCKALL if (mlockall(MCL_CURRENT | MCL_FUTURE)) { VLOG_ERR("mlockall failed: %s", ovs_strerror(errno)); } #else VLOG_ERR("mlockall not supported on this system"); #endif } worker_start(); retval = unixctl_server_create(unixctl_path, &unixctl); if (retval) { exit(EXIT_FAILURE); } unixctl_command_register("exit", "", 0, 0, ovs_vswitchd_exit, &exiting); bridge_init(remote); free(remote); exiting = false; while (!exiting) { worker_run(); if (signal_poll(sighup)) { vlog_reopen_log_file(); } memory_run(); if (memory_should_report()) { struct simap usage; simap_init(&usage); bridge_get_memory_usage(&usage); memory_report(&usage); simap_destroy(&usage); } bridge_run_fast(); bridge_run(); bridge_run_fast(); unixctl_server_run(unixctl); netdev_run(); worker_wait(); signal_wait(sighup); memory_wait(); bridge_wait(); unixctl_server_wait(unixctl); netdev_wait(); if (exiting) { poll_immediate_wake(); } poll_block(); } bridge_exit(); unixctl_server_destroy(unixctl); return 0; }
int network_manager_init(DBusConnection *conn, struct network_conf *service_conf) { GDBusMethodTable *methods = NULL; GDBusSignalTable *signals = NULL; conf = service_conf; if (conf->server_enabled && conf->connection_enabled) { methods = manager_methods; signals = connection_signals; } else if (conf->connection_enabled) { methods = connection_methods; signals = connection_signals; } else if (conf->server_enabled) methods = server_methods; else { error ("All interfaces were disabled"); return -1; } if (bnep_init(conf->panu_script, conf->gn_script, conf->nap_script)) { error("Can't init bnep module"); return -1; } /* * There is one socket to handle the incomming connections. NAP, * GN and PANU servers share the same PSM. The initial BNEP message * (setup connection request) contains the destination service * field that defines which service the source is connecting to. */ if (conf->server_enabled) { if (bridge_init(conf->gn_iface, conf->nap_iface) < 0) { error("Can't init bridge module"); return -1; } if (server_init(conn, conf->iface_prefix, conf->security) < 0) return -1; } if (conf->connection_enabled) { if (connection_init(conn, conf->iface_prefix) < 0) return -1; } if (g_dbus_register_interface(conn, NETWORK_PATH, NETWORK_MANAGER_INTERFACE, methods, signals, NULL, NULL, manager_unregister) == FALSE) { error("Failed to register %s interface to %s", NETWORK_MANAGER_INTERFACE, NETWORK_PATH); return -1; } connection = dbus_connection_ref(conn); info("Registered manager path:%s", NETWORK_PATH); register_stored(); /* Register PANU, GN and NAP servers if they don't exist */ register_server(BNEP_SVC_PANU); register_server(BNEP_SVC_GN); register_server(BNEP_SVC_NAP); return 0; }
int main(void) { if (PM->RCAUSE.reg & (PM_RCAUSE_POR | PM_RCAUSE_BOD12 | PM_RCAUSE_BOD33)) { // On powerup, force a clean reset of the MT7620 pin_low(PIN_SOC_RST); pin_out(PIN_SOC_RST); // turn off 3.3V to SoC pin_low(PIN_SOC_PWR); pin_out(PIN_SOC_PWR); // pull 1.8V low pin_low(PIN_18_V); pin_out(PIN_18_V); clock_init_crystal(GCLK_SYSTEM, GCLK_32K); timer_clock_enable(TC_BOOT); // hold everything low boot_delay_ms(50); // power off for 50ms pin_high(PIN_SOC_PWR); boot_delay_ms(2); // 2ms until 1.8 rail comes on pin_high(PIN_18_V); boot_delay_ms(50); // 50ms before soc rst comes on } else { clock_init_crystal(GCLK_SYSTEM, GCLK_32K); } pin_mux(PIN_USB_DM); pin_mux(PIN_USB_DP); usb_init(); usb_attach(); NVIC_SetPriority(USB_IRQn, 0xff); pin_high(PIN_LED); pin_out(PIN_LED); pin_in(PIN_SOC_RST); pin_high(PIN_SOC_PWR); pin_out(PIN_SOC_PWR); pin_low(PORT_A.power); pin_out(PORT_A.power); pin_low(PORT_B.power); pin_out(PORT_B.power); pin_pull_up(PIN_BRIDGE_CS); pin_pull_up(PIN_FLASH_CS); pin_pull_up(PIN_SERIAL_TX); pin_pull_up(PIN_SERIAL_RX); dma_init(); NVIC_EnableIRQ(DMAC_IRQn); NVIC_SetPriority(DMAC_IRQn, 0xff); eic_init(); NVIC_EnableIRQ(EIC_IRQn); NVIC_SetPriority(EIC_IRQn, 0xff); evsys_init(); NVIC_EnableIRQ(EVSYS_IRQn); NVIC_SetPriority(EVSYS_IRQn, 0); adc_init(GCLK_SYSTEM, ADC_REFCTRL_REFSEL_INTVCC1); dac_init(GCLK_32K); bridge_init(); port_init(&port_a, 1, &PORT_A, GCLK_PORT_A, TCC_PORT_A, DMA_PORT_A_TX, DMA_PORT_A_RX); port_init(&port_b, 2, &PORT_B, GCLK_PORT_B, TCC_PORT_B, DMA_PORT_B_TX, DMA_PORT_B_RX); __enable_irq(); SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk; init_systick(); while (1) { __WFI(); } }
void IOPMaster(UNSIGNED argc, VOID *argv) { STATUS status; int ch = 0; int i; unsigned long pci_id; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; printf("\n\r"); printf("Executing the System Code....\n\r"); /* Initilaize the Hardware */ #ifdef INCLUDE_ODYSSEY #if 0 if ((status = Init_Hardware()) != NU_SUCCESS) printf("Error in init %d\r\n", status); gt_init(); gt_initdma(0); gt_initdma(1); board_type = memmaps.aBoardType[getSlotNumber()]; init_buf(get_slotno()); #else init_galileo(); /* enable the Switches */ *((U8 *)(0xBC0F8000)) = 0; a_id = b_id = c_id = d_id = e_id = f_id = h_id = 0; /* Init the E bridge */ printf("Initializing the Bridge E...."); pci_id = get_pci_id(0, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_G_NUM, PCI_E_NUM, PCI_E_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); e_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the F bridge */ printf("Initializing the Bridge F...."); pci_id = get_pci_id(0, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_G_NUM, PCI_F_NUM, PCI_F_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); f_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the H bridge */ printf("Initializing the Bridge H...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_H_NUM, PCI_H_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); h_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the C bridge */ printf("Initializing the Bridge C...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_C_NUM, PCI_C_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); c_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the D bridge */ printf("Initializing the Bridge D...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 2); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_D_NUM, PCI_D_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); d_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the A bridge */ printf("Initializing the Bridge A...."); pci_id = get_pci_id(PCI_H_NUM, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_H_NUM, PCI_A_NUM, PCI_A_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); a_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the B bridge */ printf("Initializing the Bridge B...."); pci_id = get_pci_id(PCI_H_NUM, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_H_NUM, PCI_B_NUM, PCI_B_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); b_id = pci_id; } else { printf("Fail\n\r"); goto done; } #endif #else init_galileo(); #endif INCLUDE_ODYSSEY done: /* Spawn the rest of the tasks and initialize */ Init_System(&System_Memory); /* Lower the Priority of this task */ NU_Change_Priority( (NU_TASK *)&IOPMaster_Task, 250 ); /* Now this task will be active with lowest priority and can be used to * any cleanup required */ for(;;){ NU_Sleep(500); Cleanup_System(); /* rlw: can we implement erc91 functionality here? */ } }
int main(int argc, char *argv[]) { int sd = -1; char *conf_file = NULL; struct mosquitto *mosq; struct module *md; struct device *dev; int rc; int i; gbuf[0] = 0; if (!quiet) printf("Version: %s\n", version); signal(SIGINT, handle_signal); signal(SIGTERM, handle_signal); signal(SIGUSR1, handle_signal); signal(SIGUSR2, handle_signal); signal(SIGALRM, each_sec); for (i=1; i<argc; i++) { if(!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config")){ if(i==argc-1){ fprintf(stderr, "Error: -c argument given but no file specified.\n\n"); print_usage(argv[0]); return 1; }else{ conf_file = argv[i+1]; } i++; }else if(!strcmp(argv[i], "--quiet")){ quiet = true; }else{ fprintf(stderr, "Error: Unknown option '%s'.\n",argv[i]); print_usage(argv[0]); return 1; } } if (!conf_file) { fprintf(stderr, "Error: No config file given.\n"); return 1; } memset(&config, 0, sizeof(struct bridge_config)); if (config_parse(conf_file, &config)) return 1; if (quiet) config.debug = 0; if (config.debug != 0) printf("Debug: %d\n", config.debug); rc = bridge_init(&bridge, config.id, MODULES_BRIDGE_ID); if (rc) { if (config.debug) printf("Error: Failed to initialize bridge: %d\n", rc); return 1; } mosquitto_lib_init(); mosq = mosquitto_new(config.id, true, NULL); if(!mosq){ fprintf(stderr, "Error creating mqtt instance.\n"); switch(errno){ case ENOMEM: fprintf(stderr, " out of memory.\n"); break; case EINVAL: fprintf(stderr, " invalid id.\n"); break; } return 1; } snprintf(gbuf, GBUF_SIZE, "%d", PROTOCOL_TIMEOUT); mosquitto_will_set(mosq, bridge.bridge_dev->status_topic, strlen(gbuf), gbuf, config.mqtt_qos, MQTT_RETAIN); mosquitto_connect_callback_set(mosq, on_mqtt_connect); mosquitto_disconnect_callback_set(mosq, on_mqtt_disconnect); mosquitto_message_callback_set(mosq, on_mqtt_message); mosquitto_user_data_set(mosq, &sd); md = bridge_add_module(bridge.bridge_dev, MODULES_MQTT_ID, true); if (!md) { fprintf(stderr, "Failed to add MQTT module.\n"); return 1; } if (config.scripts_folder) { if (access(config.scripts_folder, R_OK )) { fprintf(stderr, "Couldn't open scripts folder: %s\n", config.scripts_folder); return 1; } md = bridge_add_module(bridge.bridge_dev, MODULES_SCRIPT_ID, true); if (!md) { fprintf(stderr, "Failed to add script module.\n"); return 1; } } if (config.interface) { //TODO: check if interface exists if (access("/proc/net/dev", R_OK )) { fprintf(stderr, "Couldn't open /proc/net/dev\n"); return 1; } md = bridge_add_module(bridge.bridge_dev, MODULES_BANDWIDTH_ID, true); if (!md) { fprintf(stderr, "Failed to add bandwidth module.\n"); return 1; } bandwidth = true; } if (config.serial.port) { sd = serialport_init(config.serial.port, config.serial.baudrate); if( sd == -1 ) { fprintf(stderr, "Couldn't open serial port.\n"); return 1; } else { md = bridge_add_module(bridge.bridge_dev, MODULES_SERIAL_ID, true); if (!md) { fprintf(stderr, "Failed to add serial module.\n"); return 1; } serialport_flush(sd); bridge.serial_ready = true; if (config.debug) printf("Serial ready.\n"); } } if (config.debug > 2) bridge_print_modules(bridge.bridge_dev); rc = mosquitto_connect(mosq, config.mqtt_host, config.mqtt_port, 60); if (rc) { fprintf(stderr, "ERROR: %s\n", mosquitto_strerror(rc)); return -1; } alarm(1); while (run) { if (bridge.serial_ready) { rc = serial_in(sd, mosq, MODULES_SERIAL_ID); if (rc == -1) { serial_hang(mosq); } else if (rc > 0) { bridge.serial_alive = DEVICE_ALIVE_MAX; } } if (user_signal) { if (config.debug > 2) printf("Signal - SIGUSR: %d\n", user_signal); signal_usr(sd, mosq); } rc = mosquitto_loop(mosq, 100, 1); if (run && rc) { if (config.debug > 2) printf("MQTT loop: %s\n", mosquitto_strerror(rc)); usleep(100000); // wait 100 msec mosquitto_reconnect(mosq); } usleep(20); if (every1s) { every1s = false; for (dev = bridge.dev_list; dev != NULL; dev = dev->next) { if (dev->alive) { dev->alive--; if (!dev->alive) { if (connected) { snprintf(gbuf, GBUF_SIZE, "%d", PROTOCOL_TIMEOUT); mqtt_publish(mosq, dev->status_topic, gbuf); rc = mosquitto_unsubscribe(mosq, NULL, dev->config_topic); if (rc) fprintf(stderr, "Error: MQTT unsubscribe returned: %s\n", mosquitto_strerror(rc)); } if (config.debug) printf("Device: %s - Timeout.\n", dev->id); bridge_remove_device(&bridge, dev->id); } } } } if (every30s) { every30s = false; if (connected) { send_alive(mosq); if (bandwidth) { md = bridge_get_module(bridge.bridge_dev, MODULES_BANDWIDTH_ID); if (md) { snprintf(gbuf, GBUF_SIZE, "%.0f,%.0f", upspeed, downspeed); mqtt_publish(mosq, md->topic, gbuf); if (config.debug > 2) printf("down: %f - up: %f\n", downspeed, upspeed); } } } else { if (config.debug) printf("MQTT Offline.\n"); } if (bridge.serial_alive) { bridge.serial_alive--; if (!bridge.serial_alive) { if (config.debug > 1) printf("Serial timeout.\n"); serial_hang(mosq); } } else { if (config.serial.port && !bridge.serial_ready) { if (config.debug > 1) printf("Trying to reconnect serial port.\n"); serialport_close(sd); sd = serialport_init(config.serial.port, config.serial.baudrate); if( sd == -1 ) { fprintf(stderr, "Couldn't open serial port.\n"); } else { serialport_flush(sd); bridge.serial_ready = true; snprintf(gbuf, GBUF_SIZE, "%d", MODULES_SERIAL_OPEN); mqtt_publish(mosq, md->topic, gbuf); if (config.debug) printf("Serial reopened.\n"); } } } } } if (bridge.serial_ready) { serialport_close(sd); } mosquitto_destroy(mosq); mosquitto_lib_cleanup(); config_cleanup(&config); printf("Exiting..\n\n"); return 0; }
void user_init(void) { uart_set_baud(0, 921600); printf("\n\nESP8266 UMAC\n\n"); bridge_init(); umac_cfg um_cfg = { .timer_fn = umac_impl_request_future_tick, .cancel_timer_fn = umac_impl_cancel_future_tick, .now_fn = umac_impl_now_tick, .tx_byte_fn = umac_impl_tx_byte, .tx_buf_fn = umac_impl_tx_buf, .rx_pkt_fn = umac_impl_rx_pkt, .rx_pkt_ack_fn = bridge_pkt_acked, .timeout_fn = bridge_timeout, .nonprotocol_data_fn = NULL }; umac_init(&um, &um_cfg, rx_buf); um_tim_hdl = xTimerCreate( (signed char *)"umac_tim", 10, false, (void *)um_tim_id, um_tim_cb); char ap_cred[128]; struct sdk_station_config config; bool setup_ap = true; systask_init(); device_id = 0; fs_init(); if (fs_mount() >= 0) { #if 0 spiffs_DIR d; struct spiffs_dirent e; struct spiffs_dirent *pe = &e; fs_opendir("/", &d); while ((pe = fs_readdir(&d, pe))) { printf("%s [%04x] size:%i\n", pe->name, pe->obj_id, pe->size); } fs_closedir(&d); #endif // read preferred ssid spiffs_file fd_ssid = fs_open(".ssid", SPIFFS_RDONLY, 0); if (fd_ssid > 0) { if (fs_read(fd_ssid, (uint8_t *)ap_cred, sizeof(ap_cred)) > 0) { fs_close(fd_ssid); char *nl_ix = strchr(ap_cred, '\n'); if (nl_ix > 0) { memset(&config, 0, sizeof(struct sdk_station_config)); strncpy((char *)&config.ssid, ap_cred, nl_ix - ap_cred); char *nl_ix2 = strchr(nl_ix + 1, '\n'); if (nl_ix2 > 0) { strncpy((char *)&config.password, nl_ix + 1, nl_ix2 - (nl_ix + 1)); setup_ap = false; } } printf("ssid:%s\n", config.ssid); } // if read else { printf("could not read .ssid\n"); } } // if fs_ssid else { printf("no .ssid found, running softAP\n"); } // find device id or create one spiffs_file fd_devid = fs_open(".devid", SPIFFS_RDONLY, 0); if (fd_devid < 0) { device_id = hwrand(); fd_devid = fs_open(".devid", SPIFFS_O_CREAT | SPIFFS_O_TRUNC | SPIFFS_O_WRONLY | SPIFFS_O_APPEND, 0); fs_write(fd_devid, &device_id, 4); printf("create devid\n"); } else { fs_read(fd_devid, &device_id, 4); } fs_close(fd_devid); printf("devid %08x\n", device_id); // remove previous scan results fs_remove(SYSTASK_AP_SCAN_FILENAME); } // if mount if (setup_ap) { sdk_wifi_set_opmode(SOFTAP_MODE); struct ip_info ap_ip; IP4_ADDR(&ap_ip.ip, 192, 169, 1, 1); IP4_ADDR(&ap_ip.gw, 0, 0, 0, 0); IP4_ADDR(&ap_ip.netmask, 255, 255, 255, 0); sdk_wifi_set_ip_info(1, &ap_ip); struct sdk_softap_config ap_cfg = { .ssid = "WISLEEP", .password = "", .ssid_len = 7, .channel = 1, .authmode = AUTH_OPEN, .ssid_hidden = false, .max_connection = 255, .beacon_interval = 100 }; sdk_wifi_softap_set_config(&ap_cfg); ip_addr_t first_client_ip; IP4_ADDR(&first_client_ip, 192, 169, 1, 100); dhcpserver_start(&first_client_ip, 4); } else { // required to call wifi_set_opmode before station_set_config sdk_wifi_set_opmode(STATION_MODE); sdk_wifi_station_set_config(&config); } server_init(server_actions); um_mutex = xSemaphoreCreateMutex(); xTaskCreate(uart_task, (signed char * )"uart_task", 512, NULL, 2, NULL); xTaskCreate(server_task, (signed char *)"server_task", 1024, NULL, 2, NULL); }