fix LPC812 PWM
Fork of mbed-dev by
targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_pwr_ex.c@129:2e517c56bcfb, 2016-05-16 (annotated)
- Committer:
- nameless129
- Date:
- Mon May 16 16:50:30 2016 +0000
- Revision:
- 129:2e517c56bcfb
- Parent:
- 0:9b334a45a8ff
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 stm32l1xx_hal_pwr_ex.c |
bogdanm | 0:9b334a45a8ff | 4 | * @author MCD Application Team |
bogdanm | 0:9b334a45a8ff | 5 | * @version V1.0.0 |
bogdanm | 0:9b334a45a8ff | 6 | * @date 5-September-2014 |
bogdanm | 0:9b334a45a8ff | 7 | * @brief Extended PWR HAL module driver. |
bogdanm | 0:9b334a45a8ff | 8 | * This file provides firmware functions to manage the following |
bogdanm | 0:9b334a45a8ff | 9 | * functionalities of the Power Controller (PWR) peripheral: |
bogdanm | 0:9b334a45a8ff | 10 | * + Extended Initialization and de-initialization functions |
bogdanm | 0:9b334a45a8ff | 11 | * + Extended Peripheral Control functions |
bogdanm | 0:9b334a45a8ff | 12 | * |
bogdanm | 0:9b334a45a8ff | 13 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 14 | * @attention |
bogdanm | 0:9b334a45a8ff | 15 | * |
bogdanm | 0:9b334a45a8ff | 16 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 0:9b334a45a8ff | 17 | * |
bogdanm | 0:9b334a45a8ff | 18 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 0:9b334a45a8ff | 19 | * are permitted provided that the following conditions are met: |
bogdanm | 0:9b334a45a8ff | 20 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 21 | * this list of conditions and the following disclaimer. |
bogdanm | 0:9b334a45a8ff | 22 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 23 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 0:9b334a45a8ff | 24 | * and/or other materials provided with the distribution. |
bogdanm | 0:9b334a45a8ff | 25 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 0:9b334a45a8ff | 26 | * may be used to endorse or promote products derived from this software |
bogdanm | 0:9b334a45a8ff | 27 | * without specific prior written permission. |
bogdanm | 0:9b334a45a8ff | 28 | * |
bogdanm | 0:9b334a45a8ff | 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 0:9b334a45a8ff | 30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 0:9b334a45a8ff | 31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 0:9b334a45a8ff | 32 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 0:9b334a45a8ff | 33 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 0:9b334a45a8ff | 34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 0:9b334a45a8ff | 35 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 0:9b334a45a8ff | 36 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 0:9b334a45a8ff | 37 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 0:9b334a45a8ff | 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 0:9b334a45a8ff | 39 | * |
bogdanm | 0:9b334a45a8ff | 40 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 41 | */ |
bogdanm | 0:9b334a45a8ff | 42 | |
bogdanm | 0:9b334a45a8ff | 43 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 44 | #include "stm32l1xx_hal.h" |
bogdanm | 0:9b334a45a8ff | 45 | |
bogdanm | 0:9b334a45a8ff | 46 | /** @addtogroup STM32L1xx_HAL_Driver |
bogdanm | 0:9b334a45a8ff | 47 | * @{ |
bogdanm | 0:9b334a45a8ff | 48 | */ |
bogdanm | 0:9b334a45a8ff | 49 | |
bogdanm | 0:9b334a45a8ff | 50 | /** @defgroup PWREx PWREx |
bogdanm | 0:9b334a45a8ff | 51 | * @brief PWR HAL module driver |
bogdanm | 0:9b334a45a8ff | 52 | * @{ |
bogdanm | 0:9b334a45a8ff | 53 | */ |
bogdanm | 0:9b334a45a8ff | 54 | |
bogdanm | 0:9b334a45a8ff | 55 | #ifdef HAL_PWR_MODULE_ENABLED |
bogdanm | 0:9b334a45a8ff | 56 | |
bogdanm | 0:9b334a45a8ff | 57 | /* Private typedef -----------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 58 | /* Private define ------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 59 | /* Private macro -------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 60 | /* Private variables ---------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 61 | /* Private function prototypes -----------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 62 | /* Private functions ---------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 63 | |
bogdanm | 0:9b334a45a8ff | 64 | /** @defgroup PWREx_Exported_Functions PWREx Exported Functions |
bogdanm | 0:9b334a45a8ff | 65 | * @{ |
bogdanm | 0:9b334a45a8ff | 66 | */ |
bogdanm | 0:9b334a45a8ff | 67 | |
bogdanm | 0:9b334a45a8ff | 68 | /** @defgroup PWREx_Exported_Functions_Group1 Peripheral Extended Features Functions |
bogdanm | 0:9b334a45a8ff | 69 | * @brief Low Power modes configuration functions |
bogdanm | 0:9b334a45a8ff | 70 | * |
bogdanm | 0:9b334a45a8ff | 71 | @verbatim |
bogdanm | 0:9b334a45a8ff | 72 | |
bogdanm | 0:9b334a45a8ff | 73 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 74 | ##### Peripheral extended features functions ##### |
bogdanm | 0:9b334a45a8ff | 75 | =============================================================================== |
bogdanm | 0:9b334a45a8ff | 76 | @endverbatim |
bogdanm | 0:9b334a45a8ff | 77 | * @{ |
bogdanm | 0:9b334a45a8ff | 78 | */ |
bogdanm | 0:9b334a45a8ff | 79 | |
bogdanm | 0:9b334a45a8ff | 80 | /** |
bogdanm | 0:9b334a45a8ff | 81 | * @brief Enables the Fast WakeUp from Ultra Low Power mode. |
bogdanm | 0:9b334a45a8ff | 82 | * @note This bit works in conjunction with ULP bit. |
bogdanm | 0:9b334a45a8ff | 83 | * Means, when ULP = 1 and FWU = 1 :VREFINT startup time is ignored when |
bogdanm | 0:9b334a45a8ff | 84 | * exiting from low power mode. |
bogdanm | 0:9b334a45a8ff | 85 | * @retval None |
bogdanm | 0:9b334a45a8ff | 86 | */ |
bogdanm | 0:9b334a45a8ff | 87 | void HAL_PWREx_EnableFastWakeUp(void) |
bogdanm | 0:9b334a45a8ff | 88 | { |
bogdanm | 0:9b334a45a8ff | 89 | /* Enable the fast wake up */ |
bogdanm | 0:9b334a45a8ff | 90 | *(__IO uint32_t *) CR_FWU_BB = (uint32_t)ENABLE; |
bogdanm | 0:9b334a45a8ff | 91 | } |
bogdanm | 0:9b334a45a8ff | 92 | |
bogdanm | 0:9b334a45a8ff | 93 | /** |
bogdanm | 0:9b334a45a8ff | 94 | * @brief Disables the Fast WakeUp from Ultra Low Power mode. |
bogdanm | 0:9b334a45a8ff | 95 | * @retval None |
bogdanm | 0:9b334a45a8ff | 96 | */ |
bogdanm | 0:9b334a45a8ff | 97 | void HAL_PWREx_DisableFastWakeUp(void) |
bogdanm | 0:9b334a45a8ff | 98 | { |
bogdanm | 0:9b334a45a8ff | 99 | /* Disable the fast wake up */ |
bogdanm | 0:9b334a45a8ff | 100 | *(__IO uint32_t *) CR_FWU_BB = (uint32_t)DISABLE; |
bogdanm | 0:9b334a45a8ff | 101 | } |
bogdanm | 0:9b334a45a8ff | 102 | |
bogdanm | 0:9b334a45a8ff | 103 | /** |
bogdanm | 0:9b334a45a8ff | 104 | * @brief Enables the Ultra Low Power mode |
bogdanm | 0:9b334a45a8ff | 105 | * @retval None |
bogdanm | 0:9b334a45a8ff | 106 | */ |
bogdanm | 0:9b334a45a8ff | 107 | void HAL_PWREx_EnableUltraLowPower(void) |
bogdanm | 0:9b334a45a8ff | 108 | { |
bogdanm | 0:9b334a45a8ff | 109 | /* Enable the Ultra Low Power mode */ |
bogdanm | 0:9b334a45a8ff | 110 | *(__IO uint32_t *) CR_ULP_BB = (uint32_t)ENABLE; |
bogdanm | 0:9b334a45a8ff | 111 | } |
bogdanm | 0:9b334a45a8ff | 112 | |
bogdanm | 0:9b334a45a8ff | 113 | /** |
bogdanm | 0:9b334a45a8ff | 114 | * @brief Disables the Ultra Low Power mode |
bogdanm | 0:9b334a45a8ff | 115 | * @retval None |
bogdanm | 0:9b334a45a8ff | 116 | */ |
bogdanm | 0:9b334a45a8ff | 117 | void HAL_PWREx_DisableUltraLowPower(void) |
bogdanm | 0:9b334a45a8ff | 118 | { |
bogdanm | 0:9b334a45a8ff | 119 | /* Disable the Ultra Low Power mode */ |
bogdanm | 0:9b334a45a8ff | 120 | *(__IO uint32_t *) CR_ULP_BB = (uint32_t)DISABLE; |
bogdanm | 0:9b334a45a8ff | 121 | } |
bogdanm | 0:9b334a45a8ff | 122 | |
bogdanm | 0:9b334a45a8ff | 123 | /** |
bogdanm | 0:9b334a45a8ff | 124 | * @brief Enters the Low Power Run mode. |
bogdanm | 0:9b334a45a8ff | 125 | * @note Low power run mode can only be entered when VCORE is in range 2. |
bogdanm | 0:9b334a45a8ff | 126 | * In addition, the dynamic voltage scaling must not be used when Low |
bogdanm | 0:9b334a45a8ff | 127 | * power run mode is selected. Only Stop and Sleep modes with regulator |
bogdanm | 0:9b334a45a8ff | 128 | * configured in Low power mode is allowed when Low power run mode is |
bogdanm | 0:9b334a45a8ff | 129 | * selected. |
bogdanm | 0:9b334a45a8ff | 130 | * @note In Low power run mode, all I/O pins keep the same state as in Run mode. |
bogdanm | 0:9b334a45a8ff | 131 | * @retval None |
bogdanm | 0:9b334a45a8ff | 132 | */ |
bogdanm | 0:9b334a45a8ff | 133 | void HAL_PWREx_EnableLowPowerRunMode(void) |
bogdanm | 0:9b334a45a8ff | 134 | { |
bogdanm | 0:9b334a45a8ff | 135 | /* Enters the Low Power Run mode */ |
bogdanm | 0:9b334a45a8ff | 136 | *(__IO uint32_t *) CR_LPSDSR_BB = (uint32_t)ENABLE; |
bogdanm | 0:9b334a45a8ff | 137 | *(__IO uint32_t *) CR_LPRUN_BB = (uint32_t)ENABLE; |
bogdanm | 0:9b334a45a8ff | 138 | } |
bogdanm | 0:9b334a45a8ff | 139 | |
bogdanm | 0:9b334a45a8ff | 140 | /** |
bogdanm | 0:9b334a45a8ff | 141 | * @brief Exits the Low Power Run mode. |
bogdanm | 0:9b334a45a8ff | 142 | * @retval None |
bogdanm | 0:9b334a45a8ff | 143 | */ |
bogdanm | 0:9b334a45a8ff | 144 | void HAL_PWREx_DisableLowPowerRunMode(void) |
bogdanm | 0:9b334a45a8ff | 145 | { |
bogdanm | 0:9b334a45a8ff | 146 | /* Exits the Low Power Run mode */ |
bogdanm | 0:9b334a45a8ff | 147 | *(__IO uint32_t *) CR_LPRUN_BB = (uint32_t)DISABLE; |
bogdanm | 0:9b334a45a8ff | 148 | *(__IO uint32_t *) CR_LPSDSR_BB = (uint32_t)DISABLE; |
bogdanm | 0:9b334a45a8ff | 149 | } |
bogdanm | 0:9b334a45a8ff | 150 | |
bogdanm | 0:9b334a45a8ff | 151 | /** |
bogdanm | 0:9b334a45a8ff | 152 | * @} |
bogdanm | 0:9b334a45a8ff | 153 | */ |
bogdanm | 0:9b334a45a8ff | 154 | |
bogdanm | 0:9b334a45a8ff | 155 | /** |
bogdanm | 0:9b334a45a8ff | 156 | * @} |
bogdanm | 0:9b334a45a8ff | 157 | */ |
bogdanm | 0:9b334a45a8ff | 158 | |
bogdanm | 0:9b334a45a8ff | 159 | #endif /* HAL_PWR_MODULE_ENABLED */ |
bogdanm | 0:9b334a45a8ff | 160 | /** |
bogdanm | 0:9b334a45a8ff | 161 | * @} |
bogdanm | 0:9b334a45a8ff | 162 | */ |
bogdanm | 0:9b334a45a8ff | 163 | |
bogdanm | 0:9b334a45a8ff | 164 | /** |
bogdanm | 0:9b334a45a8ff | 165 | * @} |
bogdanm | 0:9b334a45a8ff | 166 | */ |
bogdanm | 0:9b334a45a8ff | 167 | |
bogdanm | 0:9b334a45a8ff | 168 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |