nrfx 2.5
Modules | Data Structures | Macros | Typedefs | Functions
QDEC driver

Quadrature Decoder (QDEC) peripheral driver. More...

Modules

 QDEC peripheral driver configuration
 

Data Structures

struct  nrfx_qdec_config_t
 QDEC configuration structure. More...
 
struct  nrfx_qdec_sample_data_evt_t
 QDEC sample event data. More...
 
struct  nrfx_qdec_report_data_evt_t
 QDEC report event data. More...
 
struct  nrfx_qdec_event_t
 QDEC event handler structure. More...
 

Macros

#define NRFX_QDEC_DEFAULT_CONFIG(_pin_a, _pin_b, _pin_led)
 QDEC driver default configuration. More...
 

Typedefs

typedef void(* nrfx_qdec_event_handler_t) (nrfx_qdec_event_t event)
 QDEC event handler. More...
 

Functions

nrfx_err_t nrfx_qdec_init (nrfx_qdec_config_t const *p_config, nrfx_qdec_event_handler_t event_handler)
 Function for initializing QDEC. More...
 
void nrfx_qdec_uninit (void)
 Function for uninitializing QDEC. More...
 
void nrfx_qdec_enable (void)
 Function for enabling QDEC. More...
 
void nrfx_qdec_disable (void)
 Function for disabling QDEC. More...
 
void nrfx_qdec_accumulators_read (int16_t *p_acc, int16_t *p_accdbl)
 Function for reading accumulated transitions from the QDEC peripheral. More...
 
NRFX_STATIC_INLINE uint32_t nrfx_qdec_task_address_get (nrf_qdec_task_t task)
 Function for returning the address of the specified QDEC task. More...
 
NRFX_STATIC_INLINE uint32_t nrfx_qdec_event_address_get (nrf_qdec_event_t event)
 Function for returning the address of the specified QDEC event. More...
 

Detailed Description

Quadrature Decoder (QDEC) peripheral driver.

Macro Definition Documentation

◆ NRFX_QDEC_DEFAULT_CONFIG

#define NRFX_QDEC_DEFAULT_CONFIG (   _pin_a,
  _pin_b,
  _pin_led 
)
Value:
{ \
.reportper = NRF_QDEC_REPORTPER_10, \
.psela = _pin_a, \
.pselb = _pin_b, \
.pselled = _pin_led, \
.ledpre = 500, \
.sample_inten = false, \
.interrupt_priority = NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY \
}
Definition: nrf_qdec.h:66
Definition: nrf_qdec.h:87
Definition: nrf_qdec.h:74
Definition: nrf_qdec.h:96

QDEC driver default configuration.

This configuration sets up QDEC with the following options:

  • report period: 10 samples
  • sampling period: 16384 us
  • LED enabled for 500 us before sampling
  • LED polarity: active high
  • debouncing filter disabled
  • sample ready interrupt disabled
Parameters
[in]_pin_aPin for A encoder channel input.
[in]_pin_bPin for B encoder channel input.
[in]_pin_ledPin for LED output.

Typedef Documentation

◆ nrfx_qdec_event_handler_t

typedef void(* nrfx_qdec_event_handler_t) (nrfx_qdec_event_t event)

QDEC event handler.

Parameters
[in]eventQDEC event structure.

Function Documentation

◆ nrfx_qdec_accumulators_read()

void nrfx_qdec_accumulators_read ( int16_t *  p_acc,
int16_t *  p_accdbl 
)

Function for reading accumulated transitions from the QDEC peripheral.

Note
Function asserts if module is not enabled.
Accumulators are cleared after reading.
Parameters
[out]p_accPointer to store the accumulated transitions.
[out]p_accdblPointer to store the accumulated double transitions.

◆ nrfx_qdec_disable()

void nrfx_qdec_disable ( void  )

Function for disabling QDEC.

Note
Function asserts if module is uninitialized or disabled.

◆ nrfx_qdec_enable()

void nrfx_qdec_enable ( void  )

Function for enabling QDEC.

Note
Function asserts if module is uninitialized or enabled.

◆ nrfx_qdec_event_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_qdec_event_address_get ( nrf_qdec_event_t  event)

Function for returning the address of the specified QDEC event.

Parameters
eventQDEC event.
Returns
Event address.

◆ nrfx_qdec_init()

nrfx_err_t nrfx_qdec_init ( nrfx_qdec_config_t const *  p_config,
nrfx_qdec_event_handler_t  event_handler 
)

Function for initializing QDEC.

Parameters
[in]p_configPointer to the structure with the initial configuration.
[in]event_handlerEvent handler provided by the user. Must not be NULL.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_INVALID_STATEThe QDEC was already initialized.

◆ nrfx_qdec_task_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_qdec_task_address_get ( nrf_qdec_task_t  task)

Function for returning the address of the specified QDEC task.

Parameters
taskQDEC task.
Returns
Task address.

◆ nrfx_qdec_uninit()

void nrfx_qdec_uninit ( void  )

Function for uninitializing QDEC.

Note
Function asserts if module is uninitialized.

Documentation feedback | Developer Zone | Subscribe | Updated