未验证 提交 ed900427 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #4657 from OpenNuvoton/touch_class

[components/drivers/touch] Bypass controlling commands in touch class to device driver.
...@@ -77,6 +77,8 @@ static void rt_touch_irq_enable(rt_touch_t touch) ...@@ -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); 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 #endif
} }
...@@ -88,6 +90,8 @@ static void rt_touch_irq_disable(rt_touch_t touch) ...@@ -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); 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 #endif
} }
...@@ -144,28 +148,6 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args) ...@@ -144,28 +148,6 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
switch (cmd) 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: case RT_TOUCH_CTRL_SET_MODE:
result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_SET_MODE, args); 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) ...@@ -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: case RT_TOUCH_CTRL_ENABLE_INT:
rt_touch_irq_enable(touch); rt_touch_irq_enable(touch);
break; break;
case RT_TOUCH_CTRL_GET_ID:
case RT_TOUCH_CTRL_GET_INFO:
default: default:
return -RT_ERROR; return touch->ops->touch_control(touch, cmd, args);
} }
return result; return result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册