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

Function rt_touch_irq_init

components/drivers/touch/dev_touch.c:43–70  ·  view source on GitHub ↗

touch interrupt initialization function */

Source from the content-addressed store, hash-verified

41
42/* touch interrupt initialization function */
43static rt_err_t rt_touch_irq_init(rt_touch_t touch)
44{
45#ifdef RT_TOUCH_PIN_IRQ
46 if (touch->config.irq_pin.pin == PIN_IRQ_PIN_NONE)
47 {
48 return -RT_EINVAL;
49 }
50
51 rt_pin_mode(touch->config.irq_pin.pin, touch->config.irq_pin.mode);
52
53 if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLDOWN)
54 {
55 rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING, touch_irq_callback, (void *)touch);
56 }
57 else if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLUP)
58 {
59 rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_FALLING, touch_irq_callback, (void *)touch);
60 }
61 else if (touch->config.irq_pin.mode == PIN_MODE_INPUT)
62 {
63 rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING_FALLING, touch_irq_callback, (void *)touch);
64 }
65
66 rt_pin_irq_enable(touch->config.irq_pin.pin, PIN_IRQ_ENABLE);
67#endif
68
69 return RT_EOK;
70}
71
72/* touch interrupt enable */
73static void rt_touch_irq_enable(rt_touch_t touch)

Callers 1

rt_touch_openFunction · 0.85

Calls 3

rt_pin_attach_irqFunction · 0.85
rt_pin_irq_enableFunction · 0.85
rt_pin_modeFunction · 0.50

Tested by

no test coverage detected