PinProbe Item

class PinProbe

Represents a digital IO pin on the launchpad probe board.

Inherits:Component
Enumerations:PullMode, Type, Value
Properties:ioid, port, pullMode, type, value

Detailed Description

A PinProbe component represents an IO pin on the launchpad probe board. It can be used to physically interface Qst to a Device Under Test (DUT) and stimulate/analyse digital hardware signals.

Each PinProbe item can be configured either as input or output. Additional pull-up or pull-down resistors may be activated for inputs. The output state is set by writing to the output property and events on the probe wire can be observed by attaching a signal handler to the valueChanged() signal.

Example:

import qst 1.0

// Assuming a DUT with an LED and a button and two wires of a
// launchpad probe board attached.
// On a falling edge of the button IO, the LED shall be turned on.
Testcase {
    name: "test-app"

    property string port: "ttyACM3"

    PinProbe {
        id: button
        port: test.port
        type: PinProbe.Write
        value: PinProbe.High
    }

    PinProbe {
        id: led
        port: test.port
        type: PinProbe.Read

        onValueChanged: {
            Qst.info("The LED value is now " + led.value);
        }
    }

    function run() {
        Qst.wait(50);
        Qst.compare(led.value, PinProbe.Low, "LED should be off but is on");
        // Stimulate button press
        button.value = PinProbe.Low;
        Qst.wait(5);
        Qst.compare(led.value, PinProbe.High, "LED should be on but is off");
    }
}

PinProbe currently only emits the valueChanged() signal. All other properties are assumed to be constant during application life time.

Enumerations

enum Type

Configures the pin direction.

enumerator Read

Configures the pin as input.

enumerator Write

Configures the pin as output.

enum PullMode

Whether internal pull resistors should be enabled or not.

enumerator PullDisabled

Pull resistors are disabled.

enumerator PullDown

Enables a pull-down resistor on the pin.

enumerator PullUp

Enables a pull-up resistor on the pin.

enum Value

The logic level on the hardware pin.

enumerator Low

Equals to 0 and false.

enumerator High

Equals to 1 and true.

enumerator Undefined

No value has been assigned to this pin yet.

Properties

int ioid
Default:0

Specifies the IO identifier on the probe board. The range is usually 0..31, but not all IOs might be available.

string port
Default:empty

The serial port identifier of the probe board. On Windows, this is usually COMx while on Linux systems ttyACMx or ttyUSBx is commonly used.

See also Xds::portFromSerial()

PullMode pullMode
Default:PullMode::PullDisabled

Configures the pin access direction. When configured to Type::Read, the pin probe will detect negative and positive edges on the pin.

Type type
Default:Type::Read

Configures the pin access direction. When configured to Type::Read, the pin probe will detect negative and positive edges on the pin.

Value value
Default:Value::Undefined

The current state of the pin. The property can be read from and written to. A write has no effect when the pin is configured as Type::Read. Although defined as an enumerator, values are implicitly converted to integers and booleans.