xpt2046: Replace ESP_LOG with LVGL logging

This commit is contained in:
C47D 2021-10-13 23:32:12 -05:00
parent 1ededabf99
commit 9c886307b2

View file

@ -8,7 +8,6 @@
*********************/ *********************/
#include "xpt2046.h" #include "xpt2046.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_log.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "tp_spi.h" #include "tp_spi.h"
#include <stddef.h> #include <stddef.h>
@ -16,7 +15,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define TAG "XPT2046" #define TAG "XPT2046: "
#define CMD_X_READ 0b10010000 // NOTE: XPT2046 data sheet says this is actually Y #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_Y_READ 0b11010000 // NOTE: XPT2046 data sheet says this is actually X
@ -59,7 +58,7 @@ uint8_t avg_last;
*/ */
void xpt2046_init(void) void xpt2046_init(void)
{ {
ESP_LOGI(TAG, "XPT2046 Initialization"); LV_LOG_INFO(TAG, "Initialization");
#if XPT2046_TOUCH_IRQ || XPT2046_TOUCH_IRQ_PRESS #if XPT2046_TOUCH_IRQ || XPT2046_TOUCH_IRQ_PRESS
gpio_config_t irq_config = { 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); x = xpt2046_cmd(CMD_X_READ);
y = xpt2046_cmd(CMD_Y_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*/ /*Normalize Data back to 12-bits*/
x = x >> 4; x = x >> 4;
y = y >> 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_corr(&x, &y);
xpt2046_avg(&x, &y); xpt2046_avg(&x, &y);
last_x = x; last_x = x;
last_y = y; last_y = y;
ESP_LOGI(TAG, "x = %d, y = %d", x, y); LV_LOG_INFO(TAG, "x = %d, y = %d", x, y);
} }
else else
{ {