stm32f1xx_hal_gpio_ex.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. @verbatim
  11. ==============================================================================
  12. ##### GPIO Peripheral extension features #####
  13. ==============================================================================
  14. [..] GPIO module on STM32F1 family, manage also the AFIO register:
  15. (+) Possibility to use the EVENTOUT Cortex feature
  16. ##### How to use this driver #####
  17. ==============================================================================
  18. [..] This driver provides functions to use EVENTOUT Cortex feature
  19. (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
  20. (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
  21. (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
  22. @endverbatim
  23. ******************************************************************************
  24. * @attention
  25. *
  26. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  27. * All rights reserved.</center></h2>
  28. *
  29. * This software component is licensed by ST under BSD 3-Clause license,
  30. * the "License"; You may not use this file except in compliance with the
  31. * License. You may obtain a copy of the License at:
  32. * opensource.org/licenses/BSD-3-Clause
  33. *
  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. */
  108. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/