Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Timer.cpp
- Revision:
- 3:88da6c0412b0
- Parent:
- 2:e26c096f1946
diff -r e26c096f1946 -r 88da6c0412b0 Timer.cpp
--- a/Timer.cpp Sun Dec 30 04:58:42 2012 +0000
+++ b/Timer.cpp Thu Jan 03 02:57:29 2013 +0000
@@ -3,9 +3,9 @@
// static data initialization (only called once)
bool Timer::timer1initialized = false;
-int Timer::resolution = 1000000;
+int Timer::resolution = 1000000; //default: microseconds accuracy
-void Timer::initTimer1(int res) //microseconds accuracy
+void Timer::initTimer1(int res)
{
uint8_t pclk;
uint32_t pclkdiv = (LPC_SC->PCLKSEL0 >> 4) & 0x03; //PCLK for Timer 1 (page 56)
@@ -27,14 +27,14 @@
break;
}
- LPC_TIM1->TCR = 0x02; /* reset timer */
+ LPC_TIM1->TCR = 0x02; // reset timer
LPC_TIM1->PR = (SystemCoreClock / (pclk * res)); //default: microsecond steps
- LPC_TIM1->MR0 = 2147483647; /* highest number a 32bit signed int can store (for us ~ 35.79 minutes, or, for ms ~ 596.52 hours ) */
- LPC_TIM1->IR = 0xff; /* reset all interrrupts */
- LPC_TIM1->MCR = 0x02; /* reset timer on match */
- LPC_TIM1->TCR = 0x01; /* start timer */
+ LPC_TIM1->MR0 = 2147483647; // highest number a 32bit signed int can store (for us ~ 35.79 minutes, or, for ms ~ 596.52 hours )
+ LPC_TIM1->IR = 0xff; // reset all interrrupts
+ LPC_TIM1->MCR = 0x02; // reset timer on match
+ LPC_TIM1->TCR = 0x01; // start timer
- /* The timer simply goes on forever! It just resets itself when it hits the max number for TC */
+ // The timer simply goes on forever! It just resets itself when it hits the max number for TC
timer1initialized = true;
resolution = res;
}