pwm cleanup

This commit is contained in:
liquidraver committed 2026-10-09 08:38:37 +02:00
1 parent 119d1249b1
commit c60b5e1bae
10 files changed
+23 -32

No files matched your search

+3 -10
View File
@@ -71,16 +71,9 @@ extern "C" void bt_ctlr_assert_handle(char *file, uint32_t line)
#include "wifi_ota.h"
#endif
/* True when a board aliases its heartbeat or TX-activity LED to a PWM node.
* On ESP32, configuring led0 as plain GPIO after the PWM driver has already
* routed the pin takes the pin back from the LEDC peripheral (the GPIO
* matrix only serves one signal at a time), so on those boards led0 must be
* left to the PWM driver instead of reconfigured here. */
#define ZEPHCORE_HAS_PWM_SHARED_LED \
(DT_NODE_EXISTS(DT_ALIAS(heartbeat_pwm_led)) || DT_NODE_EXISTS(DT_ALIAS(lora_tx_pwm_led)))
/* LED configuration */
#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) && !ZEPHCORE_HAS_PWM_SHARED_LED
/* With a PWM LED, led0 is the same pin and belongs to the PWM driver. */
#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) && !IS_ENABLED(CONFIG_ZEPHCORE_LED_PWM)
#define LED0_NODE DT_ALIAS(led0)
static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
#endif
@@ -618,7 +611,7 @@ int server_main(const ServerRole &role)
#endif
/* Configure LEDs */
#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) && !ZEPHCORE_HAS_PWM_SHARED_LED
#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) && !IS_ENABLED(CONFIG_ZEPHCORE_LED_PWM)
if (gpio_is_ready_dt(&led0)) {
gpio_pin_configure_dt(&led0, GPIO_OUTPUT_INACTIVE);
}