lp_io.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "soc/soc_caps.h"
  8. #include "esp_err.h"
  9. #include "driver/gpio.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #if SOC_LP_GPIO_MATRIX_SUPPORTED
  14. /**
  15. * @brief Connect a RTC(LP) GPIO input with a peripheral signal, which tagged as input attribute
  16. *
  17. * @note There's no limitation on the number of signals that a RTC(LP) GPIO can connect with
  18. *
  19. * @param gpio_num GPIO number, especially, `LP_GPIO_MATRIX_CONST_ZERO_INPUT` means connect logic 0 to signal
  20. * `LP_GPIO_MATRIX_CONST_ONE_INPUT` means connect logic 1 to signal
  21. * @param signal_idx LP peripheral signal index (tagged as input attribute)
  22. * @param inv Whether the RTC(LP) GPIO input to be inverted or not
  23. * @return
  24. * - ESP_OK Success
  25. * - ESP_ERR_INVALID_ARG Parameter error
  26. */
  27. esp_err_t lp_gpio_connect_in_signal(gpio_num_t gpio_num, uint32_t signal_idx, bool inv);
  28. /**
  29. * @brief Connect a peripheral signal which tagged as output attribute with a RTC(LP) GPIO
  30. *
  31. * @note There's no limitation on the number of RTC(LP) GPIOs that a signal can connect with
  32. *
  33. * @param gpio_num GPIO number
  34. * @param signal_idx LP peripheral signal index (tagged as input attribute), especially, `SIG_LP_GPIO_OUT_IDX` means disconnect RTC(LP) GPIO and other peripherals. Only the RTC GPIO driver can control the output level
  35. * @param out_inv Whether to signal to be inverted or not
  36. * @param oen_inv Whether the output enable control is inverted or not
  37. * @return
  38. * - ESP_OK Success
  39. * - ESP_ERR_INVALID_ARG Parameter error
  40. */
  41. esp_err_t lp_gpio_connect_out_signal(gpio_num_t gpio_num, uint32_t signal_idx, bool out_inv, bool oen_inv);
  42. #endif // SOC_LP_GPIO_MATRIX_SUPPORTED
  43. #ifdef __cplusplus
  44. }
  45. #endif