Skip to content

Commit bcbf69e

Browse files
rruuaanngkartben
authored andcommitted
drivers: counter: nrf: Add nrfx-timer implementation
Implement the '.reset' interface in the nrfx-timer driver to allow the upper layers to use the counter_reset function. Signed-off-by: James Roy <[email protected]>
1 parent d019aea commit bcbf69e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/counter/counter_nrfx_timer.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ static int get_value(const struct device *dev, uint32_t *ticks)
152152
return 0;
153153
}
154154

155+
static int reset(const struct device *dev)
156+
{
157+
const struct counter_nrfx_config *config = dev->config;
158+
159+
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_CLEAR);
160+
return 0;
161+
}
162+
155163
static uint32_t ticks_add(uint32_t val1, uint32_t val2, uint32_t top)
156164
{
157165
uint32_t to_top;
@@ -446,6 +454,7 @@ static DEVICE_API(counter, counter_nrfx_driver_api) = {
446454
.start = start,
447455
.stop = stop,
448456
.get_value = get_value,
457+
.reset = reset,
449458
.set_alarm = set_alarm,
450459
.cancel_alarm = cancel_alarm,
451460
.set_top_value = set_top_value,

0 commit comments

Comments
 (0)