60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
![]() |
#include "./SYSTEM/sys/sys.h"
|
|||
|
#include "./SYSTEM/usart/usart.h"
|
|||
|
#include "./SYSTEM/delay/delay.h"
|
|||
|
#include "./BSP/LED/led.h"
|
|||
|
#include "./SYSTEM/fsmc/fsmc.h"
|
|||
|
#include "./SYSTEM/tim1/tim1_PWM.h"
|
|||
|
|
|||
|
void SystemClock_Config(void);
|
|||
|
int main(void)
|
|||
|
{
|
|||
|
|
|||
|
HAL_Init(); /* <20><>ʼ<EFBFBD><CABC>HAL<41><4C> */
|
|||
|
sys_stm32_clock_init(336, 8, 2, 7); /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>,168Mhz */
|
|||
|
// SystemClock_Config();
|
|||
|
delay_init(168); /* <20><>ʱ<EFBFBD><CAB1>ʼ<EFBFBD><CABC> */
|
|||
|
usart_init(115200); /* <20><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>Ϊ115200 */
|
|||
|
MX_FSMC_Init(); /* <20><>ʼ<EFBFBD><CABC>FSMC */
|
|||
|
AD7606_Init(); /* <20><>ʼ<EFBFBD><CABC>AD7606 */
|
|||
|
AD7606_StartRecord(); /* <20><>ʼ<EFBFBD>ɼ<EFBFBD> */
|
|||
|
printf("\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>ϢΪ:\r\n");
|
|||
|
while(1)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
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.<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
|||
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|||
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
|||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
|||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
|||
|
RCC_OscInitStruct.PLL.PLLM = 8;
|
|||
|
RCC_OscInitStruct.PLL.PLLN = 168;
|
|||
|
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
|||
|
RCC_OscInitStruct.PLL.PLLQ = 4;
|
|||
|
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
|||
|
|
|||
|
/** 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;
|
|||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
|||
|
}
|