4545
Fork of mbed-dev by
targets/TARGET_STM/TARGET_STM32F4/mbed_overrides.c@166:33361e55dd8c, 2017-08-23 (annotated)
- Committer:
- iftaziz
- Date:
- Wed Aug 23 10:32:38 2017 +0000
- Revision:
- 166:33361e55dd8c
- Parent:
- 150:02e0a0aed4ec
r1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 2 | * Copyright (c) 2014, STMicroelectronics |
<> | 149:156823d33999 | 3 | * All rights reserved. |
<> | 149:156823d33999 | 4 | * |
<> | 149:156823d33999 | 5 | * Redistribution and use in source and binary forms, with or without |
<> | 149:156823d33999 | 6 | * modification, are permitted provided that the following conditions are met: |
<> | 149:156823d33999 | 7 | * |
<> | 149:156823d33999 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 149:156823d33999 | 9 | * this list of conditions and the following disclaimer. |
<> | 149:156823d33999 | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 149:156823d33999 | 11 | * this list of conditions and the following disclaimer in the documentation |
<> | 149:156823d33999 | 12 | * and/or other materials provided with the distribution. |
<> | 149:156823d33999 | 13 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
<> | 149:156823d33999 | 14 | * may be used to endorse or promote products derived from this software |
<> | 149:156823d33999 | 15 | * without specific prior written permission. |
<> | 149:156823d33999 | 16 | * |
<> | 149:156823d33999 | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 149:156823d33999 | 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 149:156823d33999 | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 149:156823d33999 | 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 149:156823d33999 | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 149:156823d33999 | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 149:156823d33999 | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 149:156823d33999 | 24 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 149:156823d33999 | 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 149:156823d33999 | 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 149:156823d33999 | 27 | */ |
<> | 149:156823d33999 | 28 | #include "cmsis.h" |
<> | 149:156823d33999 | 29 | #include "us_ticker_api.h" |
<> | 149:156823d33999 | 30 | |
<> | 149:156823d33999 | 31 | // This function is called after RAM initialization and before main. |
<> | 149:156823d33999 | 32 | void mbed_sdk_init() |
<> | 149:156823d33999 | 33 | { |
<> | 149:156823d33999 | 34 | // Update the SystemCoreClock variable. |
<> | 149:156823d33999 | 35 | SystemCoreClockUpdate(); |
<> | 149:156823d33999 | 36 | // Need to restart HAL driver after the RAM is initialized |
<> | 149:156823d33999 | 37 | HAL_Init(); |
<> | 149:156823d33999 | 38 | } |
<> | 149:156823d33999 | 39 | |
<> | 149:156823d33999 | 40 | /** |
<> | 149:156823d33999 | 41 | * @brief This function provides accurate delay (in milliseconds) based |
<> | 149:156823d33999 | 42 | * on variable incremented. |
<> | 149:156823d33999 | 43 | * @note This function is the modified version of the __weak version contained in |
<> | 149:156823d33999 | 44 | * stm32f4xx_hal.c, using us_ticker |
<> | 149:156823d33999 | 45 | * @param Delay: specifies the delay time length, in milliseconds. |
<> | 149:156823d33999 | 46 | * @retval None |
<> | 149:156823d33999 | 47 | */ |
<> | 149:156823d33999 | 48 | void HAL_Delay(__IO uint32_t Delay) |
<> | 149:156823d33999 | 49 | { |
<> | 149:156823d33999 | 50 | uint32_t start = us_ticker_read(); |
<> | 149:156823d33999 | 51 | while ((us_ticker_read() - start) < (uint32_t)(Delay * 1000)); |
<> | 149:156823d33999 | 52 | } |
<> | 149:156823d33999 | 53 |