driver: counter: rpi_pico_timer: fix counter cancel

alarm setting function checks channel callback and it returns -EBUSY
if callback is registered. but alarm cancel function doesn't clear
callback function. this prevents from alarm setting after alarm cancel

Signed-off-by: Minho Jin <kilejin@gmail.com>
This commit is contained in:
Minho Jin 2023-11-14 16:50:38 +09:00 committed by Fabio Baltieri
parent 82644a31c2
commit a1614e8c95

View file

@ -106,6 +106,11 @@ static int counter_rpi_pico_timer_set_alarm(const struct device *dev, uint8_t id
static int counter_rpi_pico_timer_cancel_alarm(const struct device *dev, uint8_t id)
{
struct counter_rpi_pico_timer_data *data = dev->data;
struct counter_rpi_pico_timer_ch_data *chdata = &data->ch_data[id];
chdata->callback = NULL;
chdata->user_data = NULL;
hardware_alarm_cancel(id);
return 0;