-
Notifications
You must be signed in to change notification settings - Fork 1
Methods
- setSlaveConfigPath
- setFrequency
- init
- start
- writeIndex
- writeIndexes
- fromNanoseconds
- setInterval
- getDomain
- getLatencyAndJitter
- getMasterState
- getValues
- liveData
set slave configuration json file path
-
_pathstring json file path
etherlab.setSlaveConfigPath('./slaves.json');Set frequency of ethercat cyclic task in Hertz
-
freqnumber frequency in Hertz
etherlab.setFrequency(1000);Returns Object cyclick task frequency and period wrapped as object
Set frequency and slave config
etherlab.init('./slaves.json', 1000);Returns Object cyclick task frequency and period wrapped as object
start ethercat cyclic task
etherlab.start();- Throws any error if slave configuration is undefined
Write value into domain identified by its index
etherlab.writeIndex(1, 0x1fff);etherlab.writeIndex({index: 1, value: 0x1fff});Returns number write failure will return -1, otherwise returns the value
Write multiple values
etherlab.writeIndex([{index: 1, value: 0x1fff} , {index: 2, value: 0x0000}]);Returns array status of each write status
convert number from nanosecond
-
valnumber number to be converted -
unit("us"|"ms"|"s") time unit
etherlab.fromNanoseconds(1, 'ms');Returns number time in selected unit
set interval between 'data' event
-
valnumber time interval -
unit("us"|"ms"|"s") time unit (optional, default'ms')
etherlab.setInterval(1000, 'us');get allocated domain
const domain = await etherlab.getDomain();Returns Promise<Object> allocated domain
get calculated latency and jitter
-
unit(optional, default'us')
etherlab.getLatencyAndJitter('us');Returns Object latency and jitter
get current ethercat master state
etherlab.getMasterState();Returns number master state
get allocated domain's values
const domain = await etherlab.getValues();Returns Promise<Object> values of each domain
set 'data' event to be regularly emitted or not
-
stateboolean live data state
Returns number live data state