Format
This commit is contained in:
parent
72da832192
commit
7796b73e0e
1 changed files with 7 additions and 20 deletions
27
Src/main.c
27
Src/main.c
|
@ -169,9 +169,7 @@ void SystemClock_Config(void) {
|
||||||
|
|
||||||
/** Configure the main internal regulator output voltage
|
/** Configure the main internal regulator output voltage
|
||||||
*/
|
*/
|
||||||
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
|
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initializes the RCC Oscillators according to the specified parameters
|
/** Initializes the RCC Oscillators according to the specified parameters
|
||||||
* in the RCC_OscInitTypeDef structure.
|
* in the RCC_OscInitTypeDef structure.
|
||||||
|
@ -181,9 +179,7 @@ void SystemClock_Config(void) {
|
||||||
RCC_OscInitStruct.MSICalibrationValue = 0;
|
RCC_OscInitStruct.MSICalibrationValue = 0;
|
||||||
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
|
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initializes the CPU, AHB and APB buses clocks
|
/** Initializes the CPU, AHB and APB buses clocks
|
||||||
*/
|
*/
|
||||||
|
@ -194,9 +190,7 @@ void SystemClock_Config(void) {
|
||||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||||
|
|
||||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,21 +222,15 @@ static void MX_I2C1_Init(void) {
|
||||||
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||||
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||||
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||||
if (HAL_I2C_Init(&hi2c1) != HAL_OK) {
|
if (HAL_I2C_Init(&hi2c1) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Configure Analogue filter
|
/** Configure Analogue filter
|
||||||
*/
|
*/
|
||||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK) {
|
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Configure Digital filter
|
/** Configure Digital filter
|
||||||
*/
|
*/
|
||||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK) {
|
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK) { Error_Handler(); }
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
/* USER CODE BEGIN I2C1_Init 2 */
|
/* USER CODE BEGIN I2C1_Init 2 */
|
||||||
|
|
||||||
/* USER CODE END I2C1_Init 2 */
|
/* USER CODE END I2C1_Init 2 */
|
||||||
|
@ -273,8 +261,7 @@ void Error_Handler(void) {
|
||||||
/* USER CODE BEGIN Error_Handler_Debug */
|
/* USER CODE BEGIN Error_Handler_Debug */
|
||||||
/* User can add his own implementation to report the HAL error return state */
|
/* User can add his own implementation to report the HAL error return state */
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
while (1) {
|
while (1) {}
|
||||||
}
|
|
||||||
/* USER CODE END Error_Handler_Debug */
|
/* USER CODE END Error_Handler_Debug */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue