Files
VK035_Template/Core/App/rcu.c

32 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*==============================================================================
* Инициализация тактирования с использованием бибилотеки PLIB035
*------------------------------------------------------------------------------
* ЦНИИ СЭТ, Разваляев Алексей <wot890089@mail.ru>
*==============================================================================
* ЦНИИ СЭТ
*==============================================================================
*/
//-- Includes ------------------------------------------------------------------
#include "rcu.h"
//-- Defines -------------------------------------------------------------------
//-- Peripheral init functions -------------------------------------------------
void sysclk_init(void)
{
OperationStatus status;
status = RCU_PLL_AutoConfig(MCU_CLOCK_MHZ*__MHZ, OS_Type);
if (status == ERROR)
{
Error_Handler();
}
SystemCoreClockUpdate();
RCU_ClkOutConfig(RCU_SysPeriphClk_PLLClk, 1, ENABLE);
RCU_ClkOutCmd(ENABLE);
/* Прерывание должно быть каждую миллисекунду:
Для тактирования N Гц это каждый N / 1000 тик */
SysTick_Config(MCU_CLOCK_MHZ*__MHZ/1000);
}