adapnex::core::ClockGenerator
A pulse generator that creates cyclic pulses at a defined interval.
Description
When enabled (EN is true), output CLK becomes true for exactly one cycle every time the duration PT elapses.
| Parameter | Type | Direction | Description |
|---|---|---|---|
|
|
Input |
Enables cyclic pulse generation when |
|
|
Input |
The preset time duration between generated pulses. |
|
|
Output |
Becomes |
Common Use Case
Triggering periodic events, such as logging data or blinking a status indicator.
Example: Periodic Logging
class LoggerTask : public Task {
public:
bool enable_logging = true;
private:
ClockGenerator log_clock;
void Update() override {
// Trigger a log entry every 1 minute.
log_clock(enable_logging, 1min);
if (log_clock.CLK) {
// Perform logging operation here.
}
}
};
|
Generators maintain internal state across cycles and must be instantiated as member variables of a task rather than local variables within Update(). |