From d41efbf21b66e47b0ae7b4154bebf77669f4b607 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 7 Oct 2016 00:13:09 +0200 Subject: [PATCH] ADD: added a StopTicks functions, to disable the timer used for ticks (TC0, TC1) --- armsrc/ticks.c | 7 ++++++- armsrc/ticks.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/armsrc/ticks.c b/armsrc/ticks.c index 633e963a..44249879 100644 --- a/armsrc/ticks.c +++ b/armsrc/ticks.c @@ -217,7 +217,7 @@ void WaitMS(uint16_t ms){ WaitTicks( (uint32_t)(ms * 1500) ); } // Starts Clock and waits until its reset -void ResetTicks(){ +void ResetTicks(void){ AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG; AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG; while (AT91C_BASE_TC1->TC_CV >= 1); @@ -226,3 +226,8 @@ void ResetTimer(AT91PS_TC timer){ timer->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG; while(timer->TC_CV >= 1) ; } +// stop clock +void StopTicks(void){ + AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; + AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS; +} diff --git a/armsrc/ticks.h b/armsrc/ticks.h index 1b05289d..8ad4bc67 100644 --- a/armsrc/ticks.h +++ b/armsrc/ticks.h @@ -44,4 +44,5 @@ extern void WaitUS(uint16_t us); extern void WaitMS(uint16_t ms); extern void ResetTicks(); extern void ResetTimer(AT91PS_TC timer); +extern void StopTicks(void); #endif \ No newline at end of file -- 2.39.5