mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Mon Sep 28 10:45:10 2015 +0100
Revision:
630:825f75ca301e
Parent:
441:d2c15dda23c1
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10

Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/

NUCLEO_F031K6 : Add new target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 340:28d1f895c6fe 1 /**
mbed_official 340:28d1f895c6fe 2 ******************************************************************************
mbed_official 340:28d1f895c6fe 3 * @file stm32f0xx_hal_cortex.c
mbed_official 340:28d1f895c6fe 4 * @author MCD Application Team
mbed_official 630:825f75ca301e 5 * @version V1.3.0
mbed_official 630:825f75ca301e 6 * @date 26-June-2015
mbed_official 340:28d1f895c6fe 7 * @brief CORTEX HAL module driver.
mbed_official 340:28d1f895c6fe 8 * This file provides firmware functions to manage the following
mbed_official 340:28d1f895c6fe 9 * functionalities of the CORTEX:
mbed_official 340:28d1f895c6fe 10 * + Initialization and de-initialization functions
mbed_official 340:28d1f895c6fe 11 * + Peripheral Control functions
mbed_official 340:28d1f895c6fe 12 *
mbed_official 340:28d1f895c6fe 13 * @verbatim
mbed_official 340:28d1f895c6fe 14 ==============================================================================
mbed_official 340:28d1f895c6fe 15 ##### How to use this driver #####
mbed_official 340:28d1f895c6fe 16 ==============================================================================
mbed_official 340:28d1f895c6fe 17
mbed_official 340:28d1f895c6fe 18 [..]
mbed_official 340:28d1f895c6fe 19 *** How to configure Interrupts using CORTEX HAL driver ***
mbed_official 340:28d1f895c6fe 20 ===========================================================
mbed_official 340:28d1f895c6fe 21 [..]
mbed_official 340:28d1f895c6fe 22 This section provides functions allowing to configure the NVIC interrupts (IRQ).
mbed_official 340:28d1f895c6fe 23 The Cortex-M0 exceptions are managed by CMSIS functions.
mbed_official 340:28d1f895c6fe 24 (#) Enable and Configure the priority of the selected IRQ Channels.
mbed_official 340:28d1f895c6fe 25 The priority can be 0..3.
mbed_official 340:28d1f895c6fe 26
mbed_official 340:28d1f895c6fe 27 -@- Lower priority values gives higher priority.
mbed_official 340:28d1f895c6fe 28 -@- Priority Order:
mbed_official 340:28d1f895c6fe 29 (#@) Lowest priority.
mbed_official 340:28d1f895c6fe 30 (#@) Lowest hardware priority (IRQn position).
mbed_official 340:28d1f895c6fe 31
mbed_official 340:28d1f895c6fe 32 (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority()
mbed_official 340:28d1f895c6fe 33
mbed_official 340:28d1f895c6fe 34 (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ()
mbed_official 630:825f75ca301e 35
mbed_official 630:825f75ca301e 36 -@- Negative value of IRQn_Type are not allowed.
mbed_official 340:28d1f895c6fe 37
mbed_official 340:28d1f895c6fe 38
mbed_official 340:28d1f895c6fe 39 [..]
mbed_official 340:28d1f895c6fe 40 *** How to configure Systick using CORTEX HAL driver ***
mbed_official 340:28d1f895c6fe 41 ========================================================
mbed_official 340:28d1f895c6fe 42 [..]
mbed_official 630:825f75ca301e 43 Setup SysTick Timer for time base.
mbed_official 340:28d1f895c6fe 44
mbed_official 340:28d1f895c6fe 45 (+) The HAL_SYSTICK_Config()function calls the SysTick_Config() function which
mbed_official 340:28d1f895c6fe 46 is a CMSIS function that:
mbed_official 340:28d1f895c6fe 47 (++) Configures the SysTick Reload register with value passed as function parameter.
mbed_official 340:28d1f895c6fe 48 (++) Configures the SysTick IRQ priority to the lowest value (0x03).
mbed_official 340:28d1f895c6fe 49 (++) Resets the SysTick Counter register.
mbed_official 340:28d1f895c6fe 50 (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK).
mbed_official 340:28d1f895c6fe 51 (++) Enables the SysTick Interrupt.
mbed_official 340:28d1f895c6fe 52 (++) Starts the SysTick Counter.
mbed_official 340:28d1f895c6fe 53
mbed_official 340:28d1f895c6fe 54 (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro
mbed_official 340:28d1f895c6fe 55 __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the
mbed_official 340:28d1f895c6fe 56 HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined
mbed_official 340:28d1f895c6fe 57 inside the stm32f0xx_hal_cortex.h file.
mbed_official 340:28d1f895c6fe 58
mbed_official 340:28d1f895c6fe 59 (+) You can change the SysTick IRQ priority by calling the
mbed_official 340:28d1f895c6fe 60 HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function
mbed_official 340:28d1f895c6fe 61 call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function.
mbed_official 340:28d1f895c6fe 62
mbed_official 340:28d1f895c6fe 63 (+) To adjust the SysTick time base, use the following formula:
mbed_official 340:28d1f895c6fe 64
mbed_official 340:28d1f895c6fe 65 Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s)
mbed_official 340:28d1f895c6fe 66 (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function
mbed_official 340:28d1f895c6fe 67 (++) Reload Value should not exceed 0xFFFFFF
mbed_official 340:28d1f895c6fe 68
mbed_official 340:28d1f895c6fe 69 @endverbatim
mbed_official 340:28d1f895c6fe 70 ******************************************************************************
mbed_official 340:28d1f895c6fe 71 * @attention
mbed_official 340:28d1f895c6fe 72 *
mbed_official 630:825f75ca301e 73 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 340:28d1f895c6fe 74 *
mbed_official 340:28d1f895c6fe 75 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 340:28d1f895c6fe 76 * are permitted provided that the following conditions are met:
mbed_official 340:28d1f895c6fe 77 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 340:28d1f895c6fe 78 * this list of conditions and the following disclaimer.
mbed_official 340:28d1f895c6fe 79 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 340:28d1f895c6fe 80 * this list of conditions and the following disclaimer in the documentation
mbed_official 340:28d1f895c6fe 81 * and/or other materials provided with the distribution.
mbed_official 340:28d1f895c6fe 82 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 340:28d1f895c6fe 83 * may be used to endorse or promote products derived from this software
mbed_official 340:28d1f895c6fe 84 * without specific prior written permission.
mbed_official 340:28d1f895c6fe 85 *
mbed_official 340:28d1f895c6fe 86 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 340:28d1f895c6fe 87 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 340:28d1f895c6fe 88 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 340:28d1f895c6fe 89 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 340:28d1f895c6fe 90 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 340:28d1f895c6fe 91 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 340:28d1f895c6fe 92 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 340:28d1f895c6fe 93 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 340:28d1f895c6fe 94 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 340:28d1f895c6fe 95 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 340:28d1f895c6fe 96 *
mbed_official 340:28d1f895c6fe 97 ******************************************************************************
mbed_official 340:28d1f895c6fe 98 */
mbed_official 340:28d1f895c6fe 99
mbed_official 340:28d1f895c6fe 100 /* Includes ------------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 101 #include "stm32f0xx_hal.h"
mbed_official 340:28d1f895c6fe 102
mbed_official 340:28d1f895c6fe 103 /** @addtogroup STM32F0xx_HAL_Driver
mbed_official 340:28d1f895c6fe 104 * @{
mbed_official 340:28d1f895c6fe 105 */
mbed_official 340:28d1f895c6fe 106
mbed_official 630:825f75ca301e 107 /** @defgroup CORTEX CORTEX
mbed_official 340:28d1f895c6fe 108 * @brief CORTEX CORTEX HAL module driver
mbed_official 340:28d1f895c6fe 109 * @{
mbed_official 340:28d1f895c6fe 110 */
mbed_official 340:28d1f895c6fe 111
mbed_official 340:28d1f895c6fe 112 #ifdef HAL_CORTEX_MODULE_ENABLED
mbed_official 340:28d1f895c6fe 113
mbed_official 340:28d1f895c6fe 114 /* Private typedef -----------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 115 /* Private define ------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 116 /* Private macro -------------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 117 /* Private variables ---------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 118 /* Private function prototypes -----------------------------------------------*/
mbed_official 340:28d1f895c6fe 119 /* Exported functions ---------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 120
mbed_official 340:28d1f895c6fe 121 /** @defgroup CORTEX_Exported_Functions CORTEX Exported Functions
mbed_official 340:28d1f895c6fe 122 * @{
mbed_official 340:28d1f895c6fe 123 */
mbed_official 340:28d1f895c6fe 124
mbed_official 340:28d1f895c6fe 125
mbed_official 340:28d1f895c6fe 126 /** @defgroup CORTEX_Exported_Functions_Group1 Initialization and de-initialization functions
mbed_official 340:28d1f895c6fe 127 * @brief Initialization and Configuration functions
mbed_official 340:28d1f895c6fe 128 *
mbed_official 340:28d1f895c6fe 129 @verbatim
mbed_official 340:28d1f895c6fe 130 ==============================================================================
mbed_official 340:28d1f895c6fe 131 ##### Initialization and de-initialization functions #####
mbed_official 340:28d1f895c6fe 132 ==============================================================================
mbed_official 340:28d1f895c6fe 133 [..]
mbed_official 340:28d1f895c6fe 134 This section provides the CORTEX HAL driver functions allowing to configure Interrupts
mbed_official 340:28d1f895c6fe 135 Systick functionalities
mbed_official 340:28d1f895c6fe 136
mbed_official 340:28d1f895c6fe 137 @endverbatim
mbed_official 340:28d1f895c6fe 138 * @{
mbed_official 340:28d1f895c6fe 139 */
mbed_official 340:28d1f895c6fe 140
mbed_official 340:28d1f895c6fe 141 /**
mbed_official 340:28d1f895c6fe 142 * @brief Sets the priority of an interrupt.
mbed_official 340:28d1f895c6fe 143 * @param IRQn: External interrupt number .
mbed_official 340:28d1f895c6fe 144 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 145 * (For the complete STM32 Devices IRQ Channels list, please refer to stm32l0xx.h file)
mbed_official 630:825f75ca301e 146 * @param PreemptPriority: The preemption priority for the IRQn channel.
mbed_official 340:28d1f895c6fe 147 * This parameter can be a value between 0 and 3.
mbed_official 340:28d1f895c6fe 148 * A lower priority value indicates a higher priority
mbed_official 630:825f75ca301e 149 * @param SubPriority: the subpriority level for the IRQ channel.
mbed_official 340:28d1f895c6fe 150 * with stm32f0xx devices, this parameter is a dummy value and it is ignored, because
mbed_official 340:28d1f895c6fe 151 * no subpriority supported in Cortex M0 based products.
mbed_official 340:28d1f895c6fe 152 * @retval None
mbed_official 340:28d1f895c6fe 153 */
mbed_official 340:28d1f895c6fe 154 void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
mbed_official 340:28d1f895c6fe 155 {
mbed_official 340:28d1f895c6fe 156 /* Check the parameters */
mbed_official 340:28d1f895c6fe 157 assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority));
mbed_official 340:28d1f895c6fe 158 NVIC_SetPriority(IRQn,PreemptPriority);
mbed_official 340:28d1f895c6fe 159 }
mbed_official 340:28d1f895c6fe 160
mbed_official 340:28d1f895c6fe 161 /**
mbed_official 340:28d1f895c6fe 162 * @brief Enables a device specific interrupt in the NVIC interrupt controller.
mbed_official 340:28d1f895c6fe 163 * @note To configure interrupts priority correctly, the NVIC_PriorityGroupConfig()
mbed_official 340:28d1f895c6fe 164 * function should be called before.
mbed_official 630:825f75ca301e 165 * @param IRQn External interrupt number.
mbed_official 340:28d1f895c6fe 166 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 167 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 168 * @retval None
mbed_official 340:28d1f895c6fe 169 */
mbed_official 340:28d1f895c6fe 170 void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 171 {
mbed_official 630:825f75ca301e 172 /* Check the parameters */
mbed_official 630:825f75ca301e 173 assert_param(IS_NVIC_DEVICE_IRQ(IRQn));
mbed_official 630:825f75ca301e 174
mbed_official 340:28d1f895c6fe 175 /* Enable interrupt */
mbed_official 340:28d1f895c6fe 176 NVIC_EnableIRQ(IRQn);
mbed_official 340:28d1f895c6fe 177 }
mbed_official 340:28d1f895c6fe 178
mbed_official 340:28d1f895c6fe 179 /**
mbed_official 340:28d1f895c6fe 180 * @brief Disables a device specific interrupt in the NVIC interrupt controller.
mbed_official 630:825f75ca301e 181 * @param IRQn External interrupt number.
mbed_official 340:28d1f895c6fe 182 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 183 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 184 * @retval None
mbed_official 340:28d1f895c6fe 185 */
mbed_official 340:28d1f895c6fe 186 void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 187 {
mbed_official 630:825f75ca301e 188 /* Check the parameters */
mbed_official 630:825f75ca301e 189 assert_param(IS_NVIC_DEVICE_IRQ(IRQn));
mbed_official 630:825f75ca301e 190
mbed_official 340:28d1f895c6fe 191 /* Disable interrupt */
mbed_official 340:28d1f895c6fe 192 NVIC_DisableIRQ(IRQn);
mbed_official 340:28d1f895c6fe 193 }
mbed_official 340:28d1f895c6fe 194
mbed_official 340:28d1f895c6fe 195 /**
mbed_official 340:28d1f895c6fe 196 * @brief Initiates a system reset request to reset the MCU.
mbed_official 340:28d1f895c6fe 197 * @retval None
mbed_official 340:28d1f895c6fe 198 */
mbed_official 340:28d1f895c6fe 199 void HAL_NVIC_SystemReset(void)
mbed_official 340:28d1f895c6fe 200 {
mbed_official 340:28d1f895c6fe 201 /* System Reset */
mbed_official 340:28d1f895c6fe 202 NVIC_SystemReset();
mbed_official 340:28d1f895c6fe 203 }
mbed_official 340:28d1f895c6fe 204
mbed_official 340:28d1f895c6fe 205 /**
mbed_official 340:28d1f895c6fe 206 * @brief Initializes the System Timer and its interrupt, and starts the System Tick Timer.
mbed_official 340:28d1f895c6fe 207 * Counter is in free running mode to generate periodic interrupts.
mbed_official 340:28d1f895c6fe 208 * @param TicksNumb: Specifies the ticks Number of ticks between two interrupts.
mbed_official 340:28d1f895c6fe 209 * @retval status: - 0 Function succeeded.
mbed_official 340:28d1f895c6fe 210 * - 1 Function failed.
mbed_official 340:28d1f895c6fe 211 */
mbed_official 340:28d1f895c6fe 212 uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
mbed_official 340:28d1f895c6fe 213 {
mbed_official 340:28d1f895c6fe 214 return SysTick_Config(TicksNumb);
mbed_official 340:28d1f895c6fe 215 }
mbed_official 340:28d1f895c6fe 216 /**
mbed_official 340:28d1f895c6fe 217 * @}
mbed_official 340:28d1f895c6fe 218 */
mbed_official 340:28d1f895c6fe 219
mbed_official 340:28d1f895c6fe 220 /** @defgroup CORTEX_Exported_Functions_Group2 Peripheral Control functions
mbed_official 340:28d1f895c6fe 221 * @brief Cortex control functions
mbed_official 340:28d1f895c6fe 222 *
mbed_official 340:28d1f895c6fe 223 @verbatim
mbed_official 340:28d1f895c6fe 224 ==============================================================================
mbed_official 340:28d1f895c6fe 225 ##### Peripheral Control functions #####
mbed_official 340:28d1f895c6fe 226 ==============================================================================
mbed_official 340:28d1f895c6fe 227 [..]
mbed_official 340:28d1f895c6fe 228 This subsection provides a set of functions allowing to control the CORTEX
mbed_official 340:28d1f895c6fe 229 (NVIC, SYSTICK) functionalities.
mbed_official 340:28d1f895c6fe 230
mbed_official 340:28d1f895c6fe 231
mbed_official 340:28d1f895c6fe 232 @endverbatim
mbed_official 340:28d1f895c6fe 233 * @{
mbed_official 340:28d1f895c6fe 234 */
mbed_official 340:28d1f895c6fe 235
mbed_official 340:28d1f895c6fe 236
mbed_official 340:28d1f895c6fe 237 /**
mbed_official 340:28d1f895c6fe 238 * @brief Gets the priority of an interrupt.
mbed_official 630:825f75ca301e 239 * @param IRQn: External interrupt number.
mbed_official 340:28d1f895c6fe 240 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 241 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 242 * @retval None
mbed_official 340:28d1f895c6fe 243 */
mbed_official 340:28d1f895c6fe 244 uint32_t HAL_NVIC_GetPriority(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 245 {
mbed_official 340:28d1f895c6fe 246 /* Get priority for Cortex-M system or device specific interrupts */
mbed_official 340:28d1f895c6fe 247 return NVIC_GetPriority(IRQn);
mbed_official 340:28d1f895c6fe 248 }
mbed_official 340:28d1f895c6fe 249
mbed_official 340:28d1f895c6fe 250 /**
mbed_official 340:28d1f895c6fe 251 * @brief Sets Pending bit of an external interrupt.
mbed_official 340:28d1f895c6fe 252 * @param IRQn External interrupt number
mbed_official 340:28d1f895c6fe 253 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 254 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 255 * @retval None
mbed_official 340:28d1f895c6fe 256 */
mbed_official 340:28d1f895c6fe 257 void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 258 {
mbed_official 630:825f75ca301e 259 /* Check the parameters */
mbed_official 630:825f75ca301e 260 assert_param(IS_NVIC_DEVICE_IRQ(IRQn));
mbed_official 630:825f75ca301e 261
mbed_official 340:28d1f895c6fe 262 /* Set interrupt pending */
mbed_official 340:28d1f895c6fe 263 NVIC_SetPendingIRQ(IRQn);
mbed_official 340:28d1f895c6fe 264 }
mbed_official 340:28d1f895c6fe 265
mbed_official 340:28d1f895c6fe 266 /**
mbed_official 340:28d1f895c6fe 267 * @brief Gets Pending Interrupt (reads the pending register in the NVIC
mbed_official 340:28d1f895c6fe 268 * and returns the pending bit for the specified interrupt).
mbed_official 630:825f75ca301e 269 * @param IRQn External interrupt number.
mbed_official 340:28d1f895c6fe 270 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 271 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 272 * @retval status: - 0 Interrupt status is not pending.
mbed_official 340:28d1f895c6fe 273 * - 1 Interrupt status is pending.
mbed_official 340:28d1f895c6fe 274 */
mbed_official 340:28d1f895c6fe 275 uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 276 {
mbed_official 630:825f75ca301e 277 /* Check the parameters */
mbed_official 630:825f75ca301e 278 assert_param(IS_NVIC_DEVICE_IRQ(IRQn));
mbed_official 630:825f75ca301e 279
mbed_official 340:28d1f895c6fe 280 /* Return 1 if pending else 0 */
mbed_official 340:28d1f895c6fe 281 return NVIC_GetPendingIRQ(IRQn);
mbed_official 340:28d1f895c6fe 282 }
mbed_official 340:28d1f895c6fe 283
mbed_official 340:28d1f895c6fe 284 /**
mbed_official 340:28d1f895c6fe 285 * @brief Clears the pending bit of an external interrupt.
mbed_official 630:825f75ca301e 286 * @param IRQn External interrupt number.
mbed_official 340:28d1f895c6fe 287 * This parameter can be an enumerator of IRQn_Type enumeration
mbed_official 340:28d1f895c6fe 288 * (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h))
mbed_official 340:28d1f895c6fe 289 * @retval None
mbed_official 340:28d1f895c6fe 290 */
mbed_official 340:28d1f895c6fe 291 void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
mbed_official 340:28d1f895c6fe 292 {
mbed_official 630:825f75ca301e 293 /* Check the parameters */
mbed_official 630:825f75ca301e 294 assert_param(IS_NVIC_DEVICE_IRQ(IRQn));
mbed_official 630:825f75ca301e 295
mbed_official 340:28d1f895c6fe 296 /* Clear pending interrupt */
mbed_official 340:28d1f895c6fe 297 NVIC_ClearPendingIRQ(IRQn);
mbed_official 340:28d1f895c6fe 298 }
mbed_official 340:28d1f895c6fe 299
mbed_official 340:28d1f895c6fe 300 /**
mbed_official 340:28d1f895c6fe 301 * @brief Configures the SysTick clock source.
mbed_official 340:28d1f895c6fe 302 * @param CLKSource: specifies the SysTick clock source.
mbed_official 340:28d1f895c6fe 303 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 304 * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
mbed_official 340:28d1f895c6fe 305 * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
mbed_official 340:28d1f895c6fe 306 * @retval None
mbed_official 340:28d1f895c6fe 307 */
mbed_official 340:28d1f895c6fe 308 void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
mbed_official 340:28d1f895c6fe 309 {
mbed_official 340:28d1f895c6fe 310 /* Check the parameters */
mbed_official 340:28d1f895c6fe 311 assert_param(IS_SYSTICK_CLK_SOURCE(CLKSource));
mbed_official 340:28d1f895c6fe 312 if (CLKSource == SYSTICK_CLKSOURCE_HCLK)
mbed_official 340:28d1f895c6fe 313 {
mbed_official 340:28d1f895c6fe 314 SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK;
mbed_official 340:28d1f895c6fe 315 }
mbed_official 340:28d1f895c6fe 316 else
mbed_official 340:28d1f895c6fe 317 {
mbed_official 340:28d1f895c6fe 318 SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK;
mbed_official 340:28d1f895c6fe 319 }
mbed_official 340:28d1f895c6fe 320 }
mbed_official 340:28d1f895c6fe 321
mbed_official 340:28d1f895c6fe 322 /**
mbed_official 340:28d1f895c6fe 323 * @brief This function handles SYSTICK interrupt request.
mbed_official 340:28d1f895c6fe 324 * @retval None
mbed_official 340:28d1f895c6fe 325 */
mbed_official 340:28d1f895c6fe 326 void HAL_SYSTICK_IRQHandler(void)
mbed_official 340:28d1f895c6fe 327 {
mbed_official 340:28d1f895c6fe 328 HAL_SYSTICK_Callback();
mbed_official 340:28d1f895c6fe 329 }
mbed_official 340:28d1f895c6fe 330
mbed_official 340:28d1f895c6fe 331 /**
mbed_official 340:28d1f895c6fe 332 * @brief SYSTICK callback.
mbed_official 340:28d1f895c6fe 333 * @retval None
mbed_official 340:28d1f895c6fe 334 */
mbed_official 340:28d1f895c6fe 335 __weak void HAL_SYSTICK_Callback(void)
mbed_official 340:28d1f895c6fe 336 {
mbed_official 340:28d1f895c6fe 337 /* NOTE : This function Should not be modified, when the callback is needed,
mbed_official 340:28d1f895c6fe 338 the HAL_SYSTICK_Callback could be implemented in the user file
mbed_official 340:28d1f895c6fe 339 */
mbed_official 340:28d1f895c6fe 340 }
mbed_official 340:28d1f895c6fe 341
mbed_official 340:28d1f895c6fe 342 /**
mbed_official 340:28d1f895c6fe 343 * @}
mbed_official 340:28d1f895c6fe 344 */
mbed_official 340:28d1f895c6fe 345
mbed_official 340:28d1f895c6fe 346 /**
mbed_official 340:28d1f895c6fe 347 * @}
mbed_official 340:28d1f895c6fe 348 */
mbed_official 340:28d1f895c6fe 349
mbed_official 340:28d1f895c6fe 350 #endif /* HAL_CORTEX_MODULE_ENABLED */
mbed_official 340:28d1f895c6fe 351 /**
mbed_official 340:28d1f895c6fe 352 * @}
mbed_official 340:28d1f895c6fe 353 */
mbed_official 340:28d1f895c6fe 354
mbed_official 340:28d1f895c6fe 355 /**
mbed_official 340:28d1f895c6fe 356 * @}
mbed_official 340:28d1f895c6fe 357 */
mbed_official 340:28d1f895c6fe 358
mbed_official 340:28d1f895c6fe 359 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/