timer_wakeup.c 518 B

123456789101112131415161718
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Unlicense OR CC0-1.0
  5. */
  6. #include "esp_check.h"
  7. #include "esp_sleep.h"
  8. #define TIMER_WAKEUP_TIME_US (2 * 1000 * 1000)
  9. static const char *TAG = "timer_wakeup";
  10. esp_err_t example_register_timer_wakeup(void)
  11. {
  12. ESP_RETURN_ON_ERROR(esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US), TAG, "Configure timer as wakeup source failed");
  13. ESP_LOGI(TAG, "timer wakeup source is ready");
  14. return ESP_OK;
  15. }