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