Class: UART

uart~UART(options)

A UART interface, implemented as Duplex stream. Check the Node.js Duplex stream documentation on information how to read and write from the stream. Call resume() if you are not interested in the received data so it does not fill up memory.

Constructor

new UART(options)

Creates a UART interface. Destroy explicitly with distroy() when the interface is no longer in use.
Parameters:
Name Type Description
options Object The options
Properties
Name Type Attributes Default Description
baud Number <optional>
9600 speed of link in baud
stopBits Number <optional>
1 number of stop bits (1 or 2)
dataBits Number <optional>
8 number of data bits (7 or 8)
parity String <optional>
either "odd", "even", or do not set for no parity
pinRX Number <optional>
receive pin
pinTX Number <optional>
transmit pin
Source:

Extends

  • stream.Duplex

Methods

flush(callback)

Calls the callback as soon as the last transfer is completed.
Parameters:
Name Type Description
callback UARTTransferCallback called when the last transfer is completed
Source:

ref() → {UART}

Tells the interface to keep the program running when a transfer is taking place. This is the default.
Source:
Returns:
interface itself, to chain call other methods
Type
UART

unref() → {UART}

Tells the interface to not keep the program running when a transfer is taking place, but there is nothing else to do.
Source:
Returns:
interface itself, to chain call other methods
Type
UART