void main() {
#ifdef DEBUG debug(); #endif /* MRCC Configuration */ MRCC_Configuration(); /* GPIO Pins Configuration */ GPIO_Configuration(); /* EIC Configuration */ EIC_Configuration(); /* TIM Configuration in Output Compare Timing Mode ---------------------------*/ /* CK_TIM = 60 MHz, Prescaler = 239, TIM0_CLK = CK_TIM/(Prescaler + 1) = 250 KHz */ /* TIM0 Update event frequency = TIM0_CLK/ (TIM_Period+1) = 3.81 Hz */ TIM_InitStructure.TIM_Mode = TIM_Mode_OCTiming; TIM_InitStructure.TIM_Prescaler = 0xEF; TIM_InitStructure.TIM_ClockSource = TIM_ClockSource_Internal; TIM_InitStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_InitStructure.TIM_Channel = TIM_Channel_2; TIM_InitStructure.TIM_Period = 0xFFFF; TIM_Init(TIM0, &TIM_InitStructure);
/* Clear TIM0 flags */ TIM_ClearFlag(TIM0, TIM_FLAG_OC1| TIM_FLAG_OC2| TIM_FLAG_Update);
/* Enable TIM0 Update interrupt */ TIM_ITConfig(TIM0, TIM_IT_Update, ENABLE);
/* Enable TIM0 counter */ TIM_Cmd(TIM0, ENABLE);
while(1); } |