-
Notifications
You must be signed in to change notification settings - Fork 7.2k
/
esp_openthread.h
71 lines (62 loc) · 1.66 KB
/
esp_openthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_err.h"
#include "esp_openthread_types.h"
#include "openthread/error.h"
#include "openthread/instance.h"
#include "lwip/ip_addr.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