Skip to content

Commit

Permalink
rp2/mpbthciport: Cancel existing alarms.
Browse files Browse the repository at this point in the history
Cancel any existing poll alarm before add a new one.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
peterharperuk authored and dpgeorge committed Jun 14, 2023
1 parent 888a15c commit a459eaf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ports/rp2/mpbthciport.c
Expand Up @@ -57,6 +57,9 @@ static int64_t mp_bluetooth_hci_timer_callback(alarm_id_t id, void *user_data) {
}

void mp_bluetooth_hci_poll_in_ms(uint32_t ms) {
if (poll_timer_id != 0) {
cancel_alarm(poll_timer_id);
}
poll_timer_id = add_alarm_in_ms(ms, mp_bluetooth_hci_timer_callback, NULL, true);
}

Expand Down

0 comments on commit a459eaf

Please sign in to comment.