-
Notifications
You must be signed in to change notification settings - Fork 4
/
SysTick.c
48 lines (42 loc) · 919 Bytes
/
SysTick.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
/*
* Description
*
*To use delay function choose TIME_BASE and
*Initialize_SysTick()
*/
#include "SysTick.h"
//extern volatile uint16_t RPS_A ;
//extern volatile uint16_t RPS_B ; //NIE USUWAC
//
//extern volatile uint8_t i ;
//extern volatile uint16_t tmpA1 ;
//extern volatile uint16_t tmpA2 ;
//extern volatile uint16_t tmpB1 ;
//extern volatile uint16_t tmpB2 ;
void Initialize_SysTick()
{
#ifdef TIME_BASE_ms
//interrupt every 1ms
SysTick_Config(SystemCoreClock / 1000);
#endif
#ifdef TIME_BASE_us
//interrupt every 1us
SysTick_Config(SystemCoreClock / 1000000);
#endif
#ifdef TIME_BASE_10ms
//interrupt every 10ms
SysTick_Config(SystemCoreClock / 100);
#endif
}
/*Initialize_SysTick() and uncomment to use delay function*/
//void SysTick_Handler()
//{
// if (timer)
// timer--;
//}
//
void delay(uint32_t time)
{
timer = time;
while (timer);
}