Yilin Sun
bf57ad8093
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Yilin Sun <imi415@imi.moe>
146 lines
4.3 KiB
C
146 lines
4.3 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file sys_app.c
|
|
* @author MCD Application Team
|
|
* @brief Initializes HW and SW system entities (not related to the radio)
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2023 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include <stdio.h>
|
|
#include "platform.h"
|
|
#include "sys_app.h"
|
|
#include "stm32_systime.h"
|
|
#include "timer_if.h"
|
|
#include "utilities_def.h"
|
|
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
/* USER CODE END Includes */
|
|
|
|
/* External variables ---------------------------------------------------------*/
|
|
/* USER CODE BEGIN EV */
|
|
|
|
/* USER CODE END EV */
|
|
|
|
/* Private typedef -----------------------------------------------------------*/
|
|
/* USER CODE BEGIN PTD */
|
|
|
|
/* USER CODE END PTD */
|
|
|
|
/* Private define ------------------------------------------------------------*/
|
|
/* USER CODE BEGIN PD */
|
|
|
|
/* USER CODE END PD */
|
|
|
|
/* Private macro -------------------------------------------------------------*/
|
|
/* USER CODE BEGIN PM */
|
|
|
|
/* USER CODE END PM */
|
|
|
|
/* Private variables ---------------------------------------------------------*/
|
|
static uint8_t SYS_TimerInitialisedFlag = 0;
|
|
|
|
/* USER CODE BEGIN PV */
|
|
|
|
/* USER CODE END PV */
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
/* USER CODE BEGIN PFP */
|
|
|
|
/* USER CODE END PFP */
|
|
|
|
/* Exported functions ---------------------------------------------------------*/
|
|
void SystemApp_Init(void)
|
|
{
|
|
/* USER CODE BEGIN SystemApp_Init_1 */
|
|
|
|
/* USER CODE END SystemApp_Init_1 */
|
|
|
|
}
|
|
|
|
/* USER CODE BEGIN EF */
|
|
|
|
/* USER CODE END EF */
|
|
|
|
/* Private functions ---------------------------------------------------------*/
|
|
/* USER CODE BEGIN PrFD */
|
|
|
|
/* USER CODE END PrFD */
|
|
|
|
/* HAL overload functions ---------------------------------------------------------*/
|
|
|
|
/* Set #if 0 if you want to keep the default HAL instead overcharge them*/
|
|
/* USER CODE BEGIN Overload_HAL_weaks_1 */
|
|
#if 1
|
|
/* USER CODE END Overload_HAL_weaks_1 */
|
|
|
|
/* USER CODE BEGIN Overload_HAL_weaks_1a */
|
|
|
|
/* USER CODE END Overload_HAL_weaks_1a */
|
|
|
|
/**
|
|
* @note This function overwrites the __weak one from HAL
|
|
*/
|
|
uint32_t HAL_GetTick(void)
|
|
{
|
|
uint32_t ret = 0;
|
|
/* TIMER_IF can be based on other counter the SysTick e.g. RTC */
|
|
/* USER CODE BEGIN HAL_GetTick_1 */
|
|
|
|
/* USER CODE END HAL_GetTick_1 */
|
|
if (SYS_TimerInitialisedFlag == 0)
|
|
{
|
|
/* TIMER_IF_GetTimerValue should be used only once UTIL_TIMER_Init() is initialized */
|
|
/* If HAL_Delay or a TIMEOUT countdown is necessary during initialization phase */
|
|
/* please use temporarily another timebase source (SysTick or TIMx), which implies also */
|
|
/* to rework the above function HAL_InitTick() and to call HAL_IncTick() on the timebase IRQ */
|
|
/* Note: when TIMER_IF is based on RTC, stm32wlxx_hal_rtc.c calls this function before TimeServer is functional */
|
|
/* RTC TIMEOUT will not expire, i.e. if RTC has an hw problem it will keep looping in the RTC_Init function */
|
|
/* USER CODE BEGIN HAL_GetTick_EarlyCall */
|
|
|
|
/* USER CODE END HAL_GetTick_EarlyCall */
|
|
}
|
|
else
|
|
{
|
|
ret = TIMER_IF_GetTimerValue();
|
|
}
|
|
/* USER CODE BEGIN HAL_GetTick_2 */
|
|
|
|
/* USER CODE END HAL_GetTick_2 */
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* @note This function overwrites the __weak one from HAL
|
|
*/
|
|
void HAL_Delay(__IO uint32_t Delay)
|
|
{
|
|
/* TIMER_IF can be based on other counter the SysTick e.g. RTC */
|
|
/* USER CODE BEGIN HAL_Delay_1 */
|
|
|
|
/* USER CODE END HAL_Delay_1 */
|
|
TIMER_IF_DelayMs(Delay);
|
|
/* USER CODE BEGIN HAL_Delay_2 */
|
|
|
|
/* USER CODE END HAL_Delay_2 */
|
|
}
|
|
|
|
/* USER CODE BEGIN Overload_HAL_weaks_2 */
|
|
#endif /* 1 default HAL overcharge */
|
|
/* if needed set #if 0 and redefine here your own "Tick" functions*/
|
|
|
|
/* USER CODE END Overload_HAL_weaks_2 */
|