esp_openthread_radio.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdbool.h>
  8. #include "esp_err.h"
  9. #include "esp_openthread_types.h"
  10. #include "openthread/instance.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /**
  15. * @brief This function initializes the OpenThread radio.
  16. *
  17. * @return
  18. * - ESP_OK on success
  19. * - ESP_ERR_NO_MEM if allocation has failed
  20. *
  21. */
  22. esp_err_t esp_openthread_radio_init(const esp_openthread_platform_config_t *config);
  23. /**
  24. * @brief This function deinitializes the OpenThread radio.
  25. *
  26. */
  27. void esp_openthread_radio_deinit(void);
  28. /**
  29. * @brief This function updates the radio fds and timeouts to the main loop.
  30. *
  31. * @param[inout] mainloop The main loop context.
  32. *
  33. */
  34. void esp_openthread_radio_update(esp_openthread_mainloop_context_t *mainloop);
  35. /**
  36. * @brief This function performs the OpenThread radio process.
  37. *
  38. * @param[in] instance The OpenThread instance.
  39. * @param[in] mainloop The main loop context.
  40. *
  41. * @return
  42. * - ESP_OK on success
  43. * - ESP_FAIL on failure
  44. *
  45. */
  46. esp_err_t esp_openthread_radio_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
  47. #ifdef __cplusplus
  48. }
  49. #endif