<?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>Examples using the scheduler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3998/examples-using-the-scheduler</link><description>I am trying to use the Scheduler to create my own event handler system (similar to a Ti 8051 OSAL system). I&amp;#39;m writing separate classes that can push data/trigger handlers between classes via put/scheduled events. Sort of like a soft interrupt. For example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Jan 2017 07:30:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3998/examples-using-the-scheduler" /><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14365?ContentTypeID=1</link><pubDate>Thu, 12 Jan 2017 07:30:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0b92093-b790-4610-a2bf-bc57831fe971</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt;I want to implement scheduler in my application which has SAADC, BLE streaming at 1000 samples per second and SD card writing. I am facing the problem that as soon as I start BLE streaming Complete code gets stopped. Without BLE streaming , I can write into SD card. The details about the issue is mentioned in this thread &lt;a href="https://devzone.nordicsemi.com/question/109562/how-to-use-dma-in-nrf52-while-writing-on-sd-card-while-ble-is-also-operating/"&gt;Here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have suggested to use app_scheduler. I have gone through &lt;a href="https://devzone.nordicsemi.com/tutorials/23/scheduler-tutorial/"&gt;scheduler tutorial&lt;/a&gt;. But how can I implement it with BLE, SAADC and SPI events.&lt;/p&gt;
&lt;p&gt;Can anyone suggest me anything about this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14362?ContentTypeID=1</link><pubDate>Sat, 31 Oct 2015 20:08:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bfbf282-dc1e-4253-a8c7-d0331c88dcb1</guid><dc:creator>GlennEngel</dc:creator><description>&lt;p&gt;This is a great response.  It should be included in the documentation!  Item one should mention that #include &amp;quot;app_scheduler.h&amp;quot; is required.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14364?ContentTypeID=1</link><pubDate>Sun, 11 Jan 2015 06:43:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7f6b134-eb9b-4bab-8130-4891fa80a5bd</guid><dc:creator>Vyacheslav Lebets</dc:creator><description>&lt;p&gt;Values of this macro can be found in any examples in SDK:&lt;/p&gt;
&lt;p&gt;//Maximum size of scheduler events. Note that scheduler BLE stack events do not contain any data, as the events are being pulled from the stack in the event handler&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;//Maximum number of events in the scheduler queue&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SCHED_QUEUE_SIZE    20
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14363?ContentTypeID=1</link><pubDate>Sun, 11 Jan 2015 01:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb1d7640-1bbe-4ea6-9e58-acba1e6fdacb</guid><dc:creator>la-ble</dc:creator><description>&lt;p&gt;@lebets_vi, What is the value of &lt;code&gt;SCHED_MAX_EVENT_DATA_SIZE&lt;/code&gt;?  No macro is defined in my &lt;code&gt;app_scheduler.h&lt;/code&gt;. 8B, 16B, 32B?  I&amp;#39;m also not actually passing any data at this point.  Does passing 0 do anything unexpected?  Is the minimum 1?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14361?ContentTypeID=1</link><pubDate>Tue, 07 Oct 2014 20:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49e41c1e-6667-4a04-8590-5f5d42d9a8c6</guid><dc:creator>Vyacheslav Lebets</dc:creator><description>&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Need to init sheduler in main() like this:&lt;/p&gt;
&lt;p&gt;APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;in main() need insert this code:&lt;/p&gt;
&lt;p&gt;while(1)
{
app_sched_execute();
...
}&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;in app_sheduler.h we have Scheduler event handler type:&lt;/p&gt;
&lt;p&gt;typedef void (*app_sched_event_handler_t)(void * p_event_data, uint16_t event_size);&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Declare own function like than typedef:&lt;/p&gt;
&lt;p&gt;void my_flash_event_func(void *data, uint16_t size); //this is event handler&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In any place where it is need, we  call:&lt;/p&gt;
&lt;p&gt;app_sched_event_put(pointer_to_own_data, size_of_data, my_flash_event_func); //this is event&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And sheduler will call your function &amp;quot;my_flash_event_func&amp;quot; with params: &amp;quot;pointer_to_own_data&amp;quot; and &amp;quot;size_of_data&amp;quot; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my_flash_event_func(pointer_to_data, size_of_data);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Examples using the scheduler</title><link>https://devzone.nordicsemi.com/thread/14360?ContentTypeID=1</link><pubDate>Tue, 07 Oct 2014 19:12:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74405bc5-7a46-4671-b138-baa4a0585684</guid><dc:creator>Locky</dc:creator><description>&lt;p&gt;Could I interpret a lack of response as meaning there are a lack of available examples?   The reason I made this post is as I&amp;#39;m developing my application, without a real-time event handler on the Nordic platofrm, I&amp;#39;m having to write alot of app_timers to simulate event handing.  Timers are a very messy way of handling real-time events, and do not allow for any kind of queued processing?   Hope someone can chime in.  Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>