14#include "../ksComponent.h"
38 } bitflags = {
false,
false};
A component that simplifies LED control.
Definition ksLed.h:26
void setEnabled(bool enabled)
Enables or disables the LED.
Definition ksLed.cpp:81
uint32_t blinkLoops
Number of state change cycles (0 for infinite loop).
Definition ksLed.h:33
virtual ~ksLed()
Destructs the component and restores INPUT mode on the assigned pin.
Definition ksLed.cpp:24
uint8_t getPin() const
Returns a pin number assigned to the LED.
Definition ksLed.h:102
bool isBlinking() const
Returns whether LED is currently blinking.
Definition ksLed.cpp:67
bool init(ksApplication *owner) override
Initializes the LED component.
Definition ksLed.cpp:29
uint8_t pin
Pin number assigned to LED.
Definition ksLed.h:30
uint32_t lastBlinkTimeMs
Timestamp of previous state change (milliseconds).
Definition ksLed.h:31
bool driveAsPushPull
True if the LED should be driven as push-pull, otherwise false.
Definition ksLed.h:37
ksLed(uint8_t pin, bool activeLow=false, bool driveAsPushPull=false)
Constructs the LED object.
Definition ksLed.cpp:17
uint32_t blinkIntervalMs
Intervals between state change (0 to disable blinking).
Definition ksLed.h:32
void setDriveAsPushPull(bool driveAsPushPull)
Enables or disables the push/pull driving mode.
Definition ksLed.cpp:72
bool loop(ksApplication *app) override
Executes core of the LED component logic.
Definition ksLed.cpp:38
void setBlinking(uint32_t blinkIntervalMs, uint32_t blinkLoops=0)
Sets LED blinking pattern.
Definition ksLed.cpp:59
bool isEnabled() const
Returns whether the LED is actually enabled.
Definition ksLed.cpp:54
bool activeLow
True if the LED should be active low, otherwise false.
Definition ksLed.h:36
A class that serves as the base for user-defined applications.
Definition ksApplication.h:44
Base component class.
Definition ksComponent.h:36