Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LogicAnalyzer<EventTypes>

LogicAnalyzer records samples read from io periodically. This is useful for digital bus signal check.

Only one LogicAnalyzer can be used per obniz Board.

How it works

LogicAnalyzer starts logging by a trigger. The default trigger is "value change".

When it occurs, data will be recorded for a desired duration. After that is done, LogicAnalyzer starts monitoring changes in io (= continue working). One sample becomes one 1/0.

Sampling interval and duration can be configured. For example, if interval is 1 ms and duration is 800ms, you will get 800 arrays of data. The data will be in multiples of 8.

Type parameters

  • EventTypes: string

Hierarchy

Index

Constructors

constructor

Properties

Obniz

Obniz: Obniz

obniz to be used

Optional onmeasured

onmeasured: undefined | ((array: number[]) => void)

This is a callback function that will be called when data arrives.

The received data is in 0/1 array. And every data represents 0,1 of io in a particular instance.

// Javascript Example
obniz.logicAnalyzer.start({io:0, interval:2, duration:1000});  // start on io0. 1ms interval and 1sec long.

obniz.logicAnalyzer.onmeasured = function(array) {
  console.log(array);
}

timeout

timeout: number = 30 * 1000

Rsponse waiting timeout in milliseconds

Static prefixed

prefixed: string | boolean

Methods

addListener

  • addListener(event: EventTypes, fn: ListenerFn, context?: any): this

emit

  • emit(event: EventTypes, ...args: Array<any>): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: EventTypes
    • Rest ...args: Array<any>

    Returns boolean

end

  • end(): void
  • This stops the logicAnalyzer.

    // Javascript Example
    obniz.logicAnalyzer.start({io:0, interval:2, duration:1000});  // start on io0. 1ms interval and 1sec long.
    obniz.logicAnalyzer.end();

    Returns void

eventNames

  • eventNames(): Array<EventTypes>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventTypes>

fastValidate

  • fastValidate(commandUri: any, json: any): boolean
  • Parameters

    • commandUri: any
    • json: any

    Returns boolean

listenerCount

  • listenerCount(event: EventTypes): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: EventTypes

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: EventTypes

    Returns Array<ListenerFn>

notifyFromObniz

  • notifyFromObniz(json: any): void

off

  • off(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

on

  • on(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

once

  • once(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

removeAllListeners

removeListener

  • removeListener(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

schemaBasePath

  • schemaBasePath(): string

start

  • This starts the logic analyzer on a given io.

    For example, if you want to collect the data after io0 changes every 2ms for 1sec long, set as below.

    // Javascript Example
    obniz.logicAnalyzer.start({io:0, interval:2, duration:1000});  // start on io0. 2ms interval and 1sec long.
    obniz.logicAnalyzer.onmeasured = function(array) {
      console.log(array);
    }

    The trigger is an optional configuration.

    Without this, logicAnalyzer recognizes any io level change as trigger and start. Trigger specifies the start position. Value means start value, true/false. Samples means how much that value consists. So, with the below sample code, you will only receive data that start with "0, 0, 0"

    // Javascript Example
    obniz.logicAnalyzer.start({io:0, interval:2, duration:1000, triggerValue:false, triggerValueSamples:3});  // start on io0. 2ms interval and 1sec long.
    obniz.logicAnalyzer.onmeasured = function(array) {
      console.log(array);
    }

    Parameters

    Returns void

validate

  • validate(commandUri: any, json: any): WSSchema.MultiResult
  • Parameters

    • commandUri: any
    • json: any

    Returns WSSchema.MultiResult

Generated using TypeDoc