hv_drv_Gpio.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /**
  2. * @file hv_drv_Gpio.c
  3. * @brief gpio driver layer file.
  4. * @details This file provides the following functions: \n
  5. * (1) gpio pull up/down \n
  6. * (2) gpio set direction \n
  7. * (3) gpio set irq trigger mode/callback \n
  8. * (4) gpio read irq state \n
  9. * (5) gpio read level \n
  10. *
  11. * @author HiView SoC Software Team
  12. * @version 1.0.0
  13. * @date 2023-05-30
  14. * @copyright Copyright(c),2023-5, Hiview Software. All rights reserved.
  15. * @par History:
  16. */
  17. #include "hv_drv_Gpio.h"
  18. /**@brief Enable the designated gpio interrupt
  19. * @param[in] ucPinIdx Specified GPIO pin
  20. */
  21. VOID Hv_Drv_Gpio_EnableInt(UCHAR8 ucPinIdx)
  22. {
  23. Hv_Cal_Gpio_EnableInt(ucPinIdx);
  24. }
  25. /**@brief Disable the designated gpio interrupt
  26. * @param[in] ucPinIdx Specified GPIO pin
  27. */
  28. VOID Hv_Drv_Gpio_DisableInt(UCHAR8 ucPinIdx)
  29. {
  30. Hv_Cal_Gpio_DisableInt(ucPinIdx);
  31. }
  32. /**@brief Get interrupt state of designated gpio
  33. * @param[in] ucPinIdx Specified GPIO pin
  34. */
  35. BOOL Hv_Drv_Gpio_GetIntState(UCHAR8 ucPinIdx)
  36. {
  37. return Hv_Drv_Gpio_GetIntState(ucPinIdx);
  38. }
  39. /**@brief Clear the gpio interrupt status
  40. * @param[in]: ucPinIdx Specified GPIO pin
  41. */
  42. VOID Hv_Drv_Gpio_ClrIntState(UCHAR8 ucPinIdx)
  43. {
  44. Hv_Cal_Gpio_ClrIntState(ucPinIdx);
  45. }
  46. /**@brief Set gpio pin interrupt callback
  47. * @param ucPinIdx Specified GPIO pin, pfCallBack Specified callback @ref GpioIntCallBack
  48. */
  49. VOID Hv_Drv_Gpio_SetIntCallBack(UCHAR8 ucPinIdx, GpioIntCallBack pfCallBack)
  50. {
  51. Hv_Cal_Gpio_SetIntCallBack(ucPinIdx, pfCallBack);
  52. }
  53. /**@brief Set gpio pin interrupt trigger type
  54. * @param[in] ucPinIdx Specified GPIO pin, enPull Specified pull acion @ref GpioIntTrigMode
  55. */
  56. VOID Hv_Drv_Gpio_SetIntTriggerMode(UCHAR8 ucPinIdx, GpioIntTrigMode enIntTrigMode)
  57. {
  58. Hv_Cal_Gpio_SetIntTriggerMode(ucPinIdx, enIntTrigMode);
  59. }
  60. /** Set gpio pin interrupt callback
  61. * @param[in/out] N/A
  62. */
  63. VOID Hv_Drv_Gpio_CleanupInt(VOID)
  64. {
  65. Hv_Cal_Gpio_CleanupInt();
  66. }
  67. /**@brief Set gpio pin direction
  68. * @param[in] ucPinIdx Specified GPIO pin, enPull Specified pull acion @ref GpioDir
  69. */
  70. VOID Hv_Drv_Gpio_SetDirection(UCHAR8 ucPinIdx, GpioDir enDir)
  71. {
  72. Hv_Cal_Gpio_SetDirection(ucPinIdx, enDir);
  73. }
  74. /**@brief Get gpio pin direction
  75. * @param[in] ucPinIdx Specified GPIO pin
  76. * @param[out] @ref GpioDir
  77. */
  78. GpioDir Hv_Drv_Gpio_GetDirection(UCHAR8 ucPinIdx)
  79. {
  80. return Hv_Cal_Gpio_GetDirection(ucPinIdx);
  81. }
  82. /**@brief Set gpio pin level
  83. * @param ucPinIdx Specified GPIO pin
  84. * @param enLevel high(1) or low(0) level
  85. */
  86. VOID Hv_Drv_Gpio_SetPinLevel(UCHAR8 ucPinIdx, GpioLevel enLevel)
  87. {
  88. Hv_Cal_Gpio_SetPinLevel(ucPinIdx, enLevel);
  89. }
  90. /**@brief Get gpio pin out level
  91. * @param[in] :ucPinIdx Specified GPIO pin
  92. * @param[out]: state high(1)/low(0)/invalid(2)
  93. */
  94. GpioLevel Hv_Drv_Gpio_GetPinLevel(UCHAR8 ucPinIdx)
  95. {
  96. return Hv_Cal_Gpio_GetPinLevel(ucPinIdx);
  97. }