boards: esp_wrover_kit: use gpio hogs for LCD, drop LEDs
Instead of using custom board init code, use a GPIO hog to initialize the LCD backlight. Note that LCD backlight should be controller by the display driver, but this is not supported now. Initializing defined LEDs should be done by the application, using either the GPIO or LEDs driver classes. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
parent
12cca8939e
commit
b7a172fa1a
|
@ -1,6 +0,0 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if(CONFIG_GPIO_ESP32)
|
||||
zephyr_library()
|
||||
zephyr_library_sources(board_init.c)
|
||||
endif()
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
#define LED_R_PIN DT_GPIO_PIN(DT_ALIAS(led2), gpios)
|
||||
#define LED_G_PIN DT_GPIO_PIN(DT_ALIAS(led1), gpios)
|
||||
#define LED_B_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios)
|
||||
#define BL_PIN 5
|
||||
|
||||
static int board_esp_wrover_kit_init(void)
|
||||
{
|
||||
const struct device *gpio;
|
||||
|
||||
gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));
|
||||
if (!device_is_ready(gpio)) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* turns red LED off */
|
||||
gpio_pin_configure(gpio, LED_R_PIN, GPIO_OUTPUT);
|
||||
gpio_pin_set(gpio, LED_R_PIN, 0);
|
||||
|
||||
/* turns green LED off */
|
||||
gpio_pin_configure(gpio, LED_G_PIN, GPIO_OUTPUT);
|
||||
gpio_pin_set(gpio, LED_G_PIN, 0);
|
||||
|
||||
/* turns blue LED off */
|
||||
gpio_pin_configure(gpio, LED_B_PIN, GPIO_OUTPUT);
|
||||
gpio_pin_set(gpio, LED_B_PIN, 0);
|
||||
|
||||
/* turns LCD backlight on */
|
||||
gpio_pin_configure(gpio, BL_PIN, GPIO_OUTPUT);
|
||||
gpio_pin_set(gpio, BL_PIN, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(board_esp_wrover_kit_init, APPLICATION, CONFIG_GPIO_INIT_PRIORITY);
|
|
@ -88,6 +88,13 @@
|
|||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
|
||||
/* FIXME: should be part of the display node */
|
||||
lcd-backlight {
|
||||
gpio-hog;
|
||||
gpios = <5 GPIO_ACTIVE_HIGH>;
|
||||
output-low;
|
||||
};
|
||||
};
|
||||
|
||||
&gpio1 {
|
||||
|
|
Loading…
Reference in a new issue