diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-10-16 14:11:34 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-10-16 14:11:34 +0200 |
commit | 6347726748a03ad334fe51718a4ded87c70735eb (patch) | |
tree | d58eb5f66973396f2375f61a95c70fe874a38c5f /include/arch/msp430fr5969lp | |
parent | ad6008f95f597e9ce57b094a8522587ab9372fd7 (diff) |
MSP430 timer.stop: Disable timer entirely to save energy
Diffstat (limited to 'include/arch/msp430fr5969lp')
-rw-r--r-- | include/arch/msp430fr5969lp/driver/timer.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/arch/msp430fr5969lp/driver/timer.h b/include/arch/msp430fr5969lp/driver/timer.h index de87c20..cb37da2 100644 --- a/include/arch/msp430fr5969lp/driver/timer.h +++ b/include/arch/msp430fr5969lp/driver/timer.h @@ -25,7 +25,7 @@ class Timer { #if F_CPU == 1000000UL inline void setup_khz(uint16_t const frequency) { - TA0CTL = TASSEL__SMCLK | ID__1 | MC__UP; // -> 1 MHz base + TA0CTL = TASSEL__SMCLK | ID__1; // -> 1 MHz base TA0EX0 = 0; TA0CCR0 = 1000UL / frequency; TA0CTL |= TACLR; @@ -33,11 +33,11 @@ class Timer { inline void setup_hz(uint16_t const frequency) { // 1 MHz base if (frequency < 20) { - TA0CTL = TASSEL__SMCLK | ID__8 | MC__UP; // /8 + TA0CTL = TASSEL__SMCLK | ID__8; // /8 TA0EX0 = 1; // /2 -> /16 -> 62500 Hz TA0CCR0 = 62500UL / frequency; } else { - TA0CTL = TASSEL__SMCLK | ID__1 | MC__UP; + TA0CTL = TASSEL__SMCLK | ID__1; TA0EX0 = 0; TA0CCR0 = 1000000UL / frequency; } @@ -45,14 +45,14 @@ class Timer { } #else inline void setup_khz(uint16_t const frequency) { - TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV | MC__UP; // -> 2 MHz base + TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV; // -> 2 MHz base TA0EX0 = 0; TA0CCR0 = 2000UL / frequency; TA0CTL |= TACLR; } inline void setup_hz(uint16_t const frequency) { // 2 MHz base - TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV | MC__UP; + TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV; TA0EX0 = 0; TA0CCR0 = 2000000UL / frequency; TA0CTL |= TACLR; @@ -61,14 +61,14 @@ class Timer { inline void start(unsigned char const interrupt) { if (interrupt) { - TA0CTL |= TACLR | TAIE; + TA0CTL |= MC__UP | TACLR | TAIE; } else { - TA0CTL |= TACLR; + TA0CTL |= MC__UP | TACLR; } } inline void stop() { - TA0CTL &= ~TAIE; + TA0CTL &= ~MC__UP; } }; |