t096: shared PWM brightness for the heartbeat/TX LED (unpersisted)

Single LED (P0.28) doubles as heartbeat, message flash, shutdown flash
and LoRa TX indicator, all sharing the same physical pin. Adds one PWM
channel on that pin (heartbeat-pwm-led/lora-tx-pwm-led aliases) and a
single 0-100 brightness knob (get/set led) covering every one of those
events at once, deliberately RAM-only: resets to a 10% default on every
reboot regardless of CLI changes made in a previous session. The
existing persisted on/off gate (set leds on|off) is untouched.

Boards without heartbeat-pwm-led/lora-tx-pwm-led aliases keep their
current plain-GPIO behavior unchanged.
This commit is contained in:
ZephCore T096
2026-10-08 18:26:59 +02:00
parent 290b0c26b0
commit 2eb8a8e5b7
8 changed files with 210 additions and 27 deletions
+18
View File
@@ -74,3 +74,21 @@ void zephcore_led_radio_hold_pin(bool held)
{
atomic_set(&s_radio_holds_pin, held ? 1 : 0);
}
/* Same cross-thread readers/writers as the gate above (heartbeat work queue,
* TX path, CLI) — atomic for the same reason. RAM-only on purpose: no
* savePrefs() call anywhere near this, see led_gate.h. */
static atomic_t s_led_brightness_pct = ATOMIC_INIT(ZEPHCORE_LED_DEFAULT_BRIGHTNESS_PCT);
uint8_t zephcore_led_brightness_pct(void)
{
return (uint8_t)atomic_get(&s_led_brightness_pct);
}
void zephcore_led_set_brightness_pct(uint8_t pct)
{
if (pct > 100) {
pct = 100;
}
atomic_set(&s_led_brightness_pct, pct);
}