mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Apr 26 19:45:10 2016 +0100
Parent:
116:983bd476082e
Child:
118:1e9abb17742b
Commit message:
Synchronized with git revision 2451ac1026c029ba5d898e607675a269d18e9bb6

Full URL: https://github.com/mbedmicro/mbed/commit/2451ac1026c029ba5d898e607675a269d18e9bb6/

* [STM32F4 STM32F7] Overwrite HAL_Delay to allow SD example

The weak function HAL_Delay is overwritten to use us ticker API.
The user can use stm32f[4/7]xx_hal_sd.c that calls
HAL_Delay
This will allow us to add an example detecting / writing / reading an SD
card on DISCO_F469NI and DISCO_F746NG

(cherry picked from commit d491e3cd8b1d973793e6168a5037a812eadea961)

Changed in this revision

targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c	Tue Apr 26 19:30:12 2016 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c	Tue Apr 26 19:45:10 2016 +0100
@@ -26,6 +26,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "cmsis.h"
+#include "us_ticker_api.h"
 
 // This function is called after RAM initialization and before main.
 void mbed_sdk_init()
@@ -35,3 +36,18 @@
     // Need to restart HAL driver after the RAM is initialized
     HAL_Init();
 }
+
+/**
+  * @brief This function provides accurate delay (in milliseconds) based
+  *        on variable incremented.
+  * @note This function is the modified version of the __weak version contained in
+  *       stm32f4xx_hal.c, using us_ticker
+  * @param Delay: specifies the delay time length, in milliseconds.
+  * @retval None
+  */
+void HAL_Delay(__IO uint32_t Delay)
+{
+    uint32_t start = us_ticker_read();
+    while ((us_ticker_read() - start) < (uint32_t)(Delay * 1000));
+}
+
--- a/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c	Tue Apr 26 19:30:12 2016 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c	Tue Apr 26 19:45:10 2016 +0100
@@ -26,6 +26,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "cmsis.h"
+#include "us_ticker_api.h"
 
 HAL_StatusTypeDef HAL_Init(void);
 
@@ -37,3 +38,19 @@
     // Need to restart HAL driver after the RAM is initialized
     HAL_Init();
 }
+
+
+/**
+  * @brief This function provides accurate delay (in milliseconds) based
+  *        on variable incremented.
+  * @note This function is the modified version of the __weak version contained in
+  *       stm32f7xx_hal.c, using us_ticker
+  * @param Delay: specifies the delay time length, in milliseconds.
+  * @retval None
+*/
+void HAL_Delay(__IO uint32_t Delay)
+{
+    uint32_t start = us_ticker_read();
+    while ((us_ticker_read() - start) < (uint32_t)(Delay * 1000));
+}
+