adapnex::core::SR
Bistable latch with dominant set.
Description
Maintains a boolean state across execution cycles. If SET is true, the output Q becomes true, regardless of the state of RESET. If RESET is true and SET is false, the output Q becomes false. If both SET and RESET are true simultaneously, set has priority and Q becomes true.
| Parameter | Type | Direction | Description |
|---|---|---|---|
|
|
Input |
Causes the output to become |
|
|
Input |
Causes the output to become |
|
|
Output |
The current stored state of the latch. |
Common Use Case
Alarm systems and fault indicators where an active fault condition must prevent an operator from clearing the alarm until the fault is resolved.
Example: Persisting Alarm
class AlarmTask : public Task {
public:
bool over_temperature = false;
bool reset_button = false;
bool alarm_active = false;
private:
SR alarm_latch;
void Update() override {
// The alarm remains active as long as over_temperature is true, even if reset is pressed.
alarm_latch(over_temperature, reset_button, alarm_active);
}
};
|
Bistable latches maintain state across cycles and must be instantiated as member variables of a task rather than locally within Update(). |