.rxbuffrq Method


Pre-requests the "numpages" number of buffer pages (1 page is 256 bytes) for the RX buffer of the BLE interface. Returns the actual number of pages that can be allocated.


bt.rxbuffrq(numpages as word) as word


Actual number of pages that can be allocated.

See Also:

Allocating TX and RX buffers




Requested numbers of buffer pages to allocate. The maximum number of pages you can request for this buffer is limited to 255.


The actual buffer allocation happens when the sys.buffalloc method is called.

The BLE interface is unable to receive data if its RX buffer has zero capacity. Current buffer capacity can be checked through bt.rxbuffsize, which returns the buffer capacity in bytes.

The relationship between the two is as follows: bt.rxbuffsize = num_pages * 256 - 33 (or = 0 when num_pages = 0), where "num_pages" is the number of buffer pages that was GRANTED through bt.rxbuffrq. "- 33" is because a number of bytes is needed for internal buffer variables.

Buffer allocation will not work if the BLE interface is enabled (bt.enabled = 1 — YES at the time when sys.buffalloc executes).