diff options
| author | Peter Harper <peter.harper@raspberrypi.com> | 2023-03-13 10:35:48 +0000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-06-14 22:20:20 +1000 |
| commit | a459eaf3e6a8d0e0f36c885c994819a296a64e71 (patch) | |
| tree | aeff5a07fffb9e350854f69f66a7df1b381e313a | |
| parent | 888a15cda3c7094009563fc65f19c6d8f76cc201 (diff) | |
rp2/mpbthciport: Cancel existing alarms.
Cancel any existing poll alarm before add a new one.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/rp2/mpbthciport.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/rp2/mpbthciport.c b/ports/rp2/mpbthciport.c index ac05e4607..d5b3c6073 100644 --- a/ports/rp2/mpbthciport.c +++ b/ports/rp2/mpbthciport.c @@ -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); } |
