← index #16577PR #5211
Related · medium · value 1.595
QUERY · ISSUE

docs: BLE Event handling seems to contradict general guidelines for IRQ handling

openby 32BTopened 2025-01-13updated 2025-11-06
docs

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

CANDIDATE · PULL REQUEST

extmod/modbluetooth: Misc fixes and improvements

closedby jimmoopened 2019-10-14updated 2019-10-15
extmod
  • Avoid confusing ENOMEM raised from gap_advertise if there is currently an active connection. This refers to the static connection buffer pre-allocated by Nimble (nothing to do with MicroPython heap memory). Fixed by increasing the max number of connections from 1 to 4 (which is a worthwhile fix anyway).
  • Clarify behaviour of adv_data and resp_data params to gap_advertise.
  • Fix IRQ_GATTS_WRITE having conn_handle and value_handle the wrong way around in the data tuple.
  • Address some issues with the ringbuf handling avoiding a potential overflow.
  • Pin the NimBLE task on ESP32 to the app core (see commit for more info).
  • Misc documentation fixes.
  • Make gap_connect return bool rather than raising OSError(MP_ENOTCONN) when already disconnected.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied