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/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c')
-rw-r--r--Projects/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/Projects/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c b/Projects/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c
index 125305938..2e4612c1e 100644
--- a/Projects/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c
+++ b/Projects/NUCLEO-WB15CC/Examples/I2C/I2C_TwoBoards_ComDMA/Src/main.c
@@ -10,13 +10,12 @@
******************************************************************************
* @attention
*
- * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
- * All rights reserved.</center></h2>
+ * Copyright (c) 2019-2021 STMicroelectronics.
+ * All rights reserved.
*
- * 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
+ * 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.
*
******************************************************************************
*/
@@ -59,6 +58,7 @@ uint8_t aRxBuffer[RXBUFFERSIZE];
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
+void PeriphCommonClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_I2C1_Init(void);
@@ -103,6 +103,9 @@ int main(void)
/* Configure the system clock */
SystemClock_Config();
+/* Configure the peripherals common clocks */
+ PeriphCommonClock_Config();
+
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
@@ -275,7 +278,6 @@ void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
- RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
@@ -313,12 +315,22 @@ void SystemClock_Config(void)
{
Error_Handler();
}
- /** Initializes the peripherals clocks
+}
+
+/**
+ * @brief Peripherals Common Clock Configuration
+ * @retval None
*/
- PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS|RCC_PERIPHCLK_I2C1;
- PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
+void PeriphCommonClock_Config(void)
+{
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
+
+ /** Initializes the peripherals clock
+ */
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS;
PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSI;
PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1;
+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
@@ -532,5 +544,3 @@ void assert_failed(uint8_t *file, uint32_t line)
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/