kopia lustrzana https://github.com/espressif/esp-idf
openthread: move implementation-specific functions to private headers
rodzic
dea281a48e
commit
8e0af4267b
|
@ -44,8 +44,6 @@ esp_err_t esp_openthread_init(const esp_openthread_platform_config_t *init_confi
|
||||||
*
|
*
|
||||||
* @note Thie function will not return unless error happens when running the OpenThread stack.
|
* @note Thie function will not return unless error happens when running the OpenThread stack.
|
||||||
*
|
*
|
||||||
* @param[in] init_config The initialization configuration.
|
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
* - ESP_ERR_NO_MEM if allocation has failed
|
* - ESP_ERR_NO_MEM if allocation has failed
|
||||||
|
@ -55,7 +53,7 @@ esp_err_t esp_openthread_init(const esp_openthread_platform_config_t *init_confi
|
||||||
esp_err_t esp_openthread_launch_mainloop(void);
|
esp_err_t esp_openthread_launch_mainloop(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function performs OpenThread stack and platform driver deinitialization.
|
* @brief This function performs OpenThread stack and platform driver deinitialization.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success
|
* - ESP_OK on success
|
||||||
|
@ -64,37 +62,6 @@ esp_err_t esp_openthread_launch_mainloop(void);
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_openthread_deinit(void);
|
esp_err_t esp_openthread_deinit(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initializes the platform-specific support for the OpenThread stack.
|
|
||||||
*
|
|
||||||
* @note This function is not called by and will not call the OpenThread library.
|
|
||||||
* The user needs to call otInstanceInitSingle to intialize the OpenThread
|
|
||||||
* stack after calling this function.
|
|
||||||
*
|
|
||||||
* @param[in] init_config The initialization configuration.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* - ESP_OK on success
|
|
||||||
* - ESP_ERR_NO_MEM if allocation has failed
|
|
||||||
* - ESP_ERR_INVALID_ARG if radio or host connection mode not supported
|
|
||||||
* - ESP_ERR_INVALID_STATE if already initialized
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
esp_err_t esp_openthread_platform_init(const esp_openthread_platform_config_t *init_config);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function performs all platform-specific deinitialization for OpenThread's drivers.
|
|
||||||
*
|
|
||||||
* @note This function is not called by the OpenThread library. Instead, the user should
|
|
||||||
* call this function when deinitialization of OpenThread's drivers is most appropriate.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* - ESP_OK on success
|
|
||||||
* - ESP_ERR_INVALID_STATE if not initialized
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
esp_err_t esp_openthread_platform_deinit(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function acquires the underlying OpenThread instance.
|
* @brief This function acquires the underlying OpenThread instance.
|
||||||
*
|
*
|
||||||
|
@ -105,34 +72,6 @@ esp_err_t esp_openthread_platform_deinit(void);
|
||||||
*/
|
*/
|
||||||
otInstance *esp_openthread_get_instance(void);
|
otInstance *esp_openthread_get_instance(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function updates the platform fds and timeouts
|
|
||||||
*
|
|
||||||
* @note This function will not update the OpenThread core stack pending events.
|
|
||||||
* The users need to call `otTaskletsArePending` to check whether there being
|
|
||||||
* pending OpenThread tasks.
|
|
||||||
*
|
|
||||||
* @param[inout] mainloop The main loop context.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void esp_openthread_platform_update(esp_openthread_mainloop_context_t *mainloop);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function performs the OpenThread related platform process (radio, uart, alarm etc.)
|
|
||||||
*
|
|
||||||
* @note This function will call the OpenThread core stack process functions.
|
|
||||||
* The users need to call `otTaskletsProcess` by self.
|
|
||||||
*
|
|
||||||
* @param[in] instance The OpenThread instance.
|
|
||||||
* @param[in] mainloop The main loop context.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* - ESP_OK on success
|
|
||||||
* - ESP_FAIL on failure
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
esp_err_t esp_openthread_platform_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // end of extern "C"
|
} // end of extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esp_openthread_types.h"
|
||||||
|
|
||||||
|
#define ESP_OPENTHREAD_DEFAULT_RADIO_UART_RCP_CONFIG(pin_rx, pin_tx) \
|
||||||
|
{ \
|
||||||
|
.radio_mode = RADIO_MODE_UART_RCP, \
|
||||||
|
.radio_uart_config = { \
|
||||||
|
.port = 1, \
|
||||||
|
.uart_config = \
|
||||||
|
{ \
|
||||||
|
.baud_rate = 115200, \
|
||||||
|
.data_bits = UART_DATA_8_BITS, \
|
||||||
|
.parity = UART_PARITY_DISABLE, \
|
||||||
|
.stop_bits = UART_STOP_BITS_1, \
|
||||||
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \
|
||||||
|
.rx_flow_ctrl_thresh = 0, \
|
||||||
|
.source_clk = UART_SCLK_APB, \
|
||||||
|
}, \
|
||||||
|
.rx_pin = pin_rx, \
|
||||||
|
.tx_pin = pin_tx, \
|
||||||
|
}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ESP_OPENTHREAD_DEFAULT_UART_HOST_CONFIG() \
|
||||||
|
{ \
|
||||||
|
.host_connection_mode = HOST_CONNECTION_MODE_UART, \
|
||||||
|
.host_uart_config = { \
|
||||||
|
.port = 0, \
|
||||||
|
.uart_config = \
|
||||||
|
{ \
|
||||||
|
.baud_rate = 115200, \
|
||||||
|
.data_bits = UART_DATA_8_BITS, \
|
||||||
|
.parity = UART_PARITY_DISABLE, \
|
||||||
|
.stop_bits = UART_STOP_BITS_1, \
|
||||||
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \
|
||||||
|
.rx_flow_ctrl_thresh = 0, \
|
||||||
|
.source_clk = UART_SCLK_APB, \
|
||||||
|
}, \
|
||||||
|
.rx_pin = UART_PIN_NO_CHANGE, \
|
||||||
|
.tx_pin = UART_PIN_NO_CHANGE, \
|
||||||
|
}, \
|
||||||
|
}
|
|
@ -38,27 +38,6 @@ void *esp_openthread_netif_glue_init(void);
|
||||||
*/
|
*/
|
||||||
void esp_openthread_netif_glue_deinit(void);
|
void esp_openthread_netif_glue_deinit(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function updates the netif fds and timeouts to the main loop.
|
|
||||||
*
|
|
||||||
* @param[inout] mainloop The main loop context.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void esp_openthread_netif_glue_update(esp_openthread_mainloop_context_t *mainloop);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function performs the netif process.
|
|
||||||
*
|
|
||||||
* @param[in] instance The OpenThread instance.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* - ESP_OK on success
|
|
||||||
* - ESP_FAIL on OpenThread failure
|
|
||||||
* - ESP_ERR_NO_MEM on memory allocation failure
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
esp_err_t esp_openthread_netif_glue_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
#include "esp_openthread_common_macro.h"
|
#include "esp_openthread_common_macro.h"
|
||||||
#include "esp_openthread_lock.h"
|
#include "esp_openthread_lock.h"
|
||||||
#include "esp_openthread_netif_glue_priv.h"
|
#include "esp_openthread_netif_glue_priv.h"
|
||||||
|
#include "esp_openthread_platform.h"
|
||||||
#include "esp_openthread_types.h"
|
#include "esp_openthread_types.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "openthread/instance.h"
|
#include "openthread/instance.h"
|
||||||
#include "openthread/tasklet.h"
|
#include "openthread/tasklet.h"
|
||||||
#include "platform/logging.h"
|
|
||||||
|
|
||||||
static void esp_openthread_state_callback(otChangedFlags changed_flags, void *ctx)
|
static void esp_openthread_state_callback(otChangedFlags changed_flags, void *ctx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License
|
// limitations under the License
|
||||||
|
|
||||||
#include "esp_openthread.h"
|
#include "esp_openthread_platform.h"
|
||||||
|
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
#include "esp_openthread_common_macro.h"
|
#include "esp_openthread_common_macro.h"
|
||||||
#include "esp_openthread_lock.h"
|
#include "esp_openthread_lock.h"
|
||||||
#include "esp_openthread_netif_glue.h"
|
#include "esp_openthread_netif_glue.h"
|
||||||
|
#include "esp_openthread_netif_glue_priv.h"
|
||||||
#include "esp_openthread_radio_uart.h"
|
#include "esp_openthread_radio_uart.h"
|
||||||
#include "esp_openthread_types.h"
|
#include "esp_openthread_types.h"
|
||||||
#include "esp_openthread_uart.h"
|
#include "esp_openthread_uart.h"
|
||||||
|
@ -30,8 +31,6 @@
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "openthread/cli.h"
|
#include "openthread/cli.h"
|
||||||
#include "openthread/instance.h"
|
#include "openthread/instance.h"
|
||||||
#include "openthread/platform/alarm-milli.h"
|
|
||||||
#include "openthread/platform/time.h"
|
|
||||||
#include "openthread/tasklet.h"
|
#include "openthread/tasklet.h"
|
||||||
|
|
||||||
static esp_openthread_platform_config_t s_platform_config;
|
static esp_openthread_platform_config_t s_platform_config;
|
||||||
|
@ -39,33 +38,29 @@ static bool s_openthread_platform_initialized = false;
|
||||||
|
|
||||||
esp_err_t esp_openthread_platform_init(const esp_openthread_platform_config_t *config)
|
esp_err_t esp_openthread_platform_init(const esp_openthread_platform_config_t *config)
|
||||||
{
|
{
|
||||||
if (config->radio_config.radio_mode != RADIO_MODE_UART_RCP) {
|
ESP_RETURN_ON_FALSE(config->radio_config.radio_mode == RADIO_MODE_UART_RCP, ESP_ERR_INVALID_ARG, OT_PLAT_LOG_TAG,
|
||||||
otLogCritPlat("Radio mode not supported");
|
"Radio mode not supported");
|
||||||
return ESP_ERR_INVALID_ARG;
|
ESP_RETURN_ON_FALSE(config->host_config.host_connection_mode == HOST_CONNECTION_MODE_NONE ||
|
||||||
}
|
config->host_config.host_connection_mode == HOST_CONNECTION_MODE_UART,
|
||||||
if (config->host_config.host_connection_mode != HOST_CONNECTION_MODE_NONE &&
|
ESP_ERR_INVALID_ARG, OT_PLAT_LOG_TAG, "Host connection mode not supported");
|
||||||
config->host_config.host_connection_mode != HOST_CONNECTION_MODE_UART) {
|
ESP_RETURN_ON_FALSE(!s_openthread_platform_initialized, ESP_ERR_INVALID_STATE, OT_PLAT_LOG_TAG,
|
||||||
otLogCritPlat("Host connection mode not supported");
|
"OpenThread platform already initialized");
|
||||||
return ESP_ERR_INVALID_ARG;
|
|
||||||
}
|
|
||||||
if (s_openthread_platform_initialized) {
|
|
||||||
return ESP_ERR_INVALID_STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t error = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
|
|
||||||
s_platform_config = *config;
|
s_platform_config = *config;
|
||||||
SuccessOrExit(error = esp_openthread_lock_init());
|
ESP_GOTO_ON_ERROR(esp_openthread_lock_init(), exit, OT_PLAT_LOG_TAG, "esp_openthread_lock_init failed");
|
||||||
if (config->host_config.host_connection_mode == HOST_CONNECTION_MODE_UART) {
|
if (config->host_config.host_connection_mode == HOST_CONNECTION_MODE_UART) {
|
||||||
SuccessOrExit(error = esp_openthread_uart_init(config));
|
ESP_GOTO_ON_ERROR(esp_openthread_uart_init(config), exit, OT_PLAT_LOG_TAG, "esp_openthread_uart_init failed");
|
||||||
}
|
}
|
||||||
SuccessOrExit(error = esp_openthread_radio_init(config));
|
ESP_GOTO_ON_ERROR(esp_openthread_radio_init(config), exit, OT_PLAT_LOG_TAG, "esp_openthread_radio_init failed");
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (error != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
esp_openthread_platform_deinit();
|
esp_openthread_platform_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
otInstance *esp_openthread_get_instance(void)
|
otInstance *esp_openthread_get_instance(void)
|
||||||
|
@ -75,14 +70,15 @@ otInstance *esp_openthread_get_instance(void)
|
||||||
|
|
||||||
esp_err_t esp_openthread_platform_deinit(void)
|
esp_err_t esp_openthread_platform_deinit(void)
|
||||||
{
|
{
|
||||||
if (!s_openthread_platform_initialized) {
|
ESP_RETURN_ON_FALSE(s_openthread_platform_initialized, ESP_ERR_INVALID_STATE, OT_PLAT_LOG_TAG,
|
||||||
return ESP_ERR_INVALID_STATE;
|
"OpenThread platform not initialized");
|
||||||
}
|
|
||||||
esp_openthread_radio_deinit();
|
esp_openthread_radio_deinit();
|
||||||
if (s_platform_config.host_config.host_connection_mode == HOST_CONNECTION_MODE_UART) {
|
if (s_platform_config.host_config.host_connection_mode == HOST_CONNECTION_MODE_UART) {
|
||||||
esp_openthread_uart_deinit();
|
esp_openthread_uart_deinit();
|
||||||
}
|
}
|
||||||
esp_openthread_lock_deinit();
|
esp_openthread_lock_deinit();
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,27 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
void esp_openthread_netif_glue_state_callback(otChangedFlags changed_flags);
|
void esp_openthread_netif_glue_state_callback(otChangedFlags changed_flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function updates the netif fds and timeouts to the main loop.
|
||||||
|
*
|
||||||
|
* @param[inout] mainloop The main loop context.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void esp_openthread_netif_glue_update(esp_openthread_mainloop_context_t *mainloop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function performs the netif process.
|
||||||
|
*
|
||||||
|
* @param[in] instance The OpenThread instance.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
* - ESP_FAIL on OpenThread failure
|
||||||
|
* - ESP_ERR_NO_MEM on memory allocation failure
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_openthread_netif_glue_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_openthread_types.h"
|
||||||
|
#include "openthread/error.h"
|
||||||
|
#include "openthread/instance.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the platform-specific support for the OpenThread stack.
|
||||||
|
*
|
||||||
|
* @note This function is not called by and will not call the OpenThread library.
|
||||||
|
* The user needs to call otInstanceInitSingle to intialize the OpenThread
|
||||||
|
* stack after calling this function.
|
||||||
|
*
|
||||||
|
* @param[in] init_config The initialization configuration.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
* - ESP_ERR_NO_MEM if allocation has failed
|
||||||
|
* - ESP_ERR_INVALID_ARG if radio or host connection mode not supported
|
||||||
|
* - ESP_ERR_INVALID_STATE if already initialized
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_openthread_platform_init(const esp_openthread_platform_config_t *init_config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs all platform-specific deinitialization for OpenThread's drivers.
|
||||||
|
*
|
||||||
|
* @note This function is not called by the OpenThread library. Instead, the user should
|
||||||
|
* call this function when deinitialization of OpenThread's drivers is most appropriate.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
* - ESP_ERR_INVALID_STATE if not initialized
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_openthread_platform_deinit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function updates the platform fds and timeouts
|
||||||
|
*
|
||||||
|
* @note This function will not update the OpenThread core stack pending events.
|
||||||
|
* The users need to call `otTaskletsArePending` to check whether there being
|
||||||
|
* pending OpenThread tasks.
|
||||||
|
*
|
||||||
|
* @param[inout] mainloop The main loop context.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void esp_openthread_platform_update(esp_openthread_mainloop_context_t *mainloop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function performs the OpenThread related platform process (radio, uart, alarm etc.)
|
||||||
|
*
|
||||||
|
* @note This function will call the OpenThread core stack process functions.
|
||||||
|
* The users need to call `otTaskletsProcess` by self.
|
||||||
|
*
|
||||||
|
* @param[in] instance The OpenThread instance.
|
||||||
|
* @param[in] mainloop The main loop context.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
* - ESP_FAIL on failure
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_openthread_platform_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // end of extern "C"
|
||||||
|
#endif
|
|
@ -21,6 +21,7 @@
|
||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
#include "esp_netif_types.h"
|
#include "esp_netif_types.h"
|
||||||
#include "esp_openthread.h"
|
#include "esp_openthread.h"
|
||||||
|
#include "esp_openthread_defaults.h"
|
||||||
#include "esp_openthread_lock.h"
|
#include "esp_openthread_lock.h"
|
||||||
#include "esp_openthread_netif_glue.h"
|
#include "esp_openthread_netif_glue.h"
|
||||||
#include "esp_openthread_types.h"
|
#include "esp_openthread_types.h"
|
||||||
|
@ -55,46 +56,8 @@ static esp_netif_t *init_openthread_netif(void)
|
||||||
static void ot_task_worker(void *aContext)
|
static void ot_task_worker(void *aContext)
|
||||||
{
|
{
|
||||||
esp_openthread_platform_config_t config = {
|
esp_openthread_platform_config_t config = {
|
||||||
.radio_config =
|
.radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_UART_RCP_CONFIG(4, 5),
|
||||||
{
|
.host_config = ESP_OPENTHREAD_DEFAULT_UART_HOST_CONFIG(),
|
||||||
.radio_mode = RADIO_MODE_UART_RCP,
|
|
||||||
.radio_uart_config =
|
|
||||||
{
|
|
||||||
.port = 1,
|
|
||||||
.uart_config =
|
|
||||||
{
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.data_bits = UART_DATA_8_BITS,
|
|
||||||
.parity = UART_PARITY_DISABLE,
|
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
|
||||||
.rx_flow_ctrl_thresh = 0,
|
|
||||||
.source_clk = UART_SCLK_APB,
|
|
||||||
},
|
|
||||||
.rx_pin = 4,
|
|
||||||
.tx_pin = 5,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.host_config =
|
|
||||||
{
|
|
||||||
.host_connection_mode = HOST_CONNECTION_MODE_UART,
|
|
||||||
.host_uart_config =
|
|
||||||
{
|
|
||||||
.port = 0,
|
|
||||||
.uart_config =
|
|
||||||
{
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.data_bits = UART_DATA_8_BITS,
|
|
||||||
.parity = UART_PARITY_DISABLE,
|
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
|
||||||
.rx_flow_ctrl_thresh = 0,
|
|
||||||
.source_clk = UART_SCLK_APB,
|
|
||||||
},
|
|
||||||
.rx_pin = UART_PIN_NO_CHANGE,
|
|
||||||
.tx_pin = UART_PIN_NO_CHANGE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
esp_netif_t *openthread_netif;
|
esp_netif_t *openthread_netif;
|
||||||
|
|
||||||
|
@ -123,6 +86,9 @@ static void ot_task_worker(void *aContext)
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
|
// Used eventfds:
|
||||||
|
// * netif
|
||||||
|
// * radio driver
|
||||||
esp_vfs_eventfd_config_t eventfd_config = {
|
esp_vfs_eventfd_config_t eventfd_config = {
|
||||||
.max_fds = 2,
|
.max_fds = 2,
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue