Class OpenSkyhawk::LED
ClassList > OpenSkyhawk > LED
Digital LED output. Drives a pin based on a DCS-BIOS state value.More...
#include <LED.h>
Inherits the following classes: OpenSkyhawk::OutputBase
Public Functions
| Type | Name |
|---|---|
| LED (uint16_t controlId, uint16_t mask, PinRef pin, bool reverse=false) Construct and register an LED output. |
|
| virtual void | configure () override Configure pin as output and drive it to the off state. |
| virtual void | onControlPacket (uint16_t controlId, uint16_t value) override Update LED state from a CTRL_BCAST ControlPacket. |
Public Functions inherited from OpenSkyhawk::OutputBase
| Type | Name |
|---|---|
| virtual void | configure () Configure hardware pins for this output. |
| OutputBase * | next () const Next output in the list; nullptr at end. |
| virtual void | onControlPacket (uint16_t controlId, uint16_t value) = 0 Called for every non-null ControlPacket in a CTRL_BCAST frame. |
| virtual void | update () Called every PanelGroup::loop() iteration. |
Public Static Functions inherited from OpenSkyhawk::OutputBase
| Type | Name |
|---|---|
| OutputBase * | head () Head of the self-registered linked list. |
Protected Functions inherited from OpenSkyhawk::OutputBase
| Type | Name |
|---|---|
| OutputBase () Registers this instance into the linked list. |
Detailed Description
Receives state via onControlPacket() — called by PanelGroup when a CTRL_BCAST frame arrives. Ignores packets whose controlId does not match.
The mask parameter handles DCS-BIOS bit-packed outputs, where a single 16-bit address carries multiple independent flags. For whole-word binary outputs (value is 0 or 1), use mask = 0xFFFF.
The reverse parameter handles LEDs wired with current-sinking polarity — for example, an indicator LED with its anode tied to VCC through a resistor, where the MCU or MCP23017 output sinks current (LOW = on). reverse = false (default): (value & mask) != 0 → pin HIGH (on). reverse = true: (value & mask) != 0 → pin LOW (on).
Pin is driven to the off state during configure() and remains off until a CTRL_BCAST packet with a matching controlId is received.
Works with GPIO and MCP23017 PinRefs. ADS1115 PinRefs are input-only — do not assign one to an LED.
Public Functions Documentation
function LED
Construct and register an LED output.
OpenSkyhawk::LED::LED (
uint16_t controlId,
uint16_t mask,
PinRef pin,
bool reverse=false
)
Parameters:
controlIdDCS-BIOS output address (A_4E_C_* from A4EC_OutputIds.h).maskBitmask: (value & mask) != 0 → on; == 0 → off. Use A_4E_C_*_AM constants, or 0xFFFF for whole-word outputs.pinGPIO or MCP23017 PinRef for the LED pin.reversefalse (default): pin HIGH = on (current-source wiring). true: pin LOW = on (current-sink, anode to VCC).
function configure
Configure pin as output and drive it to the off state.
virtual void OpenSkyhawk::LED::configure () override
Called by PanelGroup::setup() after chip.init(). Sets OUTPUT mode on GPIO pins; sets IODIR=0 and GPPU=0 on MCP23017 pins. Drives off immediately: LOW when reverse = false, HIGH when reverse = true.
Implements OpenSkyhawk::OutputBase::configure
function onControlPacket
Update LED state from a CTRL_BCAST ControlPacket.
virtual void OpenSkyhawk::LED::onControlPacket (
uint16_t controlId,
uint16_t value
) override
Parameters:
controlIdIncoming packet controlId. Ignored if != _controlId.valueRaw 16-bit DCS-BIOS value.
Implements OpenSkyhawk::OutputBase::onControlPacket
The documentation for this class was generated from the following file Firmware/Libraries/PanelGroup/Outputs/LED/LED.h