<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processorsのトピックi.MX28: GPIO interrupt on both rising and falling edges</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-GPIO-interrupt-on-both-rising-and-falling-edges/m-p/224003#M15502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;value = gpio_get_value(pdata-&amp;gt;id_gpio) ? 1 : 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if (value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set_irq_type(gpio_to_irq(pdata-&amp;gt;id_gpio), IRQ_TYPE_LEVEL_LOW); else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set_irq_type(gpio_to_irq(pdata-&amp;gt;id_gpio), IRQ_TYPE_LEVEL_HIGH); ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Mar 2013 02:31:39 GMT</pubDate>
    <dc:creator>PeterChan</dc:creator>
    <dc:date>2013-03-14T02:31:39Z</dc:date>
    <item>
      <title>i.MX28: GPIO interrupt on both rising and falling edges</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-GPIO-interrupt-on-both-rising-and-falling-edges/m-p/224003#M15502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;value = gpio_get_value(pdata-&amp;gt;id_gpio) ? 1 : 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if (value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set_irq_type(gpio_to_irq(pdata-&amp;gt;id_gpio), IRQ_TYPE_LEVEL_LOW); else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set_irq_type(gpio_to_irq(pdata-&amp;gt;id_gpio), IRQ_TYPE_LEVEL_HIGH); ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 02:31:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-GPIO-interrupt-on-both-rising-and-falling-edges/m-p/224003#M15502</guid>
      <dc:creator>PeterChan</dc:creator>
      <dc:date>2013-03-14T02:31:39Z</dc:date>
    </item>
  </channel>
</rss>

