sleep_gpio.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include "sdkconfig.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /**
  13. * @file sleep_gpio.h
  14. *
  15. * This file contains declarations of GPIO related functions in light sleep mode.
  16. */
  17. #if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
  18. /**
  19. * @brief Save GPIO pull-up and pull-down configuration information in the wake-up state
  20. *
  21. * In light sleep mode, the pull-up and pull-down resistors of GPIO will cause
  22. * leakage current when the system sleeps. In order to reduce the power
  23. * consumption of system sleep, it needs to save the configuration information
  24. * of all GPIO pull-up and pull-down resistors and disable the pull-up and
  25. * pull-down resistors of GPIO before the system enters sleep.
  26. */
  27. void gpio_sleep_mode_config_apply(void);
  28. /**
  29. * @brief Restore GPIO pull-up and pull-down configuration information in the wake-up state
  30. *
  31. * In light sleep mode, after the system wakes up, it needs to restore all GPIO
  32. * pull-up and pull-down configurations before the last sleep.
  33. */
  34. void gpio_sleep_mode_config_unapply(void);
  35. #endif // SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
  36. #ifdef __cplusplus
  37. }
  38. #endif