Qdec#

group bsp_qdec

Read the QDEC peripherals counter.

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2023

Typedefs

typedef void (*qdec_cb_t)(void *ctx)#

Callback function prototype, it is called on each qdec interrupt.

typedef uint8_t qdec_t#

QDEC peripheral index.

Functions

void db_qdec_init(qdec_t qdec, const qdec_conf_t *conf, qdec_cb_t callback, void *ctx)#

Initialize a QDEC.

Parameters:
  • qdec[in] Pointer to the qdec descriptor

  • conf[in] Pointer to the qdec configuration

  • callback[in] Function pointer that is called from QDEC ISR

  • ctx[in] Pointer to some context passed as parameter to the callback

int32_t db_qdec_read(qdec_t qdec)#

Read the QDEC accumulator.

Parameters:
  • qdec[in] Index of the QDEC peripheral to read

int32_t db_qdec_read_and_clear(qdec_t qdec)#

Read and clear the QDEC accumulator.

Parameters:
  • qdec[in] Index of the QDEC peripheral to read and reset

struct qdec_conf_t#

QDEC pin configuration.

Public Members

const gpio_t *pin_a#

GPIO pin A.

const gpio_t *pin_b#

GPIO pin B.