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.
This commit is contained in:
C47D 2021-10-22 18:45:37 -05:00
parent a0e915eebc
commit ea37784f08
6 changed files with 37 additions and 47 deletions

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

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

View file

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

View file

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

View file

@ -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");
}
}

View file

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