Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c')
-rw-r--r--Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c b/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c
index 2db479625..5dbb88409 100644
--- a/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c
+++ b/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_HeartRateFreeRTOS_ANCS/Core/Src/stm32wbxx_hal_timebase_tim.c
@@ -1,7 +1,7 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
- * @file stm32g0xx_hal_timebase_tim.c
+ * @file stm32wbxx_hal_timebase_tim.c
* @author MCD Application Team
* @brief HAL time base based on the hardware TIM.
*
@@ -16,9 +16,9 @@
==============================================================================
[..]
This file must be copied to the application folder and modified as follows:
- (#) Rename it to 'stm32g0xx_hal_timebase_tim.c'
+ (#) Rename it to 'stm32wbxx_hal_timebase_tim.c'
(#) Add this file and the TIM HAL driver files to your project and make sure
- HAL_TIM_MODULE_ENABLED is defined in stm32l4xx_hal_conf.h
+ HAL_TIM_MODULE_ENABLED is defined in stm32wbxx_hal_conf.h
[..]
(@) The application needs to ensure that the time base is always set to 1 millisecond
@@ -59,21 +59,21 @@
/* Includes ------------------------------------------------------------------*/
#include "stm32wbxx_hal.h"
#include "stm32wbxx_hal_tim.h"
-
+
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
-TIM_HandleTypeDef htim17;
+TIM_HandleTypeDef htim17;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
- * @brief This function configures the TIM17 as a time base source.
- * The time source is configured to have 1ms time base with a dedicated
- * Tick interrupt priority.
+ * @brief This function configures the TIM17 as a time base source.
+ * The time source is configured to have 1ms time base with a dedicated
+ * Tick interrupt priority.
* @note This function is called automatically at the beginning of program after
- * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
+ * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
* @param TickPriority: Tick interrupt priority.
* @retval HAL status
*/
@@ -83,35 +83,32 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
uint32_t uwTimclock = 0;
uint32_t uwPrescalerValue = 0;
uint32_t pFLatency;
-
/*Configure the TIM17 IRQ priority */
- HAL_NVIC_SetPriority(TIM1_TRG_COM_TIM17_IRQn, TickPriority ,0);
-
+ HAL_NVIC_SetPriority(TIM1_TRG_COM_TIM17_IRQn, TickPriority ,0);
+
/* Enable the TIM17 global Interrupt */
- HAL_NVIC_EnableIRQ(TIM1_TRG_COM_TIM17_IRQn);
-
+ HAL_NVIC_EnableIRQ(TIM1_TRG_COM_TIM17_IRQn);
/* Enable TIM17 clock */
__HAL_RCC_TIM17_CLK_ENABLE();
-
+
/* Get clock configuration */
HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
-
+
/* Compute TIM17 clock */
uwTimclock = HAL_RCC_GetPCLK2Freq();
-
/* Compute the prescaler value to have TIM17 counter clock equal to 1MHz */
- uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1);
-
+ uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U);
+
/* Initialize TIM17 */
htim17.Instance = TIM17;
-
+
/* Initialize TIMx peripheral as follow:
+ Period = [(TIM17CLK/1000) - 1]. to have a (1/1000) s time base.
+ Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
+ ClockDivision = 0
+ Counter direction = Up
*/
- htim17.Init.Period = (1000000 / 1000) - 1;
+ htim17.Init.Period = (1000000U / 1000U) - 1U;
htim17.Init.Prescaler = uwPrescalerValue;
htim17.Init.ClockDivision = 0;
htim17.Init.CounterMode = TIM_COUNTERMODE_UP;
@@ -120,7 +117,7 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
/* Start the TIM time Base generation in interrupt mode */
return HAL_TIM_Base_Start_IT(&htim17);
}
-
+
/* Return function status */
return HAL_ERROR;
}
@@ -134,7 +131,7 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
void HAL_SuspendTick(void)
{
/* Disable TIM17 update Interrupt */
- __HAL_TIM_DISABLE_IT(&htim17, TIM_IT_UPDATE);
+ __HAL_TIM_DISABLE_IT(&htim17, TIM_IT_UPDATE);
}
/**