diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 00fd873a..59d31f40 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -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", diff --git a/libs/core/serial.cpp b/libs/core/serial.cpp index 814ecf4d..2ffef1c1 100644 --- a/libs/core/serial.cpp +++ b/libs/core/serial.cpp @@ -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); } - } diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 5d882261..b0082c35 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -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; }