i.MX28: GPIO Interrupt on Both Rising and Falling Edges

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

i.MX28: GPIO Interrupt on Both Rising and Falling Edges

i.MX28: GPIO Interrupt on Both Rising and Falling Edges

i.MX28 GPIO pins only support the following IRQ types: IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_HIGH and IRQ_TYPE_LEVEL_LOW. IRQ_TYPE_EDGE_BOTH is not supported.

It application requires interrupt on both rising and falling edges, software can set the IRQ type to level trigger and set the polarity in reverse to the current GPIO input level. Below is the example.

value = gpio_get_value(pdata->id_gpio) ? 1 : 0;

if (value)

    set_irq_type(gpio_to_irq(pdata->id_gpio), IRQ_TYPE_LEVEL_LOW); else

    set_irq_type(gpio_to_irq(pdata->id_gpio), IRQ_TYPE_LEVEL_HIGH); ...

When GPIO input value is low, set the IRQ type to IRQ_TYPE_LEVEL_HIGH. When the GPIO input value is high, set the IRQ type to IRQ_TYPE_LEVEL_LOW. Do the same checking in the GPIO IRQ handler. In this way, interrupts on both edges can be captured.

This document was generated from the following discussion: i.MX28: GPIO interrupt on both rising and falling edges

标签 (1)
无评分
版本历史
最后更新:
‎03-19-2013 11:17 PM
更新人: