kopia lustrzana https://github.com/espressif/esp-idf
78 wiersze
2.1 KiB
C
78 wiersze
2.1 KiB
C
// 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 full OpenThread stack.
|
|
*
|
|
* @note The OpenThread instance will also be initialized in 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_init(const esp_openthread_platform_config_t *init_config);
|
|
|
|
/**
|
|
* @brief Launches the OpenThread main loop.
|
|
*
|
|
* @note Thie function will not return unless error happens when running the OpenThread stack.
|
|
*
|
|
* @return
|
|
* - ESP_OK on success
|
|
* - ESP_ERR_NO_MEM if allocation has failed
|
|
* - ESP_FAIL on other failures
|
|
*
|
|
*/
|
|
esp_err_t esp_openthread_launch_mainloop(void);
|
|
|
|
/**
|
|
* @brief This function performs OpenThread stack and platform driver deinitialization.
|
|
*
|
|
* @return
|
|
* - ESP_OK on success
|
|
* - ESP_ERR_INVALID_STATE if not initialized
|
|
*
|
|
*/
|
|
esp_err_t esp_openthread_deinit(void);
|
|
|
|
/**
|
|
* @brief This function acquires the underlying OpenThread instance.
|
|
*
|
|
* @note This function can be called on other tasks without lock.
|
|
*
|
|
* @return The OpenThread instance pointer
|
|
*
|
|
*/
|
|
otInstance *esp_openthread_get_instance(void);
|
|
|
|
#ifdef __cplusplus
|
|
} // end of extern "C"
|
|
#endif
|