ra8875: Replace ESP_LOG with LVGL logging

This commit is contained in:
C47D 2021-10-13 23:04:44 -05:00
parent 81abc17904
commit 1a8d0d91e2

View file

@ -9,14 +9,13 @@
#include "ra8875.h" #include "ra8875.h"
#include "disp_spi.h" #include "disp_spi.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define TAG "RA8875" #define TAG "RA8875 :"
#define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d)) #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])) #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 // Initialize non-SPI GPIOs
@ -204,7 +203,7 @@ void ra8875_init(void)
vTaskDelay(1); vTaskDelay(1);
} }
if (i == 0) { 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 // Enable the display
@ -213,7 +212,7 @@ void ra8875_init(void)
void ra8875_enable_display(bool enable) 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); uint8_t val = enable ? (0x80) : (0x00);
ra8875_write_cmd(RA8875_REG_PWRR, val); // Power and Display Control Register (PWRR) 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); size_t linelen = (area->x2 - area->x1 + 1);
uint8_t * buffer = (uint8_t*)color_map; 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 // Get lock
disp_spi_acquire(); disp_spi_acquire();
// Set window if needed // Set window if needed
if ((x1 != area->x1) || (x2 != area->x2)) { 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); ra8875_set_window(area->x1, area->x2, 0, LV_VER_RES_MAX-1);
x1 = area->x1; x1 = area->x1;
x2 = area->x2; 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 // Set cursor if needed
if ((x != area->x1) || (y != area->y1)) { 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); ra8875_set_memory_write_cursor(area->x1, area->y1);
x = area->x1; x = area->x1;
} }