mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
156:95d6b41a828b
Parent:
149:156823d33999
Child:
180:96ed750bd169
--- a/targets/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_hal_flash.c	Thu Jan 05 10:51:54 2017 +0000
+++ b/targets/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_hal_flash.c	Mon Jan 16 15:03:32 2017 +0000
@@ -2,8 +2,8 @@
   ******************************************************************************
   * @file    stm32f0xx_hal_flash.c
   * @author  MCD Application Team
-  * @version V1.4.0
-  * @date    27-May-2016
+  * @version V1.5.0
+  * @date    04-November-2016
   * @brief   FLASH HAL module driver.
   *          This file provides firmware functions to manage the following 
   *          functionalities of the internal FLASH memory:
@@ -175,18 +175,18 @@
   * @note   FLASH should be previously erased before new programmation (only exception to this 
   *         is when 0x0000 is programmed)
   *
-  * @param  TypeProgram:  Indicate the way to program at a specified address.
+  * @param  TypeProgram   Indicate the way to program at a specified address.
   *                       This parameter can be a value of @ref FLASH_Type_Program
-  * @param  Address:      Specifies the address to be programmed.
-  * @param  Data:         Specifies the data to be programmed
+  * @param  Address       Specifie the address to be programmed.
+  * @param  Data          Specifie the data to be programmed
   * 
   * @retval HAL_StatusTypeDef HAL Status
   */
 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
 {
   HAL_StatusTypeDef status = HAL_ERROR;
-  uint8_t index = 0;
-  uint8_t nbiterations = 0;
+  uint8_t index = 0U;
+  uint8_t nbiterations = 0U;
   
   /* Process Locked */
   __HAL_LOCK(&pFlash);
@@ -203,22 +203,22 @@
     if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD)
     {
       /* Program halfword (16-bit) at a specified address. */
-      nbiterations = 1;
+      nbiterations = 1U;
     }
     else if(TypeProgram == FLASH_TYPEPROGRAM_WORD)
     {
       /* Program word (32-bit = 2*16-bit) at a specified address. */
-      nbiterations = 2;
+      nbiterations = 2U;
     }
     else
     {
       /* Program double word (64-bit = 4*16-bit) at a specified address. */
-      nbiterations = 4;
+      nbiterations = 4U;
     }
 
-    for (index = 0; index < nbiterations; index++)
+    for (index = 0U; index < nbiterations; index++)
     {
-      FLASH_Program_HalfWord((Address + (2*index)), (uint16_t)(Data >> (16*index)));
+      FLASH_Program_HalfWord((Address + (2U*index)), (uint16_t)(Data >> (16U*index)));
 
         /* Wait for last operation to be completed */
         status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
@@ -247,10 +247,10 @@
   * @note   If an erase and a program operations are requested simultaneously,    
   *         the erase operation is performed before the program one.
   *
-  * @param  TypeProgram: Indicate the way to program at a specified address.
+  * @param  TypeProgram  Indicate the way to program at a specified address.
   *                      This parameter can be a value of @ref FLASH_Type_Program
-  * @param  Address:     Specifies the address to be programmed.
-  * @param  Data:        Specifies the data to be programmed
+  * @param  Address      Specifie the address to be programmed.
+  * @param  Data         Specifie the data to be programmed
   * 
   * @retval HAL_StatusTypeDef HAL Status
   */
@@ -275,19 +275,19 @@
   {
     pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMHALFWORD;
     /* Program halfword (16-bit) at a specified address. */
-    pFlash.DataRemaining = 1;
+    pFlash.DataRemaining = 1U;
   }
   else if(TypeProgram == FLASH_TYPEPROGRAM_WORD)
   {
     pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMWORD;
     /* Program word (32-bit : 2*16-bit) at a specified address. */
-    pFlash.DataRemaining = 2;
+    pFlash.DataRemaining = 2U;
   }
   else
   {
     pFlash.ProcedureOnGoing = FLASH_PROC_PROGRAMDOUBLEWORD;
     /* Program double word (64-bit : 4*16-bit) at a specified address. */
-    pFlash.DataRemaining = 4;
+    pFlash.DataRemaining = 4U;
   }
 
   /* Program halfword (16-bit) at a specified address. */
@@ -302,7 +302,7 @@
   */
 void HAL_FLASH_IRQHandler(void)
 {
-  uint32_t addresstmp = 0;
+  uint32_t addresstmp = 0U;
   
   /* Check FLASH operation error flags */
   if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
@@ -337,7 +337,7 @@
         pFlash.DataRemaining--;
 
         /* Check if there are still pages to erase */
-        if(pFlash.DataRemaining != 0)
+        if(pFlash.DataRemaining != 0U)
         {
           addresstmp = pFlash.Address;
           /*Indicate user which sector has been erased */
@@ -380,14 +380,14 @@
         pFlash.DataRemaining--;
         
         /* Check if there are still 16-bit data to program */
-        if(pFlash.DataRemaining != 0)
+        if(pFlash.DataRemaining != 0U)
         {
           /* Increment address to 16-bit */
           pFlash.Address += 2;
           addresstmp = pFlash.Address;
           
           /* Shift to have next 16-bit data */
-          pFlash.Data = (pFlash.Data >> 16);
+          pFlash.Data = (pFlash.Data >> 16U);
           
           /* Operation is completed, disable the PG Bit */
           CLEAR_BIT(FLASH->CR, FLASH_CR_PG);
@@ -405,11 +405,11 @@
           }
           else if (pFlash.ProcedureOnGoing == FLASH_PROC_PROGRAMWORD)
           {
-            HAL_FLASH_EndOfOperationCallback(pFlash.Address - 2);
+            HAL_FLASH_EndOfOperationCallback(pFlash.Address - 2U);
           }
           else 
           {
-            HAL_FLASH_EndOfOperationCallback(pFlash.Address - 6);
+            HAL_FLASH_EndOfOperationCallback(pFlash.Address - 6U);
           }
         
           /* Reset Address and stop Program procedure */
@@ -643,7 +643,7 @@
   { 
     if (Timeout != HAL_MAX_DELAY)
     {
-      if((Timeout == 0) || ((HAL_GetTick()-tickstart) > Timeout))
+      if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout))
       {
         return HAL_TIMEOUT;
       }
@@ -676,7 +676,7 @@
   */
 static void FLASH_SetErrorCode(void)
 {
-  uint32_t flags = 0;
+  uint32_t flags = 0U;
   
   if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR))
   {