esp_openthread_alarm.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "esp_err.h"
  8. #include "esp_openthread_types.h"
  9. #include "openthread/instance.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief Initializes the OpenThread alarm.
  15. *
  16. * @return
  17. * -ESP_OK on success
  18. * -ESP_ERR_NO_MEM on allocation failure
  19. * -ESP_FAIL on other failures
  20. *
  21. */
  22. esp_err_t esp_openthread_alarm_init(void);
  23. /**
  24. * @brief This function deinitializes the OpenThread alarm.
  25. */
  26. void esp_openthread_alarm_deinit(void);
  27. /**
  28. * @brief Updates the file descriptor with the OpenThread alarm timeout.
  29. *
  30. * @param[inout] mainloop The main loop context.
  31. *
  32. */
  33. void esp_openthread_alarm_update(esp_openthread_mainloop_context_t *mainloop);
  34. /**
  35. * @brief Performs the alarm process and triggers the fired timers for OpenThread.
  36. *
  37. * @param[in] instance The OpenThread instance.
  38. * @param[in] mainloop The main loop context.
  39. *
  40. * return
  41. * - ESP_OK on success
  42. * - ESP_ERROR on other failures
  43. *
  44. */
  45. esp_err_t esp_openthread_alarm_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
  46. #ifdef __cplusplus
  47. }
  48. #endif