<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Best way to implement polling in the event manager</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/87977/best-way-to-implement-polling-in-the-event-manager</link><description>Hi there, 
 We are developing an nRF52832 based product based on the CAF and Event Manager that requires, among other things, regular reading of sensor data and running control loop calculations based on the readings. 
 What do you suggest is the best</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 18 May 2022 14:23:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/87977/best-way-to-implement-polling-in-the-event-manager" /><item><title>RE: Best way to implement polling in the event manager</title><link>https://test-devzone.nordicsemi.com/thread/368418?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 14:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b68326b-c065-4caf-8077-19820792e77d</guid><dc:creator>user109668</dc:creator><description>&lt;p&gt;Hello Einar,&lt;/p&gt;
&lt;p&gt;This is very useful, thank you!&lt;/p&gt;
&lt;p&gt;We&amp;#39;ve gone with a high priority thread for now, sleeping using k_sleep for the required time since the last sleep, but it&amp;#39;s not an ideal solution. We&amp;#39;ll look at moving it over to using timer interrupts in the future&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Mark&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to implement polling in the event manager</title><link>https://test-devzone.nordicsemi.com/thread/368406?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 14:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9f618eb-3e83-4565-ab42-1660b719ffcc</guid><dc:creator>user111520</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;If your sensor allows it I would set it up to take measurements at the frequency you&amp;#39;d like, and let it generate an event through a gpio interrupt when new data is ready. If your sensor can&amp;#39;t do that, then your best option is probably just to generate events through &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/kernel/services/timing/timers.html"&gt;timer interrupts&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You are correct that workqueue threads are typically used to process non-urgent work, but depending on how much else is going on in your application it could possibly work well. If your application is running several different threads and all you want is to pass sensor data to a high priority thread doing control loop calculations, then maybe Zephyr&amp;#39;s &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/kernel/services/data_passing/queues.html"&gt;Queue&lt;/a&gt; could work?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>