Skip to content

Commit

Permalink
extmod/modbluetooth: Implement config getter for BLE rxbuf size.
Browse files Browse the repository at this point in the history
Knowing the buffer size can be important, to ensure that valid data will be
received.
  • Loading branch information
friebel authored and dpgeorge committed Feb 18, 2020
1 parent 3bd2ae1 commit f472673
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/library/ubluetooth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Configuration
(e.g. PYBD) then it will be returned. Otherwise (e.g. ESP32) a random
address will be generated when the BLE interface is made active.

- ``'rxbuf'``: Set the size in bytes of the internal buffer used to store
- ``'rxbuf'``: Get/set the size in bytes of the internal buffer used to store
incoming events. This buffer is global to the entire BLE driver and so
handles incoming data for all events, including all characteristics.
Increasing this allows better handling of bursty incoming data (for
Expand Down
2 changes: 2 additions & 0 deletions extmod/modbluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ STATIC mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map
mp_bluetooth_get_device_addr(addr);
return mp_obj_new_bytes(addr, MP_ARRAY_SIZE(addr));
}
case MP_QSTR_rxbuf:
return mp_obj_new_int(self->ringbuf.size);
default:
mp_raise_ValueError("unknown config param");
}
Expand Down

0 comments on commit f472673

Please sign in to comment.