diff options
Diffstat (limited to 'Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE_LLD/BLE_LLD_Datarate/Core/Inc/main.h')
-rw-r--r-- | Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE_LLD/BLE_LLD_Datarate/Core/Inc/main.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE_LLD/BLE_LLD_Datarate/Core/Inc/main.h b/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE_LLD/BLE_LLD_Datarate/Core/Inc/main.h new file mode 100644 index 000000000..05a9002bb --- /dev/null +++ b/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE_LLD/BLE_LLD_Datarate/Core/Inc/main.h @@ -0,0 +1,104 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file main.h + * @author MCD Application Team + * @brief Header for main.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2019-2021 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 */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAIN_H +#define __MAIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ + +/* USER CODE END ET */ + +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ + +/* USER CODE END EC */ + +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ + +/* USER CODE END EM */ + +/* Exported functions prototypes ---------------------------------------------*/ +void Error_Handler(void); +void SystemClock_Config_HSE(uint32_t usePLL); +void SystemClock_Config_MSI(uint32_t usePLL); + +/* USER CODE BEGIN EFP */ + +/* USER CODE END EFP */ + +/* Private defines -----------------------------------------------------------*/ +/* USER CODE BEGIN Private defines */ + + +/* + In this example TIM2 input clock (TIM2CLK) is set to APB1 clock (PCLK1), + since APB1 prescaler is equal to 1. + TIM2CLK = PCLK1 + PCLK1 = HCLK + => TIM2CLK = HCLK = SystemCoreClock + To get TIM2 counter clock at 10 KHz, the Prescaler is computed as following: + Prescaler = (TIM2CLK / TIM2 counter clock) - 1 + Prescaler = (SystemCoreClock /10 KHz) - 1 + + Note: + SystemCoreClock variable holds HCLK frequency and is defined in system_stm32wbxx.c file. + Each time the core clock (HCLK) changes, user had to update SystemCoreClock + variable value. Otherwise, any configuration based on this variable will be incorrect. + This variable is updated in three ways: + 1) by calling CMSIS function SystemCoreClockUpdate() + 2) by calling HAL API function HAL_RCC_GetSysClockFreq() + 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency + ----------------------------------------------------------------------- */ + +/* Compute the prescaler value to have TIMx counter clock equal to 10000 Hz */ + +#define PRESCALER_VALUE (uint32_t)(((SystemCoreClock) / (1000000)) - 1) + + /* Initialize TIMx peripheral as follows: + + Period = 10000 - 1 + + Prescaler = (SystemCoreClock/10000) - 1 + + ClockDivision = 0 + + Counter direction = Up + */ + +#define PERIOD_VALUE (1000000 - 1); + + +/* USER CODE END Private defines */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIN_H */ |