<?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>Quad Decoder Question</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89949/quad-decoder-question</link><description>I was looking through the quadrature decoder example for the nRF52 and I was having trouble getting an insight into how the three libraries (driver, driver legacy, and HAL) can be used. 
 
 For instance, I haven&amp;#39;t a clue what &amp;quot;_STATIC_INLINE uint32_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Aug 2022 07:32:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89949/quad-decoder-question" /><item><title>RE: Quad Decoder Question</title><link>https://devzone.nordicsemi.com/thread/379447?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2022 07:32:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5900e1ce-7b7d-469c-9b44-277e28e78138</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The&amp;nbsp;ACC register is continuously updated. The&amp;nbsp;ACCREAD on the other hand contains a snapshot of the register, triggered by&amp;nbsp;READCLRACC or RDCLRACC task (see QDEC chapter in product specification for more detail). (In practice, this means that you can for instance get a snapshot of this register via PPI without CPU intervention, and read it at a later time when appropriate. So even if there are delays in SW due to for instance higher priority interrupts, you will still get the ACC snapshot at the time you should if you capture it via PPI).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quad Decoder Question</title><link>https://devzone.nordicsemi.com/thread/379444?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2022 07:27:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4cae7c4-46f0-4674-9d99-d6a708dcaf08</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ah, sorry. I replied too quickly.&amp;nbsp; The nrf_qdec_reportper_to_value() is just a convenience function to convert the register value to the amount of samples per report, and for that the configured REPORTPER needs to be provided as input. You can refer to the (oneline) implementation in&amp;nbsp;nrf_qdec.h and see how it is used in &amp;lt;nRF5 SDK&amp;gt;\examples\peripheral\qdec\main.c.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quad Decoder Question</title><link>https://devzone.nordicsemi.com/thread/376824?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2022 19:50:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0a812b1-717c-493e-ad74-e92bfc0ea1c9</guid><dc:creator>Canadian_EE</dc:creator><description>&lt;p&gt;What is the purpose of having an ACC and ACCREAD register. I seem to be able to read both, one using &amp;quot;nrf_qdec_acc_get()&amp;quot; and the other using &amp;quot;nrf_qdec_accread_get()&amp;quot;, respectively.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I not seeing the utility and I&amp;#39;m trying to understand so that I can best write my code. Please let me know, thanks.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quad Decoder Question</title><link>https://devzone.nordicsemi.com/thread/376823?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2022 14:17:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf01e259-72a3-47ee-ac96-6bca2760201e</guid><dc:creator>Canadian_EE</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; If this function reads the SAMPLEPER register, then why does it take an input? What does it do with that input?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quad Decoder Question</title><link>https://devzone.nordicsemi.com/thread/376822?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2022 10:52:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8748a5d9-00a3-41b6-8ae6-8d5fb92b3784</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I was looking through the quadrature decoder example for the nRF52 and I was having trouble getting an insight into how the three libraries (driver, driver legacy, and HAL) can be used.&amp;nbsp;[/quote]
&lt;p&gt;The HAL is lower layer, and enables things like reading and writing to registers. This is also used by the driver implementation. You want to use the driver, either via legacy API (nrf_drv_*) or nrfx (nrfx_*). These have the same implementation, so it does not really matter which you use. See &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__drv__qdec.html"&gt;API doc for the legacy API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can see how it is used in the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/qdec_example.html"&gt;QDEC Example&lt;/a&gt;.&lt;/p&gt;
[quote user=""]For instance, I haven&amp;#39;t a clue what &amp;quot;_STATIC_INLINE uint32_t nrf_qdec_reportper_to_value ( uint32_t reportper )&amp;quot; does after reading the documentation. [/quote]
&lt;p&gt;This just reads the SAMPLEPER register. You need to refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/qdec.html?cp=4_0_0_5_17"&gt;QDEC chapter in the product specification&lt;/a&gt; to see the details about this register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>