lcd: add debug log on/off Kconfig

This commit is contained in:
morris
2022-03-03 15:34:32 +08:00
parent b57fc93585
commit f35edeb5a3
11 changed files with 89 additions and 37 deletions

View File

@@ -341,9 +341,6 @@ esp_err_t gptimer_stop(gptimer_handle_t timer)
static gptimer_group_t *gptimer_acquire_group_handle(int group_id) static gptimer_group_t *gptimer_acquire_group_handle(int group_id)
{ {
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
bool new_group = false; bool new_group = false;
gptimer_group_t *group = NULL; gptimer_group_t *group = NULL;
@@ -494,6 +491,9 @@ esp_err_t gptimer_get_pm_lock(gptimer_handle_t timer, esp_pm_lock_handle_t *ret_
__attribute__((constructor)) __attribute__((constructor))
static void check_gptimer_driver_conflict(void) static void check_gptimer_driver_conflict(void)
{ {
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
extern int timer_group_driver_init_count; extern int timer_group_driver_init_count;
timer_group_driver_init_count++; timer_group_driver_init_count++;
if (timer_group_driver_init_count > 1) { if (timer_group_driver_init_count > 1) {

View File

@@ -605,9 +605,6 @@ esp_err_t pcnt_channel_set_level_action(pcnt_channel_handle_t chan, pcnt_channel
static pcnt_group_t *pcnt_acquire_group_handle(int group_id) static pcnt_group_t *pcnt_acquire_group_handle(int group_id)
{ {
#if CONFIG_PCNT_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
bool new_group = false; bool new_group = false;
pcnt_group_t *group = NULL; pcnt_group_t *group = NULL;
@@ -705,6 +702,9 @@ IRAM_ATTR static void pcnt_default_isr(void *args)
__attribute__((constructor)) __attribute__((constructor))
static void check_pulse_cnt_driver_conflict(void) static void check_pulse_cnt_driver_conflict(void)
{ {
#if CONFIG_PCNT_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
extern int pcnt_driver_init_count; extern int pcnt_driver_init_count;
pcnt_driver_init_count++; pcnt_driver_init_count++;
if (pcnt_driver_init_count > 1) { if (pcnt_driver_init_count > 1) {

View File

@@ -6,5 +6,11 @@ menu "LCD and Touch Panel"
help help
LCD driver allocates an internal buffer to transform the data into a proper format, because of LCD driver allocates an internal buffer to transform the data into a proper format, because of
the endian order mismatch. This option is to set the size of the buffer, in bytes. the endian order mismatch. This option is to set the size of the buffer, in bytes.
config LCD_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
help
Wether to enable the debug log message for LCD driver.
Note that, this option only controls the LCD driver log, won't affect other drivers.
endmenu endmenu
endmenu endmenu

View File

@@ -1,14 +1,18 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "esp_lcd_panel_io_interface.h" #include "esp_lcd_panel_io_interface.h"
#include "esp_lcd_panel_io.h" #include "esp_lcd_panel_io.h"
#include "driver/i2c.h" #include "driver/i2c.h"
@@ -40,6 +44,9 @@ typedef struct {
esp_err_t esp_lcd_new_panel_io_i2c(esp_lcd_i2c_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io) esp_err_t esp_lcd_new_panel_io_i2c(esp_lcd_i2c_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
lcd_panel_io_i2c_t *i2c_panel_io = NULL; lcd_panel_io_i2c_t *i2c_panel_io = NULL;
ESP_GOTO_ON_FALSE(io_config && ret_io, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(io_config && ret_io, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");

View File

@@ -1,11 +1,9 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Although we're manipulating I2S peripheral (on esp32/s2 target), it has nothing to do with the AUDIO BUS. // Although we're manipulating I2S peripheral (on esp32/s2 target), it has nothing to do with the AUDIO BUS.
// In fact, we're simulating the Intel 8080 bus with I2S peripheral, in a special parallel mode. // In fact, we're simulating the Intel 8080 bus with I2S peripheral, in a special parallel mode.
@@ -16,6 +14,12 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
@@ -33,7 +37,6 @@
#include "hal/gpio_hal.h" #include "hal/gpio_hal.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#if SOC_I2S_LCD_I80_VARIANT
#include "esp_private/i2s_platform.h" #include "esp_private/i2s_platform.h"
#include "soc/lcd_periph.h" #include "soc/lcd_periph.h"
#include "hal/i2s_hal.h" #include "hal/i2s_hal.h"
@@ -117,6 +120,9 @@ struct lcd_panel_io_i80_t {
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus) esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
esp_lcd_i80_bus_t *bus = NULL; esp_lcd_i80_bus_t *bus = NULL;
ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
@@ -748,5 +754,3 @@ static IRAM_ATTR void lcd_default_isr_handler(void *args)
portYIELD_FROM_ISR(); portYIELD_FROM_ISR();
} }
} }
#endif // SOC_I2S_LCD_I80_VARIANT

View File

@@ -4,13 +4,17 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
@@ -28,7 +32,6 @@
#include "esp_private/gdma.h" #include "esp_private/gdma.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#if SOC_LCDCAM_SUPPORTED
#include "esp_lcd_common.h" #include "esp_lcd_common.h"
#include "soc/lcd_periph.h" #include "soc/lcd_periph.h"
#include "hal/lcd_ll.h" #include "hal/lcd_ll.h"
@@ -119,6 +122,9 @@ struct lcd_panel_io_i80_t {
esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus) esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
esp_lcd_i80_bus_t *bus = NULL; esp_lcd_i80_bus_t *bus = NULL;
ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(bus_config && ret_bus, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
@@ -659,5 +665,3 @@ IRAM_ATTR static void lcd_default_isr_handler(void *args)
portYIELD_FROM_ISR(); portYIELD_FROM_ISR();
} }
} }
#endif // SOC_LCDCAM_SUPPORTED

View File

@@ -1,14 +1,18 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "esp_lcd_panel_io_interface.h" #include "esp_lcd_panel_io_interface.h"
#include "esp_lcd_panel_io.h" #include "esp_lcd_panel_io.h"
#include "driver/spi_master.h" #include "driver/spi_master.h"
@@ -53,6 +57,9 @@ typedef struct {
esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_panel_io_spi_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io) esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_panel_io_spi_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
esp_lcd_panel_io_spi_t *spi_panel_io = NULL; esp_lcd_panel_io_spi_t *spi_panel_io = NULL;
ESP_GOTO_ON_FALSE(bus && io_config && ret_io, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(bus && io_config && ret_io, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");

View File

@@ -1,13 +1,17 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_lcd_panel_interface.h" #include "esp_lcd_panel_interface.h"
@@ -45,6 +49,9 @@ typedef struct {
esp_err_t esp_lcd_new_panel_nt35510(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel) esp_err_t esp_lcd_new_panel_nt35510(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
nt35510_panel_t *nt35510 = NULL; nt35510_panel_t *nt35510 = NULL;
ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");

View File

@@ -1,13 +1,17 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_lcd_panel_interface.h" #include "esp_lcd_panel_interface.h"
@@ -56,6 +60,9 @@ typedef struct {
esp_err_t esp_lcd_new_panel_ssd1306(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel) esp_err_t esp_lcd_new_panel_ssd1306(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
ssd1306_panel_t *ssd1306 = NULL; ssd1306_panel_t *ssd1306 = NULL;
ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");

View File

@@ -1,13 +1,17 @@
/* /*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_lcd_panel_interface.h" #include "esp_lcd_panel_interface.h"
@@ -45,6 +49,9 @@ typedef struct {
esp_err_t esp_lcd_new_panel_st7789(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel) esp_err_t esp_lcd_new_panel_st7789(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
st7789_panel_t *st7789 = NULL; st7789_panel_t *st7789 = NULL;
ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); ESP_GOTO_ON_FALSE(io && panel_dev_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");

View File

@@ -4,13 +4,16 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#include <stdlib.h> #include <stdlib.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/param.h> #include <sys/param.h>
#include <string.h> #include <string.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#if CONFIG_LCD_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
@@ -31,7 +34,6 @@
#if CONFIG_SPIRAM #if CONFIG_SPIRAM
#include "spiram.h" #include "spiram.h"
#endif #endif
#if SOC_LCDCAM_SUPPORTED
#include "esp_lcd_common.h" #include "esp_lcd_common.h"
#include "soc/lcd_periph.h" #include "soc/lcd_periph.h"
#include "hal/lcd_hal.h" #include "hal/lcd_hal.h"
@@ -93,6 +95,9 @@ struct esp_rgb_panel_t {
esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_config, esp_lcd_panel_handle_t *ret_panel) esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_config, esp_lcd_panel_handle_t *ret_panel)
{ {
#if CONFIG_LCD_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
esp_rgb_panel_t *rgb_panel = NULL; esp_rgb_panel_t *rgb_panel = NULL;
ESP_GOTO_ON_FALSE(rgb_panel_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid parameter"); ESP_GOTO_ON_FALSE(rgb_panel_config && ret_panel, ESP_ERR_INVALID_ARG, err, TAG, "invalid parameter");
@@ -529,5 +534,3 @@ IRAM_ATTR static void lcd_default_isr_handler(void *args)
portYIELD_FROM_ISR(); portYIELD_FROM_ISR();
} }
} }
#endif // SOC_LCDCAM_SUPPORTED