Merge pull request #4657 from OpenNuvoton/touch_class

[components/drivers/touch] Bypass controlling commands in touch class to device driver.
This commit is contained in:
Bernard Xiong 2021-05-05 21:38:54 +08:00 committed by GitHub
commit ed900427cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 23 deletions

View File

@ -77,6 +77,8 @@ static void rt_touch_irq_enable(rt_touch_t touch)
{
rt_pin_irq_enable(touch->config.irq_pin.pin, RT_TRUE);
}
#else
touch->ops->touch_control(touch, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);
#endif
}
@ -88,6 +90,8 @@ static void rt_touch_irq_disable(rt_touch_t touch)
{
rt_pin_irq_enable(touch->config.irq_pin.pin, RT_FALSE);
}
#else
touch->ops->touch_control(touch, RT_TOUCH_CTRL_DISABLE_INT, RT_NULL);
#endif
}
@ -144,28 +148,6 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
switch (cmd)
{
case RT_TOUCH_CTRL_GET_ID:
if (args)
{
result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_GET_ID, args);
}
else
{
result = -RT_ERROR;
}
break;
case RT_TOUCH_CTRL_GET_INFO:
if (args)
{
result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_GET_INFO, args);
}
else
{
result = -RT_ERROR;
}
break;
case RT_TOUCH_CTRL_SET_MODE:
result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_SET_MODE, args);
@ -206,8 +188,11 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
case RT_TOUCH_CTRL_ENABLE_INT:
rt_touch_irq_enable(touch);
break;
case RT_TOUCH_CTRL_GET_ID:
case RT_TOUCH_CTRL_GET_INFO:
default:
return -RT_ERROR;
return touch->ops->touch_control(touch, cmd, args);
}
return result;