Skip to content

Commit

Permalink
drivers/input/ist415: Add debug log level cmd of touch coordinate log.
Browse files Browse the repository at this point in the history
The touch coordinates should be managed at a debug level, allowing them
to be turned on only when necessary.

Therefore, Apply debug log level of touch coordinate logs

Signed-off-by: eunwoo.nam <[email protected]>
  • Loading branch information
ewoodev committed Dec 23, 2024
1 parent 8e04898 commit ae8ca79
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
37 changes: 34 additions & 3 deletions os/drivers/input/ist415.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,21 @@ static int ist415_get_touch_data(struct ist415_dev_s *dev, FAR void *buf)
switch (p_evt_coord->tsta) {
case TOUCH_STA_PRESS:
data->point[data->npoints].flags = TOUCH_DOWN;
touchvdbg("COORDDINATES: [P] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
if (dev->log) {
touchdbg("COORDDINATES: [P] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
}
break;
case TOUCH_STA_MOVE:
data->point[data->npoints].flags = TOUCH_MOVE;
touchvdbg("COORDDINATES: [M] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
if (dev->log) {
touchdbg("COORDDINATES: [M] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
}
break;
case TOUCH_STA_RELEASE:
data->point[data->npoints].flags = TOUCH_UP;
touchvdbg("COORDDINATES: [R] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
if (dev->log) {
touchdbg("COORDDINATES: [R] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y);
}
break;
default:
break;
Expand Down Expand Up @@ -376,6 +382,27 @@ static int ist415_get_touch_data(struct ist415_dev_s *dev, FAR void *buf)
return ret;
}

/****************************************************************************
* Name: ist415_set_dbg
****************************************************************************/

static int ist415_set_dbg(struct ist415_dev_s *dev, int argc, char **argv)
{
if (argc < 3) {
return -EINVAL;
}

if (strncmp(argv[2], "1", 2) == 0) {
dev->log = true;
} else if (strncmp(argv[2], "0", 2) == 0) {
dev->log = false;
} else {
return -EINVAL;
}
return OK;
}


/****************************************************************************
* Name: ist415_cmd_show_usage
****************************************************************************/
Expand All @@ -390,6 +417,7 @@ static void ist415_cmd_show_usage(void)
printf(" cpc : Display CPC\n");
printf(" update : Update binary\n");
printf(" intrdbg : Set Intr Debug\n");
printf(" dbg : Enable(1)/Disable(0) coordinates logs\n");
}

/****************************************************************************
Expand All @@ -415,6 +443,8 @@ static int ist415_cmd(struct touchscreen_s *upper, int argc, char **argv)
ret = ist415_set_intr_debug(dev, argc, argv);
} else if (strncmp(argv[1], "update", 7) == 0) {
ret = ist415_force_update(dev, argc, argv);
} else if (strncmp(argv[1], "dbg", 4) == 0) {
ret = ist415_set_dbg(dev, argc, argv);
} else {
ret = -EINVAL;
}
Expand Down Expand Up @@ -928,6 +958,7 @@ int ist415_initialize(const char *path, struct i2c_dev_s *i2c, struct ist415_con
dev->ready = false;
dev->enable = false;
dev->pre_enable = false;
dev->log = false;

dev->sys_mode = SYS_MODE_TOUCH;
dev->touch_type = (1 << TOUCH_TYPE_NORMAL) | (1 << TOUCH_TYPE_WET) | (1 << TOUCH_TYPE_PALMLARGE);
Expand Down
1 change: 1 addition & 0 deletions os/drivers/input/ist415.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ struct ist415_dev_s {
bool ready;
bool enable;
bool pre_enable;
bool log;

uint8_t sys_mode; /* System Mode (NPM or LPM) */
uint16_t touch_type; /* Touch Type */
Expand Down

0 comments on commit ae8ca79

Please sign in to comment.