stm32f1xx_hal_gpio_ex.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_gpio_ex.c
  4. * @author MCD Application Team
  5. * @brief GPIO Extension HAL module driver.
  6. * This file provides firmware functions to manage the following
  7. * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
  8. * + Extended features functions
  9. *
  10. ******************************************************************************
  11. * @attention
  12. *
  13. * Copyright (c) 2016 STMicroelectronics.
  14. * All rights reserved.
  15. *
  16. * This software is licensed under terms that can be found in the LICENSE file
  17. * in the root directory of this software component.
  18. * If no LICENSE file comes with this software, it is provided AS-IS.
  19. *
  20. ******************************************************************************
  21. @verbatim
  22. ==============================================================================
  23. ##### GPIO Peripheral extension features #####
  24. ==============================================================================
  25. [..] GPIO module on STM32F1 family, manage also the AFIO register:
  26. (+) Possibility to use the EVENTOUT Cortex feature
  27. ##### How to use this driver #####
  28. ==============================================================================
  29. [..] This driver provides functions to use EVENTOUT Cortex feature
  30. (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
  31. (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
  32. (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
  33. @endverbatim
  34. ******************************************************************************
  35. */
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32f1xx_hal.h"
  38. /** @addtogroup STM32F1xx_HAL_Driver
  39. * @{
  40. */
  41. /** @defgroup GPIOEx GPIOEx
  42. * @brief GPIO HAL module driver
  43. * @{
  44. */
  45. #ifdef HAL_GPIO_MODULE_ENABLED
  46. /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
  47. * @{
  48. */
  49. /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
  50. * @brief Extended features functions
  51. *
  52. @verbatim
  53. ==============================================================================
  54. ##### Extended features functions #####
  55. ==============================================================================
  56. [..] This section provides functions allowing to:
  57. (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
  58. (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
  59. (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
  60. @endverbatim
  61. * @{
  62. */
  63. /**
  64. * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
  65. * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
  66. * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
  67. * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
  68. * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
  69. * @retval None
  70. */
  71. void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
  72. {
  73. /* Verify the parameters */
  74. assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
  75. assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
  76. /* Apply the new configuration */
  77. MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource));
  78. }
  79. /**
  80. * @brief Enables the Event Output.
  81. * @retval None
  82. */
  83. void HAL_GPIOEx_EnableEventout(void)
  84. {
  85. SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
  86. }
  87. /**
  88. * @brief Disables the Event Output.
  89. * @retval None
  90. */
  91. void HAL_GPIOEx_DisableEventout(void)
  92. {
  93. CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
  94. }
  95. /**
  96. * @}
  97. */
  98. /**
  99. * @}
  100. */
  101. #endif /* HAL_GPIO_MODULE_ENABLED */
  102. /**
  103. * @}
  104. */
  105. /**
  106. * @}
  107. */