Reading ACC and ACCDBL values from NRFX QDEC.

Hello,

I am currently working on the NRFX QDEC library with a decoder to be used with a servo motor. 

We manage to initialize and enable the QDEC and IRQ and we get into the event handler. It seems like the QDEC registers values and comparing the values from the event.data.report.acc, we are able to determine the direction of the rotation using a if-statement to see if the acc-value is over or below 0.

The problem is as following:

  • We only get values between -10 and 10, with the negative values overflowing to 2^32.
  • We are not able to get the accumulate function to read, as we dont know what variables it takes as arguments. 

Our questions are:

  • Can we have an example code? We have tried googling, but without luck.
  • What arguments does the read-function takes? It says pointer, but do we have to declare any variables to store it in the first place?
  • It seems to count to somewhere between 5- and 6000 events per revolution, do you have any idea what the problems could be?
  • How exactly does event.data.report.acc and event.data.report.accdbl work?

The code were using can be found here: [https://github.com/anderszk/nRF52832_dev/tree/master/code/src/Encoder_experimental/Encoder_QDEC_improvement]

Related