.txbuffrq Method

Function:

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

Syntax:

bt.txbuffrq(numpages as word) as word

Returns:

Actual number of pages that can be allocated.

See Also:

Allocating TX and RX Buffers


Part

Description

numpages

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


Details

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

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

The relationship between the two is as follows: bt.txbuffsize = num_pages * 256 - 33 (or = 0 when num_pages = 0), where "num_pages" is the number of buffer pages that was GRANTED through bt.txbuffrq. "- 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).


.txbuffrq Method

Details