<?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>How to check ADC sampling status.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83203/how-to-check-adc-sampling-status</link><description>How we can get to know about the ADC sampling is done. On the basis of the sampling done i want to do furture opration like the stop sampling,Continues sampling. How i can achive this, one callback function is there which will return the enum adc_action</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Dec 2021 12:25:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83203/how-to-check-adc-sampling-status" /><item><title>RE: How to check ADC sampling status.</title><link>https://devzone.nordicsemi.com/thread/345352?ContentTypeID=1</link><pubDate>Wed, 29 Dec 2021 12:25:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:790c1f3a-1b07-4709-a669-35e16a3e42b4</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Swati&lt;/p&gt;
&lt;p&gt;All functions and variables I reference in the following text can be found in &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/peripherals/adc.html?highlight=adc_action#c.adc_action"&gt;Zephyr ADC API reference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you are calling the adc_read function, you need to configure the ADC using the &lt;strong&gt;adc_&lt;/strong&gt;&lt;strong&gt;sequence&lt;/strong&gt; argument.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;adc_sequence&lt;/strong&gt; has seven different configurations for the adc. These are&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;channels&lt;/li&gt;
&lt;li&gt;buffer&lt;/li&gt;
&lt;li&gt;buffer_size&lt;/li&gt;
&lt;li&gt;resolution&lt;/li&gt;
&lt;li&gt;oversampling&lt;/li&gt;
&lt;li&gt;calibrate&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;options&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;options&lt;/strong&gt; are additional options for the ADC configuration, and has the type &lt;strong&gt;adc_sequence_options&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;adc_sequence_options&lt;/strong&gt; has four different additional configurations:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;interval_us&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;callback&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;user_data&lt;/li&gt;
&lt;li&gt;extra_samplings&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;the &lt;strong&gt;callback&lt;/strong&gt; configuration will be to a callback function which must be on the form:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef enum adc_action (*adc_sequence_callback)(const struct device *dev, const struct adc_sequence *sequence, uint16_t sampling_index)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When this have been configured, this callback function will be called after a requested sampling by the ADC is done.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]2.&amp;nbsp; I want to understand about the Zeyphr &lt;strong&gt;adc_context_on_sampling_done()&lt;/strong&gt; API how it is working in drivers/adc/adc_context.h.[/quote]
&lt;p&gt;The adc_context_on_sampling_done() function is not a part of the public ADC driver. It is only used for internal operations in the driver.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Here is an example showcasing how the adc with callback can be used with the adc_read function:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2705.adc.zip"&gt;devzone.nordicsemi.com/.../2705.adc.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Does this answer your questions?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>