stm32f1xx_hal_gpio_ex.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_gpio_ex.c
  4. * @author MCD Application Team
  5. * @version V1.0.4
  6. * @date 29-April-2016
  7. * @brief GPIO Extension HAL module driver.
  8. * This file provides firmware functions to manage the following
  9. * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
  10. * + Extended features functions
  11. *
  12. @verbatim
  13. ==============================================================================
  14. ##### GPIO Peripheral extension features #####
  15. ==============================================================================
  16. [..] GPIO module on STM32F1 family, manage also the AFIO register:
  17. (+) Possibility to use the EVENTOUT Cortex feature
  18. ##### How to use this driver #####
  19. ==============================================================================
  20. [..] This driver provides functions to use EVENTOUT Cortex feature
  21. (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
  22. (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
  23. (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
  24. @endverbatim
  25. ******************************************************************************
  26. * @attention
  27. *
  28. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  29. *
  30. * Redistribution and use in source and binary forms, with or without modification,
  31. * are permitted provided that the following conditions are met:
  32. * 1. Redistributions of source code must retain the above copyright notice,
  33. * this list of conditions and the following disclaimer.
  34. * 2. Redistributions in binary form must reproduce the above copyright notice,
  35. * this list of conditions and the following disclaimer in the documentation
  36. * and/or other materials provided with the distribution.
  37. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  38. * may be used to endorse or promote products derived from this software
  39. * without specific prior written permission.
  40. *
  41. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  42. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  43. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  44. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  45. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  46. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  47. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  48. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  49. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  50. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51. *
  52. ******************************************************************************
  53. */
  54. /* Includes ------------------------------------------------------------------*/
  55. #include "stm32f1xx_hal.h"
  56. /** @addtogroup STM32F1xx_HAL_Driver
  57. * @{
  58. */
  59. /** @defgroup GPIOEx GPIOEx
  60. * @brief GPIO HAL module driver
  61. * @{
  62. */
  63. #ifdef HAL_GPIO_MODULE_ENABLED
  64. /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
  65. * @{
  66. */
  67. /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
  68. * @brief Extended features functions
  69. *
  70. @verbatim
  71. ==============================================================================
  72. ##### Extended features functions #####
  73. ==============================================================================
  74. [..] This section provides functions allowing to:
  75. (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
  76. (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
  77. (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
  78. @endverbatim
  79. * @{
  80. */
  81. /**
  82. * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
  83. * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
  84. * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
  85. * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
  86. * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
  87. * @retval None
  88. */
  89. void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
  90. {
  91. /* Verify the parameters */
  92. assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
  93. assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
  94. /* Apply the new configuration */
  95. MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT)|(AFIO_EVCR_PIN), (GPIO_PortSource)|(GPIO_PinSource));
  96. }
  97. /**
  98. * @brief Enables the Event Output.
  99. * @retval None
  100. */
  101. void HAL_GPIOEx_EnableEventout(void)
  102. {
  103. SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
  104. }
  105. /**
  106. * @brief Disables the Event Output.
  107. * @retval None
  108. */
  109. void HAL_GPIOEx_DisableEventout(void)
  110. {
  111. CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
  112. }
  113. /**
  114. * @}
  115. */
  116. /**
  117. * @}
  118. */
  119. #endif /* HAL_GPIO_MODULE_ENABLED */
  120. /**
  121. * @}
  122. */
  123. /**
  124. * @}
  125. */
  126. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/