Updated for the next revision of the motor board
Diff: HardwareSetup.cpp
- Revision:
- 5:d2dffc88e94d
- Parent:
- 3:2f46953e7c8b
- Child:
- 6:417655779dc5
--- a/HardwareSetup.cpp Wed Aug 26 02:49:34 2020 +0000 +++ b/HardwareSetup.cpp Wed Aug 26 14:37:16 2020 +0000 @@ -10,7 +10,6 @@ TIM_HandleTypeDef htim17; int PWM_PERIOD; -void SystemClock_Config(void); void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim); static void MX_TIM12_Init(void); static void MX_TIM13_Init(void); @@ -24,9 +23,6 @@ /* Initialise the HAL Layer */ HAL_Init(); - /* Configure the system clock */ - SystemClock_Config(); - /* Initialize all configured peripherals */ MX_TIM12_Init(); MX_TIM13_Init(); @@ -374,54 +370,6 @@ } -void SystemClock_Config(void) -{ - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - - /** Supply configuration update enable - */ - HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); - /** Configure the main internal regulator output voltage - */ - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); - - while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} - /** Macro to configure the PLL clock source - */ - __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSI); - /** Initializes the CPU, AHB and APB busses clocks - */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; - RCC_OscInitStruct.HSIState = RCC_HSI_DIV1; - RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; - if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) - { - //Error_Handler(); - } - /** Initializes the CPU, AHB and APB busses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK - |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 - |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI; - RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1; - RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV1; - RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV1; - RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV1; - - if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) - { - //Error_Handler(); - } - -} -