Small timer support fix Adding useful define in timer support.
authorNathael Pajani <nathael.pajani@ed3l.fr>
Sat, 1 May 2021 19:25:40 +0000 (21:25 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:05 +0000 (17:03 +0100)
drivers/countertimers.c
include/drivers/timers.h

index 0113ecf..c28cac2 100644 (file)
@@ -273,7 +273,7 @@ int countertimer_tc_setup(uint8_t timer_num, const struct lpc_tc_config* conf)
        /* Select between timer (counts on PCLK) and counter mode (counts on CAP events) */
        if (conf->mode & LPC_TIMER_MODE_COUNTER) {
                /* Configure the counter */
-               timer->regs->count_ctrl = (conf->count_control & 0x0F);
+               timer->regs->count_ctrl = (conf->count_control & 0x03);
                timer->regs->count_ctrl |= LPC_COUNTER_INC_INPUT(conf->count_chan);
        } else {
                /* Timer mode */
index 1811a68..ff52eb8 100644 (file)
@@ -239,6 +239,7 @@ int timer_counter_config(uint8_t timer_num, const struct lpc_tc_config* conf);
  *   config field in timer_config struct upon timer setup)
  *   The interrupt flags are passed to the interrupt routine as argument.
  */
+#define TIMER_NO_PRESCALE  0
 int timer_on(uint8_t timer_num, uint32_t clkrate, void (*callback)(uint32_t));
 
 /* Removes the main clock from the selected timer block */