Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Driver/main.h
- Revision:
- 22:5b77cf59d630
- Parent:
- 15:2860c960d2ff
--- a/Driver/main.h Tue Oct 09 22:15:01 2018 +0000
+++ b/Driver/main.h Fri Oct 19 04:27:55 2018 +0000
@@ -1,5 +1,5 @@
/*
-_ _ _____ _______
+ _ _ _____ _______
| | | | |_ _| |__ __|
| |__| | __ ___ __ | | ___ | |
| __ |/ _` \ \/ / | | / _ \| |
@@ -12,8 +12,9 @@
*/
/*******************************************************************************
* @File Name : main.h
- * @Author : Fahad Mirza
- * @Modified : 04 July, 2018
+ * @Author : Fahad Mirza (Haxiot)
+ * @Version : V1.0.0
+ * @Modified : 18 October, 2018
* @Description : Header file for main.c
******************************************************************************
* @attention
@@ -57,9 +58,6 @@
#include "delay.h"
#include "low_power_manager.h"
-/* Macros --------------------------------------------------------------------*/
-#define ENABLE_FAST_WAKEUP
-
/* Variables -----------------------------------------------------------------*/
//Flag to indicate if the MCU is Initialized
static bool McuInitialized = false;
@@ -73,6 +71,29 @@
DigitalOut greenLED(D9);
+/* Function Declarations -----------------------------------------------------*/
+void SystemClock_Config(void);
+
+
+/******************************************************************************
+ * @Brief : This function initializes the hardware
+ * @Param : None
+ * @Return: None
+******************************************************************************/
+void HW_Init(void)
+{
+ if(McuInitialized == false)
+ {
+ // Reset of all peripherals, Initializes the Flash interface and the Systick.
+ HAL_Init();
+ SystemClock_Config();
+ Debug_UART_Init();
+ HW_RTC_Init();
+ BSP_LED_Init(LED_GREEN);// LED on Nucleo board
+ slideSwitch.mode(PullDown);
+ McuInitialized = true;
+ }
+}
/******************************************************************************
* @Brief : System Clock Configuration
@@ -132,76 +153,6 @@
}
/******************************************************************************
- * @Brief : Set all pin as analog
- * @Param : None
- * @Return: None
-******************************************************************************/
-void HW_GpioInit(void)
-{
- GPIO_InitTypeDef GPIO_InitStruct;
-
- // STM32L0 Gpios are all configured as analog input at Reset
- __HAL_RCC_GPIOA_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- __HAL_RCC_GPIOC_CLK_ENABLE();
-
- /*GPIOC*/
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
- |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_12;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
-
- /*GPIOA*/
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_6
- |GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
- |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_15;
-
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- /*GPIOB*/
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
- |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
- |GPIO_PIN_15|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
- |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
-
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
- __HAL_RCC_GPIOA_CLK_DISABLE();
- __HAL_RCC_GPIOB_CLK_DISABLE();
- __HAL_RCC_GPIOC_CLK_DISABLE();
-}
-
-/******************************************************************************
- * @Brief : This function initializes the hardware
- * @Param : None
- * @Return: None
-******************************************************************************/
-void HW_Init(void)
-{
- if(McuInitialized == false)
- {
- // Reset of all peripherals, Initializes the Flash interface and the Systick.
- HAL_Init();
- SystemClock_Config();
- Debug_UART_Init();
-
- #if defined( USE_BOOTLOADER )
- /* Set the Vector Table base location at 0x3000 */
- NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x3000 );
- #endif
-
- HW_RTC_Init();
-
- // LED on Nucleo board
- BSP_LED_Init(LED_GREEN);
- slideSwitch.mode(PullDown);
- McuInitialized = true;
- }
-}
-
-/******************************************************************************
* @Brief : Initializes the MSP.
* @Param : None
* @Return: None
@@ -223,13 +174,8 @@
* case the first instruction. To overcome this issue, the flash remain clocked during sleep mode
*/
DBG( __HAL_FLASH_SLEEP_POWERDOWN_DISABLE(); );
-
- #ifdef ENABLE_FAST_WAKEUP
- /*Enable fast wakeUp*/
- HAL_PWREx_EnableFastWakeUp( );
- #else
- HAL_PWREx_DisableFastWakeUp( );
- #endif
+ /*Enable fast wakeUp*/
+ HAL_PWREx_EnableFastWakeUp( );
}