GetTickCount
Published 25 Jan 2010, by
Michael Wei

No tags
« Back to documentation index
Show/hide line numbers
GetTickCount.h Source File
GetTickCount.h
00001
00002
00003
00004
00005
00006 #include "LPC1768/LPC17xx.h"
00007
00008 #ifndef MBED_TICKCOUNT_H
00009 #define MBED_TICKCOUNT_H
00010 extern volatile unsigned int TickCount;
00011
00012 inline void GetTickCount_Start(void) {
00013
00014 SysTick_Config(SystemCoreClock / 100);
00015 }
00016
00017 inline void GetTickCount_Stop(void) {
00018 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (0<<SYSTICK_ENABLE) | (0<<SYSTICK_TICKINT);
00019 }
00020
00021 inline void GetTickCount_Reset(void) {
00022 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (0<<SYSTICK_ENABLE) | (0<<SYSTICK_TICKINT);
00023 TickCount = 0;
00024 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (1<<SYSTICK_ENABLE) | (1<<SYSTICK_TICKINT);
00025 }
00026
00027 inline unsigned int GetTickCount(void)
00028 {
00029 return TickCount;
00030 }
00031 #endif