add blocks for serial set tx/rx buffer size (#2144)

This commit is contained in:
Peli de Halleux 2019-06-07 09:12:35 -07:00 committed by Abhijith Chatra
parent b553825f0c
commit a0181ef2a7
3 changed files with 12 additions and 3 deletions

View File

@ -365,6 +365,8 @@
"serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv",
"serial.redirectToUSB|block": "serial|redirect to USB",
"serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate",
"serial.setRxBufferSize|block": "serial set rx buffer size to $size",
"serial.setTxBufferSize|block": "serial set tx buffer size to $size",
"serial.writeBuffer|block": "serial|write buffer %buffer=serial_readbuffer",
"serial.writeLine|block": "serial|write line %text",
"serial.writeNumbers|block": "serial|write numbers %values",

View File

@ -195,6 +195,8 @@ namespace serial {
* @param size length of the rx buffer in bytes, eg: 32
*/
//% help=reference/serial/set-rx-buffer-size
//% blockId=serialSetRxBufferSize block="serial set rx buffer size to $size"
//% advanced=true
void setRxBufferSize(uint8_t size) {
uBit.serial.setRxBufferSize(size);
}
@ -204,8 +206,9 @@ namespace serial {
* @param size length of the tx buffer in bytes, eg: 32
*/
//% help=reference/serial/set-tx-buffer-size
//% blockId=serialSetTxBufferSize block="serial set tx buffer size to $size"
//% advanced=true
void setTxBufferSize(uint8_t size) {
uBit.serial.setTxBufferSize(size);
}
}

View File

@ -869,14 +869,18 @@ declare namespace serial {
* Sets the size of the RX buffer in bytes
* @param size length of the rx buffer in bytes, eg: 32
*/
//% help=reference/serial/set-rx-buffer-size shim=serial::setRxBufferSize
//% help=reference/serial/set-rx-buffer-size
//% blockId=serialSetRxBufferSize block="serial set rx buffer size to $size"
//% advanced=true shim=serial::setRxBufferSize
function setRxBufferSize(size: uint8): void;
/**
* Sets the size of the TX buffer in bytes
* @param size length of the tx buffer in bytes, eg: 32
*/
//% help=reference/serial/set-tx-buffer-size shim=serial::setTxBufferSize
//% help=reference/serial/set-tx-buffer-size
//% blockId=serialSetTxBufferSize block="serial set tx buffer size to $size"
//% advanced=true shim=serial::setTxBufferSize
function setTxBufferSize(size: uint8): void;
}