Cleanup
This commit is contained in:
parent
662a7a9b12
commit
7eedbfdf9b
8 changed files with 80 additions and 68 deletions
|
@ -32,16 +32,16 @@ extern "C" {
|
|||
|
||||
#include "stm32f4xx_ll_crc.h"
|
||||
#include "stm32f4xx_ll_dma.h"
|
||||
#include "stm32f4xx_ll_spi.h"
|
||||
#include "stm32f4xx_ll_usart.h"
|
||||
#include "stm32f4xx_ll_rcc.h"
|
||||
#include "stm32f4xx_ll_system.h"
|
||||
#include "stm32f4xx_ll_gpio.h"
|
||||
#include "stm32f4xx_ll_exti.h"
|
||||
#include "stm32f4xx_ll_bus.h"
|
||||
#include "stm32f4xx_ll_system.h"
|
||||
#include "stm32f4xx_ll_exti.h"
|
||||
#include "stm32f4xx_ll_cortex.h"
|
||||
#include "stm32f4xx_ll_utils.h"
|
||||
#include "stm32f4xx_ll_pwr.h"
|
||||
#include "stm32f4xx_ll_spi.h"
|
||||
#include "stm32f4xx_ll_usart.h"
|
||||
#include "stm32f4xx_ll_gpio.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
|
|
@ -62,17 +62,7 @@ void MX_FREERTOS_Init(void);
|
|||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
//TaskHandle_t g_handle;
|
||||
//StaticTask_t g_tcb;
|
||||
//StackType_t g_stack[200];
|
||||
//
|
||||
//void TaskFn(void * param)
|
||||
//{
|
||||
// for(;;) {
|
||||
// vTaskDelay(100);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
|
@ -98,6 +88,7 @@ int main(void)
|
|||
SystemClock_Config();
|
||||
|
||||
/* USER CODE BEGIN SysInit */
|
||||
LL_SYSTICK_EnableIT();
|
||||
|
||||
/* USER CODE END SysInit */
|
||||
|
||||
|
@ -109,10 +100,9 @@ int main(void)
|
|||
MX_CRC_Init();
|
||||
MX_SPI2_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
// g_handle = xTaskCreateStatic(TaskFn, "lofasz", sizeof(g_stack)/sizeof(g_stack[0]),
|
||||
// NULL, 5, g_stack, &g_tcb);
|
||||
AppInit();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Init scheduler */
|
||||
osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */
|
||||
|
@ -138,38 +128,40 @@ int main(void)
|
|||
*/
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 4;
|
||||
RCC_OscInitStruct.PLL.PLLN = 168;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 4;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
LL_FLASH_SetLatency(LL_FLASH_LATENCY_5);
|
||||
while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_5)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
|
||||
LL_RCC_HSE_Enable();
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
|
||||
/* Wait till HSE is ready */
|
||||
while(LL_RCC_HSE_IsReady() != 1)
|
||||
{
|
||||
|
||||
}
|
||||
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_4, 168, LL_RCC_PLLP_DIV_2);
|
||||
LL_RCC_PLL_Enable();
|
||||
|
||||
/* Wait till PLL is ready */
|
||||
while(LL_RCC_PLL_IsReady() != 1)
|
||||
{
|
||||
|
||||
}
|
||||
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
|
||||
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_4);
|
||||
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_2);
|
||||
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||
|
||||
/* Wait till System clock is ready */
|
||||
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
||||
{
|
||||
|
||||
}
|
||||
LL_SetSystemCoreClock(168000000);
|
||||
|
||||
/* Update the time base */
|
||||
if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue