| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Macros | Typedefs | Functions
QDEC driver
QDEC HAL and driver

Quadrature decoder (QDEC) driver. More...

## Modules
| QDEC peripheral driver configuration

## Data Structures
struct | nrf_drv_qdec_config_t
| QDEC configuration structure. More...
struct | nrf_drv_qdec_sample_data_evt_t
| QDEC sample event data. More...
struct | nrf_drv_qdec_report_data_evt_t
| QDEC report event data. More...
struct | nrf_drv_qdec_event_t
| QDEC event handler structure. More...

## Macros
#define | NRF_DRV_QDEC_DEFAULT_CONFIG
| QDEC default configuration. More...

## Typedefs
typedef void(* | qdec_event_handler_t )(nrf_drv_qdec_event_t event)
| QDEC event handler. More...

## Functions
ret_code_t | nrf_drv_qdec_init (nrf_drv_qdec_config_t const *p_config, qdec_event_handler_t event_handler)
| Function for initializing QDEC. More...
void | nrf_drv_qdec_uninit (void)
| Function for uninitializing QDEC. More...
void | nrf_drv_qdec_enable (void)
| Function for enabling QDEC. More...
void | nrf_drv_qdec_disable (void)
| Function for disabling QDEC. More...
void | nrf_drv_qdec_accumulators_read (int16_t *p_acc, int16_t *p_accdbl)
| Function for reading accumulated transitions QDEC. More...
void | nrf_drv_qdec_task_address_get (nrf_qdec_task_t task, uint32_t *p_task)
| Function for returning the address of a specific timer task. More...
void | nrf_drv_qdec_event_address_get (nrf_qdec_event_t event, uint32_t *p_event)
| Function for returning the address of a specific timer event. More...

## Detailed Description

Quadrature decoder (QDEC) driver.

## Macro Definition Documentation

#define NRF_DRV_QDEC_DEFAULT_CONFIG

Value:
{ \
.reportper = (nrf_qdec_reportper_t)QDEC_CONFIG_REPORTPER, \
.sampleper = (nrf_qdec_sampleper_t)QDEC_CONFIG_SAMPLEPER, \
.psela = QDEC_CONFIG_PIO_A, \
.pselb = QDEC_CONFIG_PIO_B, \
.pselled = QDEC_CONFIG_PIO_LED, \
.ledpre = QDEC_CONFIG_LEDPRE, \
.ledpol = (nrf_qdec_ledpol_t)QDEC_CONFIG_LEDPOL, \
.interrupt_priority = QDEC_CONFIG_IRQ_PRIORITY, \
.dbfen = QDEC_CONFIG_DBFEN, \
.sample_inten = QDEC_CONFIG_SAMPLE_INTEN \
}

QDEC default configuration.

## Typedef Documentation

typedef void(* qdec_event_handler_t)(nrf_drv_qdec_event_t event)

QDEC event handler.

Parameters

  [in] | event | QDEC event structure.

## Function Documentation

void nrf_drv_qdec_accumulators_read | ( | int16_t * | p_acc,
|  | int16_t * | p_accdbl
| ) |  |

Function for reading accumulated transitions QDEC.

Note
  Function asserts if module is not enabled.
  Accumulators are cleared after reading.

Parameters

  [out] | p_acc | Pointer to store accumulated transitions.
  [out] | p_accdbl | Pointer to store accumulated double transitions.

void nrf_drv_qdec_disable | ( | void |  | ) |

Function for disabling QDEC.

Note
  Function asserts if module is uninitialized or disabled.

void nrf_drv_qdec_enable | ( | void |  | ) |

Function for enabling QDEC.

Note
  Function asserts if module is uninitialized or enabled.

void nrf_drv_qdec_event_address_get | ( | nrf_qdec_event_t | event,
|  | uint32_t * | p_event
| ) |  |

Function for returning the address of a specific timer event.

Parameters

  [in] | event | QDEC event.
  [out] | p_event | Event address.

ret_code_t nrf_drv_qdec_init | ( | nrf_drv_qdec_config_t const * | p_config,
|  | qdec_event_handler_t | event_handler
| ) |  |

Function for initializing QDEC.

Parameters

  [in] | p_config | Pointer to configuration parameters.
  [in] | event_handler | Event handler function.

Return values

  NRF_SUCCESS | If initialization was successful.
  NRF_ERROR_INVALID_PARAM | If invalid parameters were supplied.
  NRF_ERROR_INVALID_STATE | If QDEC was already initialized.

void nrf_drv_qdec_task_address_get | ( | nrf_qdec_task_t | task,
|  | uint32_t * | p_task
| ) |  |

Function for returning the address of a specific timer task.

Parameters

  [in] | task | QDEC task.
  [out] | p_task | Task address.

void nrf_drv_qdec_uninit | ( | void |  | ) |

Function for uninitializing QDEC.

Note
  Function asserts if module is uninitialized.