Add some descriptive info to serial docs (#704)

* Local commit

* Add some descriptive info to serial docs

* Example typo

* Tiny edit
This commit is contained in:
Galen Nickel
2018-03-09 13:14:24 -08:00
committed by Peli de Halleux
parent 13f20bfcad
commit ddc9aeae35
6 changed files with 53 additions and 36 deletions

View File

@ -409,26 +409,26 @@
"pins.spiWrite": "Write to the SPI slave and return the response",
"pins.spiWrite|param|value": "Data to be sent to the SPI slave",
"serial": "Reading and writing data over a serial connection.",
"serial.delimiters": "Returns the delimiter corresponding string",
"serial.onDataReceived": "Registers an event to be fired when one of the delimiter is matched.",
"serial.delimiters": "Return the corresponding delimiter string",
"serial.onDataReceived": "Register an event to be fired when one of the delimiter is matched.",
"serial.onDataReceived|param|delimiters": "the characters to match received characters against.",
"serial.readBuffer": "Read multiple characters from the receive buffer. Pause until enough characters are present.",
"serial.readBuffer|param|length": "default buffer length, eg: 64",
"serial.readLine": "Reads a line of text from the serial port.",
"serial.readString": "Reads the buffered received data as a string",
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
"serial.readLine": "Read a line of text from the serial port.",
"serial.readString": "Read the buffered received data as a string",
"serial.readUntil": "Read a line of text from the serial port and return the buffer when the delimiter is met.",
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
"serial.redirect": "Set the serial input and output to use pins instead of the USB connection.",
"serial.redirectToUSB": "Direct the serial input and output to use the USB connection.",
"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.writeBuffer": "Sends a buffer through Serial connection",
"serial.writeLine": "Prints a line of text to the serial",
"serial.writeNumber": "Prints a numeric value to the serial",
"serial.writeNumbers": "Prints an array of numeric values to the serial as CSV",
"serial.writeString": "Sends a piece of text through Serial connection.",
"serial.writeValue": "Writes a ``name: value`` pair line to the serial.",
"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",
"serial.writeNumbers": "Print an array of numeric values as CSV to the serial port",
"serial.writeString": "Send a piece of text through the serial connection.",
"serial.writeValue": "Write a name:value pair as a line to the serial port.",
"serial.writeValue|param|name": "name of the value stream, eg: x",
"serial.writeValue|param|value": "to write"
}

View File

@ -62,7 +62,7 @@ namespace serial {
// note that at least one // followed by % is needed per declaration!
/**
* Reads a line of text from the serial port and returns the buffer when the delimiter is met.
* Read a line of text from the serial port and return the buffer when the delimiter is met.
* @param delimiter text delimiter that separates each text chunk
*/
//% help=serial/read-until
@ -73,7 +73,7 @@ namespace serial {
}
/**
* Reads the buffered received data as a string
* Read the buffered received data as a string
*/
//% help=serial/read-string
//% blockId=serial_read_buffer block="serial|read string"
@ -85,7 +85,7 @@ namespace serial {
}
/**
* Registers an event to be fired when one of the delimiter is matched.
* Register an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against.
*/
//% help=serial/on-data-received
@ -98,7 +98,7 @@ namespace serial {
}
/**
* Sends a piece of text through Serial connection.
* Send a piece of text through the serial connection.
*/
//% help=serial/write-string
//% weight=87 blockGap=8
@ -110,7 +110,7 @@ namespace serial {
}
/**
* Sends a buffer through Serial connection
* Send a buffer through serial connection
*/
//% blockId=serial_writebuffer block="serial|write buffer %buffer"
//% help=serial/write-buffer advanced=true weight=6

View File

@ -5,7 +5,7 @@
//% advanced=true
namespace serial {
/**
* Prints a line of text to the serial
* Print a line of text to the serial port
* @param value to send over serial
*/
//% weight=90
@ -23,7 +23,7 @@ namespace serial {
}
/**
* Prints a numeric value to the serial
* Print a numeric value to the serial port
*/
//% help=serial/write-number
//% weight=89 blockGap=8
@ -33,9 +33,9 @@ namespace serial {
}
/**
* Prints an array of numeric values to the serial as CSV
* Print an array of numeric values as CSV to the serial port
*/
//% help=serial-write-numbers
//% help=serial/write-numbers
//% weight=86
//% blockId=serial_writenumbers block="serial|write numbers %values"
export function writeNumbers(values: number[]): void {
@ -48,7 +48,7 @@ namespace serial {
}
/**
* Writes a ``name: value`` pair line to the serial.
* Write a name:value pair as a line to the serial port.
* @param name name of the value stream, eg: x
* @param value to write
*/
@ -60,7 +60,7 @@ namespace serial {
}
/**
* Reads a line of text from the serial port.
* Read a line of text from the serial port.
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial|read line"
@ -70,7 +70,7 @@ namespace serial {
}
/**
* Returns the delimiter corresponding string
* Return the corresponding delimiter string
*/
//% blockId="serial_delimiter_conv" block="%del"
//% weight=1 blockHidden=true

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

@ -772,7 +772,7 @@ declare namespace pins {
declare namespace serial {
/**
* Reads a line of text from the serial port and returns the buffer when the delimiter is met.
* Read a line of text from the serial port and return the buffer when the delimiter is met.
* @param delimiter text delimiter that separates each text chunk
*/
//% help=serial/read-until
@ -781,7 +781,7 @@ declare namespace serial {
function readUntil(delimiter: string): string;
/**
* Reads the buffered received data as a string
* Read the buffered received data as a string
*/
//% help=serial/read-string
//% blockId=serial_read_buffer block="serial|read string"
@ -789,7 +789,7 @@ declare namespace serial {
function readString(): string;
/**
* Registers an event to be fired when one of the delimiter is matched.
* Register an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against.
*/
//% help=serial/on-data-received
@ -797,7 +797,7 @@ declare namespace serial {
function onDataReceived(delimiters: string, body: () => void): void;
/**
* Sends a piece of text through Serial connection.
* Send a piece of text through the serial connection.
*/
//% help=serial/write-string
//% weight=87 blockGap=8
@ -805,7 +805,7 @@ declare namespace serial {
function writeString(text: string): void;
/**
* Sends a buffer through Serial connection
* Send a buffer through serial connection
*/
//% blockId=serial_writebuffer block="serial|write buffer %buffer"
//% help=serial/write-buffer advanced=true weight=6 shim=serial::writeBuffer