nRF51 SDK - S120 SoftDevice
|
Hardware abstraction layer for accessing the quadrature decoder (QDEC) peripheral. More...
Enumerations | |
enum | nrf_qdec_tasks_t { NRF_QDEC_TASKS_START = offsetof(NRF_QDEC_Type, TASKS_START), NRF_QDEC_TASKS_STOP = offsetof(NRF_QDEC_Type, TASKS_STOP), NRF_QDEC_TASKS_READCLRACC = offsetof(NRF_QDEC_Type, TASKS_READCLRACC) } |
QDEC tasks. More... | |
enum | nrf_qdec_events_t { NRF_QDEC_EVENTS_SAMPLERDY = offsetof(NRF_QDEC_Type, EVENTS_SAMPLERDY), NRF_QDEC_EVENTS_REPORTRDY = offsetof(NRF_QDEC_Type, EVENTS_REPORTRDY), NRF_QDEC_EVENTS_ACCOF = offsetof(NRF_QDEC_Type, EVENTS_ACCOF) } |
QDEC events. More... | |
enum | nrf_qdec_shorts_mask_t { NRF_QDEC_SHORTS_REPORTRDY_READCLRACC_MASK = QDEC_SHORTS_REPORTRDY_READCLRACC_Msk, NRF_QDEC_SHORTS_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_pio_t { NRF_QDEC_PIO_PSELLED, NRF_QDEC_PIO_PSELA, NRF_QDEC_PIO_PSELB } |
QDEC peripheral input/output pins. 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_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, NRF_QDEC_REPORTPER_DISABLED } |
Available report periods. More... | |
Functions | |
__STATIC_INLINE void | nrf_qdec_enable (void) |
Function for enabling QDEC. | |
__STATIC_INLINE void | nrf_qdec_disable (void) |
Function for disabling QDEC. | |
__STATIC_INLINE uint32_t | nrf_qdec_enable_get (void) |
Function for returning the enable state of QDEC. More... | |
__STATIC_INLINE void | nrf_qdec_int_enable (uint32_t qdec_int_mask) |
Function for enabling QDEC interrupts by mask. More... | |
__STATIC_INLINE void | nrf_qdec_int_disable (uint32_t qdec_int_mask) |
Function for disabling QDEC interrupts by mask. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_int_enable_check (nrf_qdec_int_mask_t qdec_int_mask) |
Function for getting the enabled interrupts of the QDEC. | |
__STATIC_INLINE void | nrf_qdec_dbfen_enable (void) |
Function for enabling the debouncing filter of the QED. | |
__STATIC_INLINE void | nrf_qdec_dbfen_disable (void) |
Function for disabling the debouncing filter of the QED. | |
__STATIC_INLINE uint32_t | nrf_qdec_dbfen_get (void) |
Function for getting the state of the QDEC's debouncing filter. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_pio_assign (nrf_qdec_pio_t qdec_pio, uint32_t pin_number) |
Function for assigning QDEC pins. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_pio_assignment_get (nrf_qdec_pio_t qdec_pio, uint32_t *p_pin_number) |
Function for retrieving the assigned pin number for a pio function. More... | |
__STATIC_INLINE void | nrf_qdec_task_set (nrf_qdec_tasks_t qdec_task) |
Function for setting a specific QDEC task. More... | |
__STATIC_INLINE uint32_t * | nrf_qdec_task_address_get (nrf_qdec_tasks_t qdec_task) |
Function for retrieving the address of a QDEC task register. More... | |
__STATIC_INLINE void | nrf_qdec_event_clear (nrf_qdec_events_t qdec_event) |
Function for clearing a specific QDEC event. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_event_check (nrf_qdec_events_t qdec_event) |
Function for retrieving the state of a specific QDEC event. More... | |
__STATIC_INLINE uint32_t * | nrf_qdec_event_address_get (nrf_qdec_events_t qdec_event) |
Function for retrieving the address of a specific QDEC event register. More... | |
__STATIC_INLINE void | nrf_qdec_shorts_set (uint32_t qdec_short_mask) |
Function for setting QDEC shortcuts. More... | |
__STATIC_INLINE void | nrf_qdec_shorts_clear (uint32_t qdec_short_mask) |
Function for clearing shortcuts of the QDEC by mask. More... | |
__STATIC_INLINE int32_t | nrf_qdec_sampleper_reg_get (void) |
Function for retrieving the value of QDEC's SAMPLEPER register. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_sampleper_to_value (uint32_t sampleper) |
Function for converting the value of QDEC's SAMPLE PERIOD to microseconds. More... | |
__STATIC_INLINE void | nrf_qdec_sampleper_set (nrf_qdec_sampleper_t sample_per) |
Function for setting the value of QDEC's SAMPLEPER register. More... | |
__STATIC_INLINE int32_t | nrf_qdec_sample_get (void) |
Function for retrieving the value of QDEC's SAMPLE register. More... | |
__STATIC_INLINE int32_t | nrf_qdec_acc_get (void) |
Function for retrieving the value of QDEC's ACC register. More... | |
__STATIC_INLINE int32_t | nrf_qdec_accread_get (void) |
Function for retrieving the value of QDEC's ACCREAD register. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_accdbl_get (void) |
Function for retrieving the value of QDEC's ACCDBL register. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_accdblread_get (void) |
Function for retrieving the value of QDEC's ACCDBLREAD register. More... | |
__STATIC_INLINE void | nrf_qdec_ledpre_set (uint32_t time_us) |
Function for setting how long the LED is switched on before sampling. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_ledpre_get (void) |
Function for retrieving how long the LED is switched on before sampling. More... | |
__STATIC_INLINE void | nrf_qdec_reportper_set (nrf_qdec_reportper_t reportper) |
Function for setting the report period (in samples). More... | |
__STATIC_INLINE uint32_t | nrf_qdec_reportper_reg_get (void) |
Function for retrieving the report period. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_reportper_to_value (uint32_t reportper) |
Function for retrieving the value of QDEC's SAMPLEPER register. More... | |
__STATIC_INLINE void | nrf_qdec_ledpol_set (nrf_qdec_ledpol_t pol) |
Function for setting the active level for the LED. More... | |
__STATIC_INLINE uint32_t | nrf_qdec_ledpol_get (void) |
Function for retrieving the active level for the LED. More... | |
Hardware abstraction layer for accessing the quadrature decoder (QDEC) peripheral.
enum nrf_qdec_dbfen_t |
enum nrf_qdec_enable_t |
enum nrf_qdec_events_t |
enum nrf_qdec_int_mask_t |
enum nrf_qdec_ledpol_t |
enum nrf_qdec_pio_t |
enum nrf_qdec_reportper_t |
Available report periods.
enum nrf_qdec_sampleper_t |
Available sampling periods.
enum nrf_qdec_tasks_t |
__STATIC_INLINE int32_t nrf_qdec_acc_get | ( | void | ) |
Function for retrieving the value of QDEC's ACC register.
__STATIC_INLINE uint32_t nrf_qdec_accdbl_get | ( | void | ) |
Function for retrieving the value of QDEC's ACCDBL register.
__STATIC_INLINE uint32_t nrf_qdec_accdblread_get | ( | void | ) |
Function for retrieving the value of QDEC's ACCDBLREAD register.
__STATIC_INLINE int32_t nrf_qdec_accread_get | ( | void | ) |
Function for retrieving the value of QDEC's ACCREAD register.
__STATIC_INLINE uint32_t nrf_qdec_dbfen_get | ( | void | ) |
Function for getting the state of the QDEC's debouncing filter.
NRF_QDEC_DBFEN_DISABLE | If the debouncing filter is disabled. |
NRF_QDEC_DBFEN_ENABLE | If the debouncing filter is enabled. |
__STATIC_INLINE uint32_t nrf_qdec_enable_get | ( | void | ) |
Function for returning the enable state of QDEC.
__STATIC_INLINE uint32_t* nrf_qdec_event_address_get | ( | nrf_qdec_events_t | qdec_event | ) |
Function for retrieving the address of a specific QDEC event register.
[in] | qdec_event | QDEC event. |
__STATIC_INLINE uint32_t nrf_qdec_event_check | ( | nrf_qdec_events_t | qdec_event | ) |
Function for retrieving the state of a specific QDEC event.
__STATIC_INLINE void nrf_qdec_event_clear | ( | nrf_qdec_events_t | qdec_event | ) |
Function for clearing a specific QDEC event.
[in] | qdec_event | QDEC event to clear. |
__STATIC_INLINE void nrf_qdec_int_disable | ( | uint32_t | qdec_int_mask | ) |
Function for disabling QDEC interrupts by mask.
[in] | qdec_int_mask | Sources of the interrupts to disable. |
__STATIC_INLINE void nrf_qdec_int_enable | ( | uint32_t | qdec_int_mask | ) |
Function for enabling QDEC interrupts by mask.
[in] | qdec_int_mask | Sources of the interrupts to enable. |
__STATIC_INLINE uint32_t nrf_qdec_ledpol_get | ( | void | ) |
Function for retrieving the active level for the LED.
__STATIC_INLINE void nrf_qdec_ledpol_set | ( | nrf_qdec_ledpol_t | pol | ) |
Function for setting the active level for the LED.
[in] | pol | Active level for the LED. |
__STATIC_INLINE uint32_t nrf_qdec_ledpre_get | ( | void | ) |
Function for retrieving how long the LED is switched on before sampling.
time_us | Time (in microseconds) how long the LED is switched on before sampling. |
__STATIC_INLINE void nrf_qdec_ledpre_set | ( | uint32_t | time_us | ) |
Function for setting how long the LED is switched on before sampling.
[in] | time_us | Time (in microseconds) how long the LED is switched on before sampling. |
__STATIC_INLINE uint32_t nrf_qdec_pio_assign | ( | nrf_qdec_pio_t | qdec_pio, |
uint32_t | pin_number | ||
) |
Function for assigning QDEC pins.
[in] | qdec_pio | Function of the pin. |
[in] | pin_number | Pin number. |
NRF_SUCCESS | If the function could be assigned to the pin successfully. |
NRF_ERROR_INVALID_PARAM | If the input parameters are invalid. |
__STATIC_INLINE uint32_t nrf_qdec_pio_assignment_get | ( | nrf_qdec_pio_t | qdec_pio, |
uint32_t * | p_pin_number | ||
) |
Function for retrieving the assigned pin number for a pio function.
[in] | qdec_pio | Function of the the pin. |
[out] | p_pin_number | Pointer to the pin number. |
NRF_SUCCESS | If the pin number could be retrieved successfully. |
NRF_ERROR_INVALID_PARAM | If the input parameter is invalid. |
NRF_ERROR_NULL | If no pin number is assigned. |
__STATIC_INLINE uint32_t nrf_qdec_reportper_reg_get | ( | void | ) |
Function for retrieving the report period.
reportper | Number of samples as encoded in the register. |
__STATIC_INLINE void nrf_qdec_reportper_set | ( | nrf_qdec_reportper_t | reportper | ) |
Function for setting the report period (in samples).
[in] | reportper | Number of samples. |
__STATIC_INLINE uint32_t nrf_qdec_reportper_to_value | ( | uint32_t | reportper | ) |
Function for retrieving the value of QDEC's SAMPLEPER register.
[in] | reportper | Reportper to be converted to amount of samples per report. |
__STATIC_INLINE int32_t nrf_qdec_sample_get | ( | void | ) |
Function for retrieving the value of QDEC's SAMPLE register.
__STATIC_INLINE int32_t nrf_qdec_sampleper_reg_get | ( | void | ) |
Function for retrieving the value of QDEC's SAMPLEPER register.
__STATIC_INLINE void nrf_qdec_sampleper_set | ( | nrf_qdec_sampleper_t | sample_per | ) |
Function for setting the value of QDEC's SAMPLEPER register.
[in] | sample_per | Sampling period. |
__STATIC_INLINE uint32_t nrf_qdec_sampleper_to_value | ( | uint32_t | sampleper | ) |
Function for converting the value of QDEC's SAMPLE PERIOD to microseconds.
sampling | period in microseconds. |
__STATIC_INLINE void nrf_qdec_shorts_clear | ( | uint32_t | qdec_short_mask | ) |
Function for clearing shortcuts of the QDEC by mask.
[in] | qdec_short_mask | QDEC shortcute to be cleared. |
__STATIC_INLINE void nrf_qdec_shorts_set | ( | uint32_t | qdec_short_mask | ) |
Function for setting QDEC shortcuts.
[in] | qdec_short_mask | QDEC shortcut by mask. |
__STATIC_INLINE uint32_t* nrf_qdec_task_address_get | ( | nrf_qdec_tasks_t | qdec_task | ) |
Function for retrieving the address of a QDEC task register.
[in] | qdec_task | QDEC task. |
__STATIC_INLINE void nrf_qdec_task_set | ( | nrf_qdec_tasks_t | qdec_task | ) |
Function for setting a specific QDEC task.
[in] | qdec_task | QDEC task to be set. |