From 3577bbcbb6b0354bc97c7a9ac749d1d1a4511651 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Sat, 1 May 2021 21:25:40 +0200 Subject: [PATCH] Small timer support fix Adding useful define in timer support. --- drivers/countertimers.c | 2 +- include/drivers/timers.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/countertimers.c b/drivers/countertimers.c index 0113ecf..c28cac2 100644 --- a/drivers/countertimers.c +++ b/drivers/countertimers.c @@ -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 */ diff --git a/include/drivers/timers.h b/include/drivers/timers.h index 1811a68..ff52eb8 100644 --- a/include/drivers/timers.h +++ b/include/drivers/timers.h @@ -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 */ -- 2.43.0