adapnex::core::RS

Bistable latch with dominant reset.

Synopsis

Declared in <adapnex/core/bistable.h>

class RS;

Description

Maintains a boolean state across execution cycles. If SET is true and RESET is false, the output Q becomes true. If RESET is true, the output Q becomes false, regardless of the state of SET. If both SET and RESET are true simultaneously, reset has priority and Q becomes false.

Parameter Type Direction Description

SET

bool

Input

Causes the output to become true.

RESET

bool

Input

Causes the output to become false. Overrides SET.

Q

bool

Output

The current stored state of the latch.

Common Use Case

Safety‐critical start and stop circuits where an emergency stop or stop button must override a start command.

Example: Motor Control

class MotorControlTask : public Task {
public:
    bool start_button = false;
    bool stop_button = false;
    bool motor_cmd = false;

private:
    RS motor_latch;

    void Update() override {
        // If both buttons are pressed, stop_button wins (motor stays off).
        motor_latch(start_button, stop_button, motor_cmd);
    }
};

Bistable latches maintain state across cycles and must be instantiated as member variables of a task rather than locally within Update().

Member Functions

Name

Description

operator()

Function call operators

Data Members

Name

Description

Q

The state output.

RESET

The reset input.

SET

The set input.

Created with MrDocs