Files
flyradar/src/led_alert.h
2026-08-16 14:33:27 +02:00

26 lines
809 B
C++

#pragma once
#include <Arduino.h>
// Controls the discrete RGB LED on the back of the CYD (no speaker
// present, therefore the LED replaces the acoustic alarm from the Cardputer
// project). Pins: Red=GPIO4, Green=GPIO16, Blue=GPIO17, active-low (LOW = on).
namespace LedAlert {
enum class Mode {
Off,
ProximityGreen,
WatchlistBlue,
EmergencyRed,
};
void begin();
bool update(Mode mode, uint32_t nowMs);
void pulseHeartbeat(uint32_t nowMs);
// Blocking, short white flash (all 3 color channels on) as
// immediate confirmation for a one-time user action (e.g. "Cam"
// button hit). Deliberately blocking (delay), since only called from the
// main loop on a tap, not from the NetTask loop.
void flashWhite(uint32_t durationMs = 150);
}