Quad Decoder Question

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't a clue what "_STATIC_INLINE uint32_t nrf_qdec_reportper_to_value ( uint32_t reportper )" does after reading the documentation. Can I get some more explanation on what this function actually does, as it doesn't seem clear to me. 

thank you

Parents
  • Hi,

    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. 

    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 API doc for the legacy API.

    You can see how it is used in the QDEC Example.

    For instance, I haven't a clue what "_STATIC_INLINE uint32_t nrf_qdec_reportper_to_value ( uint32_t reportper )" does after reading the documentation.

    This just reads the SAMPLEPER register. You need to refer to the QDEC chapter in the product specification to see the details about this register.

Reply
  • Hi,

    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. 

    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 API doc for the legacy API.

    You can see how it is used in the QDEC Example.

    For instance, I haven't a clue what "_STATIC_INLINE uint32_t nrf_qdec_reportper_to_value ( uint32_t reportper )" does after reading the documentation.

    This just reads the SAMPLEPER register. You need to refer to the QDEC chapter in the product specification to see the details about this register.

Children
No Data
Related