[c1aed7]: freetimer.c  Maximize  Restore  History

Download this file

25 lines (16 with data), 475 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "includes.h"
unsigned short freetimer;
void InitFreeTimer(void)
{
unsigned short periode;
/* Set the Prescaler value */
TIM2->PSCR = TIM2_PRESCALER_1;
/* Set the Autoreload value */
periode = (CLK_GetClockFreq()/1000); // we want a ms timer
TIM2->ARRH = (u8)(periode >> 8);
TIM2->ARRL = (u8)(periode);
TIM2->CR1 |= (u8)TIM2_CR1_CEN;
freetimer = 0;
/* Enable the Interrupt sources */
TIM2->IER |= (u8)TIM2_IT_UPDATE;
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks