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.
Fork of HardwareTimersLib by
Diff: Timer_TPM.cpp
- Revision:
- 13:3564122e9c10
- Parent:
- 12:cb395e4be69e
--- a/Timer_TPM.cpp Tue Mar 11 05:38:56 2014 +0000
+++ b/Timer_TPM.cpp Tue Mar 11 05:49:26 2014 +0000
@@ -62,13 +62,14 @@
//Configure TPM prescaler
TPM0->SC = TPM_SC_PS(0); //Prescaler set to 1
+ TPM0->CNT = 0; //Set the count register
+
//Set interrupt handler
NVIC_SetVector(TPM0_IRQn, (uint32_t) __tpm_isr_wrapper);
NVIC_EnableIRQ(TPM0_IRQn);
}
void Timer_TPM::__start_timer() {
- TPM0->CNT = 0; //Set the count register
TPM0->MOD = (uint16_t) __rolloverValue; //Set the modulo register
TPM0->SC |= TPM_SC_TOIE_MASK; //Enable interrupt
TPM0->SC |= TPM_SC_CMOD(1); //Start the timer. Timer will increment on the TPM clock edges, not an external clock
