rtc_ctrl.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include "esp_err.h"
  9. #include "esp_intr_alloc.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief Register a handler for specific RTC_CNTL interrupts
  15. *
  16. * Multiple handlers can be registered using this function. Whenever an
  17. * RTC interrupt happens, all handlers with matching rtc_intr_mask values
  18. * will be called.
  19. *
  20. * @param handler handler function to call
  21. * @param handler_arg argument to be passed to the handler
  22. * @param rtc_intr_mask combination of RTC_CNTL_*_INT_ENA bits indicating the
  23. * sources to call the handler for
  24. * @return
  25. * - ESP_OK on success
  26. * - ESP_ERR_NO_MEM not enough memory to allocate handler structure
  27. * - other errors returned by esp_intr_alloc
  28. */
  29. esp_err_t rtc_isr_register(intr_handler_t handler, void* handler_arg,
  30. uint32_t rtc_intr_mask);
  31. /**
  32. * @brief Deregister the handler previously registered using rtc_isr_register
  33. * @param handler handler function to call (as passed to rtc_isr_register)
  34. * @param handler_arg argument of the handler (as passed to rtc_isr_register)
  35. * @return
  36. * - ESP_OK on success
  37. * - ESP_ERR_INVALID_STATE if a handler matching both handler and
  38. * handler_arg isn't registered
  39. */
  40. esp_err_t rtc_isr_deregister(intr_handler_t handler, void* handler_arg);
  41. #ifdef __cplusplus
  42. }
  43. #endif