<?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>turning off qdec led</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15669/turning-off-qdec-led</link><description>In the nrf52 specification: 
 &amp;quot;The Phase A, Phase B, and LED signals are mapped to physical pins according to the configuration
specified in the PSEL.A, PSEL.B, and PSEL.LED registers respectively.
If the CONNECT field value &amp;#39;Disconnected&amp;#39; is specified</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Sep 2018 12:39:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15669/turning-off-qdec-led" /><item><title>RE: turning off qdec led</title><link>https://devzone.nordicsemi.com/thread/150260?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 12:39:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de0b3252-bef3-421e-8864-395c76048d06</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;&lt;span&gt;&lt;strong&gt;Note&lt;/strong&gt;, if you are using the nrf_drv_qdec driver in SDK 12 (at least) you can NOT set the LED-pin to 0xFFFFFFFF! &lt;/span&gt;&lt;span&gt;(you may do that for the psel.led register directly, but not when using the driver)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This will in best case end up in an assert in&amp;nbsp;nrf_gpio_pin_port_decode(), in worst case if assert is not enabled it will&amp;nbsp;actually write to reg-&amp;gt;PIN_CNF[0xFFFFFFFF] which is way out of range..&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This happens because nrf_drv_qdec_init calls:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_gpio_cfg_input(p_config-&amp;gt;pselled, NRF_GPIO_PIN_NOPULL);

----&amp;gt; nrf_gpio_cfg(pin_number, ...)
{
    NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&amp;amp;pin_number);
    reg-&amp;gt;PIN_CNF[pin_number] = .... // pin_number = 0xFFFFFFFF
    &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;See also:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/37968/nrfx_qdec-driver-quirks"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/37968/nrfx_qdec-driver-quirks&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off qdec led</title><link>https://devzone.nordicsemi.com/thread/59831?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 12:20:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e3c3d13-76a3-407f-a24b-7b48e789c77c</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You can set the pin to 0xFFFFFFFF.&lt;/p&gt;
&lt;p&gt;When using the default configuration (&lt;code&gt;nrf_drv_qdec_init(NULL, qdec_event_handler)&lt;/code&gt;) you can set the default pin in  nrf_drv_config.h:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define QDEC_CONFIG_PIO_LED 0xFFFFFFFF
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When using your own config:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_qdec_config_t qdec_config;
qdec_config.pselled = 0xFFFFFFFF;
...
nrf_drv_qdec_init(&amp;amp;qdec_config, qdec_event_handler)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: turning off qdec led</title><link>https://devzone.nordicsemi.com/thread/59830?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 12:10:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3855c2e0-c4f3-433a-92dc-f4c55e13a980</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    nrf_drv_qdec_config_t qdec_cfg = 
    {
        .reportper = NRF_QDEC_REPORTPER_10,             /**&amp;lt; Report period in samples. */
        .sampleper = NRF_QDEC_SAMPLEPER_128us,         /**&amp;lt; Sampling period in microseconds. */
        .psela = GPIO_INPUT_A,                          /**&amp;lt; Pin number for A input. */
        .pselb = GPIO_INPUT_B,                          /**&amp;lt; Pin number for B input. */
        .pselled = GPIO_INPUT_LED,                      /**&amp;lt; Pin number for LED output. */
        .ledpre = 10,                                   /**&amp;lt; Time (in microseconds) how long LED is switched on before sampling. */
        .ledpol = 0,                                    /**&amp;lt; Active LED polarity. */
        .dbfen = false,                                 /**&amp;lt; State of debouncing filter. */
        .sample_inten = true,                           /**&amp;lt; Enabling sample ready interrupt. */
        .interrupt_priority = 3,                        /**&amp;lt; QDEC interrupt priority. */
    };
    
    err_code = nrf_drv_qdec_init(&amp;amp;qdec_cfg, qdec_event_handler);
    APP_ERROR_CHECK(err_code);
    
    // Needed for my quad enc. as I have no external pulls
    nrf_gpio_cfg_input(qdec_cfg.pselb,NRF_GPIO_PIN_PULLUP);
    nrf_gpio_cfg_input(qdec_cfg.psela,NRF_GPIO_PIN_PULLUP);
    nrf_drv_qdec_enable();
    
    while (true)
    {
        __WFI();
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here you can set .pselled to whatever you like, for example disconnected.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>