
#ifndef __CONFIG_C
#define __CONFIG_C

#include "opora.h"
//--- Clock configuration ---
void ClkConfig()
{
	RST_CLK->HS_CONTROL=0x00000001;				//HSE - On; Osc mode On
	while((RST_CLK->CLOCK_STATUS&0x04)!=0x04);	//Wait until HSE not ready
	RST_CLK->CPU_CLOCK=0x00000002;				//CPU_C1 Clock = HSE (8MHz)
	RST_CLK->PLL_CONTROL=(1<<2)|(1<<8);			//CPU PLL On, PLL_MULL=1
	while((RST_CLK->CLOCK_STATUS&0x02)!=0x02);	//Wait until CPU PLL not ready
	RST_CLK->PER_CLOCK|=0x08;					//EEPROM Clock enable
	EEPROM->CMD = 0;
	RST_CLK->PER_CLOCK&=(~0x08);				//EEPROM Clock disable
	RST_CLK->CPU_CLOCK=0x00000106;				//CPU Clock = HSE (16MHz)
	RST_CLK->PER_CLOCK|=1<<24;	 				//clock of PORTD On	
}

#endif	//__CONFIG_C
