Collection of Ftdi related functions
Methods
(static) close(devIdx)
Close the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device index |
(static) flushBuffer(devIdx, offsetopt)
flush read buffer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
devIdx |
Number | device Index |
||
offset |
Number |
<optional> |
0
|
if non-zero offset is provided, data in the read buffer before the offset will be flushed and the rest will be retained. |
(static) getDeviceList(options) → {ftdi.DeviceInfo}
Get all device List
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
- All devices list
- Type
- ftdi.DeviceInfo
(static) getErrorCode(devIdx) → {Number}
Get Error code from the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device index |
Returns:
- the error code of the device
- Type
- Number
(static) open(deviceInfo, options) → {Number}
Open a FTDI device with Interface.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deviceInfo |
Object | device information to open Properties
|
|||||||||||||||||||||||||||||||||||
options |
Object |
Properties
|
Returns:
device index
- Type
- Number
(static) pipe(devIdx, logname) → {Boolean}
Pipe data to a file.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device Index |
logname |
String | A log descriptor name. |
Returns:
- Returns true if piping to a file was successful
- Type
- Boolean
(static) read(devIdx, size, buffered) → {Buffer}
Read data from the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | A device index. |
size |
Number | The number of read size. |
buffered |
Boolean | Returns data from a read buffer. A read buffer accumulates all received data until flush a flush command is issued |
Returns:
- read data
- Type
- Buffer
(static) setBaudRate(devIdx, baudRate)
Set baud rate to the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device index |
baudRate |
Number | baudRate |
(static) setBitmode(devIdx, bitmode)
Set bitmode to the FTDI device.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
devIdx |
Number | device index |
|||||||||
bitmode |
Object | bitmode Properties
|
(static) setParity(devIdx, parity)
Set parity to the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device index |
parity |
String | parity Allowed values are:
|
(static) unpipe(devIdx)
Unpipe FTDI device from a log file.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device Index |
(static) useBinaryMode(devIdx)
Use binary mode for read data.
Under the binary mode, the data received from the device will not be piped to a log file.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device Index |
(static) useTextMode(devIdx)
Use text mode for read data.
\r\n
and \r
will be changed to \n
.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device Index |
(static) write(devIdx, data) → {Number}
Write data to the FTDI device.
Parameters:
Name | Type | Description |
---|---|---|
devIdx |
Number | device Index |
data |
Array | Buffer | data |
Returns:
- The number of written bytes.
- Type
- Number
Type Definitions
DeviceInfo
Properties:
Name | Type | Description |
---|---|---|
vendorId |
Number | Vendor ID |
productId |
Number | Product ID |
description |
String | Product Description |
serial |
String | Serial Number |
vendor |
String | Vendor Description |
Type:
- object