Quadrature Decoder (QDEC) peripheral driver.
More...
Quadrature Decoder (QDEC) peripheral driver.
◆ NRFX_QDEC_DEFAULT_CONFIG
| #define NRFX_QDEC_DEFAULT_CONFIG |
( |
| _pin_a, |
|
|
| _pin_b, |
|
|
| _pin_led ) |
Value:{ \
.psela = _pin_a, \
.pselb = _pin_b, \
.pselled = _pin_led, \
.ledpre = 500, \
.sample_inten = false, \
.reportper_inten = true, \
.interrupt_priority = NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY, \
}
@ NRF_QDEC_LEPOL_ACTIVE_HIGH
Definition nrf_qdec.h:161
@ NRF_QDEC_DBFEN_DISABLE
Definition nrf_qdec.h:153
@ NRF_QDEC_SAMPLEPER_16384US
Definition nrf_qdec.h:174
@ NRF_QDEC_REPORTPER_10
Definition nrf_qdec.h:188
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_a | Pin for A encoder channel input. |
| [in] | _pin_b | Pin for B encoder channel input. |
| [in] | _pin_led | Pin for LED output. |
◆ NRFX_QDEC_INSTANCE
| #define NRFX_QDEC_INSTANCE |
( |
| reg | ) |
|
Value:{ \
.p_reg = (NRF_QDEC_Type *)reg, \
.cb = {0}, \
}
Macro for creating a QDEC driver instance.
◆ nrfx_qdec_event_handler_t
QDEC event handler.
- Parameters
-
| [in] | event | QDEC event structure. |
| [in] | p_context | Context passed to event handler. |
◆ nrfx_qdec_accumulators_read()
| void nrfx_qdec_accumulators_read |
( |
nrfx_qdec_t const * | p_instance, |
|
|
int32_t * | p_acc, |
|
|
uint32_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
-
| [in] | p_instance | Pointer to the driver instance structure. |
| [out] | p_acc | Pointer to store the accumulated transitions. |
| [out] | p_accdbl | Pointer to store the accumulated double transitions. |
◆ nrfx_qdec_disable()
Function for disabling QDEC.
- Note
- Function asserts if module is uninitialized or disabled.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
◆ nrfx_qdec_enable()
Function for enabling QDEC.
- Note
- Function asserts if module is uninitialized or enabled.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
◆ nrfx_qdec_event_address_get()
Function for returning the address of the specified QDEC event.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | event | QDEC event. |
- Returns
- Event address.
◆ nrfx_qdec_init()
Function for initializing QDEC.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | p_config | Pointer to the structure with the initial configuration. |
| [in] | handler | Event handler provided by the user. Must not be NULL. |
| [in] | p_context | Context passed to event handler. |
- Return values
-
| 0 | Initialization was successful. |
| -EALREADY | The driver is already initialized. |
◆ nrfx_qdec_init_check()
| bool nrfx_qdec_init_check |
( |
nrfx_qdec_t const * | p_instance | ) |
|
Function for checking if the QDEC driver instance is initialized.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
- Return values
-
| true | Instance is already initialized. |
| false | Instance is not initialized. |
◆ nrfx_qdec_irq_handler()
Driver interrupt handler.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
◆ nrfx_qdec_reconfigure()
Function for reconfiguring QDEC.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | p_config | Pointer to the structure with the configuration. |
- Return values
-
| 0 | Reconfiguration was successful. |
| -EBUSY | The driver is enabled and cannot be reconfigured. |
| -EINPROGRESS | The driver is uninitialized. |
◆ nrfx_qdec_task_address_get()
Function for returning the address of the specified QDEC task.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | task | QDEC task. |
- Returns
- Task address.
◆ nrfx_qdec_uninit()
Function for uninitializing QDEC.
- Note
- Function asserts if module is uninitialized.
- Parameters
-
| [in] | p_instance | Pointer to the driver instance structure. |