Hardware access layer for managing the Quadrature Decoder (QDEC) peripheral. More...
Macros | |
#define | NRF_QDEC_PIN_NOT_CONNECTED 0xFFFFFFFF |
This value can be provided as a parameter for the nrf_qdec_pins_set function call to specify that a LED signal shall not be use by the QDEC and connected to a physical pin. | |
#define | NRF_QDEC_HAS_TASK_RDCLRACC 1 |
Presence of the RDCLRACC task. | |
#define | NRF_QDEC_HAS_TASK_RDCLRDBL 1 |
Presence of the RDCLRDBL task. | |
#define | NRF_QDEC_HAS_EVENT_DBLRDY 1 |
Presence of the DBLRDY event. | |
#define | NRF_QDEC_HAS_EVENT_STOPPED 1 |
Presence of the STOPPED event. | |
#define | NRF_QDEC_LEDPRE_DEFAULT 0x10 |
Reset value of LEDPRE register. | |
Enumerations | |
enum | nrf_qdec_task_t { NRF_QDEC_TASK_START = offsetof(NRF_QDEC_Type, TASKS_START) , NRF_QDEC_TASK_STOP = offsetof(NRF_QDEC_Type, TASKS_STOP) , NRF_QDEC_TASK_READCLRACC = offsetof(NRF_QDEC_Type, TASKS_READCLRACC) , NRF_QDEC_TASK_RDCLRACC = offsetof(NRF_QDEC_Type, TASKS_RDCLRACC) , NRF_QDEC_TASK_RDCLRDBL = offsetof(NRF_QDEC_Type, TASKS_RDCLRDBL) } |
QDEC tasks. More... | |
enum | nrf_qdec_event_t { NRF_QDEC_EVENT_SAMPLERDY = offsetof(NRF_QDEC_Type, EVENTS_SAMPLERDY) , NRF_QDEC_EVENT_REPORTRDY = offsetof(NRF_QDEC_Type, EVENTS_REPORTRDY) , NRF_QDEC_EVENT_ACCOF = offsetof(NRF_QDEC_Type, EVENTS_ACCOF) , NRF_QDEC_EVENT_DBLRDY = offsetof(NRF_QDEC_Type, EVENTS_DBLRDY) , NRF_QDEC_EVENT_STOPPED = offsetof(NRF_QDEC_Type, EVENTS_STOPPED) } |
QDEC events. More... | |
enum | nrf_qdec_short_mask_t { NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK = QDEC_SHORTS_REPORTRDY_READCLRACC_Msk , NRF_QDEC_SHORT_SAMPLERDY_STOP_MASK = QDEC_SHORTS_SAMPLERDY_STOP_Msk } |
QDEC shortcuts. More... | |
enum | nrf_qdec_int_mask_t { NRF_QDEC_INT_SAMPLERDY_MASK = QDEC_INTENSET_SAMPLERDY_Msk , NRF_QDEC_INT_REPORTRDY_MASK = QDEC_INTENSET_REPORTRDY_Msk , NRF_QDEC_INT_ACCOF_MASK = QDEC_INTENSET_ACCOF_Msk } |
QDEC interrupts. More... | |
enum | nrf_qdec_enable_t { NRF_QDEC_DISABLE = QDEC_ENABLE_ENABLE_Disabled , NRF_QDEC_ENABLE = QDEC_ENABLE_ENABLE_Enabled } |
States of the enable bit. More... | |
enum | nrf_qdec_dbfen_t { NRF_QDEC_DBFEN_DISABLE = QDEC_DBFEN_DBFEN_Disabled , NRF_QDEC_DBFEN_ENABLE = QDEC_DBFEN_DBFEN_Enabled } |
States of the debounce filter enable bit. More... | |
enum | nrf_qdec_ledpol_t { NRF_QDEC_LEPOL_ACTIVE_LOW = QDEC_LEDPOL_LEDPOL_ActiveLow , NRF_QDEC_LEPOL_ACTIVE_HIGH = QDEC_LEDPOL_LEDPOL_ActiveHigh } |
Active LED polarity. More... | |
enum | nrf_qdec_sampleper_t { NRF_QDEC_SAMPLEPER_128US = QDEC_SAMPLEPER_SAMPLEPER_128us , NRF_QDEC_SAMPLEPER_256US = QDEC_SAMPLEPER_SAMPLEPER_256us , NRF_QDEC_SAMPLEPER_512US = QDEC_SAMPLEPER_SAMPLEPER_512us , NRF_QDEC_SAMPLEPER_1024US = QDEC_SAMPLEPER_SAMPLEPER_1024us , NRF_QDEC_SAMPLEPER_2048US = QDEC_SAMPLEPER_SAMPLEPER_2048us , NRF_QDEC_SAMPLEPER_4096US = QDEC_SAMPLEPER_SAMPLEPER_4096us , NRF_QDEC_SAMPLEPER_8192US = QDEC_SAMPLEPER_SAMPLEPER_8192us , NRF_QDEC_SAMPLEPER_16384US = QDEC_SAMPLEPER_SAMPLEPER_16384us } |
Available sampling periods. More... | |
enum | nrf_qdec_reportper_t { NRF_QDEC_REPORTPER_1 = QDEC_REPORTPER_REPORTPER_1Smpl , NRF_QDEC_REPORTPER_10 = QDEC_REPORTPER_REPORTPER_10Smpl , NRF_QDEC_REPORTPER_40 = QDEC_REPORTPER_REPORTPER_40Smpl , NRF_QDEC_REPORTPER_80 = QDEC_REPORTPER_REPORTPER_80Smpl , NRF_QDEC_REPORTPER_120 = QDEC_REPORTPER_REPORTPER_120Smpl , NRF_QDEC_REPORTPER_160 = QDEC_REPORTPER_REPORTPER_160Smpl , NRF_QDEC_REPORTPER_200 = QDEC_REPORTPER_REPORTPER_200Smpl , NRF_QDEC_REPORTPER_240 = QDEC_REPORTPER_REPORTPER_240Smpl , NRF_QDEC_REPORTPER_280 = QDEC_REPORTPER_REPORTPER_280Smpl } |
Available report periods. More... | |
Functions | |
NRF_STATIC_INLINE void | nrf_qdec_enable (NRF_QDEC_Type *p_reg) |
Function for enabling QDEC. | |
NRF_STATIC_INLINE void | nrf_qdec_disable (NRF_QDEC_Type *p_reg) |
Function for disabling QDEC. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_enable_get (NRF_QDEC_Type const *p_reg) |
Function for returning the enable state of QDEC. | |
NRF_STATIC_INLINE void | nrf_qdec_int_enable (NRF_QDEC_Type *p_reg, uint32_t mask) |
Function for enabling QDEC interrupts by mask. | |
NRF_STATIC_INLINE void | nrf_qdec_int_disable (NRF_QDEC_Type *p_reg, uint32_t mask) |
Function for disabling QDEC interrupts by mask. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_int_enable_check (NRF_QDEC_Type const *p_reg, uint32_t mask) |
Function for checking if the specified interrupts are enabled. | |
NRF_STATIC_INLINE void | nrf_qdec_dbfen_enable (NRF_QDEC_Type *p_reg) |
Function for enabling the QDEC debouncing filter. | |
NRF_STATIC_INLINE void | nrf_qdec_dbfen_disable (NRF_QDEC_Type *p_reg) |
Function for disabling the QDEC debouncing filter. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_dbfen_get (NRF_QDEC_Type const *p_reg) |
Function for getting the state of the QDEC debouncing filter. | |
NRF_STATIC_INLINE void | nrf_qdec_pins_set (NRF_QDEC_Type *p_reg, uint32_t phase_a_pin, uint32_t phase_b_pin, uint32_t led_pin) |
Function for configuring QDEC pins. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_phase_a_pin_get (NRF_QDEC_Type const *p_reg) |
Function for getting the Phase A pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_phase_b_pin_get (NRF_QDEC_Type const *p_reg) |
Function for getting the Phase B pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_led_pin_get (NRF_QDEC_Type const *p_reg) |
Function for getting the LED pin selection. | |
NRF_STATIC_INLINE void | nrf_qdec_task_trigger (NRF_QDEC_Type *p_reg, nrf_qdec_task_t task) |
Function for setting the specified QDEC task. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_task_address_get (NRF_QDEC_Type const *p_reg, nrf_qdec_task_t task) |
Function for retrieving the address of a QDEC task register. | |
NRF_STATIC_INLINE void | nrf_qdec_event_clear (NRF_QDEC_Type *p_reg, nrf_qdec_event_t event) |
Function for clearing the specified QDEC event. | |
NRF_STATIC_INLINE bool | nrf_qdec_event_check (NRF_QDEC_Type const *p_reg, nrf_qdec_event_t event) |
Function for getting the state of the specified QDEC event. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_event_address_get (NRF_QDEC_Type const *p_reg, nrf_qdec_event_t event) |
Function for retrieving the address of the specified QDEC event register. | |
NRF_STATIC_INLINE void | nrf_qdec_shorts_enable (NRF_QDEC_Type *p_reg, uint32_t mask) |
Function for setting QDEC shortcuts. | |
NRF_STATIC_INLINE void | nrf_qdec_shorts_disable (NRF_QDEC_Type *p_reg, uint32_t mask) |
Function for clearing shortcuts of the QDEC by mask. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_sampleper_to_value (nrf_qdec_sampleper_t sampleper) |
Function for converting return value of the nrf_qdec_sampleper_get function to microseconds. | |
NRF_STATIC_INLINE void | nrf_qdec_sampleper_set (NRF_QDEC_Type *p_reg, nrf_qdec_sampleper_t sampleper) |
Function for setting value of the QDEC sampling period. | |
NRF_STATIC_INLINE nrf_qdec_sampleper_t | nrf_qdec_sampleper_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC sampling period. | |
NRF_STATIC_INLINE int32_t | nrf_qdec_sample_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC SAMPLE register. | |
NRF_STATIC_INLINE int32_t | nrf_qdec_acc_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC ACC register. | |
NRF_STATIC_INLINE int32_t | nrf_qdec_accread_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC ACCREAD register. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_accdbl_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC ACCDBL register. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_accdblread_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving value of the QDEC ACCDBLREAD register. | |
NRF_STATIC_INLINE void | nrf_qdec_ledpre_set (NRF_QDEC_Type *p_reg, uint32_t time_us) |
Function for setting delay time between setting LED active state and start sampling. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_ledpre_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving how long the LED is switched on before sampling. | |
NRF_STATIC_INLINE void | nrf_qdec_reportper_set (NRF_QDEC_Type *p_reg, nrf_qdec_reportper_t reportper) |
Function for setting the report period (in samples). | |
NRF_STATIC_INLINE nrf_qdec_reportper_t | nrf_qdec_reportper_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving the report period. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_reportper_to_value (nrf_qdec_reportper_t reportper) |
Function for retrieving the value of QDEC SAMPLEPER register. | |
NRF_STATIC_INLINE void | nrf_qdec_ledpol_set (NRF_QDEC_Type *p_reg, nrf_qdec_ledpol_t pol) |
Function for setting the active level for the LED. | |
NRF_STATIC_INLINE uint32_t | nrf_qdec_ledpol_get (NRF_QDEC_Type const *p_reg) |
Function for retrieving the active level for the LED. | |
Hardware access layer for managing the Quadrature Decoder (QDEC) peripheral.
enum nrf_qdec_dbfen_t |
enum nrf_qdec_enable_t |
enum nrf_qdec_event_t |
QDEC events.
enum nrf_qdec_int_mask_t |
enum nrf_qdec_ledpol_t |
enum nrf_qdec_reportper_t |
Available report periods.
enum nrf_qdec_sampleper_t |
Available sampling periods.
enum nrf_qdec_task_t |
QDEC tasks.
NRF_STATIC_INLINE int32_t nrf_qdec_acc_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC ACC register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_accdbl_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC ACCDBL register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_accdblread_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC ACCDBLREAD register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE int32_t nrf_qdec_accread_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC ACCREAD register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_dbfen_disable | ( | NRF_QDEC_Type * | p_reg | ) |
Function for disabling the QDEC debouncing filter.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_dbfen_enable | ( | NRF_QDEC_Type * | p_reg | ) |
Function for enabling the QDEC debouncing filter.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_dbfen_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for getting the state of the QDEC debouncing filter.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_QDEC_DBFEN_DISABLE | The debouncing filter is disabled. |
NRF_QDEC_DBFEN_ENABLE | The debouncing filter is enabled. |
NRF_STATIC_INLINE void nrf_qdec_disable | ( | NRF_QDEC_Type * | p_reg | ) |
Function for disabling QDEC.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_enable | ( | NRF_QDEC_Type * | p_reg | ) |
Function for enabling QDEC.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_enable_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for returning the enable state of QDEC.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_event_address_get | ( | NRF_QDEC_Type const * | p_reg, |
nrf_qdec_event_t | event | ||
) |
Function for retrieving the address of the specified QDEC event register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | QDEC event to get its address. |
NRF_STATIC_INLINE bool nrf_qdec_event_check | ( | NRF_QDEC_Type const * | p_reg, |
nrf_qdec_event_t | event | ||
) |
Function for getting the state of the specified QDEC event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | QDEC event to be checked. |
NRF_STATIC_INLINE void nrf_qdec_event_clear | ( | NRF_QDEC_Type * | p_reg, |
nrf_qdec_event_t | event | ||
) |
Function for clearing the specified QDEC event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | QDEC event to be cleared. |
NRF_STATIC_INLINE void nrf_qdec_int_disable | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling QDEC interrupts by mask.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be disabled. Use nrf_qdec_int_mask_t values for bit masking. |
NRF_STATIC_INLINE void nrf_qdec_int_enable | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling QDEC interrupts by mask.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be enabled. Use nrf_qdec_int_mask_t values for bit masking. |
NRF_STATIC_INLINE uint32_t nrf_qdec_int_enable_check | ( | NRF_QDEC_Type const * | p_reg, |
uint32_t | mask | ||
) |
Function for checking if the specified interrupts are enabled.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be checked. Use nrf_qdec_int_mask_t values for bit masking. |
NRF_STATIC_INLINE uint32_t nrf_qdec_led_pin_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for getting the LED pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_ledpol_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving the active level for the LED.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_ledpol_set | ( | NRF_QDEC_Type * | p_reg, |
nrf_qdec_ledpol_t | pol | ||
) |
Function for setting the active level for the LED.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | pol | Level of the active signal of the LED. |
NRF_STATIC_INLINE uint32_t nrf_qdec_ledpre_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving how long the LED is switched on before sampling.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_ledpre_set | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | time_us | ||
) |
Function for setting delay time between setting LED active state and start sampling.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | time_us | Delay time (in microseconds) between setting LED active state and start sampling. |
NRF_STATIC_INLINE uint32_t nrf_qdec_phase_a_pin_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for getting the Phase A pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_qdec_phase_b_pin_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for getting the Phase B pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_pins_set | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | phase_a_pin, | ||
uint32_t | phase_b_pin, | ||
uint32_t | led_pin | ||
) |
Function for configuring QDEC pins.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | phase_a_pin | Phase A pin number. |
[in] | phase_b_pin | Phase B pin number. |
[in] | led_pin | LED pin number. |
NRF_STATIC_INLINE nrf_qdec_reportper_t nrf_qdec_reportper_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving the report period.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_reportper_set | ( | NRF_QDEC_Type * | p_reg, |
nrf_qdec_reportper_t | reportper | ||
) |
Function for setting the report period (in samples).
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | reportper | The number of samples. |
NRF_STATIC_INLINE uint32_t nrf_qdec_reportper_to_value | ( | nrf_qdec_reportper_t | reportper | ) |
Function for retrieving the value of QDEC SAMPLEPER register.
[in] | reportper | Reportper to be converted to amount of samples per report. |
NRF_STATIC_INLINE int32_t nrf_qdec_sample_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC SAMPLE register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE nrf_qdec_sampleper_t nrf_qdec_sampleper_get | ( | NRF_QDEC_Type const * | p_reg | ) |
Function for retrieving value of the QDEC sampling period.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_qdec_sampleper_set | ( | NRF_QDEC_Type * | p_reg, |
nrf_qdec_sampleper_t | sampleper | ||
) |
Function for setting value of the QDEC sampling period.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | sampleper | The sampling period. |
NRF_STATIC_INLINE uint32_t nrf_qdec_sampleper_to_value | ( | nrf_qdec_sampleper_t | sampleper | ) |
Function for converting return value of the nrf_qdec_sampleper_get function to microseconds.
[in] | sampleper | The sampling period. |
NRF_STATIC_INLINE void nrf_qdec_shorts_disable | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for clearing shortcuts of the QDEC by mask.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of QDEC shortcuts to be cleared. |
NRF_STATIC_INLINE void nrf_qdec_shorts_enable | ( | NRF_QDEC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for setting QDEC shortcuts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of QDEC shortcuts to be set. |
NRF_STATIC_INLINE uint32_t nrf_qdec_task_address_get | ( | NRF_QDEC_Type const * | p_reg, |
nrf_qdec_task_t | task | ||
) |
Function for retrieving the address of a QDEC task register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | QDEC task to get its address. |
NRF_STATIC_INLINE void nrf_qdec_task_trigger | ( | NRF_QDEC_Type * | p_reg, |
nrf_qdec_task_t | task | ||
) |
Function for setting the specified QDEC task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | QDEC task to be triggered. |