QDEC HALY

group nrfy_qdec

Hardware access layer with cache and barrier support for managing the QDEC peripheral.

Functions

NRFY_STATIC_INLINE void nrfy_qdec_periph_configure(NRF_QDEC_Type *p_reg, nrfy_qdec_config_t const *p_config)

Function for configuring the QDEC.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_qdec_int_init(NRF_QDEC_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified QDEC interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if the interrupts are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_qdec_int_uninit(NRF_QDEC_Type *p_reg)

Function for uninitializing the QDEC interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_qdec_events_process(NRF_QDEC_Type *p_reg, uint32_t mask)

Function for processing the specified QDEC events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE void nrfy_qdec_accumulators_read(NRF_QDEC_Type const *p_reg, int32_t *p_acc, uint32_t *p_accdbl)

Function for reading QDEC accumulators.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_acc[in] Pointer to store the accumulated transitions

  • p_accdbl[in] Pointer to store the accumulated double transitions.

NRFY_STATIC_INLINE void nrfy_qdec_pins_get(NRF_QDEC_Type const *p_reg, nrfy_qdec_pins_t *p_pins)

Function for reading QDEC pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[in] Pointer to the QDEC pin configurartion structure.

NRFY_STATIC_INLINE void nrfy_qdec_pins_set(NRF_QDEC_Type *p_reg, nrfy_qdec_pins_t const *p_pins)

Function for setting QDEC pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[in] Pointer to the QDEC pin configurartion structure.

NRFY_STATIC_INLINE void nrfy_qdec_enable(NRF_QDEC_Type *p_reg)

@refhal{nrf_qdec_enable}

NRFY_STATIC_INLINE void nrfy_qdec_disable(NRF_QDEC_Type *p_reg)

@refhal{nrf_qdec_disable}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_enable_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_enable_get}

NRFY_STATIC_INLINE void nrfy_qdec_int_enable(NRF_QDEC_Type *p_reg, uint32_t mask)

@refhal{nrf_qdec_int_enable}

NRFY_STATIC_INLINE void nrfy_qdec_int_disable(NRF_QDEC_Type *p_reg, uint32_t mask)

@refhal{nrf_qdec_int_disable}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_int_enable_check(NRF_QDEC_Type const *p_reg, uint32_t mask)

@refhal{nrf_qdec_int_enable_check}

NRFY_STATIC_INLINE void nrfy_qdec_dbfen_enable(NRF_QDEC_Type *p_reg)

@refhal{nrf_qdec_dbfen_enable}

NRFY_STATIC_INLINE void nrfy_qdec_dbfen_disable(NRF_QDEC_Type *p_reg)

@refhal{nrf_qdec_dbfen_disable}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_dbfen_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_dbfen_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_a_pin_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_phase_a_pin_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_b_pin_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_phase_b_pin_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_led_pin_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_led_pin_get}

NRFY_STATIC_INLINE void nrfy_qdec_task_trigger(NRF_QDEC_Type *p_reg, nrf_qdec_task_t task)

@refhal{nrf_qdec_task_trigger}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_task_address_get(NRF_QDEC_Type const *p_reg, nrf_qdec_task_t task)

@refhal{nrf_qdec_task_address_get}

NRFY_STATIC_INLINE void nrfy_qdec_event_clear(NRF_QDEC_Type *p_reg, nrf_qdec_event_t event)

@refhal{nrf_qdec_event_clear}

NRFY_STATIC_INLINE bool nrfy_qdec_event_check(NRF_QDEC_Type const *p_reg, nrf_qdec_event_t event)

@refhal{nrf_qdec_event_check}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_event_address_get(NRF_QDEC_Type const *p_reg, nrf_qdec_event_t event)

@refhal{nrf_qdec_event_address_get}

NRFY_STATIC_INLINE void nrfy_qdec_shorts_enable(NRF_QDEC_Type *p_reg, uint32_t mask)

@refhal{nrf_qdec_shorts_enable}

NRFY_STATIC_INLINE void nrfy_qdec_shorts_disable(NRF_QDEC_Type *p_reg, uint32_t mask)

@refhal{nrf_qdec_shorts_disable}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_sampleper_to_value(nrf_qdec_sampleper_t sampleper)

@refhal{nrf_qdec_sampleper_to_value}

NRFY_STATIC_INLINE void nrfy_qdec_sampleper_set(NRF_QDEC_Type *p_reg, nrf_qdec_sampleper_t sampleper)

@refhal{nrf_qdec_sampleper_set}

NRFY_STATIC_INLINE nrf_qdec_sampleper_t nrfy_qdec_sampleper_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_sampleper_get}

NRFY_STATIC_INLINE int32_t nrfy_qdec_sample_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_sample_get}

NRFY_STATIC_INLINE int32_t nrfy_qdec_acc_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_acc_get}

NRFY_STATIC_INLINE int32_t nrfy_qdec_accread_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_accread_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_accdbl_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_accdbl_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_accdblread_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_accdblread_get}

NRFY_STATIC_INLINE void nrfy_qdec_ledpre_set(NRF_QDEC_Type *p_reg, uint32_t time_us)

@refhal{nrf_qdec_ledpre_set}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_ledpre_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_ledpre_get}

NRFY_STATIC_INLINE void nrfy_qdec_ledpol_set(NRF_QDEC_Type *p_reg, nrf_qdec_ledpol_t pol)

@refhal{nrf_qdec_ledpol_set}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_ledpol_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_ledpol_get}

NRFY_STATIC_INLINE void nrfy_qdec_reportper_set(NRF_QDEC_Type *p_reg, nrf_qdec_reportper_t reportper)

@refhal{nrf_qdec_reportper_set}

NRFY_STATIC_INLINE nrf_qdec_reportper_t nrfy_qdec_reportper_get(NRF_QDEC_Type const *p_reg)

@refhal{nrf_qdec_reportper_get}

NRFY_STATIC_INLINE uint32_t nrfy_qdec_reportper_to_value(nrf_qdec_reportper_t reportper)

@refhal{nrf_qdec_reportper_to_value}

struct nrfy_qdec_pins_t
#include <nrfy_qdec.h>

Configuration structure for QDEC pins.

Public Members

uint32_t a_pin

Pin number for A input.

uint32_t b_pin

Pin number for B input.

uint32_t led_pin

Pin number for LED output.

struct nrfy_qdec_config_t
#include <nrfy_qdec.h>

QDEC configuration structure.

Public Members

nrf_qdec_reportper_t reportper

Report period in samples.

nrf_qdec_sampleper_t sampleper

Sampling period in microseconds.

nrfy_qdec_pins_t pins

Pin configuration structure.

uint32_t ledpre

Time (in microseconds) how long LED is switched on before sampling.

nrf_qdec_ledpol_t ledpol

Active LED polarity.

bool dbfen

State of debouncing filter.

bool skip_psel_cfg

Skip pin selection configuration. When set to true, the driver does not modify pin select registers in the peripheral. Those registers are supposed to be set up externally before the driver is initialized.

Note

When both GPIO configuration and pin selection are to be skipped, the structure fields that specify pins can be omitted, as they are ignored anyway.