<?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>Where to put APP_TIMER_DEF without error or warning?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28312/where-to-put-app_timer_def-without-error-or-warning</link><description>I am working on a project in Nordic SDK 8.1 that requires using a timer. I am confused where I need to define the timer though (using APP_TIMER_DEF). If I put it right after my #include statements I get the following error: ../../../main.c:39:1: warning</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Dec 2017 18:29:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28312/where-to-put-app_timer_def-without-error-or-warning" /><item><title>RE: Where to put APP_TIMER_DEF without error or warning?</title><link>https://devzone.nordicsemi.com/thread/111788?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 18:29:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0e99977-599e-4b6c-99c6-f6ded2acf226</guid><dc:creator>tyler</dc:creator><description>&lt;p&gt;Ok thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Where to put APP_TIMER_DEF without error or warning?</title><link>https://devzone.nordicsemi.com/thread/111786?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 10:27:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de0ae8e3-e03e-4e13-b1f4-4bb18667709b</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Are you using the app_timer library from SDK 8.1 too? I can&amp;#39;t find that macro in that version of the library. The correct way to do it there would be to declare &lt;code&gt;static app_timer_id_t m_battery_timer_id;&lt;/code&gt;   somewhere at the top of main.c (as it is done in e.g. the ble_app_hrs example).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Where to put APP_TIMER_DEF without error or warning?</title><link>https://devzone.nordicsemi.com/thread/111787?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 09:27:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3396759-334a-4559-a34e-bd2935df7cb8</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I do not know if my answer will help you, but I used it like this:&lt;/p&gt;
&lt;p&gt;int You_want_function(void)
{
APP_TIMER_DEF(m_timer_id);
app_timer_create(&amp;amp;m_timer_id, APP_TIMER_MODE_SINGLE_SHOT,timeout_handler);
app_timer_start(m_timer_id, APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER), NULL);
}&lt;/p&gt;
&lt;p&gt;You can start as above in the some function you want to use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>