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:121
@ NRF_QDEC_DBFEN_DISABLE
Definition: nrf_qdec.h:113
@ NRF_QDEC_SAMPLEPER_16384US
Definition: nrf_qdec.h:134
@ NRF_QDEC_REPORTPER_10
Definition: nrf_qdec.h:143
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 |
( |
|
id | ) |
|
Value:{ \
.p_reg = NRF_QDEC##id, \
}
#define NRFX_CONCAT_3(p1, p2, p3)
Macro for concatenating three tokens in macro expansion.
Definition: nrfx_common.h:155
Macro for creating an instance of the QDEC driver.
◆ 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()
void nrfx_qdec_disable |
( |
nrfx_qdec_t const * |
p_instance | ) |
|
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()
void nrfx_qdec_enable |
( |
nrfx_qdec_t const * |
p_instance | ) |
|
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
-
NRFX_SUCCESS | Initialization was successful. |
NRFX_ERROR_ALREADY | The driver is already initialized. |
NRFX_ERROR_INVALID_STATE | The driver is already initialized. Deprecated - use NRFX_ERROR_ALREADY instead. |
◆ 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_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
-
NRFX_SUCCESS | Reconfiguration was successful. |
NRFX_ERROR_BUSY | The driver is enabled and cannot be reconfigured. |
NRFX_ERROR_INVALID_STATE | 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()
void nrfx_qdec_uninit |
( |
nrfx_qdec_t const * |
p_instance | ) |
|
Function for uninitializing QDEC.
- Note
- Function asserts if module is uninitialized.
- Parameters
-
[in] | p_instance | Pointer to the driver instance structure. |