MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_touch_control

Function rt_touch_control

components/drivers/touch/dev_touch.c:142–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
143{
144 rt_touch_t touch;
145 rt_err_t result = RT_EOK;
146 RT_ASSERT(dev != RT_NULL);
147 touch = (rt_touch_t)dev;
148
149 switch (cmd)
150 {
151 case RT_TOUCH_CTRL_SET_MODE:
152 result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_SET_MODE, args);
153
154 if (result == RT_EOK)
155 {
156 rt_uint16_t mode;
157 mode = *(rt_uint16_t*)args;
158 if (mode == RT_DEVICE_FLAG_INT_RX)
159 {
160 rt_touch_irq_enable(touch); /* enable interrupt */
161 }
162 }
163
164 break;
165 case RT_TOUCH_CTRL_SET_X_RANGE:
166 result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_SET_X_RANGE, args);
167
168 if (result == RT_EOK)
169 {
170 touch->info.range_x = *(rt_int32_t *)args;
171 LOG_D("set x coordinate range :%d\n", touch->info.range_x);
172 }
173
174 break;
175 case RT_TOUCH_CTRL_SET_Y_RANGE:
176 result = touch->ops->touch_control(touch, RT_TOUCH_CTRL_SET_Y_RANGE, args);
177
178 if (result == RT_EOK)
179 {
180 touch->info.range_y = *(rt_uint32_t *)args;
181 LOG_D("set y coordinate range :%d \n", touch->info.range_x);
182 }
183
184 break;
185 case RT_TOUCH_CTRL_DISABLE_INT:
186 rt_touch_irq_disable(touch);
187 break;
188 case RT_TOUCH_CTRL_ENABLE_INT:
189 rt_touch_irq_enable(touch);
190 break;
191
192 case RT_TOUCH_CTRL_GET_ID:
193 case RT_TOUCH_CTRL_GET_INFO:
194 default:
195 return touch->ops->touch_control(touch, cmd, args);
196 }
197
198 return result;
199}

Callers

nothing calls this directly

Calls 2

rt_touch_irq_enableFunction · 0.85
rt_touch_irq_disableFunction · 0.85

Tested by

no test coverage detected