Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
670 B

/*
* Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
*
* SPDX-License-Identifier: Apache-2.0
*
* Automatically turns on backlight if display is configured, i.e. display DT
* node has status okay.
*/
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
#define DISPLAY_NODE DT_CHOSEN(zephyr_display)
#if DT_NODE_HAS_STATUS(DISPLAY_NODE, okay)
static const struct gpio_dt_spec backlight = GPIO_DT_SPEC_GET(DT_ALIAS(backlight), gpios);
#endif
void board_late_init_hook(void)
{
#if DT_NODE_HAS_STATUS(DISPLAY_NODE, okay)
if (gpio_is_ready_dt(&backlight)) {
gpio_pin_configure_dt(&backlight, GPIO_OUTPUT_ACTIVE);
}
#endif
}