mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
rp2/mpbthciport: Cancel existing alarms.
Cancel any existing poll alarm before add a new one. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
committed by
Damien George
parent
888a15cda3
commit
a459eaf3e6
@@ -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) {
|
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);
|
poll_timer_id = add_alarm_in_ms(ms, mp_bluetooth_hci_timer_callback, NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user