nRF51 SDK - S210 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Quadrature decoder (QDEC) driver. More...

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_tasks_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_events_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 = QDEC_CONFIG_REPORTPER, \
.sampleper = QDEC_CONFIG_SAMPLEPER, \
.psela = QDEC_CONFIG_PIO_A, \
.pselb = QDEC_CONFIG_PIO_B, \
.pselled = QDEC_CONFIG_PIO_LED, \
.ledpre = QDEC_CONFIG_LEDPRE, \
.ledpol = 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]eventQDEC 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_accPointer to store accumulated transitions.
[out]p_accdblPointer 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_events_t  event,
uint32_t *  p_event 
)

Function for returning the address of a specific timer event.

Parameters
[in]eventQDEC event.
[out]p_eventEvent 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_configPointer to configuration parameters.
[in]event_handlerEvent handler function.
Return values
NRF_SUCCESSIf initialization was successful.
NRF_ERROR_INVALID_PARAMIf invalid parameters were supplied.
NRF_ERROR_INVALID_STATEIf QDEC was already initialized.
void nrf_drv_qdec_task_address_get ( nrf_qdec_tasks_t  task,
uint32_t *  p_task 
)

Function for returning the address of a specific timer task.

Parameters
[in]taskQDEC task.
[out]p_taskTask address.
void nrf_drv_qdec_uninit ( void  )

Function for uninitializing QDEC.

Note
Function asserts if module is uninitialized.