From 116b7880c39ec86f0612d33933f8d2c04966dc40 Mon Sep 17 00:00:00 2001 From: tyustli <1225613647@qq.com> Date: Thu, 13 Jun 2019 16:48:40 +0800 Subject: [PATCH] add enable/disable interrupt command --- components/drivers/touch/touch.c | 8 ++++++-- components/drivers/touch/touch.h | 2 ++ 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; } @@ -197,6 +195,12 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args) LOG_D("set y coordinate range :%d \n", touch->info.range_x); } + 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 */ -- GitLab