Adding serial.set(Rx|Tx)BufferSize (#1931)

* Fix for https://github.com/Microsoft/pxt-microbit/issues/1929

* bump pxt

* updated docs

* fix default values

* moving dialogs to react

* moving to react

* typo

* typo
This commit is contained in:
Peli de Halleux
2019-03-21 08:04:48 -07:00
committed by GitHub
parent d640dc5eed
commit ea2361792f
13 changed files with 5416 additions and 1100 deletions

View File

@ -535,6 +535,10 @@
"serial.redirect|param|rate": "the new baud rate. eg: 115200",
"serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1",
"serial.redirect|param|tx": "the new transmission pin, eg: SerialPin.P0",
"serial.setRxBufferSize": "Sets the size of the RX buffer in bytes",
"serial.setRxBufferSize|param|size": "length of the rx buffer in bytes, eg: 32",
"serial.setTxBufferSize": "Sets the size of the TX buffer in bytes",
"serial.setTxBufferSize|param|size": "length of the tx buffer in bytes, eg: 32",
"serial.writeBuffer": "Send a buffer through serial connection",
"serial.writeLine": "Print a line of text to the serial port",
"serial.writeNumber": "Print a numeric value to the serial port",

View File

@ -191,4 +191,23 @@ namespace serial {
uBit.serial.redirect(USBTX, USBRX);
uBit.serial.baud(115200);
}
/**
* Sets the size of the RX buffer in bytes
* @param size length of the rx buffer in bytes, eg: 32
*/
//% help=serial/set-rx-buffer-size
void setRxBufferSize(uint8_t size) {
uBit.serial.setRxBufferSize(size);
}
/**
* Sets the size of the TX buffer in bytes
* @param size length of the tx buffer in bytes, eg: 32
*/
//% help=serial/set-tx-buffer-size
void setTxBufferSize(uint8_t size) {
uBit.serial.setTxBufferSize(size);
}
}

14
libs/core/shims.d.ts vendored
View File

@ -864,6 +864,20 @@ declare namespace serial {
//% weight=9 help=serial/redirect-to-usb
//% blockId=serial_redirect_to_usb block="serial|redirect to USB" shim=serial::redirectToUSB
function redirectToUSB(): void;
/**
* Sets the size of the RX buffer in bytes
* @param size length of the rx buffer in bytes, eg: 32
*/
//% help=serial/set-rx-buffer-size 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=serial/set-tx-buffer-size shim=serial::setTxBufferSize
function setTxBufferSize(size: uint8): void;
}