adapnex::core::SquareWaveGenerator
A cyclic signal generator that produces pulses with defined high and low durations.
Description
When enabled (EN is true), output CLK alternates between true and false. PTON defines the high duration and PTOFF defines the low duration.
| Parameter | Type | Direction | Description |
|---|---|---|---|
|
|
Input |
Enables signal generation when |
|
|
Input |
The duration the output remains |
|
|
Input |
The duration the output remains |
|
|
Output |
The oscillating signal that alternates between |
Example: Warning Light
class WarningTask : public Task {
public:
bool fault_active = false;
bool light_output = false;
private:
SquareWaveGenerator blinker;
void Update() override {
// Flash light: 500ms ON, 500ms OFF while fault is active.
blinker(fault_active, 500ms, 500ms, light_output);
}
};
|
Generators maintain internal state across cycles and must be instantiated as member variables of a task rather than local variables within Update(). |
Data Members
Name |
Description |
Output that alternates between true and false according to the durations PTON and PTOFF. |
|
Input that enables the pulse generation when true. |
|
Input defining the duration that the output CLK remains false during each cycle. |
|
Input defining the duration that the output CLK remains true during each cycle. |
Created with MrDocs