Dependencies:   mbed

Committer:
no2chem
Date:
Mon Jan 25 05:56:58 2010 +0000
Revision:
0:c162b0b96146

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
no2chem 0:c162b0b96146 1 /* mbed GetTickCount Library
no2chem 0:c162b0b96146 2 * Copyright (c) 2010 Michael Wei
no2chem 0:c162b0b96146 3 */
no2chem 0:c162b0b96146 4
no2chem 0:c162b0b96146 5 //shouldn't have to include, but fixes weird problems with defines
no2chem 0:c162b0b96146 6 #include "LPC1768/LPC17xx.h"
no2chem 0:c162b0b96146 7
no2chem 0:c162b0b96146 8 #ifndef MBED_TICKCOUNT_H
no2chem 0:c162b0b96146 9 #define MBED_TICKCOUNT_H
no2chem 0:c162b0b96146 10 extern volatile unsigned int TickCount;
no2chem 0:c162b0b96146 11
no2chem 0:c162b0b96146 12 inline void GetTickCount_Start(void) {
no2chem 0:c162b0b96146 13 //CMSIS SYSTICK Config
no2chem 0:c162b0b96146 14 SysTick_Config(SystemCoreClock / 100); /* Generate interrupt every 10 ms */
no2chem 0:c162b0b96146 15 }
no2chem 0:c162b0b96146 16
no2chem 0:c162b0b96146 17 inline void GetTickCount_Stop(void) {
no2chem 0:c162b0b96146 18 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (0<<SYSTICK_ENABLE) | (0<<SYSTICK_TICKINT); /* Disable SysTick IRQ and SysTick Timer */
no2chem 0:c162b0b96146 19 }
no2chem 0:c162b0b96146 20
no2chem 0:c162b0b96146 21 inline void GetTickCount_Reset(void) {
no2chem 0:c162b0b96146 22 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (0<<SYSTICK_ENABLE) | (0<<SYSTICK_TICKINT); /* Disable SysTick IRQ and SysTick Timer */
no2chem 0:c162b0b96146 23 TickCount = 0;
no2chem 0:c162b0b96146 24 SysTick->CTRL = (1 << SYSTICK_CLKSOURCE) | (1<<SYSTICK_ENABLE) | (1<<SYSTICK_TICKINT); /* Enable SysTick IRQ and SysTick Timer */
no2chem 0:c162b0b96146 25 }
no2chem 0:c162b0b96146 26
no2chem 0:c162b0b96146 27 inline unsigned int GetTickCount(void)
no2chem 0:c162b0b96146 28 {
no2chem 0:c162b0b96146 29 return TickCount;
no2chem 0:c162b0b96146 30 }
no2chem 0:c162b0b96146 31 #endif