62 esp_openthread_platform_config_t config = {
65 .radio_mode = RADIO_MODE_NATIVE,
66 .radio_uart_config = {},
77 .storage_partition_name =
"nvs",
78 .netif_queue_size = 10,
79 .task_queue_size = 10,
85 ESP_ERROR_CHECK(esp_openthread_init(&config));
87#if CONFIG_OPENTHREAD_STATE_INDICATOR_ENABLE
88 ESP_ERROR_CHECK(esp_openthread_state_indicator_init(esp_openthread_get_instance()));
91#if CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC
93 (void) otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL);
96#if CONFIG_OPENTHREAD_CLI
97 esp_openthread_cli_init();
100 esp_netif_t *openthread_netif;
102 openthread_netif = init_openthread_netif(&config);
103 esp_netif_set_default_netif(openthread_netif);
105#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
106 esp_cli_custom_command_init();
110#if CONFIG_OPENTHREAD_CLI
111 esp_openthread_cli_create_task();
113 ESP_LOGI(TAG,
"Activating dataset...");
114 otOperationalDatasetTlvs dataset;
116#ifdef CONFIG_OPENTHREAD_FORCE_DATASET
117 ESP_ERROR_CHECK(esp_openthread_auto_start(NULL));
119 otError error = otDatasetGetActiveTlvs(esp_openthread_get_instance(), &dataset);
120 ESP_ERROR_CHECK(esp_openthread_auto_start((error == OT_ERROR_NONE) ? &dataset : NULL));
122 esp_openthread_launch_mainloop();
125 esp_openthread_netif_glue_deinit();
126 esp_netif_destroy(openthread_netif);
128 esp_vfs_eventfd_unregister();