adapnex::core::TOF

An off‐delay timer that delays the falling edge of a signal by a defined duration.

Synopsis

Declared in <adapnex/core/timer.h>

class TOF;

Description

Output Q becomes true immediately when input IN is true. When IN falls to false, Q remains true for the duration PT before turning off.

TOF Timing Diagram

Parameter Type Direction Description

IN

bool

Input

Starts the timer delay with a falling edge and resets it with a rising edge.

PT

Duration

Input

The preset time that must pass after IN falls before Q is reset.

Q

bool

Output

Remains true after IN falls until PT has elapsed.

ET

Duration

Output

The current elapsed time, incrementing while IN is false until it reaches PT.

Common Use Case

Keeping a cooling fan running for a set time after a machine stops.

Example: Cooling Fan Control

class CoolingTask : public Task {
public:
    bool machine_running = false;
    bool fan_on = false;

private:
    TOF off_delay;

    void Update() override {
        // Keep fan running for 10s after machine stops running.
        off_delay(machine_running, 10s, fan_on);
    }
};

Timers maintain internal state across cycles and must be instantiated as member variables of a task rather than local variables within Update().

Member Functions

Name

Description

operator()

Function call operators

Data Members

Name

Description

ET

If IN is true, the ET output is 0. As soon as IN is false, the duration in ET is incremented until the value reaches PT. It then remains equal to PT.

IN

Input that starts the timer with a falling edge and resets the timer with a rising edge.

PT

Input defining the time that must pass before Q is reset.

Q

Output that has a falling edge when the duration specified in PT has passed. Q is false, if IN is false and ET is equal to PT. Otherwise, Q is true.

Created with MrDocs