2021-06-26 06:40:41 +00:00
|
|
|
/**
|
|
|
|
* @file esp_lcd_backlight.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ESP_LCD_BACKLIGHT_H
|
|
|
|
#define ESP_LCD_BACKLIGHT_H
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2021-08-03 06:59:59 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" { /* extern "C" */
|
2021-06-26 08:00:26 +00:00
|
|
|
#endif
|
2021-06-26 06:40:41 +00:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
2021-08-03 06:59:59 +00:00
|
|
|
/**
|
|
|
|
* @brief Display backlight controller handle
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef void * disp_backlight_h;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Configuration structure of backlight controller
|
|
|
|
*
|
2021-08-04 07:38:05 +00:00
|
|
|
* Must be passed to disp_backlight_new() for correct configuration
|
2021-08-03 06:59:59 +00:00
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
bool pwm_control;
|
|
|
|
bool output_invert;
|
|
|
|
int gpio_num; // see gpio_num_t
|
|
|
|
|
|
|
|
// Relevant only for PWM controlled backlight
|
|
|
|
// Ignored for switch (ON/OFF) backlight control
|
2021-08-04 07:38:05 +00:00
|
|
|
int timer_idx; // ledc_timer_t
|
2021-08-03 06:59:59 +00:00
|
|
|
int channel_idx; // ledc_channel_t
|
|
|
|
} disp_backlight_config_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Create new backlight controller
|
|
|
|
*
|
|
|
|
* @param[in] config Configuration structure of backlight controller
|
|
|
|
* @return Display backlight controller handle
|
|
|
|
*/
|
|
|
|
disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set backlight
|
|
|
|
*
|
|
|
|
* Brightness parameter can be 0-100 for PWM controlled backlight.
|
|
|
|
* GPIO controlled backlight (ON/OFF) is turned off witch value 0 and turned on with any positive value.
|
|
|
|
*
|
|
|
|
* @param bckl Backlight controller handle
|
|
|
|
* @param[in] brightness_percent Brightness in [%]
|
|
|
|
*/
|
|
|
|
void disp_backlight_set(disp_backlight_h bckl, int brightness_percent);
|
|
|
|
void disp_backlight_delete(disp_backlight_h bckl);
|
2021-06-26 06:40:41 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2021-08-03 06:59:59 +00:00
|
|
|
#endif /*ESP_LCD_BACKLIGHT_H*/
|