Merge pull request #131 from lvgl/fix/use_lvgl_logging

Replace ESP_LOG with LVGL logging
This commit is contained in:
Carlos Diaz 2021-10-22 18:51:15 -05:00 committed by GitHub
commit ec944af90f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 100 additions and 156 deletions

View file

@ -41,6 +41,11 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#include <stdio.h>
#include <string.h>
#if defined (BT81X_ENABLE)
#include <stdarg.h>
#endif
#include "EVE.h"
#include "EVE_commands.h"
@ -50,19 +55,8 @@ 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 <string.h>
#if defined (BT81X_ENABLE)
#include <stdarg.h>
#endif
#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)
@ -875,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)
ESP_LOGI(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)
ESP_LOGI(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;
@ -897,7 +891,7 @@ uint8_t EVE_init(void)
timeout++;
if(timeout > 400)
{
ESP_LOGI(TAG_LOG, "Failed to read ChipID...aborting initialization.");
LV_LOG_WARN("Failed to read ChipID...aborting initialization.");
return 0;
}
}
@ -909,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 */
{
ESP_LOGI(TAG_LOG, "Failed to read CPU status...aborting initialization.");
LV_LOG_WARN("Failed to read CPU status...aborting initialization.");
return 0;
}
}

View file

@ -16,7 +16,6 @@
/*********************
* DEFINES
*********************/
#define TAG "GC9A01"
/**********************
* TYPEDEFS
@ -126,7 +125,7 @@ void GC9A01_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(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"
};
ESP_LOGI(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
ESP_LOGD(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);

View file

@ -18,15 +18,12 @@
#include "hx8357.h"
#include "disp_spi.h"
#include "driver/gpio.h"
#include <esp_log.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
/*********************
* DEFINES
*********************/
#define TAG "HX8357"
#define MADCTL_MY 0x80 ///< Bottom to top
#define MADCTL_MX 0x40 ///< Right to left
#define MADCTL_MV 0x20 ///< Reverse Mode
@ -174,7 +171,7 @@ void hx8357_init(void)
vTaskDelay(120 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");
LV_LOG_INFO("Initialization.");
//Send all the commands
const uint8_t *addr = (displayType == HX8357B) ? initb : initd;

View file

@ -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"
@ -39,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.
@ -279,7 +277,7 @@ static void il3820_waitbusy(int wait_ms)
vTaskDelay(10 / portTICK_RATE_MS);
}
ESP_LOGE( TAG, "busy exceeded %dms", i*10 );
LV_LOG_ERROR("Busy exceeded %dms", i*10 );
}
/* Set DC signal to command mode */

View file

@ -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,8 +16,6 @@
/*********************
* DEFINES
*********************/
#define TAG "ILI9163C"
// ILI9163C specific commands used in init
#define ILI9163C_NOP 0x00
#define ILI9163C_SWRESET 0x01
@ -109,7 +106,7 @@ static void ili9163c_reset(void);
void ili9163c_init(void)
{
ESP_LOGD(TAG, "Init");
LV_LOG_INFO("Init");
lcd_init_cmd_t ili_init_cmds[] = {
{ILI9163C_SWRESET, {0}, 0x80}, // Software reset, 0 args, w/delay 120ms
@ -229,7 +226,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("Display orientation: %s", orientation_str[orientation]);
uint8_t data[] = {0x48, 0x88, 0xA8, 0x68};

View file

@ -14,7 +14,6 @@
/*********************
* DEFINES
*********************/
#define TAG "ILI9341"
#define END_OF_CMD_MARKER 0xFFU
#define MEMORY_ACCESS_CONTROL_REG 0x36U

View file

@ -8,16 +8,13 @@
#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"
/*********************
* DEFINES
*********************/
#define TAG "ILI9481"
/**********************
* TYPEDEFS
@ -88,7 +85,7 @@ void ili9481_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9481 initialization.");
LV_LOG_INFO("Initialization.");
// Exit sleep
ili9481_send_cmd(0x01); /* Software reset */
@ -117,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) ESP_LOGW(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;
@ -196,7 +193,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("Display orientation: %s", orientation_str[orientation]);
uint8_t data[] = {0x48, 0x4B, 0x28, 0x2B};
ili9481_send_cmd(ILI9481_CMD_MEMORY_ACCESS_CONTROL);

View file

@ -9,14 +9,12 @@
#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"
/**********************
* TYPEDEFS
@ -80,7 +78,7 @@ void ili9486_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9486 Initialization.");
LV_LOG_INFO("ILI9486 Initialization.");
//Send all the commands
uint16_t cmd = 0;
@ -171,11 +169,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("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("0x36 command value: 0x%02X", data[orientation]);
ili9486_send_cmd(0x36);
ili9486_send_data((void *) &data[orientation], 1);

View file

@ -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,6 @@
/*********************
* DEFINES
*********************/
#define TAG "ILI9488"
/**********************
* TYPEDEFS
@ -90,7 +88,7 @@ void ili9488_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9488 initialization.");
LV_LOG_INFO("ILI9488 initialization.");
// Exit sleep
ili9488_send_cmd(0x01); /* Software reset */
@ -119,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) ESP_LOGW(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;
@ -200,11 +198,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("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("0x36 command value: 0x%02X", data[orientation]);
ili9488_send_cmd(0x36);
ili9488_send_data((void *) &data[orientation], 1);

View file

@ -29,13 +29,10 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#include <freertos/task.h>
#include <freertos/event_groups.h>
#include <driver/gpio.h>
#include <esp_log.h>
#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)))
@ -188,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)
{
ESP_LOGD(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++) {
@ -244,7 +241,7 @@ static void jd79653a_load_partial_lut()
static void jd79653a_partial_in()
{
ESP_LOGD(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)
@ -272,7 +269,7 @@ static void jd79653a_partial_in()
static void jd79653a_partial_out()
{
ESP_LOGD(TAG, "Partial out!");
LV_LOG_INFO("Partial out!");
// Panel setting: use LUT from OTP
#if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
@ -299,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();
ESP_LOGD(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;
ESP_LOGD(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 };
@ -318,12 +315,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("Partial wait start");
jd79653a_spi_send_cmd(0x12);
jd79653a_wait_busy(0);
ESP_LOGD(TAG, "Partial updated");
LV_LOG_INFO("Partial updated");
jd79653a_partial_out();
jd79653a_power_off();
}
@ -360,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();
ESP_LOGD(TAG, "Performing full update, len: %u", len);
LV_LOG_INFO("Performing full update, len: %u", len);
uint8_t *data_ptr = data;
@ -379,7 +376,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("Rest len: %u", len);
jd79653a_spi_send_cmd(0x12); // Issue refresh command
vTaskDelay(pdMS_TO_TICKS(100));
@ -414,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;
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("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) {
ESP_LOGD(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 {
@ -446,7 +443,7 @@ void jd79653a_init()
// Initialise event group
jd79653a_evts = xEventGroupCreate();
if (!jd79653a_evts) {
ESP_LOGE(TAG, "Failed when initialising event group!");
LV_LOG_ERROR("Failed when initialising event group!");
return;
}
@ -466,12 +463,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("Panel init sequence sent");
// Check BUSY status here
jd79653a_wait_busy(0);
ESP_LOGI(TAG, "Panel is up!");
LV_LOG_INFO("Panel is up!");
}
static void jd79653a_reset(void)

View file

@ -9,15 +9,12 @@
#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 DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d))
#define SPI_CLOCK_SPEED_SLOW_HZ 1000000
@ -170,7 +167,7 @@ void ra8875_init(void)
};
#define INIT_CMDS_SIZE (sizeof(init_cmds)/sizeof(init_cmds[0]))
ESP_LOGI(TAG, "Initializing RA8875...");
LV_LOG_INFO("Initializing RA8875...");
// Initialize non-SPI GPIOs
@ -204,7 +201,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("WARNING: Memory clear timed out; RA8875 may be unresponsive.");
}
// Enable the display
@ -213,7 +210,7 @@ void ra8875_init(void)
void ra8875_enable_display(bool enable)
{
ESP_LOGI(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)
}
@ -229,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;
ESP_LOGD(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)) {
ESP_LOGD(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;
@ -244,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)) {
ESP_LOGD(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;
}

View file

@ -16,7 +16,6 @@
/*********************
* DEFINES
*********************/
#define TAG "SH1107"
/**********************
* TYPEDEFS

View file

@ -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

View file

@ -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,6 @@
/*********************
* DEFINES
*********************/
#define TAG "ST7735S"
#define AXP192_I2C_ADDRESS 0x34
/**********************
@ -115,7 +113,7 @@ void st7735s_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ST7735S initialization.");
LV_LOG_INFO("ST7735S initialization.");
//Send all the commands
uint16_t cmd = 0;
@ -211,7 +209,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("Display orientation: %s", orientation_str[orientation]);
/*
Portrait: 0xC8 = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_BGR
@ -220,7 +218,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("0x36 command value: 0x%02X", data[orientation]);
st7735s_send_cmd(ST7735_MADCTL);
st7735s_send_data((void *) &data[orientation], 1);
@ -232,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) {
ESP_LOGE(TAG, "AXP192 send failed. code: 0x%.2X", ret);
LV_LOG_ERROR("AXP192 send failed. code: 0x%.2X", ret);
}
}
@ -244,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();
ESP_LOGI(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()

View file

@ -12,7 +12,6 @@
/*********************
* DEFINES
*********************/
#define TAG "ST7789"
/**********************
* TYPEDEFS

View file

@ -9,14 +9,12 @@
#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"
/**********************
* TYPEDEFS
@ -96,7 +94,7 @@ void st7796s_init(void)
vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization.");
LV_LOG_INFO("Initialization.");
//Send all the commands
uint16_t cmd = 0;
@ -194,7 +192,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("Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
@ -206,7 +204,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("0x36 command value: 0x%02X", data[orientation]);
st7796s_send_cmd(0x36);
st7796s_send_data((void *)&data[orientation], 1);

View file

@ -29,14 +29,11 @@
#include <freertos/task.h>
#include <freertos/event_groups.h>
#include <driver/gpio.h>
#include <esp_log.h>
#include "disp_spi.h"
#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)))
@ -106,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)
{
ESP_LOGD(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++) {
@ -201,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;
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("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);
ESP_LOGD(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,
@ -220,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 {
ESP_LOGD(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);
}
}
@ -239,7 +236,7 @@ void uc8151d_init()
// Initialise event group
uc8151d_evts = xEventGroupCreate();
if (!uc8151d_evts) {
ESP_LOGE(TAG, "Failed when initialising event group!");
LV_LOG_ERROR("Failed when initialising event group!");
return;
}
@ -255,9 +252,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("IO init finished");
uc8151d_panel_init();
ESP_LOGI(TAG, "Panel initialised");
LV_LOG_INFO("Panel initialised");
}
static void uc8151d_reset(void)

View file

@ -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

View file

@ -18,7 +18,6 @@
* SOFTWARE.
*/
#include <esp_log.h>
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include <lvgl.h>
#else
@ -28,9 +27,6 @@
#include "lvgl_i2c/i2c_manager.h"
#define TAG "FT6X36"
ft6x36_status_t ft6x36_status;
uint8_t current_dev_addr; // set during init
@ -46,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) {
ESP_LOGE(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))
ESP_LOGE(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;
}
@ -67,23 +63,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("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("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("\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("\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("\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("\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("\tRelease code: 0x%02x", data_buf);
}
@ -95,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) {
ESP_LOGE(TAG, "Init first!");
LV_LOG_ERROR("Init first!");
return 0x00;
}
uint8_t data_buf[5]; // 1 byte status, 2 bytes X, 2 bytes Y
@ -104,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) {
ESP_LOGE(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
@ -132,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;
ESP_LOGD(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;
}

View file

@ -18,7 +18,6 @@
* SOFTWARE.
*/
#include <esp_log.h>
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include <lvgl.h>
#else
@ -28,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
@ -53,9 +50,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("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("Error reading from device: %s",
esp_err_to_name(ret)); // Only show error the first time
return;
}
@ -64,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);
}
ESP_LOGI(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);
ESP_LOGI(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);
ESP_LOGI(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);
ESP_LOGI(TAG, "\tY Resolution: %d", gt911_status.max_y_coord);
LV_LOG_INFO("\tY Resolution: %d", gt911_status.max_y_coord);
gt911_status.inited = true;
}
}
@ -98,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);
// ESP_LOGI(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
@ -112,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);
// ESP_LOGI(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;
@ -138,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;
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("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;
}

View file

@ -5,7 +5,6 @@
/*********************
* INCLUDES
*********************/
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
@ -23,7 +22,6 @@
* DEFINES
*********************/
#define DEBUG false
#define TAG "RA8875-Touch"
#define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d))
@ -83,7 +81,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("Initializing RA8875 Touch...");
// Send all the commands
for (unsigned int i = 0; i < INIT_CMDS_SIZE; i++) {
@ -94,7 +92,7 @@ void ra8875_touch_init(void)
void ra8875_touch_enable(bool enable)
{
ESP_LOGI(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);
}
@ -122,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
ESP_LOGI(TAG, "Touch Poll Raw: %d,%d", x, y);
LV_LOG_INFO("Touch Poll Raw: %d,%d", x, y);
#endif
// Convert to display coordinates
@ -136,7 +134,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("Touch Poll - Event: %d; %d,%d", data->state, data->point.x, data->point.y);
#endif
return false;

View file

@ -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,8 +16,6 @@
/*********************
* DEFINES
*********************/
#define TAG "STMPE610"
/**********************
* TYPEDEFS
@ -55,11 +52,11 @@ void stmpe610_init(void)
uint8_t u8;
uint16_t u16;
ESP_LOGI(TAG, "Initialization.");
LV_LOG_INFO("Initialization.");
// Get the initial SPI configuration
//u8 = read_8bit_reg(STMPE_SPI_CFG);
//ESP_LOGI(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);
@ -69,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);
ESP_LOGI(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) {
ESP_LOGE(TAG, "Incorrect version: 0x%x", u16);
LV_LOG_ERROR("Incorrect version: 0x%x", u16);
}
write_8bit_reg(STMPE_SYS_CTRL2, 0x00); // Disable clocks
@ -130,12 +127,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("%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(" ==> %d %d", x, y);
}
z = read_8bit_reg(STMPE_INT_STA); // Clear interrupts
@ -144,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
ESP_LOGE(TAG, "Fifo overflow");
LV_LOG_ERROR("Fifo overflow");
}
}

View file

@ -8,7 +8,6 @@
*********************/
#include "xpt2046.h"
#include "esp_system.h"
#include "esp_log.h"
#include "driver/gpio.h"
#include "tp_spi.h"
#include <stddef.h>
@ -16,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
@ -59,7 +56,7 @@ uint8_t avg_last;
*/
void xpt2046_init(void)
{
ESP_LOGI(TAG, "XPT2046 Initialization");
LV_LOG_INFO("Initialization");
#if XPT2046_TOUCH_IRQ || XPT2046_TOUCH_IRQ_PRESS
gpio_config_t irq_config = {
@ -94,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);
ESP_LOGI(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;
ESP_LOGI(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;
ESP_LOGI(TAG, "x = %d, y = %d", x, y);
LV_LOG_INFO("x = %d, y = %d", x, y);
}
else
{