STM32L476G-Discovery board drivers V1.0.0

Dependents:   DiscoLogger DISCO_L476VG_GlassLCD DISCO_L476VG_MicrophoneRecorder DISCO_L476VG_UART ... more

Revision:
5:4943b15cce9f
Parent:
3:4c7d003a8259
--- a/Drivers/BSP/STM32L476G-Discovery/stm32l476g_discovery.c	Wed Jan 17 15:20:12 2018 +0100
+++ b/Drivers/BSP/STM32L476G-Discovery/stm32l476g_discovery.c	Tue Sep 24 18:00:58 2019 +0200
@@ -7,36 +7,19 @@
   ******************************************************************************
   * @attention
   *
-  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
+  * All rights reserved.</center></h2>
   *
-  * Redistribution and use in source and binary forms, with or without modification,
-  * are permitted provided that the following conditions are met:
-  *   1. Redistributions of source code must retain the above copyright notice,
-  *      this list of conditions and the following disclaimer.
-  *   2. Redistributions in binary form must reproduce the above copyright notice,
-  *      this list of conditions and the following disclaimer in the documentation
-  *      and/or other materials provided with the distribution.
-  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-  *      may be used to endorse or promote products derived from this software
-  *      without specific prior written permission.
-  *
-  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  * This software component is licensed by ST under BSD 3-Clause license,
+  * the "License"; You may not use this file except in compliance with the
+  * License. You may obtain a copy of the License at:
+  *                        opensource.org/licenses/BSD-3-Clause
   *
   ******************************************************************************
   */
 
 /* Includes ------------------------------------------------------------------*/
 #include "stm32l476g_discovery.h"
-#include "mbed_wait_api.h" // MBED: replace HAL_Delay by wait_ms
 
 /** @addtogroup BSP
   * @{
@@ -70,7 +53,7 @@
    */
 #define __STM32L476G_DISCOVERY_BSP_VERSION_MAIN   (0x02) /*!< [31:24] main version */
 #define __STM32L476G_DISCOVERY_BSP_VERSION_SUB1   (0x00) /*!< [23:16] sub1 version */
-#define __STM32L476G_DISCOVERY_BSP_VERSION_SUB2   (0x01) /*!< [15:8]  sub2 version */
+#define __STM32L476G_DISCOVERY_BSP_VERSION_SUB2   (0x03) /*!< [15:8]  sub2 version */
 #define __STM32L476G_DISCOVERY_BSP_VERSION_RC     (0x00) /*!< [7:0]  release candidate */
 #define __STM32L476G_DISCOVERY_BSP_VERSION            ((__STM32L476G_DISCOVERY_BSP_VERSION_MAIN << 24)\
                                                       |(__STM32L476G_DISCOVERY_BSP_VERSION_SUB1 << 16)\
@@ -315,8 +298,8 @@
   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
   HAL_GPIO_Init(BATTERY_DETECTION_GPIO_PORT, &GPIO_InitStruct);
 
-  wait_ms(400);
-  if(HAL_GPIO_ReadPin(BATTERY_DETECTION_GPIO_PORT, GPIO_InitStruct.Pin) != GPIO_PIN_RESET)
+  HAL_Delay(400);
+  if (HAL_GPIO_ReadPin(BATTERY_DETECTION_GPIO_PORT, GPIO_InitStruct.Pin) != GPIO_PIN_RESET)
   {
     supplymode = SUPPLY_MODE_EXTERNAL;
   }
@@ -335,8 +318,8 @@
   * @brief  Configures LED GPIOs.
   * @param  Led: Specifies the Led to be configured.
   *   This parameter can be one of following parameters:
-  *     @arg LED4
-  *     @arg LED5
+  *     @arg DISCO_LED4
+  *     @arg DISCO_LED5
   * @retval None
   */
 #elif defined (USE_STM32L476G_DISCO_REVA)
@@ -344,8 +327,8 @@
   * @brief  Configures LED GPIOs.
   * @param  Led: Specifies the Led to be configured.
   *   This parameter can be one of following parameters:
-  *     @arg LED3
-  *     @arg LED4
+  *     @arg DISCO_LED3
+  *     @arg DISCO_LED4
   * @retval None
   */
 #endif
@@ -372,8 +355,8 @@
   * @brief  Unconfigures LED GPIOs.
   * @param  Led: Specifies the Led to be unconfigured.
   *   This parameter can be one of following parameters:
-  *     @arg LED4
-  *     @arg LED5
+  *     @arg DISCO_LED4
+  *     @arg DISCO_LED5
   * @retval None
   */
 #elif defined (USE_STM32L476G_DISCO_REVA)
@@ -381,8 +364,8 @@
   * @brief  Unconfigures LED GPIOs.
   * @param  Led: Specifies the Led to be unconfigured.
   *   This parameter can be one of following parameters:
-  *     @arg LED3
-  *     @arg LED4
+  *     @arg DISCO_LED3
+  *     @arg DISCO_LED4
   * @retval None
   */
 #endif
@@ -399,8 +382,8 @@
   * @brief  Turns selected LED On.
   * @param  Led: Specifies the Led to be set on.
   *   This parameter can be one of following parameters:
-  *     @arg LED4
-  *     @arg LED5
+  *     @arg DISCO_LED4
+  *     @arg DISCO_LED5
   * @retval None
   */
 #elif defined (USE_STM32L476G_DISCO_REVA)
@@ -408,8 +391,8 @@
   * @brief  Turns selected LED On.
   * @param  Led: Specifies the Led to be set on.
   *   This parameter can be one of following parameters:
-  *     @arg LED3
-  *     @arg LED4
+  *     @arg DISCO_LED3
+  *     @arg DISCO_LED4
   * @retval None
   */
 #endif
@@ -423,8 +406,8 @@
   * @brief  Turns selected LED Off.
   * @param  Led: Specifies the Led to be set off.
   *   This parameter can be one of following parameters:
-  *     @arg LED4
-  *     @arg LED5
+  *     @arg DISCO_LED4
+  *     @arg DISCO_LED5
   * @retval None
   */
 #elif defined (USE_STM32L476G_DISCO_REVA)
@@ -432,8 +415,8 @@
   * @brief  Turns selected LED Off.
   * @param  Led: Specifies the Led to be set off.
   *   This parameter can be one of following parameters:
-  *     @arg LED3
-  *     @arg LED4
+  *     @arg DISCO_LED3
+  *     @arg DISCO_LED4
   * @retval None
   */
 #endif
@@ -447,8 +430,8 @@
   * @brief  Toggles the selected LED.
   * @param  Led: Specifies the Led to be toggled.
   *   This parameter can be one of following parameters:
-  *     @arg LED4
-  *     @arg LED5
+  *     @arg DISCO_LED4
+  *     @arg DISCO_LED5
   * @retval None
   */
 #elif defined (USE_STM32L476G_DISCO_REVA)
@@ -456,8 +439,8 @@
   * @brief  Toggles the selected LED.
   * @param  Led: Specifies the Led to be toggled.
   *   This parameter can be one of following parameters:
-  *     @arg LED3
-  *     @arg LED4
+  *     @arg DISCO_LED3
+  *     @arg DISCO_LED4
   * @retval None
   */
 #endif
@@ -1590,7 +1573,7 @@
   HAL_GPIO_WritePin(IDD_WAKEUP_GPIO_PORT, IDD_WAKEUP_PIN, GPIO_PIN_SET);
 
   /* Wait */
-  wait_ms(1);
+  HAL_Delay(1);
 
   /* Set gpio pin basck to low */
   HAL_GPIO_WritePin(IDD_WAKEUP_GPIO_PORT, IDD_WAKEUP_PIN, GPIO_PIN_RESET);
@@ -1652,7 +1635,7 @@
   */
 void MFX_IO_Delay(uint32_t Delay)
 {
-  wait_ms(Delay);
+  HAL_Delay(Delay);
 }
 
 
@@ -1682,13 +1665,13 @@
   CODEC_AUDIO_POWER_OFF();
 
   /* wait for a delay to insure registers erasing */
-  wait_ms(5);
+  HAL_Delay(5);
 
   /* Power on the codec */
   CODEC_AUDIO_POWER_ON();
 
   /* wait for a delay to insure registers erasing */
-  wait_ms(5);
+  HAL_Delay(5);
 }
 
 /**
@@ -1753,7 +1736,7 @@
   */
 void AUDIO_IO_Delay(uint32_t Delay)
 {
-  wait_ms(Delay);
+  HAL_Delay(Delay);
 }
 #endif /* HAL_I2C_MODULE_ENABLED */