40 lines
725 B
C
40 lines
725 B
C
/**
|
|
* @file touch_drv.c
|
|
* @touch driver source file.
|
|
*
|
|
* @Copyright (c) 2022 Semidrive Semiconductor.
|
|
* @All rights reserved.
|
|
*
|
|
**/
|
|
|
|
#include "touch_drv.h"
|
|
#include "touch_dev.h"
|
|
|
|
static bool touch_init_stat = false;
|
|
|
|
bool touch_get_event(int *x, int *y, int *id)
|
|
{
|
|
if (!touch_init_stat)
|
|
return false;
|
|
|
|
touch_data_t *data_p = sdrv_touch_data_pointer();
|
|
|
|
if (!data_p->touch_num)
|
|
return false;
|
|
|
|
for (int i = 0; i < 1; i++) {
|
|
*x = data_p->touch_point[i].x;
|
|
*y = data_p->touch_point[i].y;
|
|
*id = data_p->touch_point[i].id;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void board_touch_init(sdrv_i2c_t *i2c_ctrl)
|
|
{
|
|
if (!sdrv_touch_init(i2c_ctrl))
|
|
touch_init_stat = true;
|
|
}
|
|
|