py32f002b_hal_gpio_ex.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. ******************************************************************************
  3. * @file py32f002b_hal_gpio_ex.h
  4. * @author MCU Application Team
  5. * @brief Header file of GPIO HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef __PY32F002B_HAL_GPIO_EX_H
  32. #define __PY32F002B_HAL_GPIO_EX_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "py32f002b_hal_def.h"
  38. /** @addtogroup PY32F002B_HAL_Driver
  39. * @{
  40. */
  41. /** @defgroup GPIOEx GPIOEx
  42. * @brief GPIO Extended HAL module driver
  43. * @{
  44. */
  45. /* Exported types ------------------------------------------------------------*/
  46. /* Exported constants --------------------------------------------------------*/
  47. /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
  48. * @{
  49. */
  50. /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
  51. * @{
  52. */
  53. /**
  54. * @brief AF 0 selection
  55. */
  56. #define GPIO_AF0_SPI1 (0x0000000U) /*!< SPI1 Alternate Function mapping */
  57. #define GPIO_AF0_SWJ (0x0000000U) /*!< SWJ (SWD) Alternate Function mapping */
  58. /**
  59. * @brief AF 1 selection
  60. */
  61. #define GPIO_AF1_USART1 (0x0000001U) /*!< USART1 Alternate Function mapping */
  62. /**
  63. * @brief AF 2 selection
  64. */
  65. #define GPIO_AF2_TIM1 (0x0000002U) /*!< TIM1 Alternate Function mapping */
  66. #define GPIO_AF2_SPI1 (0x0000002U) /*!< SPI1 Alternate Function mapping */
  67. /**
  68. * @brief AF 3 selection
  69. */
  70. #define GPIO_AF3_USART1 (0x0000003U) /*!< USART1 Alternate Function mapping*/
  71. #define GPIO_AF3_TIM1 (0x0000003U) /*!< TIM1 Alternate Function mapping*/
  72. /**
  73. * @brief AF 4 selection
  74. */
  75. #define GPIO_AF4_MCO (0x0000004U) /*!< MCO Alternate Function mapping*/
  76. #if defined (COMP1)
  77. #define GPIO_AF4_COMP1 (0x0000004U) /*!< COMP1 Alternate Function mapping*/
  78. #endif
  79. #if defined (COMP2)
  80. #define GPIO_AF4_COMP2 (0x0000004U) /*!< COMP2 Alternate Function mapping*/
  81. #endif
  82. /**
  83. * @brief AF 5 selection
  84. */
  85. #define GPIO_AF5_TIM14 (0x0000005U) /*!< TIM14 Alternate Function mapping*/
  86. /**
  87. * @brief AF 6 selection
  88. */
  89. #define GPIO_AF6_I2C1 (0x0000006U) /*!< I2C1 Alternate Function mapping */
  90. /**
  91. * @brief AF 7 selection
  92. */
  93. #define GPIO_AF7_EVENTOUT (0x0000007U) /*!< EVENTOUT Alternate Function mapping */
  94. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  95. /**
  96. * @}
  97. */
  98. /**
  99. * @}
  100. */
  101. /* Exported macro ------------------------------------------------------------*/
  102. /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
  103. * @{
  104. */
  105. /** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
  106. * @{
  107. */
  108. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  109. ((__GPIOx__) == (GPIOB))? 1uL : 2uL)
  110. /**
  111. * @}
  112. */
  113. /**
  114. * @}
  115. */
  116. /* Exported functions --------------------------------------------------------*/
  117. /**
  118. * @}
  119. */
  120. /**
  121. * @}
  122. */
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #endif /* __PY32F002B_HAL_GPIO_EX_H */
  127. /************************ (C) COPYRIGHT Puya *****END OF FILE****/