QDEC sample code from zephyr is not running on nrf52840dk

I am using a rotary encoder with nrf52840dk and I am confused about how to run sample QDEC code from zephyr/sample/sensor/qdec on nrf52840dk.

I got this error when i tried to directly build the code for nrf52840

I tried to add an overlay file to add qdec0 in this project. It was compulsory to add reg and interrupts parameters. 

&{/} {
    qdec0: qdec0{
        compatible="nordic,nrf-qdec";
        a-pin = <38>;
        b-pin = <39>;
        enable-pin = <32>;
        led-pin = <13>;
        led-pre = <0>;
        steps = <20>;
        reg = <0x000f8000 0x00008000>;
        interrupts = <&gpio0>;
    };
    
    aliases {
        qdec0=&qdec;
    };
};

 C

Related