support for serial read/write buffer (#384)

This commit is contained in:
Peli de Halleux
2017-04-21 09:02:29 -07:00
committed by GitHub
parent 43bad888dc
commit 17c1abe86a
5 changed files with 76 additions and 1 deletions

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

@ -714,6 +714,19 @@ declare namespace serial {
//% blockId=serial_writestring block="serial|write string %text" shim=serial::writeString
function writeString(text: string): void;
/**
* Sends a buffer through Serial connection
*/
//% help=serial/write-buffer advanced=true weight=6 shim=serial::writeBuffer
function writeBuffer(buffer: Buffer): void;
/**
* Reads multiple characters from the rxBuff and fills a user buffer.
* @param length default buffer length, eg: 64
*/
//% help=serial/read-buffer advanced=true weight=5 shim=serial::readBuffer
function readBuffer(length: number): Buffer;
/**
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
* @param tx the new transmission pins, eg: SerialPin.P0