docs: BLE Event handling seems to contradict general guidelines for IRQ handling
Documentation URL
https://docs.micropython.org/en/latest/library/bluetooth.html#event-handling
Description
In BLE event handling a suggestion is given to create copies of the ringbuffer parameters. This however, would violate the general guidelines given for interrupt routines which specifically warn against instantiating objects.
https://github.com/micropython/micropython/blob/99ac8193ea299e6d836b076149f561e58226ede6/docs/reference/isr_rules.rst?plain=1#L102
Code of Conduct
Yes, I agree
extmod/nimble: Run the eventq in micropython.schedule.
This PR changes the background nimble processing to run the nimble eventq handler via schedule() and remove the ringbuffer system.
This change basically ensures that the python IRQ callback for any BLE operation is run to completion before the next BLE operation is handled.
I've only tested the peripheral mode running my application on reader so far, but it appears to be running very reliably - I've had no transmission sync/order/race issues for many hours where previously I'd have a glitch at least every 10-20 minutes.
I'm looking at how to achieve the same in btstack and it appears far less straightforward there. I can't find anything that looks like a similar functional boundary to split across to schedule().
Event callbacks in btstack_packet_handler() are typically run during the processing of mp_bluetooth_hci_poll_h4(), not going via any sort of event queue.
Perhaps I just need to run the entire mp_bluetooth_hci_poll() function via schedule?