<?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>Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7304/timers-for-nrf51822-beacon-kit</link><description>Hi, 
 In my project, I need to periodically perform some jobs on the nRF51822 Beacon kit (sdk 7.1). For that, I think I need to use timers. However, I&amp;#39;m not sure how to do this. I found some sample code online but it wasn&amp;#39;t very explanatory. 
 Could</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jun 2015 20:57:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7304/timers-for-nrf51822-beacon-kit" /><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25834?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2015 20:57:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa2d0ac8-872c-45f0-bf79-950e595c8f45</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;Hi Aryan, thank you very much. Here is the new question:&lt;a href="https://devzone.nordicsemi.com/question/41604/using-single-shot-timer-to-create-repeated-timers-with-changing-intervals/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25833?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2015 11:57:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:517215ff-7a05-4374-8e1b-fd8d4d9118f2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This is very good question, to make it more visible to others, please create another question for this with a good title. I will follow up. Thanks for your patience.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25832?ContentTypeID=1</link><pubDate>Mon, 15 Jun 2015 20:31:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b2ae37c-e0b5-4f6c-a8c1-499451e9cd2f</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;Thanks very much Aryan, it works now. I have another question. I would like to use the single shot timer and when the timeout handler is called, I would like to set up the same timer again with different interval this time. Do I have to use both of the app_timer_create and app_timer_start functions, or would just using app_timer_start suffice? (In other words, I&amp;#39;m not sure whether the timer needs to be recreated or not). Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25831?ContentTypeID=1</link><pubDate>Fri, 12 Jun 2015 09:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccdcb450-c380-4057-97f3-daff44eeceba</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;sorry my bad, copy paste mistake, changed my answer, instead of BSP_MS_TO_TICK macro use macro APP_TIMER_TICKS defined in app_timer.h. Its purpose is to convert the milliseconds delay you require to timer tick.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25830?ContentTypeID=1</link><pubDate>Thu, 11 Jun 2015 19:54:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc0d5ca7-f28d-47cd-9350-b1517b4ca4bb</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;Thank you very much! I get the error &amp;quot;invalid declaration  of function BSP_MS_TO_TICK is invalid in C99 &amp;quot;. How can I fix this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers for nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/25829?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 06:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75ba3a17-ce08-427a-a1c5-9667b81f30fd</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You Initialize the APP timer, read about APP_TIMER_INIT in app_timer.h, APP_TIMER_MAX_TIMERS should atleast be equal to number of times you use &lt;code&gt;app_timer_create&lt;/code&gt; in your whole application&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you create a timer by&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app_timer_create(&amp;amp;m_leds_timer_id, APP_TIMER_MODE_SINGLE_SHOT, timeout_handler);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app_timer_create(&amp;amp;m_leds_timer_id, APP_TIMER_MODE_REPEATED, timeout_handler);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Singleshot will make your timeout_handler run once and then disable the timer, repeated on the otherhand will call your timeout_handler repeatedly with interval of configured timeout.&lt;/p&gt;
&lt;p&gt;Now you have initialized the app_timer and also created your timer. Now we configure the timer and start it by&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app_timer_start(m_leds_timer_id, APP_TIMER_TICKS(MS, APP_TIMER_PRESCALER), NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;now your timeout_handler will be called after INTERVAL_IN_MS&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>