mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 15:19:59 +00:00
pwm cleanup
This commit is contained in:
@@ -44,15 +44,8 @@ LOG_MODULE_REGISTER(zephcore_observer_main, CONFIG_ZEPHCORE_MAIN_LOG_LEVEL);
|
||||
|
||||
/* ========== LED (optional) ========== */
|
||||
|
||||
/* 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)))
|
||||
|
||||
#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)
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#define LED0_NODE DT_ALIAS(led0)
|
||||
static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
|
||||
@@ -328,7 +321,7 @@ int main(void)
|
||||
LOG_INF("=== ZephCore Observer starting ===");
|
||||
|
||||
/* Configure LED */
|
||||
#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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user