From 4b015640769e9bb7629cfc8b83345df58ea23cca Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 22:39:32 -0500 Subject: [PATCH 01/22] ili9481: Replace ESP_LOG with LVGL logging --- lvgl_tft/ili9481.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index 74bda98..732c9b6 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -8,9 +8,7 @@ #include "ili9481.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "esp_heap_caps.h" - #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -88,7 +86,7 @@ void ili9481_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "ILI9481 initialization."); + LV_LOG_INFO("TAG" ": Initialization."); // Exit sleep ili9481_send_cmd(0x01); /* Software reset */ @@ -196,7 +194,7 @@ static void ili9481_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("TAG" ": Display orientation: %s", orientation_str[orientation]); uint8_t data[] = {0x48, 0x4B, 0x28, 0x2B}; ili9481_send_cmd(ILI9481_CMD_MEMORY_ACCESS_CONTROL); From 364349dbf81f13612b68ff531a4160d58a7321ae Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 22:43:57 -0500 Subject: [PATCH 02/22] ili9481: Replace ESP_LOG with LVGL logging --- lvgl_tft/ili9481.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index 732c9b6..3e22f39 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -115,7 +115,7 @@ void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col uint8_t *mybuf; do { mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA); - if (mybuf == NULL) ESP_LOGW(TAG, "Could not allocate enough DMA memory!"); + if (mybuf == NULL) LV_LOG_WARN("TAG" ": Could not allocate enough DMA memory!"); } while (mybuf == NULL); uint32_t LD = 0; From 6a76078ba83b89e2c6655dfad41c84260479da6e Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 22:53:00 -0500 Subject: [PATCH 03/22] ili9481: Fix TAG --- lvgl_tft/GC9A01.c | 8 ++++---- lvgl_tft/ili9481.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lvgl_tft/GC9A01.c b/lvgl_tft/GC9A01.c index bb6741b..8ec916d 100644 --- a/lvgl_tft/GC9A01.c +++ b/lvgl_tft/GC9A01.c @@ -16,7 +16,7 @@ /********************* * DEFINES *********************/ - #define TAG "GC9A01" + #define TAG "GC9A01: " /********************** * TYPEDEFS @@ -126,7 +126,7 @@ void GC9A01_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "Initialization."); + LV_LOG_INFO(TAG "Initialization."); //Send all the commands uint16_t cmd = 0; @@ -226,7 +226,7 @@ static void GC9A01_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG "Display orientation: %s", orientation_str[orientation]); #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; @@ -236,7 +236,7 @@ static void GC9A01_set_orientation(uint8_t orientation) const uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8}; #endif - ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO(TAG "0x36 command value: 0x%02X", data[orientation]); GC9A01_send_cmd(0x36); GC9A01_send_data((void *) &data[orientation], 1); diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index 3e22f39..c587c2b 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -15,7 +15,7 @@ /********************* * DEFINES *********************/ - #define TAG "ILI9481" + #define TAG "ILI9481: " /********************** * TYPEDEFS @@ -86,7 +86,7 @@ void ili9481_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO("TAG" ": Initialization."); + LV_LOG_INFO(TAG "Initialization."); // Exit sleep ili9481_send_cmd(0x01); /* Software reset */ @@ -115,7 +115,7 @@ void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col uint8_t *mybuf; do { mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA); - if (mybuf == NULL) LV_LOG_WARN("TAG" ": Could not allocate enough DMA memory!"); + if (mybuf == NULL) LV_LOG_WARN(TAG "Could not allocate enough DMA memory!"); } while (mybuf == NULL); uint32_t LD = 0; @@ -194,7 +194,7 @@ static void ili9481_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO("TAG" ": Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG "Display orientation: %s", orientation_str[orientation]); uint8_t data[] = {0x48, 0x4B, 0x28, 0x2B}; ili9481_send_cmd(ILI9481_CMD_MEMORY_ACCESS_CONTROL); From f1e1f0d9fd1d166983850302b4777cbdeac9b15b Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:00:18 -0500 Subject: [PATCH 04/22] uc8151d: Replace ESP_LOG with LVGL logging --- lvgl_tft/uc8151d.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lvgl_tft/uc8151d.c b/lvgl_tft/uc8151d.c index b01982c..9d5676a 100644 --- a/lvgl_tft/uc8151d.c +++ b/lvgl_tft/uc8151d.c @@ -29,13 +29,12 @@ #include #include #include -#include - +:x #include "disp_spi.h" #include "disp_driver.h" #include "uc8151d.h" -#define TAG "lv_uc8151d" +#define TAG "lv_uc8151d: " #define PIN_DC CONFIG_LV_DISP_PIN_DC #define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC))) @@ -106,7 +105,7 @@ static void uc8151d_spi_send_fb(uint8_t *data, size_t len) static void uc8151d_spi_send_seq(const uc8151d_seq_t *seq, size_t len) { - ESP_LOGD(TAG, "Writing cmd/data sequence, count %u", len); + LV_LOG_INFO(TAG, "Writing cmd/data sequence, count %u", len); if (!seq || len < 1) return; for (size_t cmd_idx = 0; cmd_idx < len; cmd_idx++) { @@ -201,14 +200,14 @@ void uc8151d_lv_fb_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t * { size_t len = ((area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1)) / 8; - ESP_LOGD(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); - ESP_LOGD(TAG, "Writing LVGL fb with len: %u", len); + LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); + LV_LOG_INFO(TAG, "Writing LVGL fb with len: %u", len); uint8_t *buf = (uint8_t *) color_map; uc8151d_full_update(buf); lv_disp_flush_ready(drv); - ESP_LOGD(TAG, "Ready"); + LV_LOG_INFO(TAG, "Ready"); } void uc8151d_lv_set_fb_cb(struct _disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, @@ -220,7 +219,7 @@ void uc8151d_lv_set_fb_cb(struct _disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t if (color.full) { BIT_SET(buf[byte_index], 7 - bit_index); } else { - ESP_LOGD(TAG, "Clear at x: %u, y: %u", x, y); + LV_LOG_INFO(TAG, "Clear at x: %u, y: %u", x, y); BIT_CLEAR(buf[byte_index], 7 - bit_index); } } @@ -239,7 +238,7 @@ void uc8151d_init() // Initialise event group uc8151d_evts = xEventGroupCreate(); if (!uc8151d_evts) { - ESP_LOGE(TAG, "Failed when initialising event group!"); + LV_LOG_ERROR(TAG, "Failed when initialising event group!"); return; } @@ -255,9 +254,9 @@ void uc8151d_init() gpio_install_isr_service(0); gpio_isr_handler_add(PIN_BUSY, uc8151d_busy_intr, (void *) PIN_BUSY); - ESP_LOGI(TAG, "IO init finished"); + LV_LOG_INFO(TAG, "IO init finished"); uc8151d_panel_init(); - ESP_LOGI(TAG, "Panel initialised"); + LV_LOG_INFO(TAG, "Panel initialised"); } static void uc8151d_reset(void) From ef0946a6cc14afe0dec983c553a96b6216fc8506 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:01:26 -0500 Subject: [PATCH 05/22] st7796s: Replace ESP_LOG with LVGL logging --- lvgl_tft/st7796s.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lvgl_tft/st7796s.c b/lvgl_tft/st7796s.c index 48a767c..68f8f9a 100644 --- a/lvgl_tft/st7796s.c +++ b/lvgl_tft/st7796s.c @@ -9,14 +9,13 @@ #include "st7796s.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" /********************* * DEFINES *********************/ -#define TAG "ST7796S" +#define TAG "ST7796S: " /********************** * TYPEDEFS @@ -96,7 +95,7 @@ void st7796s_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "Initialization."); + LV_LOG_INFO(TAG, "Initialization."); //Send all the commands uint16_t cmd = 0; @@ -194,7 +193,7 @@ static void st7796s_set_orientation(uint8_t orientation) const char *orientation_str[] = { "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"}; - ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; @@ -206,7 +205,7 @@ static void st7796s_set_orientation(uint8_t orientation) const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; #endif - ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); st7796s_send_cmd(0x36); st7796s_send_data((void *)&data[orientation], 1); From 81abc17904421b99d52fcc1d770c57aa5cc863a7 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:02:47 -0500 Subject: [PATCH 06/22] st7735s: Replace ESP_LOG with LVGL logging --- lvgl_tft/st7735s.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lvgl_tft/st7735s.c b/lvgl_tft/st7735s.c index aedf386..29fd452 100644 --- a/lvgl_tft/st7735s.c +++ b/lvgl_tft/st7735s.c @@ -9,7 +9,6 @@ #include "st7735s.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -20,7 +19,7 @@ /********************* * DEFINES *********************/ - #define TAG "ST7735S" + #define TAG "ST7735S: " #define AXP192_I2C_ADDRESS 0x34 /********************** @@ -115,7 +114,7 @@ void st7735s_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "ST7735S initialization."); + LV_LOG_INFO(TAG, "ST7735S initialization."); //Send all the commands uint16_t cmd = 0; @@ -211,7 +210,7 @@ static void st7735s_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - ESP_LOGD(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); /* Portrait: 0xC8 = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_BGR @@ -220,7 +219,7 @@ static void st7735s_set_orientation(uint8_t orientation) */ uint8_t data[] = {0xC8, 0xC8, 0xA8, 0xA8}; - ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); st7735s_send_cmd(ST7735_MADCTL); st7735s_send_data((void *) &data[orientation], 1); @@ -232,7 +231,7 @@ static void axp192_write_byte(uint8_t addr, uint8_t data) { err = lvgl_i2c_write(CONFIG_LV_I2C_DISPLAY_PORT, AXP192_I2C_ADDRESS, addr, &data, 1); if (ret != ESP_OK) { - ESP_LOGE(TAG, "AXP192 send failed. code: 0x%.2X", ret); + LV_LOG_ERROR(TAG, "AXP192 send failed. code: 0x%.2X", ret); } } @@ -244,7 +243,7 @@ static void axp192_init() axp192_write_byte(0x10, 0xFF); // OLED_VPP Enable axp192_write_byte(0x28, 0xCC); // Enable LDO2&LDO3, LED&TFT 3.0V axp192_sleep_out(); - ESP_LOGI(TAG, "AXP192 initialized, power enabled for LDO2 and LDO3"); + LV_LOG_INFO(TAG, "AXP192 initialized, power enabled for LDO2 and LDO3"); } static void axp192_sleep_in() From 1a8d0d91e21d641d7af408027b1c7d64393f3ae9 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:04:44 -0500 Subject: [PATCH 07/22] ra8875: Replace ESP_LOG with LVGL logging --- lvgl_tft/ra8875.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lvgl_tft/ra8875.c b/lvgl_tft/ra8875.c index c22cb8c..1b431fa 100644 --- a/lvgl_tft/ra8875.c +++ b/lvgl_tft/ra8875.c @@ -9,14 +9,13 @@ #include "ra8875.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" /********************* * DEFINES *********************/ -#define TAG "RA8875" +#define TAG "RA8875 :" #define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d)) @@ -170,7 +169,7 @@ void ra8875_init(void) }; #define INIT_CMDS_SIZE (sizeof(init_cmds)/sizeof(init_cmds[0])) - ESP_LOGI(TAG, "Initializing RA8875..."); + LV_LOG_INFO(TAG, "Initializing RA8875..."); // Initialize non-SPI GPIOs @@ -204,7 +203,7 @@ void ra8875_init(void) vTaskDelay(1); } if (i == 0) { - ESP_LOGW(TAG, "WARNING: Memory clear timed out; RA8875 may be unresponsive."); + LV_LOG_WARN(TAG, "WARNING: Memory clear timed out; RA8875 may be unresponsive."); } // Enable the display @@ -213,7 +212,7 @@ void ra8875_init(void) void ra8875_enable_display(bool enable) { - ESP_LOGI(TAG, "%s display.", enable ? "Enabling" : "Disabling"); + LV_LOG_INFO(TAG, "%s display.", enable ? "Enabling" : "Disabling"); uint8_t val = enable ? (0x80) : (0x00); ra8875_write_cmd(RA8875_REG_PWRR, val); // Power and Display Control Register (PWRR) } @@ -229,14 +228,14 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo size_t linelen = (area->x2 - area->x1 + 1); uint8_t * buffer = (uint8_t*)color_map; - ESP_LOGD(TAG, "flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 ); + LV_LOG_INFO(TAG, "flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 ); // Get lock disp_spi_acquire(); // Set window if needed if ((x1 != area->x1) || (x2 != area->x2)) { - ESP_LOGD(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2); + LV_LOG_INFO(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2); ra8875_set_window(area->x1, area->x2, 0, LV_VER_RES_MAX-1); x1 = area->x1; x2 = area->x2; @@ -244,7 +243,7 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo // Set cursor if needed if ((x != area->x1) || (y != area->y1)) { - ESP_LOGD(TAG, "flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1); + LV_LOG_INFO(TAG, "flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1); ra8875_set_memory_write_cursor(area->x1, area->y1); x = area->x1; } From 83d54862074ec979c52976cd918853147062794a Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:09:17 -0500 Subject: [PATCH 08/22] uc8151d: Remove typo --- lvgl_tft/uc8151d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lvgl_tft/uc8151d.c b/lvgl_tft/uc8151d.c index 9d5676a..e93be7c 100644 --- a/lvgl_tft/uc8151d.c +++ b/lvgl_tft/uc8151d.c @@ -29,7 +29,7 @@ #include #include #include -:x + #include "disp_spi.h" #include "disp_driver.h" #include "uc8151d.h" From e1c18c13b90732590f5a4c77878d7c8b2cb63e31 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:14:03 -0500 Subject: [PATCH 09/22] jd79653a: Replace ESP_LOG with LVGL logging --- lvgl_tft/jd79653a.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lvgl_tft/jd79653a.c b/lvgl_tft/jd79653a.c index 53fbc20..d5171ad 100644 --- a/lvgl_tft/jd79653a.c +++ b/lvgl_tft/jd79653a.c @@ -29,12 +29,11 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include #include #include -#include #include "disp_spi.h" #include "jd79653a.h" -#define TAG "lv_jd79653a" +#define TAG "lv_jd79653a: " #define PIN_DC CONFIG_LV_DISP_PIN_DC #define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC))) @@ -188,7 +187,7 @@ static void jd79653a_spi_send_fb(uint8_t *data, size_t len) static void jd79653a_spi_send_seq(const jd79653a_seq_t *seq, size_t len) { - ESP_LOGD(TAG, "Writing cmd/data sequence, count %u", len); + LV_LOG_INFO(TAG, "Writing cmd/data sequence, count %u", len); if (!seq || len < 1) return; for (size_t cmd_idx = 0; cmd_idx < len; cmd_idx++) { @@ -244,7 +243,7 @@ static void jd79653a_load_partial_lut() static void jd79653a_partial_in() { - ESP_LOGD(TAG, "Partial in!"); + LV_LOG_INFO(TAG, "Partial in!"); // Panel setting: accept LUT from registers instead of OTP #if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) @@ -272,7 +271,7 @@ static void jd79653a_partial_in() static void jd79653a_partial_out() { - ESP_LOGD(TAG, "Partial out!"); + LV_LOG_INFO(TAG, "Partial out!"); // Panel setting: use LUT from OTP #if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) @@ -299,10 +298,10 @@ static void jd79653a_update_partial(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t { jd79653a_power_on(); jd79653a_partial_in(); - ESP_LOGD(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", x1, x2, y1, y2); + LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", x1, x2, y1, y2); size_t len = ((x2 - x1 + 1) * (y2 - y1 + 1)) / 8; - ESP_LOGD(TAG, "Writing PARTIAL LVGL fb with len: %u", len); + LV_LOG_INFO(TAG, "Writing PARTIAL LVGL fb with len: %u", len); // Set partial window uint8_t ptl_setting[7] = { x1, x2, 0, y1, 0, y2, 0x01 }; @@ -318,12 +317,12 @@ static void jd79653a_update_partial(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t len -= EPD_ROW_LEN; } - ESP_LOGD(TAG, "Partial wait start"); + LV_LOG_INFO(TAG, "Partial wait start"); jd79653a_spi_send_cmd(0x12); jd79653a_wait_busy(0); - ESP_LOGD(TAG, "Partial updated"); + LV_LOG_INFO(TAG, "Partial updated"); jd79653a_partial_out(); jd79653a_power_off(); } @@ -360,7 +359,7 @@ void jd79653a_fb_set_full_color(uint8_t color) void jd79653a_fb_full_update(uint8_t *data, size_t len) { jd79653a_power_on(); - ESP_LOGD(TAG, "Performing full update, len: %u", len); + LV_LOG_INFO(TAG, "Performing full update, len: %u", len); uint8_t *data_ptr = data; @@ -379,7 +378,7 @@ void jd79653a_fb_full_update(uint8_t *data, size_t len) len -= EPD_ROW_LEN; } - ESP_LOGD(TAG, "Rest len: %u", len); + LV_LOG_INFO(TAG, "Rest len: %u", len); jd79653a_spi_send_cmd(0x12); // Issue refresh command vTaskDelay(pdMS_TO_TICKS(100)); @@ -414,13 +413,13 @@ void jd79653a_lv_fb_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t { size_t len = ((area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1)) / 8; - ESP_LOGD(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); - ESP_LOGD(TAG, "Writing LVGL fb with len: %u, partial counter: %u", len, partial_counter); + LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); + LV_LOG_INFO(TAG, "Writing LVGL fb with len: %u, partial counter: %u", len, partial_counter); uint8_t *buf = (uint8_t *) color_map; if (partial_counter == 0) { - ESP_LOGD(TAG, "Refreshing in FULL"); + LV_LOG_INFO(TAG, "Refreshing in FULL"); jd79653a_fb_full_update(buf, ((EPD_HEIGHT * EPD_WIDTH) / 8)); partial_counter = EPD_PARTIAL_CNT; // Reset partial counter here } else { @@ -446,7 +445,7 @@ void jd79653a_init() // Initialise event group jd79653a_evts = xEventGroupCreate(); if (!jd79653a_evts) { - ESP_LOGE(TAG, "Failed when initialising event group!"); + LV_LOG_ERROR(TAG, "Failed when initialising event group!"); return; } @@ -466,12 +465,12 @@ void jd79653a_init() // Dump in initialise sequence jd79653a_spi_send_seq(init_seq, EPD_SEQ_LEN(init_seq)); - ESP_LOGI(TAG, "Panel init sequence sent"); + LV_LOG_INFO(TAG, "Panel init sequence sent"); // Check BUSY status here jd79653a_wait_busy(0); - ESP_LOGI(TAG, "Panel is up!"); + LV_LOG_INFO(TAG, "Panel is up!"); } static void jd79653a_reset(void) From e51f47526309528685751c786c615ce0db452434 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:15:27 -0500 Subject: [PATCH 10/22] ili9486: Replace ESP_LOG with LVGL logging --- lvgl_tft/ili9486.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lvgl_tft/ili9486.c b/lvgl_tft/ili9486.c index e96b607..afc5fd4 100644 --- a/lvgl_tft/ili9486.c +++ b/lvgl_tft/ili9486.c @@ -9,14 +9,13 @@ #include "ili9486.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" /********************* * DEFINES *********************/ - #define TAG "ILI9486" +#define TAG "ILI9486: " /********************** * TYPEDEFS @@ -80,7 +79,7 @@ void ili9486_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "ILI9486 Initialization."); + LV_LOG_INFO(TAG, "ILI9486 Initialization."); //Send all the commands uint16_t cmd = 0; @@ -171,11 +170,11 @@ static void ili9486_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; - ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); ili9486_send_cmd(0x36); ili9486_send_data((void *) &data[orientation], 1); From b9c381a07db2029ef5931106ae9c2557bc887c3c Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:17:24 -0500 Subject: [PATCH 11/22] ili9488: Replace ESP_LOG with LVGL logging --- lvgl_tft/ili9488.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lvgl_tft/ili9488.c b/lvgl_tft/ili9488.c index 482f114..60e8657 100644 --- a/lvgl_tft/ili9488.c +++ b/lvgl_tft/ili9488.c @@ -8,7 +8,6 @@ #include "ili9488.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "esp_heap_caps.h" #include "freertos/FreeRTOS.h" @@ -17,7 +16,7 @@ /********************* * DEFINES *********************/ - #define TAG "ILI9488" +#define TAG "ILI9488: " /********************** * TYPEDEFS @@ -90,7 +89,7 @@ void ili9488_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "ILI9488 initialization."); + LV_LOG_INFO(TAG, "ILI9488 initialization."); // Exit sleep ili9488_send_cmd(0x01); /* Software reset */ @@ -119,7 +118,7 @@ void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col uint8_t *mybuf; do { mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA); - if (mybuf == NULL) ESP_LOGW(TAG, "Could not allocate enough DMA memory!"); + if (mybuf == NULL) LV_LOG_WARN(TAG, "Could not allocate enough DMA memory!"); } while (mybuf == NULL); uint32_t LD = 0; @@ -200,11 +199,11 @@ static void ili9488_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; - ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); ili9488_send_cmd(0x36); ili9488_send_data((void *) &data[orientation], 1); From 44b552758e702029305925eb6aa43fbfe3d26581 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:19:51 -0500 Subject: [PATCH 12/22] ili9163c: Replace ESP_LOG with LVGL logging --- lvgl_tft/ili9163c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lvgl_tft/ili9163c.c b/lvgl_tft/ili9163c.c index b8de56e..b12479b 100644 --- a/lvgl_tft/ili9163c.c +++ b/lvgl_tft/ili9163c.c @@ -9,7 +9,6 @@ #include "ili9163c.h" #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "assert.h" @@ -17,7 +16,7 @@ /********************* * DEFINES *********************/ -#define TAG "ILI9163C" +#define TAG "ILI9163C: " // ILI9163C specific commands used in init #define ILI9163C_NOP 0x00 @@ -109,7 +108,7 @@ static void ili9163c_reset(void); void ili9163c_init(void) { - ESP_LOGD(TAG, "Init"); + LV_LOG_INFO(TAG, "Init"); lcd_init_cmd_t ili_init_cmds[] = { {ILI9163C_SWRESET, {0}, 0x80}, // Software reset, 0 args, w/delay 120ms @@ -229,7 +228,7 @@ static void ili9163c_set_orientation(uint8_t orientation) const char *orientation_str[] = { "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"}; - ESP_LOGD(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); uint8_t data[] = {0x48, 0x88, 0xA8, 0x68}; From 94244ad432d4c45a12412bb5067635a63567b8fc Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:20:31 -0500 Subject: [PATCH 13/22] il3820: Replace ESP_LOG with LVGL logging --- lvgl_tft/il3820.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index 4fe8e82..779cfa2 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -30,7 +30,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH *********************/ #include "disp_spi.h" #include "driver/gpio.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -279,7 +278,7 @@ static void il3820_waitbusy(int wait_ms) vTaskDelay(10 / portTICK_RATE_MS); } - ESP_LOGE( TAG, "busy exceeded %dms", i*10 ); + LV_LOG_ERROR( TAG, "busy exceeded %dms", i*10 ); } /* Set DC signal to command mode */ From 83875cc6bd6f691bce0a2d15b909ab6329624ee2 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:21:19 -0500 Subject: [PATCH 14/22] hx8357: Replace ESP_LOG with LVGL logging --- lvgl_tft/hx8357.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lvgl_tft/hx8357.c b/lvgl_tft/hx8357.c index bb9ea58..41209f6 100644 --- a/lvgl_tft/hx8357.c +++ b/lvgl_tft/hx8357.c @@ -18,14 +18,13 @@ #include "hx8357.h" #include "disp_spi.h" #include "driver/gpio.h" -#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" /********************* * DEFINES *********************/ -#define TAG "HX8357" +#define TAG "HX8357: " #define MADCTL_MY 0x80 ///< Bottom to top #define MADCTL_MX 0x40 ///< Right to left @@ -174,7 +173,7 @@ void hx8357_init(void) vTaskDelay(120 / portTICK_RATE_MS); #endif - ESP_LOGI(TAG, "Initialization."); + LV_LOG_INFO(TAG, "Initialization."); //Send all the commands const uint8_t *addr = (displayType == HX8357B) ? initb : initd; From 4a9cfeb6fb79da011242724a39f9685f49d9be67 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:23:56 -0500 Subject: [PATCH 15/22] EVE_commands: Replace ESP_LOG with LVGL logging --- lvgl_tft/EVE_commands.c | 24 ++++++++++-------------- lvgl_tft/il3820.c | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lvgl_tft/EVE_commands.c b/lvgl_tft/EVE_commands.c index 2a93efa..5e132e4 100644 --- a/lvgl_tft/EVE_commands.c +++ b/lvgl_tft/EVE_commands.c @@ -41,6 +41,11 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include +#include + +#if defined (BT81X_ENABLE) +#include +#endif #include "EVE.h" #include "EVE_commands.h" @@ -50,18 +55,9 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include "driver/gpio.h" #include "esp_log.h" #include "soc/soc_memory_layout.h" - -#include "esp_log.h" - #include "disp_spi.h" -#include - -#if defined (BT81X_ENABLE) -#include -#endif - -#define TAG_LOG "FT81X" +#define TAG_LOG "FT81X: " /* data structure for SPI reading that has (optional) space for inserted dummy byte */ typedef struct _spi_read_data { @@ -875,13 +871,13 @@ uint8_t EVE_init(void) /* The most reliable DIO/QIO switching point is after EVE start up but before reading the ChipID. */ #if defined(DISP_SPI_TRANS_MODE_DIO) - ESP_LOGI(TAG_LOG, "Switching to DIO mode"); + LV_LOG_INFO(TAG_LOG, "Switching to DIO mode"); DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */ EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_DIO); SPIInherentSendFlags = DISP_SPI_MODE_DIO | DISP_SPI_MODE_DIOQIO_ADDR; SPIDummyReadBits = 4; /* Esp32 DMA SPI transaction dummy_bits works more like clock cycles, so in DIO 4 dummy_bits == 8 total bits */ #elif defined(DISP_SPI_TRANS_MODE_QIO) - ESP_LOGI(TAG_LOG, "Switching to QIO mode"); + LV_LOG_INFO(TAG_LOG, "Switching to QIO mode"); DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */ EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_QIO); SPIInherentSendFlags = DISP_SPI_MODE_QIO | DISP_SPI_MODE_DIOQIO_ADDR; @@ -897,7 +893,7 @@ uint8_t EVE_init(void) timeout++; if(timeout > 400) { - ESP_LOGI(TAG_LOG, "Failed to read ChipID...aborting initialization."); + LV_LOG_WARN(TAG_LOG, "Failed to read ChipID...aborting initialization."); return 0; } } @@ -909,7 +905,7 @@ uint8_t EVE_init(void) timeout++; if(timeout > 50) /* experimental, 10 was the lowest value to get the BT815 started with, the touch-controller was the last to get out of reset */ { - ESP_LOGI(TAG_LOG, "Failed to read CPU status...aborting initialization."); + LV_LOG_WARN(TAG_LOG, "Failed to read CPU status...aborting initialization."); return 0; } } diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index 779cfa2..691e84d 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -38,7 +38,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH /********************* * DEFINES *********************/ - #define TAG "IL3820" +#define TAG "IL3820: " /** * SSD1673, SSD1608 compatible EPD controller driver. From 5d55edc37cdd0bd387194f03a1cb4caac1edc59d Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:27:31 -0500 Subject: [PATCH 16/22] ft6x36: Replace ESP_LOG with LVGL logging --- lvgl_touch/ft6x36.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index fcef596..ede0966 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -18,7 +18,6 @@ * SOFTWARE. */ -#include #ifdef LV_LVGL_H_INCLUDE_SIMPLE #include #else @@ -28,8 +27,7 @@ #include "lvgl_i2c/i2c_manager.h" -#define TAG "FT6X36" - +#define TAG "FT6X36: " ft6x36_status_t ft6x36_status; uint8_t current_dev_addr; // set during init @@ -46,13 +44,13 @@ esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *d */ uint8_t ft6x36_get_gesture_id() { if (!ft6x36_status.inited) { - ESP_LOGE(TAG, "Init first!"); + LV_LOG_ERROR(TAG, "Init first!"); return 0x00; } uint8_t data_buf; esp_err_t ret; if ((ret = ft6x06_i2c_read8(current_dev_addr, FT6X36_GEST_ID_REG, &data_buf) != ESP_OK)) - ESP_LOGE(TAG, "Error reading from device: %s", esp_err_to_name(ret)); + LV_LOG_ERROR(TAG, "Error reading from device: %s", esp_err_to_name(ret)); return data_buf; } @@ -67,23 +65,23 @@ void ft6x06_init(uint16_t dev_addr) { current_dev_addr = dev_addr; uint8_t data_buf; esp_err_t ret; - ESP_LOGI(TAG, "Found touch panel controller"); + LV_LOG_INFO(TAG, "Found touch panel controller"); if ((ret = ft6x06_i2c_read8(dev_addr, FT6X36_PANEL_ID_REG, &data_buf) != ESP_OK)) - ESP_LOGE(TAG, "Error reading from device: %s", + LV_LOG_ERROR(TAG, "Error reading from device: %s", esp_err_to_name(ret)); // Only show error the first time - ESP_LOGI(TAG, "\tDevice ID: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tDevice ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_CHIPSELECT_REG, &data_buf); - ESP_LOGI(TAG, "\tChip ID: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tChip ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_DEV_MODE_REG, &data_buf); - ESP_LOGI(TAG, "\tDevice mode: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tDevice mode: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_FIRMWARE_ID_REG, &data_buf); - ESP_LOGI(TAG, "\tFirmware ID: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tFirmware ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf); - ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tRelease code: 0x%02x", data_buf); } @@ -95,7 +93,7 @@ void ft6x06_init(uint16_t dev_addr) { */ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { if (!ft6x36_status.inited) { - ESP_LOGE(TAG, "Init first!"); + LV_LOG_ERROR(TAG, "Init first!"); return 0x00; } uint8_t data_buf[5]; // 1 byte status, 2 bytes X, 2 bytes Y @@ -104,7 +102,7 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { esp_err_t ret = lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, current_dev_addr, FT6X36_TD_STAT_REG, &data_buf[0], 5); if (ret != ESP_OK) { - ESP_LOGE(TAG, "Error talking to touch IC: %s", esp_err_to_name(ret)); + LV_LOG_ERROR(TAG, "Error talking to touch IC: %s", esp_err_to_name(ret)); } uint8_t touch_pnt_cnt = data_buf[0]; // Number of detected touch points @@ -132,6 +130,6 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { data->point.x = last_x; data->point.y = last_y; data->state = LV_INDEV_STATE_PR; - ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); return false; } From 18569b6c1747e30fed9bc182345077bd50822ce6 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:28:50 -0500 Subject: [PATCH 17/22] gt911: Replace ESP_LOG with LVGL logging --- lvgl_touch/gt911.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lvgl_touch/gt911.c b/lvgl_touch/gt911.c index 03c3d9d..ba32c51 100644 --- a/lvgl_touch/gt911.c +++ b/lvgl_touch/gt911.c @@ -18,7 +18,6 @@ * SOFTWARE. */ -#include #ifdef LV_LVGL_H_INCLUDE_SIMPLE #include #else @@ -28,7 +27,7 @@ #include "lvgl_i2c/i2c_manager.h" -#define TAG "GT911" +#define TAG "GT911: " gt911_status_t gt911_status; @@ -53,9 +52,9 @@ void gt911_init(uint8_t dev_addr) { uint8_t data_buf; esp_err_t ret; - ESP_LOGI(TAG, "Checking for GT911 Touch Controller"); + LV_LOG_INFO(TAG, "Checking for GT911 Touch Controller"); if ((ret = gt911_i2c_read(dev_addr, GT911_PRODUCT_ID1, &data_buf, 1) != ESP_OK)) { - ESP_LOGE(TAG, "Error reading from device: %s", + LV_LOG_ERROR(TAG, "Error reading from device: %s", esp_err_to_name(ret)); // Only show error the first time return; } @@ -64,22 +63,22 @@ void gt911_init(uint8_t dev_addr) { for (int i = 0; i < GT911_PRODUCT_ID_LEN; i++) { gt911_i2c_read(dev_addr, (GT911_PRODUCT_ID1 + i), (uint8_t *)&(gt911_status.product_id[i]), 1); } - ESP_LOGI(TAG, "\tProduct ID: %s", gt911_status.product_id); + LV_LOG_INFO(TAG, "\tProduct ID: %s", gt911_status.product_id); gt911_i2c_read(dev_addr, GT911_VENDOR_ID, &data_buf, 1); - ESP_LOGI(TAG, "\tVendor ID: 0x%02x", data_buf); + LV_LOG_INFO(TAG, "\tVendor ID: 0x%02x", data_buf); gt911_i2c_read(dev_addr, GT911_X_COORD_RES_L, &data_buf, 1); gt911_status.max_x_coord = data_buf; gt911_i2c_read(dev_addr, GT911_X_COORD_RES_H, &data_buf, 1); gt911_status.max_x_coord |= ((uint16_t)data_buf << 8); - ESP_LOGI(TAG, "\tX Resolution: %d", gt911_status.max_x_coord); + LV_LOG_INFO(TAG, "\tX Resolution: %d", gt911_status.max_x_coord); gt911_i2c_read(dev_addr, GT911_Y_COORD_RES_L, &data_buf, 1); gt911_status.max_y_coord = data_buf; gt911_i2c_read(dev_addr, GT911_Y_COORD_RES_H, &data_buf, 1); gt911_status.max_y_coord |= ((uint16_t)data_buf << 8); - ESP_LOGI(TAG, "\tY Resolution: %d", gt911_status.max_y_coord); + LV_LOG_INFO(TAG, "\tY Resolution: %d", gt911_status.max_y_coord); gt911_status.inited = true; } } @@ -98,7 +97,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { uint8_t status_reg; gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_STATUS_REG, &status_reg, 1); -// ESP_LOGI(TAG, "\tstatus: 0x%02x", status_reg); +// LV_LOG_INFO(TAG, "\tstatus: 0x%02x", status_reg); touch_pnt_cnt = status_reg & 0x0F; if ((status_reg & 0x80) || (touch_pnt_cnt < 6)) { //Reset Status Reg Value @@ -112,7 +111,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { } // gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_TRACK_ID1, &data_buf, 1); -// ESP_LOGI(TAG, "\ttrack_id: %d", data_buf); +// LV_LOG_INFO(TAG, "\ttrack_id: %d", data_buf); gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_PT1_X_COORD_L, &data_buf, 1); last_x = data_buf; @@ -138,7 +137,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { data->point.x = last_x; data->point.y = last_y; data->state = LV_INDEV_STATE_PR; - ESP_LOGI(TAG, "X=%u Y=%u", data->point.x, data->point.y); - ESP_LOGV(TAG, "X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); return false; } From 6b6b756da37898460b66adba83fe2d8a1e4a9de2 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:29:34 -0500 Subject: [PATCH 18/22] ra8875: Replace ESP_LOG with LVGL logging --- lvgl_touch/ra8875_touch.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lvgl_touch/ra8875_touch.c b/lvgl_touch/ra8875_touch.c index 3340e4f..1292de9 100644 --- a/lvgl_touch/ra8875_touch.c +++ b/lvgl_touch/ra8875_touch.c @@ -5,7 +5,6 @@ /********************* * INCLUDES *********************/ -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -83,7 +82,7 @@ void ra8875_touch_init(void) }; #define INIT_CMDS_SIZE (sizeof(init_cmds)/sizeof(init_cmds[0])) - ESP_LOGI(TAG, "Initializing RA8875 Touch..."); + LV_LOG_INFO(TAG, "Initializing RA8875 Touch..."); // Send all the commands for (unsigned int i = 0; i < INIT_CMDS_SIZE; i++) { @@ -94,7 +93,7 @@ void ra8875_touch_init(void) void ra8875_touch_enable(bool enable) { - ESP_LOGI(TAG, "%s touch.", enable ? "Enabling" : "Disabling"); + LV_LOG_INFO(TAG, "%s touch.", enable ? "Enabling" : "Disabling"); uint8_t val = enable ? (0x80 | TPCR0_VAL) : (TPCR0_VAL); ra8875_write_cmd(RA8875_REG_TPCR0, val); } @@ -122,7 +121,7 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data) y = (y << 2) | ((xy >> 2) & 0x03); #if DEBUG - ESP_LOGI(TAG, "Touch Poll Raw: %d,%d", x, y); + LV_LOG_INFO(TAG, "Touch Poll Raw: %d,%d", x, y); #endif // Convert to display coordinates @@ -136,7 +135,7 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data) data->point.y = y; #if DEBUG - ESP_LOGI(TAG, "Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y); + LV_LOG_INFO(TAG, "Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y); #endif return false; From 1ededabf996f03297fa8109d46640a76467b6b99 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:30:45 -0500 Subject: [PATCH 19/22] stmpe610: Replace ESP_LOG with LVGL logging --- lvgl_touch/stmpe610.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lvgl_touch/stmpe610.c b/lvgl_touch/stmpe610.c index 6c5ae60..e823ecc 100644 --- a/lvgl_touch/stmpe610.c +++ b/lvgl_touch/stmpe610.c @@ -7,7 +7,6 @@ *********************/ #include "stmpe610.h" #include "esp_system.h" -#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" @@ -17,7 +16,7 @@ /********************* * DEFINES *********************/ -#define TAG "STMPE610" +#define TAG "STMPE610: " /********************** @@ -55,11 +54,11 @@ void stmpe610_init(void) uint8_t u8; uint16_t u16; - ESP_LOGI(TAG, "Initialization."); + LV_LOG_INFO(TAG, "Initialization."); // Get the initial SPI configuration //u8 = read_8bit_reg(STMPE_SPI_CFG); - //ESP_LOGI(TAG, "SPI_CFG = 0x%x", u8); + //LV_LOG_INFO(TAG, "SPI_CFG = 0x%x", u8); // Attempt a software reset write_8bit_reg(STMPE_SYS_CTRL1, STMPE_SYS_CTRL1_RESET); @@ -69,12 +68,12 @@ void stmpe610_init(void) u8 = read_8bit_reg(STMPE_SPI_CFG); write_8bit_reg(STMPE_SPI_CFG, u8 | STMPE_SPI_CFG_AA); u8 = read_8bit_reg(STMPE_SPI_CFG); - ESP_LOGI(TAG, "SPI_CFG = 0x%x", u8); + LV_LOG_INFO(TAG, "SPI_CFG = 0x%x", u8); // Verify SPI communication u16 = read_16bit_reg(STMPE_CHIP_ID); if (u16 != 0x811) { - ESP_LOGE(TAG, "Incorrect version: 0x%x", u16); + LV_LOG_ERROR(TAG, "Incorrect version: 0x%x", u16); } write_8bit_reg(STMPE_SYS_CTRL2, 0x00); // Disable clocks @@ -130,12 +129,12 @@ bool stmpe610_read(lv_indev_drv_t * drv, lv_indev_data_t * data) } if (c > 0) { - //ESP_LOGI(TAG, "%d: %d %d %d", c, x, y, z); + //LV_LOG_INFO(TAG, "%d: %d %d %d", c, x, y, z); adjust_data(&x, &y); last_x = x; last_y = y; - //ESP_LOGI(TAG, " ==> %d %d", x, y); + //LV_LOG_INFO(TAG, " ==> %d %d", x, y); } z = read_8bit_reg(STMPE_INT_STA); // Clear interrupts @@ -144,7 +143,7 @@ bool stmpe610_read(lv_indev_drv_t * drv, lv_indev_data_t * data) // Clear the FIFO if we discover an overflow write_8bit_reg(STMPE_FIFO_STA, STMPE_FIFO_STA_RESET); write_8bit_reg(STMPE_FIFO_STA, 0); // unreset - ESP_LOGE(TAG, "Fifo overflow"); + LV_LOG_ERROR(TAG, "Fifo overflow"); } } From 9c886307b243421f2cb1656c7334af782fd7b7b5 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 13 Oct 2021 23:32:12 -0500 Subject: [PATCH 20/22] xpt2046: Replace ESP_LOG with LVGL logging --- lvgl_touch/xpt2046.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lvgl_touch/xpt2046.c b/lvgl_touch/xpt2046.c index 93b4329..4c66753 100644 --- a/lvgl_touch/xpt2046.c +++ b/lvgl_touch/xpt2046.c @@ -8,7 +8,6 @@ *********************/ #include "xpt2046.h" #include "esp_system.h" -#include "esp_log.h" #include "driver/gpio.h" #include "tp_spi.h" #include @@ -16,7 +15,7 @@ /********************* * DEFINES *********************/ -#define TAG "XPT2046" +#define TAG "XPT2046: " #define CMD_X_READ 0b10010000 // NOTE: XPT2046 data sheet says this is actually Y #define CMD_Y_READ 0b11010000 // NOTE: XPT2046 data sheet says this is actually X @@ -59,7 +58,7 @@ uint8_t avg_last; */ void xpt2046_init(void) { - ESP_LOGI(TAG, "XPT2046 Initialization"); + LV_LOG_INFO(TAG, "Initialization"); #if XPT2046_TOUCH_IRQ || XPT2046_TOUCH_IRQ_PRESS gpio_config_t irq_config = { @@ -94,19 +93,19 @@ bool xpt2046_read(lv_indev_drv_t * drv, lv_indev_data_t * data) x = xpt2046_cmd(CMD_X_READ); y = xpt2046_cmd(CMD_Y_READ); - ESP_LOGI(TAG, "P(%d,%d)", x, y); + LV_LOG_INFO(TAG, "P(%d,%d)", x, y); /*Normalize Data back to 12-bits*/ x = x >> 4; y = y >> 4; - ESP_LOGI(TAG, "P_norm(%d,%d)", x, y); + LV_LOG_INFO(TAG, "P_norm(%d,%d)", x, y); xpt2046_corr(&x, &y); xpt2046_avg(&x, &y); last_x = x; last_y = y; - ESP_LOGI(TAG, "x = %d, y = %d", x, y); + LV_LOG_INFO(TAG, "x = %d, y = %d", x, y); } else { From a0e915eebca28d2ec4c1bec37e640ee368e41fdd Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 22 Oct 2021 18:41:47 -0500 Subject: [PATCH 21/22] Remove TAG from LVGL log API The filename is appended at the beginning of the log output by default, we don't need to do it. --- lvgl_tft/EVE_commands.c | 10 ++++------ lvgl_tft/GC9A01.c | 7 +++---- lvgl_tft/hx8357.c | 4 +--- lvgl_tft/il3820.c | 3 +-- lvgl_tft/ili9163c.c | 6 ++---- lvgl_tft/ili9341.c | 1 - lvgl_tft/ili9481.c | 7 +++---- lvgl_tft/ili9486.c | 7 +++---- lvgl_tft/ili9488.c | 9 ++++----- lvgl_tft/jd79653a.c | 32 +++++++++++++++----------------- lvgl_tft/ra8875.c | 14 ++++++-------- lvgl_tft/sh1107.c | 1 - lvgl_tft/ssd1306.c | 2 -- lvgl_tft/st7735s.c | 11 +++++------ lvgl_tft/st7789.c | 1 - lvgl_tft/st7796s.c | 7 +++---- lvgl_tft/uc8151d.c | 18 ++++++++---------- 17 files changed, 58 insertions(+), 82 deletions(-) diff --git a/lvgl_tft/EVE_commands.c b/lvgl_tft/EVE_commands.c index 5e132e4..8765609 100644 --- a/lvgl_tft/EVE_commands.c +++ b/lvgl_tft/EVE_commands.c @@ -57,8 +57,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include "soc/soc_memory_layout.h" #include "disp_spi.h" -#define TAG_LOG "FT81X: " - /* data structure for SPI reading that has (optional) space for inserted dummy byte */ typedef struct _spi_read_data { #if defined(DISP_SPI_FULL_DUPLEX) @@ -871,13 +869,13 @@ uint8_t EVE_init(void) /* The most reliable DIO/QIO switching point is after EVE start up but before reading the ChipID. */ #if defined(DISP_SPI_TRANS_MODE_DIO) - LV_LOG_INFO(TAG_LOG, "Switching to DIO mode"); + LV_LOG_INFO("Switching to DIO mode"); DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */ EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_DIO); SPIInherentSendFlags = DISP_SPI_MODE_DIO | DISP_SPI_MODE_DIOQIO_ADDR; SPIDummyReadBits = 4; /* Esp32 DMA SPI transaction dummy_bits works more like clock cycles, so in DIO 4 dummy_bits == 8 total bits */ #elif defined(DISP_SPI_TRANS_MODE_QIO) - LV_LOG_INFO(TAG_LOG, "Switching to QIO mode"); + LV_LOG_INFO("Switching to QIO mode"); DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */ EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_QIO); SPIInherentSendFlags = DISP_SPI_MODE_QIO | DISP_SPI_MODE_DIOQIO_ADDR; @@ -893,7 +891,7 @@ uint8_t EVE_init(void) timeout++; if(timeout > 400) { - LV_LOG_WARN(TAG_LOG, "Failed to read ChipID...aborting initialization."); + LV_LOG_WARN("Failed to read ChipID...aborting initialization."); return 0; } } @@ -905,7 +903,7 @@ uint8_t EVE_init(void) timeout++; if(timeout > 50) /* experimental, 10 was the lowest value to get the BT815 started with, the touch-controller was the last to get out of reset */ { - LV_LOG_WARN(TAG_LOG, "Failed to read CPU status...aborting initialization."); + LV_LOG_WARN("Failed to read CPU status...aborting initialization."); return 0; } } diff --git a/lvgl_tft/GC9A01.c b/lvgl_tft/GC9A01.c index 8ec916d..81a71d3 100644 --- a/lvgl_tft/GC9A01.c +++ b/lvgl_tft/GC9A01.c @@ -16,7 +16,6 @@ /********************* * DEFINES *********************/ - #define TAG "GC9A01: " /********************** * TYPEDEFS @@ -126,7 +125,7 @@ void GC9A01_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG "Initialization."); + LV_LOG_INFO("Initialization."); //Send all the commands uint16_t cmd = 0; @@ -226,7 +225,7 @@ static void GC9A01_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO(TAG "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; @@ -236,7 +235,7 @@ static void GC9A01_set_orientation(uint8_t orientation) const uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8}; #endif - LV_LOG_INFO(TAG "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); GC9A01_send_cmd(0x36); GC9A01_send_data((void *) &data[orientation], 1); diff --git a/lvgl_tft/hx8357.c b/lvgl_tft/hx8357.c index 41209f6..a22287b 100644 --- a/lvgl_tft/hx8357.c +++ b/lvgl_tft/hx8357.c @@ -24,8 +24,6 @@ /********************* * DEFINES *********************/ -#define TAG "HX8357: " - #define MADCTL_MY 0x80 ///< Bottom to top #define MADCTL_MX 0x40 ///< Right to left #define MADCTL_MV 0x20 ///< Reverse Mode @@ -173,7 +171,7 @@ void hx8357_init(void) vTaskDelay(120 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG, "Initialization."); + LV_LOG_INFO("Initialization."); //Send all the commands const uint8_t *addr = (displayType == HX8357B) ? initb : initd; diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index 691e84d..31fea55 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -38,7 +38,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH /********************* * DEFINES *********************/ -#define TAG "IL3820: " /** * SSD1673, SSD1608 compatible EPD controller driver. @@ -278,7 +277,7 @@ static void il3820_waitbusy(int wait_ms) vTaskDelay(10 / portTICK_RATE_MS); } - LV_LOG_ERROR( TAG, "busy exceeded %dms", i*10 ); + LV_LOG_ERROR("Busy exceeded %dms", i*10 ); } /* Set DC signal to command mode */ diff --git a/lvgl_tft/ili9163c.c b/lvgl_tft/ili9163c.c index b12479b..56b9fca 100644 --- a/lvgl_tft/ili9163c.c +++ b/lvgl_tft/ili9163c.c @@ -16,8 +16,6 @@ /********************* * DEFINES *********************/ -#define TAG "ILI9163C: " - // ILI9163C specific commands used in init #define ILI9163C_NOP 0x00 #define ILI9163C_SWRESET 0x01 @@ -108,7 +106,7 @@ static void ili9163c_reset(void); void ili9163c_init(void) { - LV_LOG_INFO(TAG, "Init"); + LV_LOG_INFO("Init"); lcd_init_cmd_t ili_init_cmds[] = { {ILI9163C_SWRESET, {0}, 0x80}, // Software reset, 0 args, w/delay 120ms @@ -228,7 +226,7 @@ static void ili9163c_set_orientation(uint8_t orientation) const char *orientation_str[] = { "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"}; - LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); uint8_t data[] = {0x48, 0x88, 0xA8, 0x68}; diff --git a/lvgl_tft/ili9341.c b/lvgl_tft/ili9341.c index e4b89b0..4c02f40 100644 --- a/lvgl_tft/ili9341.c +++ b/lvgl_tft/ili9341.c @@ -14,7 +14,6 @@ /********************* * DEFINES *********************/ -#define TAG "ILI9341" #define END_OF_CMD_MARKER 0xFFU #define MEMORY_ACCESS_CONTROL_REG 0x36U diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index c587c2b..a599059 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -15,7 +15,6 @@ /********************* * DEFINES *********************/ - #define TAG "ILI9481: " /********************** * TYPEDEFS @@ -86,7 +85,7 @@ void ili9481_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG "Initialization."); + LV_LOG_INFO("Initialization."); // Exit sleep ili9481_send_cmd(0x01); /* Software reset */ @@ -115,7 +114,7 @@ void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col uint8_t *mybuf; do { mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA); - if (mybuf == NULL) LV_LOG_WARN(TAG "Could not allocate enough DMA memory!"); + if (mybuf == NULL) LV_LOG_WARN("Could not allocate enough DMA memory!"); } while (mybuf == NULL); uint32_t LD = 0; @@ -194,7 +193,7 @@ static void ili9481_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO(TAG "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); uint8_t data[] = {0x48, 0x4B, 0x28, 0x2B}; ili9481_send_cmd(ILI9481_CMD_MEMORY_ACCESS_CONTROL); diff --git a/lvgl_tft/ili9486.c b/lvgl_tft/ili9486.c index afc5fd4..b4e3a0a 100644 --- a/lvgl_tft/ili9486.c +++ b/lvgl_tft/ili9486.c @@ -15,7 +15,6 @@ /********************* * DEFINES *********************/ -#define TAG "ILI9486: " /********************** * TYPEDEFS @@ -79,7 +78,7 @@ void ili9486_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG, "ILI9486 Initialization."); + LV_LOG_INFO("ILI9486 Initialization."); //Send all the commands uint16_t cmd = 0; @@ -170,11 +169,11 @@ static void ili9486_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; - LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); ili9486_send_cmd(0x36); ili9486_send_data((void *) &data[orientation], 1); diff --git a/lvgl_tft/ili9488.c b/lvgl_tft/ili9488.c index 60e8657..7a2ab9e 100644 --- a/lvgl_tft/ili9488.c +++ b/lvgl_tft/ili9488.c @@ -16,7 +16,6 @@ /********************* * DEFINES *********************/ -#define TAG "ILI9488: " /********************** * TYPEDEFS @@ -89,7 +88,7 @@ void ili9488_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG, "ILI9488 initialization."); + LV_LOG_INFO("ILI9488 initialization."); // Exit sleep ili9488_send_cmd(0x01); /* Software reset */ @@ -118,7 +117,7 @@ void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col uint8_t *mybuf; do { mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA); - if (mybuf == NULL) LV_LOG_WARN(TAG, "Could not allocate enough DMA memory!"); + if (mybuf == NULL) LV_LOG_WARN("Could not allocate enough DMA memory!"); } while (mybuf == NULL); uint32_t LD = 0; @@ -199,11 +198,11 @@ static void ili9488_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; - LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); ili9488_send_cmd(0x36); ili9488_send_data((void *) &data[orientation], 1); diff --git a/lvgl_tft/jd79653a.c b/lvgl_tft/jd79653a.c index d5171ad..f71b673 100644 --- a/lvgl_tft/jd79653a.c +++ b/lvgl_tft/jd79653a.c @@ -33,8 +33,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include "disp_spi.h" #include "jd79653a.h" -#define TAG "lv_jd79653a: " - #define PIN_DC CONFIG_LV_DISP_PIN_DC #define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC))) @@ -187,7 +185,7 @@ static void jd79653a_spi_send_fb(uint8_t *data, size_t len) static void jd79653a_spi_send_seq(const jd79653a_seq_t *seq, size_t len) { - LV_LOG_INFO(TAG, "Writing cmd/data sequence, count %u", len); + LV_LOG_INFO("Writing cmd/data sequence, count %u", len); if (!seq || len < 1) return; for (size_t cmd_idx = 0; cmd_idx < len; cmd_idx++) { @@ -243,7 +241,7 @@ static void jd79653a_load_partial_lut() static void jd79653a_partial_in() { - LV_LOG_INFO(TAG, "Partial in!"); + LV_LOG_INFO("Partial in!"); // Panel setting: accept LUT from registers instead of OTP #if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) @@ -271,7 +269,7 @@ static void jd79653a_partial_in() static void jd79653a_partial_out() { - LV_LOG_INFO(TAG, "Partial out!"); + LV_LOG_INFO("Partial out!"); // Panel setting: use LUT from OTP #if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) @@ -298,10 +296,10 @@ static void jd79653a_update_partial(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t { jd79653a_power_on(); jd79653a_partial_in(); - LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", x1, x2, y1, y2); + LV_LOG_INFO("x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", x1, x2, y1, y2); size_t len = ((x2 - x1 + 1) * (y2 - y1 + 1)) / 8; - LV_LOG_INFO(TAG, "Writing PARTIAL LVGL fb with len: %u", len); + LV_LOG_INFO("Writing PARTIAL LVGL fb with len: %u", len); // Set partial window uint8_t ptl_setting[7] = { x1, x2, 0, y1, 0, y2, 0x01 }; @@ -317,12 +315,12 @@ static void jd79653a_update_partial(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t len -= EPD_ROW_LEN; } - LV_LOG_INFO(TAG, "Partial wait start"); + LV_LOG_INFO("Partial wait start"); jd79653a_spi_send_cmd(0x12); jd79653a_wait_busy(0); - LV_LOG_INFO(TAG, "Partial updated"); + LV_LOG_INFO("Partial updated"); jd79653a_partial_out(); jd79653a_power_off(); } @@ -359,7 +357,7 @@ void jd79653a_fb_set_full_color(uint8_t color) void jd79653a_fb_full_update(uint8_t *data, size_t len) { jd79653a_power_on(); - LV_LOG_INFO(TAG, "Performing full update, len: %u", len); + LV_LOG_INFO("Performing full update, len: %u", len); uint8_t *data_ptr = data; @@ -378,7 +376,7 @@ void jd79653a_fb_full_update(uint8_t *data, size_t len) len -= EPD_ROW_LEN; } - LV_LOG_INFO(TAG, "Rest len: %u", len); + LV_LOG_INFO("Rest len: %u", len); jd79653a_spi_send_cmd(0x12); // Issue refresh command vTaskDelay(pdMS_TO_TICKS(100)); @@ -413,13 +411,13 @@ void jd79653a_lv_fb_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t { size_t len = ((area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1)) / 8; - LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); - LV_LOG_INFO(TAG, "Writing LVGL fb with len: %u, partial counter: %u", len, partial_counter); + LV_LOG_INFO("x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); + LV_LOG_INFO("Writing LVGL fb with len: %u, partial counter: %u", len, partial_counter); uint8_t *buf = (uint8_t *) color_map; if (partial_counter == 0) { - LV_LOG_INFO(TAG, "Refreshing in FULL"); + LV_LOG_INFO("Refreshing in FULL"); jd79653a_fb_full_update(buf, ((EPD_HEIGHT * EPD_WIDTH) / 8)); partial_counter = EPD_PARTIAL_CNT; // Reset partial counter here } else { @@ -445,7 +443,7 @@ void jd79653a_init() // Initialise event group jd79653a_evts = xEventGroupCreate(); if (!jd79653a_evts) { - LV_LOG_ERROR(TAG, "Failed when initialising event group!"); + LV_LOG_ERROR("Failed when initialising event group!"); return; } @@ -465,12 +463,12 @@ void jd79653a_init() // Dump in initialise sequence jd79653a_spi_send_seq(init_seq, EPD_SEQ_LEN(init_seq)); - LV_LOG_INFO(TAG, "Panel init sequence sent"); + LV_LOG_INFO("Panel init sequence sent"); // Check BUSY status here jd79653a_wait_busy(0); - LV_LOG_INFO(TAG, "Panel is up!"); + LV_LOG_INFO("Panel is up!"); } static void jd79653a_reset(void) diff --git a/lvgl_tft/ra8875.c b/lvgl_tft/ra8875.c index 1b431fa..7021a45 100644 --- a/lvgl_tft/ra8875.c +++ b/lvgl_tft/ra8875.c @@ -15,8 +15,6 @@ /********************* * DEFINES *********************/ -#define TAG "RA8875 :" - #define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d)) #define SPI_CLOCK_SPEED_SLOW_HZ 1000000 @@ -169,7 +167,7 @@ void ra8875_init(void) }; #define INIT_CMDS_SIZE (sizeof(init_cmds)/sizeof(init_cmds[0])) - LV_LOG_INFO(TAG, "Initializing RA8875..."); + LV_LOG_INFO("Initializing RA8875..."); // Initialize non-SPI GPIOs @@ -203,7 +201,7 @@ void ra8875_init(void) vTaskDelay(1); } if (i == 0) { - LV_LOG_WARN(TAG, "WARNING: Memory clear timed out; RA8875 may be unresponsive."); + LV_LOG_WARN("WARNING: Memory clear timed out; RA8875 may be unresponsive."); } // Enable the display @@ -212,7 +210,7 @@ void ra8875_init(void) void ra8875_enable_display(bool enable) { - LV_LOG_INFO(TAG, "%s display.", enable ? "Enabling" : "Disabling"); + LV_LOG_INFO("%s display.", enable ? "Enabling" : "Disabling"); uint8_t val = enable ? (0x80) : (0x00); ra8875_write_cmd(RA8875_REG_PWRR, val); // Power and Display Control Register (PWRR) } @@ -228,14 +226,14 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo size_t linelen = (area->x2 - area->x1 + 1); uint8_t * buffer = (uint8_t*)color_map; - LV_LOG_INFO(TAG, "flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 ); + LV_LOG_INFO("flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 ); // Get lock disp_spi_acquire(); // Set window if needed if ((x1 != area->x1) || (x2 != area->x2)) { - LV_LOG_INFO(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2); + LV_LOG_INFO("flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2); ra8875_set_window(area->x1, area->x2, 0, LV_VER_RES_MAX-1); x1 = area->x1; x2 = area->x2; @@ -243,7 +241,7 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo // Set cursor if needed if ((x != area->x1) || (y != area->y1)) { - LV_LOG_INFO(TAG, "flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1); + LV_LOG_INFO("flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1); ra8875_set_memory_write_cursor(area->x1, area->y1); x = area->x1; } diff --git a/lvgl_tft/sh1107.c b/lvgl_tft/sh1107.c index d7f6067..6f787b2 100644 --- a/lvgl_tft/sh1107.c +++ b/lvgl_tft/sh1107.c @@ -16,7 +16,6 @@ /********************* * DEFINES *********************/ - #define TAG "SH1107" /********************** * TYPEDEFS diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index 1700d02..802842c 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -22,8 +22,6 @@ /********************* * DEFINES *********************/ -#define TAG "SSD1306" - #define OLED_I2C_PORT (CONFIG_LV_I2C_DISPLAY_PORT) // SLA (0x3C) + WRITE_MODE (0x00) = 0x78 (0b01111000) #define OLED_I2C_ADDRESS 0x3C diff --git a/lvgl_tft/st7735s.c b/lvgl_tft/st7735s.c index 29fd452..0f23a29 100644 --- a/lvgl_tft/st7735s.c +++ b/lvgl_tft/st7735s.c @@ -19,7 +19,6 @@ /********************* * DEFINES *********************/ - #define TAG "ST7735S: " #define AXP192_I2C_ADDRESS 0x34 /********************** @@ -114,7 +113,7 @@ void st7735s_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG, "ST7735S initialization."); + LV_LOG_INFO("ST7735S initialization."); //Send all the commands uint16_t cmd = 0; @@ -210,7 +209,7 @@ static void st7735s_set_orientation(uint8_t orientation) "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED" }; - LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); /* Portrait: 0xC8 = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_BGR @@ -219,7 +218,7 @@ static void st7735s_set_orientation(uint8_t orientation) */ uint8_t data[] = {0xC8, 0xC8, 0xA8, 0xA8}; - LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); st7735s_send_cmd(ST7735_MADCTL); st7735s_send_data((void *) &data[orientation], 1); @@ -231,7 +230,7 @@ static void axp192_write_byte(uint8_t addr, uint8_t data) { err = lvgl_i2c_write(CONFIG_LV_I2C_DISPLAY_PORT, AXP192_I2C_ADDRESS, addr, &data, 1); if (ret != ESP_OK) { - LV_LOG_ERROR(TAG, "AXP192 send failed. code: 0x%.2X", ret); + LV_LOG_ERROR("AXP192 send failed. code: 0x%.2X", ret); } } @@ -243,7 +242,7 @@ static void axp192_init() axp192_write_byte(0x10, 0xFF); // OLED_VPP Enable axp192_write_byte(0x28, 0xCC); // Enable LDO2&LDO3, LED&TFT 3.0V axp192_sleep_out(); - LV_LOG_INFO(TAG, "AXP192 initialized, power enabled for LDO2 and LDO3"); + LV_LOG_INFO("AXP192 initialized, power enabled for LDO2 and LDO3"); } static void axp192_sleep_in() diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 1aa1b75..ba2889a 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -12,7 +12,6 @@ /********************* * DEFINES *********************/ -#define TAG "ST7789" /********************** * TYPEDEFS diff --git a/lvgl_tft/st7796s.c b/lvgl_tft/st7796s.c index 68f8f9a..8bc07e5 100644 --- a/lvgl_tft/st7796s.c +++ b/lvgl_tft/st7796s.c @@ -15,7 +15,6 @@ /********************* * DEFINES *********************/ -#define TAG "ST7796S: " /********************** * TYPEDEFS @@ -95,7 +94,7 @@ void st7796s_init(void) vTaskDelay(100 / portTICK_RATE_MS); #endif - LV_LOG_INFO(TAG, "Initialization."); + LV_LOG_INFO("Initialization."); //Send all the commands uint16_t cmd = 0; @@ -193,7 +192,7 @@ static void st7796s_set_orientation(uint8_t orientation) const char *orientation_str[] = { "PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"}; - LV_LOG_INFO(TAG, "Display orientation: %s", orientation_str[orientation]); + LV_LOG_INFO("Display orientation: %s", orientation_str[orientation]); #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK const uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; @@ -205,7 +204,7 @@ static void st7796s_set_orientation(uint8_t orientation) const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8}; #endif - LV_LOG_INFO(TAG, "0x36 command value: 0x%02X", data[orientation]); + LV_LOG_INFO("0x36 command value: 0x%02X", data[orientation]); st7796s_send_cmd(0x36); st7796s_send_data((void *)&data[orientation], 1); diff --git a/lvgl_tft/uc8151d.c b/lvgl_tft/uc8151d.c index e93be7c..91a7f7a 100644 --- a/lvgl_tft/uc8151d.c +++ b/lvgl_tft/uc8151d.c @@ -34,8 +34,6 @@ #include "disp_driver.h" #include "uc8151d.h" -#define TAG "lv_uc8151d: " - #define PIN_DC CONFIG_LV_DISP_PIN_DC #define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC))) @@ -105,7 +103,7 @@ static void uc8151d_spi_send_fb(uint8_t *data, size_t len) static void uc8151d_spi_send_seq(const uc8151d_seq_t *seq, size_t len) { - LV_LOG_INFO(TAG, "Writing cmd/data sequence, count %u", len); + LV_LOG_INFO("Writing cmd/data sequence, count %u", len); if (!seq || len < 1) return; for (size_t cmd_idx = 0; cmd_idx < len; cmd_idx++) { @@ -200,14 +198,14 @@ void uc8151d_lv_fb_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t * { size_t len = ((area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1)) / 8; - LV_LOG_INFO(TAG, "x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); - LV_LOG_INFO(TAG, "Writing LVGL fb with len: %u", len); + LV_LOG_INFO("x1: 0x%x, x2: 0x%x, y1: 0x%x, y2: 0x%x", area->x1, area->x2, area->y1, area->y2); + LV_LOG_INFO("Writing LVGL fb with len: %u", len); uint8_t *buf = (uint8_t *) color_map; uc8151d_full_update(buf); lv_disp_flush_ready(drv); - LV_LOG_INFO(TAG, "Ready"); + LV_LOG_INFO("Ready"); } void uc8151d_lv_set_fb_cb(struct _disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, @@ -219,7 +217,7 @@ void uc8151d_lv_set_fb_cb(struct _disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t if (color.full) { BIT_SET(buf[byte_index], 7 - bit_index); } else { - LV_LOG_INFO(TAG, "Clear at x: %u, y: %u", x, y); + LV_LOG_INFO("Clear at x: %u, y: %u", x, y); BIT_CLEAR(buf[byte_index], 7 - bit_index); } } @@ -238,7 +236,7 @@ void uc8151d_init() // Initialise event group uc8151d_evts = xEventGroupCreate(); if (!uc8151d_evts) { - LV_LOG_ERROR(TAG, "Failed when initialising event group!"); + LV_LOG_ERROR("Failed when initialising event group!"); return; } @@ -254,9 +252,9 @@ void uc8151d_init() gpio_install_isr_service(0); gpio_isr_handler_add(PIN_BUSY, uc8151d_busy_intr, (void *) PIN_BUSY); - LV_LOG_INFO(TAG, "IO init finished"); + LV_LOG_INFO("IO init finished"); uc8151d_panel_init(); - LV_LOG_INFO(TAG, "Panel initialised"); + LV_LOG_INFO("Panel initialised"); } static void uc8151d_reset(void) From ea37784f08e0af3afb7be8a19486bf1b27078a54 Mon Sep 17 00:00:00 2001 From: C47D Date: Fri, 22 Oct 2021 18:45:37 -0500 Subject: [PATCH 22/22] Remove TAG from LVGL log API in touch drivers The filename is appended at the beginning of the log output by default, we don't need to do it. --- lvgl_touch/adcraw.c | 1 - lvgl_touch/ft6x36.c | 26 ++++++++++++-------------- lvgl_touch/gt911.c | 22 ++++++++++------------ lvgl_touch/ra8875_touch.c | 9 ++++----- lvgl_touch/stmpe610.c | 16 +++++++--------- lvgl_touch/xpt2046.c | 10 ++++------ 6 files changed, 37 insertions(+), 47 deletions(-) diff --git a/lvgl_touch/adcraw.c b/lvgl_touch/adcraw.c index 6170b4c..c8da1b0 100644 --- a/lvgl_touch/adcraw.c +++ b/lvgl_touch/adcraw.c @@ -12,7 +12,6 @@ #if CONFIG_LV_TOUCH_CONTROLLER_ADCRAW -#define TAG "ADCRAW" #define CALIBRATIONINSET 1 // range 0 <= CALIBRATIONINSET <= 40 #define SAMPLE_CALIBRATION_POINTS 4 // use this scale factor to avoid working in floating point numbers diff --git a/lvgl_touch/ft6x36.c b/lvgl_touch/ft6x36.c index ede0966..5b9b46d 100644 --- a/lvgl_touch/ft6x36.c +++ b/lvgl_touch/ft6x36.c @@ -27,8 +27,6 @@ #include "lvgl_i2c/i2c_manager.h" -#define TAG "FT6X36: " - ft6x36_status_t ft6x36_status; uint8_t current_dev_addr; // set during init @@ -44,13 +42,13 @@ esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *d */ uint8_t ft6x36_get_gesture_id() { if (!ft6x36_status.inited) { - LV_LOG_ERROR(TAG, "Init first!"); + LV_LOG_ERROR("Init first!"); return 0x00; } uint8_t data_buf; esp_err_t ret; if ((ret = ft6x06_i2c_read8(current_dev_addr, FT6X36_GEST_ID_REG, &data_buf) != ESP_OK)) - LV_LOG_ERROR(TAG, "Error reading from device: %s", esp_err_to_name(ret)); + LV_LOG_ERROR("Error reading from device: %s", esp_err_to_name(ret)); return data_buf; } @@ -65,23 +63,23 @@ void ft6x06_init(uint16_t dev_addr) { current_dev_addr = dev_addr; uint8_t data_buf; esp_err_t ret; - LV_LOG_INFO(TAG, "Found touch panel controller"); + LV_LOG_INFO("Found touch panel controller"); if ((ret = ft6x06_i2c_read8(dev_addr, FT6X36_PANEL_ID_REG, &data_buf) != ESP_OK)) - LV_LOG_ERROR(TAG, "Error reading from device: %s", + LV_LOG_ERROR("Error reading from device: %s", esp_err_to_name(ret)); // Only show error the first time - LV_LOG_INFO(TAG, "\tDevice ID: 0x%02x", data_buf); + LV_LOG_INFO("\tDevice ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_CHIPSELECT_REG, &data_buf); - LV_LOG_INFO(TAG, "\tChip ID: 0x%02x", data_buf); + LV_LOG_INFO("\tChip ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_DEV_MODE_REG, &data_buf); - LV_LOG_INFO(TAG, "\tDevice mode: 0x%02x", data_buf); + LV_LOG_INFO("\tDevice mode: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_FIRMWARE_ID_REG, &data_buf); - LV_LOG_INFO(TAG, "\tFirmware ID: 0x%02x", data_buf); + LV_LOG_INFO("\tFirmware ID: 0x%02x", data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf); - LV_LOG_INFO(TAG, "\tRelease code: 0x%02x", data_buf); + LV_LOG_INFO("\tRelease code: 0x%02x", data_buf); } @@ -93,7 +91,7 @@ void ft6x06_init(uint16_t dev_addr) { */ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { if (!ft6x36_status.inited) { - LV_LOG_ERROR(TAG, "Init first!"); + LV_LOG_ERROR("Init first!"); return 0x00; } uint8_t data_buf[5]; // 1 byte status, 2 bytes X, 2 bytes Y @@ -102,7 +100,7 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { esp_err_t ret = lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, current_dev_addr, FT6X36_TD_STAT_REG, &data_buf[0], 5); if (ret != ESP_OK) { - LV_LOG_ERROR(TAG, "Error talking to touch IC: %s", esp_err_to_name(ret)); + LV_LOG_ERROR("Error talking to touch IC: %s", esp_err_to_name(ret)); } uint8_t touch_pnt_cnt = data_buf[0]; // Number of detected touch points @@ -130,6 +128,6 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { data->point.x = last_x; data->point.y = last_y; data->state = LV_INDEV_STATE_PR; - LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO("X=%u Y=%u", data->point.x, data->point.y); return false; } diff --git a/lvgl_touch/gt911.c b/lvgl_touch/gt911.c index ba32c51..112b9ac 100644 --- a/lvgl_touch/gt911.c +++ b/lvgl_touch/gt911.c @@ -27,8 +27,6 @@ #include "lvgl_i2c/i2c_manager.h" -#define TAG "GT911: " - gt911_status_t gt911_status; //TODO: handle multibyte read and refactor to just one read transaction @@ -52,9 +50,9 @@ void gt911_init(uint8_t dev_addr) { uint8_t data_buf; esp_err_t ret; - LV_LOG_INFO(TAG, "Checking for GT911 Touch Controller"); + LV_LOG_INFO("Checking for GT911 Touch Controller"); if ((ret = gt911_i2c_read(dev_addr, GT911_PRODUCT_ID1, &data_buf, 1) != ESP_OK)) { - LV_LOG_ERROR(TAG, "Error reading from device: %s", + LV_LOG_ERROR("Error reading from device: %s", esp_err_to_name(ret)); // Only show error the first time return; } @@ -63,22 +61,22 @@ void gt911_init(uint8_t dev_addr) { for (int i = 0; i < GT911_PRODUCT_ID_LEN; i++) { gt911_i2c_read(dev_addr, (GT911_PRODUCT_ID1 + i), (uint8_t *)&(gt911_status.product_id[i]), 1); } - LV_LOG_INFO(TAG, "\tProduct ID: %s", gt911_status.product_id); + LV_LOG_INFO("\tProduct ID: %s", gt911_status.product_id); gt911_i2c_read(dev_addr, GT911_VENDOR_ID, &data_buf, 1); - LV_LOG_INFO(TAG, "\tVendor ID: 0x%02x", data_buf); + LV_LOG_INFO("\tVendor ID: 0x%02x", data_buf); gt911_i2c_read(dev_addr, GT911_X_COORD_RES_L, &data_buf, 1); gt911_status.max_x_coord = data_buf; gt911_i2c_read(dev_addr, GT911_X_COORD_RES_H, &data_buf, 1); gt911_status.max_x_coord |= ((uint16_t)data_buf << 8); - LV_LOG_INFO(TAG, "\tX Resolution: %d", gt911_status.max_x_coord); + LV_LOG_INFO("\tX Resolution: %d", gt911_status.max_x_coord); gt911_i2c_read(dev_addr, GT911_Y_COORD_RES_L, &data_buf, 1); gt911_status.max_y_coord = data_buf; gt911_i2c_read(dev_addr, GT911_Y_COORD_RES_H, &data_buf, 1); gt911_status.max_y_coord |= ((uint16_t)data_buf << 8); - LV_LOG_INFO(TAG, "\tY Resolution: %d", gt911_status.max_y_coord); + LV_LOG_INFO("\tY Resolution: %d", gt911_status.max_y_coord); gt911_status.inited = true; } } @@ -97,7 +95,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { uint8_t status_reg; gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_STATUS_REG, &status_reg, 1); -// LV_LOG_INFO(TAG, "\tstatus: 0x%02x", status_reg); +// LV_LOG_INFO("\tstatus: 0x%02x", status_reg); touch_pnt_cnt = status_reg & 0x0F; if ((status_reg & 0x80) || (touch_pnt_cnt < 6)) { //Reset Status Reg Value @@ -111,7 +109,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { } // gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_TRACK_ID1, &data_buf, 1); -// LV_LOG_INFO(TAG, "\ttrack_id: %d", data_buf); +// LV_LOG_INFO("\ttrack_id: %d", data_buf); gt911_i2c_read(gt911_status.i2c_dev_addr, GT911_PT1_X_COORD_L, &data_buf, 1); last_x = data_buf; @@ -137,7 +135,7 @@ bool gt911_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { data->point.x = last_x; data->point.y = last_y; data->state = LV_INDEV_STATE_PR; - LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); - LV_LOG_INFO(TAG, "X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO("X=%u Y=%u", data->point.x, data->point.y); + LV_LOG_INFO("X=%u Y=%u", data->point.x, data->point.y); return false; } diff --git a/lvgl_touch/ra8875_touch.c b/lvgl_touch/ra8875_touch.c index 1292de9..b694dcd 100644 --- a/lvgl_touch/ra8875_touch.c +++ b/lvgl_touch/ra8875_touch.c @@ -22,7 +22,6 @@ * DEFINES *********************/ #define DEBUG false -#define TAG "RA8875-Touch" #define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d)) @@ -82,7 +81,7 @@ void ra8875_touch_init(void) }; #define INIT_CMDS_SIZE (sizeof(init_cmds)/sizeof(init_cmds[0])) - LV_LOG_INFO(TAG, "Initializing RA8875 Touch..."); + LV_LOG_INFO("Initializing RA8875 Touch..."); // Send all the commands for (unsigned int i = 0; i < INIT_CMDS_SIZE; i++) { @@ -93,7 +92,7 @@ void ra8875_touch_init(void) void ra8875_touch_enable(bool enable) { - LV_LOG_INFO(TAG, "%s touch.", enable ? "Enabling" : "Disabling"); + LV_LOG_INFO("%s touch.", enable ? "Enabling" : "Disabling"); uint8_t val = enable ? (0x80 | TPCR0_VAL) : (TPCR0_VAL); ra8875_write_cmd(RA8875_REG_TPCR0, val); } @@ -121,7 +120,7 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data) y = (y << 2) | ((xy >> 2) & 0x03); #if DEBUG - LV_LOG_INFO(TAG, "Touch Poll Raw: %d,%d", x, y); + LV_LOG_INFO("Touch Poll Raw: %d,%d", x, y); #endif // Convert to display coordinates @@ -135,7 +134,7 @@ bool ra8875_touch_read(lv_indev_drv_t * drv, lv_indev_data_t * data) data->point.y = y; #if DEBUG - LV_LOG_INFO(TAG, "Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y); + LV_LOG_INFO("Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y); #endif return false; diff --git a/lvgl_touch/stmpe610.c b/lvgl_touch/stmpe610.c index e823ecc..f10cc6f 100644 --- a/lvgl_touch/stmpe610.c +++ b/lvgl_touch/stmpe610.c @@ -16,8 +16,6 @@ /********************* * DEFINES *********************/ -#define TAG "STMPE610: " - /********************** * TYPEDEFS @@ -54,11 +52,11 @@ void stmpe610_init(void) uint8_t u8; uint16_t u16; - LV_LOG_INFO(TAG, "Initialization."); + LV_LOG_INFO("Initialization."); // Get the initial SPI configuration //u8 = read_8bit_reg(STMPE_SPI_CFG); - //LV_LOG_INFO(TAG, "SPI_CFG = 0x%x", u8); + //LV_LOG_INFO("SPI_CFG = 0x%x", u8); // Attempt a software reset write_8bit_reg(STMPE_SYS_CTRL1, STMPE_SYS_CTRL1_RESET); @@ -68,12 +66,12 @@ void stmpe610_init(void) u8 = read_8bit_reg(STMPE_SPI_CFG); write_8bit_reg(STMPE_SPI_CFG, u8 | STMPE_SPI_CFG_AA); u8 = read_8bit_reg(STMPE_SPI_CFG); - LV_LOG_INFO(TAG, "SPI_CFG = 0x%x", u8); + LV_LOG_INFO("SPI_CFG = 0x%x", u8); // Verify SPI communication u16 = read_16bit_reg(STMPE_CHIP_ID); if (u16 != 0x811) { - LV_LOG_ERROR(TAG, "Incorrect version: 0x%x", u16); + LV_LOG_ERROR("Incorrect version: 0x%x", u16); } write_8bit_reg(STMPE_SYS_CTRL2, 0x00); // Disable clocks @@ -129,12 +127,12 @@ bool stmpe610_read(lv_indev_drv_t * drv, lv_indev_data_t * data) } if (c > 0) { - //LV_LOG_INFO(TAG, "%d: %d %d %d", c, x, y, z); + //LV_LOG_INFO("%d: %d %d %d", c, x, y, z); adjust_data(&x, &y); last_x = x; last_y = y; - //LV_LOG_INFO(TAG, " ==> %d %d", x, y); + //LV_LOG_INFO(" ==> %d %d", x, y); } z = read_8bit_reg(STMPE_INT_STA); // Clear interrupts @@ -143,7 +141,7 @@ bool stmpe610_read(lv_indev_drv_t * drv, lv_indev_data_t * data) // Clear the FIFO if we discover an overflow write_8bit_reg(STMPE_FIFO_STA, STMPE_FIFO_STA_RESET); write_8bit_reg(STMPE_FIFO_STA, 0); // unreset - LV_LOG_ERROR(TAG, "Fifo overflow"); + LV_LOG_ERROR("Fifo overflow"); } } diff --git a/lvgl_touch/xpt2046.c b/lvgl_touch/xpt2046.c index 4c66753..98a5804 100644 --- a/lvgl_touch/xpt2046.c +++ b/lvgl_touch/xpt2046.c @@ -15,8 +15,6 @@ /********************* * DEFINES *********************/ -#define TAG "XPT2046: " - #define CMD_X_READ 0b10010000 // NOTE: XPT2046 data sheet says this is actually Y #define CMD_Y_READ 0b11010000 // NOTE: XPT2046 data sheet says this is actually X #define CMD_Z1_READ 0b10110000 @@ -58,7 +56,7 @@ uint8_t avg_last; */ void xpt2046_init(void) { - LV_LOG_INFO(TAG, "Initialization"); + LV_LOG_INFO("Initialization"); #if XPT2046_TOUCH_IRQ || XPT2046_TOUCH_IRQ_PRESS gpio_config_t irq_config = { @@ -93,19 +91,19 @@ bool xpt2046_read(lv_indev_drv_t * drv, lv_indev_data_t * data) x = xpt2046_cmd(CMD_X_READ); y = xpt2046_cmd(CMD_Y_READ); - LV_LOG_INFO(TAG, "P(%d,%d)", x, y); + LV_LOG_INFO("P(%d,%d)", x, y); /*Normalize Data back to 12-bits*/ x = x >> 4; y = y >> 4; - LV_LOG_INFO(TAG, "P_norm(%d,%d)", x, y); + LV_LOG_INFO("P_norm(%d,%d)", x, y); xpt2046_corr(&x, &y); xpt2046_avg(&x, &y); last_x = x; last_y = y; - LV_LOG_INFO(TAG, "x = %d, y = %d", x, y); + LV_LOG_INFO("x = %d, y = %d", x, y); } else {