summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyustli <[email protected]>2019-06-13 16:48:40 +0800
committertyustli <[email protected]>2019-06-13 16:48:40 +0800
commit116b7880c39ec86f0612d33933f8d2c04966dc40 (patch)
treeb86dd0be11646b0ef1447d824023b04b72986a97
parent10ac5f7a3486df6cda77013ab568c444cf72b4f3 (diff)
add enable/disable interrupt command
-rw-r--r--components/drivers/touch/touch.c8
-rw-r--r--components/drivers/touch/touch.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/components/drivers/touch/touch.c b/components/drivers/touch/touch.c
index 1dd93d915f..f8802a526f 100644
--- a/components/drivers/touch/touch.c
+++ b/components/drivers/touch/touch.c
@@ -66,8 +66,6 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch)
rt_pin_irq_enable(touch->config.irq_pin.pin, PIN_IRQ_ENABLE);
- LOG_I("interrupt init success");
-
return RT_EOK;
}
@@ -198,6 +196,12 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
}
break;
+ case RT_TOUCH_CTRL_DISABLE_INT:
+ rt_touch_irq_disable(touch);
+ break;
+ case RT_TOUCH_CTRL_ENABLE_INT:
+ rt_touch_irq_enable(touch);
+ break;
default:
return RT_ERROR;
}
diff --git a/components/drivers/touch/touch.h b/components/drivers/touch/touch.h
index 4fa19aed47..6b7288a5a0 100644
--- a/components/drivers/touch/touch.h
+++ b/components/drivers/touch/touch.h
@@ -43,6 +43,8 @@ extern "C" {
#define RT_TOUCH_CTRL_SET_X_RANGE (3) /* Set x coordinate range */
#define RT_TOUCH_CTRL_SET_Y_RANGE (4) /* Set y coordinate range */
#define RT_TOUCH_CTRL_SET_X_TO_Y (5) /* Set X Y coordinate exchange */
+#define RT_TOUCH_CTRL_DISABLE_INT (6) /* Disable interrupt */
+#define RT_TOUCH_CTRL_ENABLE_INT (7) /* Enable interrupt */
/* Touch event */
#define RT_TOUCH_EVENT_NONE (0) /* Touch none */