diff options
Diffstat (limited to 'include/arch/msp430fr5994lp/driver')
-rw-r--r-- | include/arch/msp430fr5994lp/driver/timer.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/arch/msp430fr5994lp/driver/timer.h b/include/arch/msp430fr5994lp/driver/timer.h index 9a2c7fe..97bd302 100644 --- a/include/arch/msp430fr5994lp/driver/timer.h +++ b/include/arch/msp430fr5994lp/driver/timer.h @@ -56,17 +56,17 @@ class Timer { TA0CTL |= TACLR; } - inline void setup_hz(uint16_t const frequency) { // 2 MHz base + inline void setup_hz(uint16_t const frequency) { TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV; - TA0EX0 = 0; - TA0CCR0 = 2000000UL / frequency; - TA0CTL |= TACLR; - } - - inline void setup_hz_low(uint16_t const frequency) { // 250 kHz base - TA0CTL = TASSEL__SMCLK | _TA0_MAIN_DIV; - TA0EX0 = 7; - TA0CCR0 = 250000UL / frequency; + if (frequency < 32) { + // 2 MHz base + TA0EX0 = 7; + TA0CCR0 = 250000UL / frequency; + } else { + // 250 kHz base + TA0EX0 = 0; + TA0CCR0 = 2000000UL / frequency; + } TA0CTL |= TACLR; } #endif |