Skip to content

Commit

Permalink
Merge pull request #289 from espressif/fix/bsp-display
Browse files Browse the repository at this point in the history
fix bsp/display.h
  • Loading branch information
tore-espressif authored Feb 2, 2024
2 parents 085332d + 887ebc2 commit 899b6d0
Show file tree
Hide file tree
Showing 26 changed files with 434 additions and 410 deletions.
40 changes: 39 additions & 1 deletion bsp/esp-box-3/include/bsp/display.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -29,6 +29,9 @@
#define BSP_LCD_BITS_PER_PIXEL (16)
/* LCD display color space */
#define BSP_LCD_COLOR_SPACE (ESP_LCD_COLOR_SPACE_BGR)
/* LCD definition */
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -67,6 +70,41 @@ typedef struct {
*/
esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_handle_t *ret_panel, esp_lcd_panel_io_handle_t *ret_io);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controlling backlight.
* Display must be already initialized by calling bsp_display_new()
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

#ifdef __cplusplus
}
#endif
37 changes: 1 addition & 36 deletions bsp/esp-box-3/include/bsp/esp-box-3.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "esp_lvgl_port.h"
#include "esp_codec_dev.h"
#include "iot_button.h"
#include "bsp/display.h"

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include "driver/i2s.h"
Expand Down Expand Up @@ -333,8 +334,6 @@ esp_err_t bsp_sdcard_unmount(void);
*
* Display's backlight must be enabled explicitly by calling bsp_display_backlight_on()
**************************************************************************************************/
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)
#define BSP_LCD_PIXEL_CLOCK_HZ (40 * 1000 * 1000)
#define BSP_LCD_SPI_NUM (SPI3_HOST)

Expand Down Expand Up @@ -384,40 +383,6 @@ bool bsp_display_lock(uint32_t timeout_ms);
*/
void bsp_display_unlock(void);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controling backlight.
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

/**
* @brief Set display enter sleep mode
*
Expand Down
40 changes: 39 additions & 1 deletion bsp/esp-box-lite/include/bsp/display.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -29,6 +29,9 @@
#define BSP_LCD_BITS_PER_PIXEL (16)
/* LCD display color space */
#define BSP_LCD_COLOR_SPACE (ESP_LCD_COLOR_SPACE_RGB)
/* LCD definition */
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -67,6 +70,41 @@ typedef struct {
*/
esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_handle_t *ret_panel, esp_lcd_panel_io_handle_t *ret_io);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controlling backlight.
* Display must be already initialized by calling bsp_display_new()
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

#ifdef __cplusplus
}
#endif
37 changes: 1 addition & 36 deletions bsp/esp-box-lite/include/bsp/esp-box-lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "esp_lvgl_port.h"
#include "esp_codec_dev.h"
#include "iot_button.h"
#include "bsp/display.h"

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include "driver/i2s.h"
Expand Down Expand Up @@ -278,8 +279,6 @@ esp_err_t bsp_spiffs_unmount(void);
*
* Display's backlight must be enabled explicitly by calling bsp_display_backlight_on()
**************************************************************************************************/
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)
#define BSP_LCD_PIXEL_CLOCK_HZ (40 * 1000 * 1000)
#define BSP_LCD_SPI_NUM (SPI3_HOST)

Expand Down Expand Up @@ -329,40 +328,6 @@ bool bsp_display_lock(uint32_t timeout_ms);
*/
void bsp_display_unlock(void);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controlling backlight.
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

/**
* @brief Rotate screen
*
Expand Down
40 changes: 39 additions & 1 deletion bsp/esp-box/include/bsp/display.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -29,6 +29,9 @@
#define BSP_LCD_BITS_PER_PIXEL (16)
/* LCD display color space */
#define BSP_LCD_COLOR_SPACE (ESP_LCD_COLOR_SPACE_BGR)
/* LCD definition */
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -67,6 +70,41 @@ typedef struct {
*/
esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_handle_t *ret_panel, esp_lcd_panel_io_handle_t *ret_io);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controlling backlight.
* Display must be already initialized by calling bsp_display_new()
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_new()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

#ifdef __cplusplus
}
#endif
37 changes: 1 addition & 36 deletions bsp/esp-box/include/bsp/esp-box.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "esp_lvgl_port.h"
#include "esp_codec_dev.h"
#include "iot_button.h"
#include "bsp/display.h"

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include "driver/i2s.h"
Expand Down Expand Up @@ -275,8 +276,6 @@ esp_err_t bsp_spiffs_unmount(void);
*
* Display's backlight must be enabled explicitly by calling bsp_display_backlight_on()
**************************************************************************************************/
#define BSP_LCD_H_RES (320)
#define BSP_LCD_V_RES (240)
#define BSP_LCD_PIXEL_CLOCK_HZ (40 * 1000 * 1000)
#define BSP_LCD_SPI_NUM (SPI3_HOST)

Expand Down Expand Up @@ -326,40 +325,6 @@ bool bsp_display_lock(uint32_t timeout_ms);
*/
void bsp_display_unlock(void);

/**
* @brief Set display's brightness
*
* Brightness is controlled with PWM signal to a pin controling backlight.
*
* @param[in] brightness_percent Brightness in [%]
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_brightness_set(int brightness_percent);

/**
* @brief Turn on display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_on(void);

/**
* @brief Turn off display backlight
*
* Display must be already initialized by calling bsp_display_start()
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t bsp_display_backlight_off(void);

/**
* @brief Rotate screen
*
Expand Down
10 changes: 9 additions & 1 deletion bsp/esp32_azure_iot_kit/include/bsp/display.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -30,6 +30,9 @@
#define BSP_LCD_BITS_PER_PIXEL (1)
/* LCD display color space */
#define BSP_LCD_COLOR_SPACE (ESP_LCD_COLOR_SPACE_MONOCHROME)
/* LCD definition */
#define BSP_LCD_H_RES (128)
#define BSP_LCD_V_RES (64)

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -68,6 +71,11 @@ typedef struct {
*/
esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_handle_t *ret_panel, esp_lcd_panel_io_handle_t *ret_io);

/* Backlight functions are not implemented - Azure kit doesn't provide backlight control
These functions are here to provide consistent API with other Board Support Packages */
esp_err_t bsp_display_brightness_set(int brightness_percent);
esp_err_t bsp_display_backlight_on(void);
esp_err_t bsp_display_backlight_off(void);
#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 899b6d0

Please sign in to comment.