<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NVIC check if IRQ is enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24057/nvic-check-if-irq-is-enabled</link><description>Hi, 
 as far as I see, I can enable or disable external interrupts using NVIC_EnableIRQ() and NVIC_DisableIRQ . Is there a method to check if a specified external interrupt is currently enabled or disabled? 
 Is this done by NVIC_GetActive() ? 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Aug 2017 10:59:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24057/nvic-check-if-irq-is-enabled" /><item><title>RE: NVIC check if IRQ is enabled</title><link>https://devzone.nordicsemi.com/thread/94724?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 10:59:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:163f18a9-89f5-46a3-8c5d-33f6414fc88a</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;No,  &lt;code&gt;NVIC_GetActive()&lt;/code&gt; will only return 1 when the interrupt is currently being serviced (directly or preempted by a higher priority). So it should always return zero in main() funtion.&lt;/p&gt;
&lt;p&gt;You are probably looking for the &lt;code&gt;NVIC_GetEnableIRQ()&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;Note that both functions do not work with negative IRQn like SysTick.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NVIC check if IRQ is enabled</title><link>https://devzone.nordicsemi.com/thread/94723?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 10:54:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd32b106-aa3e-439e-a0bf-b6d93a9e4e24</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found out that I work with CMSIS v4.30, which does not have the required method yet. As far as I see, CMSIS v5.0.1 already has a function called &lt;code&gt;NVIC_GetEnableIRQ()&lt;/code&gt; (see &lt;a href="https://www.keil.com/pack/doc/CMSIS/Core/html/group__NVIC__gr.html#gadf4252e600661fd762cfc0d1a9f5b892"&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;So, I decided to borrow the implementation of that function, as seen below. Cited from &lt;a href="https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/core_cm4.h"&gt;github.com/.../core_cm4.h&lt;/a&gt; (as of 2017-08-03):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**
  \brief   Get Interrupt Enable status
  \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
  \param [in]      IRQn  Device specific interrupt number.
  \return             0  Interrupt is not enabled.
  \return             1  Interrupt is enabled.
  \note    IRQn must not be negative.
 */
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
{
  if ((int32_t)(IRQn) &amp;gt;= 0)
  {
    return((uint32_t)(((NVIC-&amp;gt;ISER[(((uint32_t)(int32_t)IRQn) &amp;gt;&amp;gt; 5UL)] &amp;amp; (1UL &amp;lt;&amp;lt; (((uint32_t)(int32_t)IRQn) &amp;amp; 0x1FUL))) != 0UL) ? 1UL : 0UL));
  }
  else
  {
    return(0U);
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Thanks for your time,
Tamas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>