<?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>Is there a place to store a pointer that I can pick up in an interrupt handler?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/512/is-there-a-place-to-store-a-pointer-that-i-can-pick-up-in-an-interrupt-handler</link><description>In my ADC interrupt service routine (ADC_IRQHandler), I&amp;#39;d like to have a pointer available that I could use to carry some state from the main app thread to the IRQ handler. 
 Yes, I could do this by declaring a global, but I go to great lengths to avoid</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Sep 2013 23:28:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/512/is-there-a-place-to-store-a-pointer-that-i-can-pick-up-in-an-interrupt-handler" /><item><title>RE: Is there a place to store a pointer that I can pick up in an interrupt handler?</title><link>https://devzone.nordicsemi.com/thread/2666?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2013 23:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:848864ec-5373-4b7e-81ab-aaea9185dfde</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I think that&amp;#39;s a little cleaner than a global as it limits the contract to the function call vs. leaving a variable out there that is hard to change down the road.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a place to store a pointer that I can pick up in an interrupt handler?</title><link>https://devzone.nordicsemi.com/thread/2665?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2013 21:23:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147b1577-8c98-487d-a573-ba5235eb268c</guid><dc:creator>John Kelley</dc:creator><description>&lt;p&gt;Globals are the only answer unless you want to write a function to return a pointer to a static member variable and call that from your interrupt routine. For example:&lt;/p&gt;
&lt;p&gt;struct my_struct *get_my_struct_ptr() {
static struct my_struct data;
return &amp;amp;data;
}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>