-
Notifications
You must be signed in to change notification settings - Fork 0
/
ticker.c
113 lines (86 loc) · 2.78 KB
/
ticker.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*****************************************************************************
*
* Project : lwIP Web
* Subproject :
* Name : ticker.c
* Function : Routines for ticker
* Designer : K. Sterckx
* Creation date : 22/07/2007
* Compiler : GNU ARM
* Processor : LPC23xx
* Last update :
* Last updated by :
* History :
*
*****************************************************************************
*
* Routines that start ticker
*
****************************************************************************/
#include "ticker.h"
/*****************************************************************************
*
* Local defines
*
*****************************************************************************/
/*****************************************************************************
*
* Local variables
*
*****************************************************************************/
/*****************************************************************************
*
* Global variables
*
*****************************************************************************/
volatile unsigned int TICKER_time;
/*****************************************************************************
*
* Local functions
*
*****************************************************************************/
/*****************************************************************************
*
* Global functions
*
*****************************************************************************/
/*****************************************************************************
Function name : TICKER_Init
Description :
This function initialize the ticker.
We want a 1ms resolution
PCLK is 72MHz.
Timer Freq = PCLK / (T0PR * T0MR1) = 1000Hz
T0PR = 60
T0MR1 = 1000
Parameters : NONE
Returns : NONE
*/
void TICKER_Init(void)
{
// PCLKSEL0 = (PCLKSEL0 & (~(0x3<<2))) | (0x01 << 2);
// T0TCR = 2; /* Stop and reset the timer */
// T0CTCR = 0; /* Timer mode */
// T0PR = 72; /* Prescaler */
// T0MR1 = 1000; /* Match value */
// T0MCR = (3 << 3); /* Reset timer on match and generate interrupt */
}
/*****************************************************************************
Function name : TICKER_Start
Description :
This function starts the ticker.
Parameters : NONE
Returns : NONE
*/
void TICKER_Start(void)
{
TICKER_time = 0;
// T0TCR = 1; /* Start timer */
}
void TICKER_Handler(void)
{
/* 1ms */
TICKER_time += 1;
// T0IR = 2;
// VICVectAddr = 0;
}