QEI driver APIs. More...
Macros | |
| #define | QEI_EVENT_WDOG_FLAG_MASK (1U << 31) |
| #define | QEI_EVENT_HOME_FLAG_MASK (1U << 30) |
| #define | QEI_EVENT_POSITIVE_COMPARE_FLAG_MASK (1U << 29) |
| #define | QEI_EVENT_Z_PHASE_FLAG_MASK (1U << 28) |
Typedefs | |
| typedef enum qei_z_count_inc_mode | qei_z_count_inc_mode_t |
| counting mode of Z-phase counter More... | |
| typedef enum qei_rotation_dir_cmp | qei_rotation_dir_cmp_t |
| motor rotation direction More... | |
| typedef enum qei_counter_type | qei_counter_type_t |
| counter type More... | |
| typedef enum qei_work_mode | qei_work_mode_t |
| qei work mode More... | |
| typedef enum qei_speed_his_type | qei_speed_his_type_t |
| speed history type More... | |
Enumerations | |
| enum | qei_z_count_inc_mode { qei_z_count_inc_on_z_input_assert = 0 , qei_z_count_inc_on_phase_count_max = 1 } |
| counting mode of Z-phase counter More... | |
| enum | qei_rotation_dir_cmp { qei_rotation_dir_cmp_positive = 0 , qei_rotation_dir_cmp_negative = 1 , qei_rotation_dir_cmp_ignore = 2 } |
| motor rotation direction More... | |
| enum | qei_counter_type { qei_counter_type_z = 0 , qei_counter_type_phase = 1 , qei_counter_type_speed = 2 , qei_counter_type_timer = 3 } |
| counter type More... | |
| enum | qei_work_mode { qei_work_mode_abz = 0 , qei_work_mode_pd = 1 , qei_work_mode_ud = 2 } |
| qei work mode More... | |
| enum | qei_speed_his_type { qei_speed_his0 = QEI_SPDHIS_SPDHIS0 , qei_speed_his1 = QEI_SPDHIS_SPDHIS1 , qei_speed_his2 = QEI_SPDHIS_SPDHIS2 , qei_speed_his3 = QEI_SPDHIS_SPDHIS3 } |
| speed history type More... | |
Functions | |
| static void | qei_wdog_enable (QEI_Type *qei_x) |
| enable qei watchdog More... | |
| static void | qei_wdog_disable (QEI_Type *qei_x) |
| disable qei watchdog More... | |
| static void | qei_wdog_config (QEI_Type *qei_x, uint32_t timeout, bool enable) |
| config watchdog More... | |
| static void | qei_phase_config (QEI_Type *qei_x, uint32_t phase_count, qei_z_count_inc_mode_t mode, bool z_calibrate) |
| static void | qei_phase_set_index (QEI_Type *qei_x, uint32_t phase_index) |
| set phase index More... | |
| static void | qei_output_trigger_event_enable (QEI_Type *qei_x, uint32_t event_mask) |
| enable trigger event More... | |
| static void | qei_output_trigger_event_disable (QEI_Type *qei_x, uint32_t event_mask) |
| disable trigger event More... | |
| static void | qei_load_read_trigger_event_enable (QEI_Type *qei_x, uint32_t event_mask) |
| enable load read trigger event More... | |
| static void | qei_load_read_trigger_event_disable (QEI_Type *qei_x, uint32_t event_mask) |
| disable load read trigger event More... | |
| static void | qei_z_cmp_set (QEI_Type *qei_x, uint32_t cmp) |
| set zcnt postion compare value More... | |
| static void | qei_speed_cmp_set (QEI_Type *qei_x, uint32_t cmp) |
| set spdcnt position compare value More... | |
| static void | qei_phase_cmp_set (QEI_Type *qei_x, uint32_t cmp, bool cmp_z, qei_rotation_dir_cmp_t rotation_dir) |
| set Phase comparator value More... | |
| static void | qei_clear_status (QEI_Type *qei_x, uint32_t mask) |
| clear qei status register More... | |
| static uint32_t | qei_get_status (QEI_Type *qei_x) |
| get qei status More... | |
| static bool | qei_get_bit_status (QEI_Type *qei_x, uint32_t mask) |
| get qei bit status More... | |
| static void | qei_irq_enable (QEI_Type *qei_x, uint32_t mask) |
| enable qei irq More... | |
| static void | qei_irq_disable (QEI_Type *qei_x, uint32_t mask) |
| disable qei irq More... | |
| static void | qei_dma_request_enable (QEI_Type *qei_x, uint32_t mask) |
| enable dma request More... | |
| static void | qei_dma_request_disable (QEI_Type *qei_x, uint32_t mask) |
| disable qei dma More... | |
| static uint32_t | qei_get_current_count (QEI_Type *qei_x, qei_counter_type_t type) |
| get current counter value More... | |
| static uint32_t | qei_get_current_phase_phcnt (QEI_Type *qei_x) |
| get current phcnt value More... | |
| static bool | qei_get_current_phase_astat (QEI_Type *qei_x) |
| get current a phase status More... | |
| static bool | qei_get_current_phase_bstat (QEI_Type *qei_x) |
| get current b phase status More... | |
| static bool | qei_get_current_phase_dir (QEI_Type *qei_x) |
| get current phase dir More... | |
| static uint32_t | qei_get_count_on_read_event (QEI_Type *qei_x, qei_counter_type_t type) |
| get read event count value More... | |
| static uint32_t | qei_get_count_on_snap0_event (QEI_Type *qei_x, qei_counter_type_t type) |
| read the value of each phase snapshot 0 counter More... | |
| static uint32_t | qei_get_count_on_snap1_event (QEI_Type *qei_x, qei_counter_type_t type) |
| read the value of each phase snapshot 1 counter More... | |
| static uint32_t | qei_get_speed_history (QEI_Type *qei_x, qei_speed_his_type_t hist_index) |
| get speed history More... | |
| static void | qei_load_counter_to_read_registers (QEI_Type *qei_x) |
| load phcnt, zcnt, spdcnt and tmrcnt into their read registers More... | |
| static void | qei_reset_counter_on_h_assert (QEI_Type *qei_x, uint32_t counter_mask) |
| reset spdcnt/phcnt/zcnt More... | |
| static void | qei_pause_counter_on_pause (QEI_Type *qei_x, uint32_t counter_mask) |
| pause spdcnt when PAUSE assert More... | |
| static void | qei_snap_enable (QEI_Type *qei_x) |
| load phcnt, zcnt, spdcnt and tmrcnt into their snap registers More... | |
| static void | qei_snap_disable (QEI_Type *qei_x) |
| disable snap More... | |
| static void | qei_counter_reset_assert (QEI_Type *qei_x) |
| reset zcnt, spdcnt and tmrcnt to 0 More... | |
| static void | qei_counter_reset_release (QEI_Type *qei_x) |
| qei counter reset release More... | |
| static void | qei_set_work_mode (QEI_Type *qei_x, qei_work_mode_t mode) |
| set work mode More... | |
QEI driver APIs.
| #define QEI_EVENT_HOME_FLAG_MASK (1U << 30) |
#include <drivers/inc/hpm_qei_drv.h>
home flag
| #define QEI_EVENT_POSITIVE_COMPARE_FLAG_MASK (1U << 29) |
#include <drivers/inc/hpm_qei_drv.h>
postion compare match flag
| #define QEI_EVENT_WDOG_FLAG_MASK (1U << 31) |
#include <drivers/inc/hpm_qei_drv.h>
watchdog flag
| #define QEI_EVENT_Z_PHASE_FLAG_MASK (1U << 28) |
#include <drivers/inc/hpm_qei_drv.h>
z input flag
| typedef enum qei_counter_type qei_counter_type_t |
#include <drivers/inc/hpm_qei_drv.h>
counter type
| typedef enum qei_rotation_dir_cmp qei_rotation_dir_cmp_t |
#include <drivers/inc/hpm_qei_drv.h>
motor rotation direction
| typedef enum qei_speed_his_type qei_speed_his_type_t |
#include <drivers/inc/hpm_qei_drv.h>
speed history type
| typedef enum qei_work_mode qei_work_mode_t |
#include <drivers/inc/hpm_qei_drv.h>
qei work mode
| typedef enum qei_z_count_inc_mode qei_z_count_inc_mode_t |
#include <drivers/inc/hpm_qei_drv.h>
counting mode of Z-phase counter
| enum qei_counter_type |
#include <drivers/inc/hpm_qei_drv.h>
counter type
| Enumerator | |
|---|---|
| qei_counter_type_z | Z counter |
| qei_counter_type_phase | Phase counter |
| qei_counter_type_speed | Speed counter |
| qei_counter_type_timer | Timer counter |
| enum qei_rotation_dir_cmp |
#include <drivers/inc/hpm_qei_drv.h>
motor rotation direction
| Enumerator | |
|---|---|
| qei_rotation_dir_cmp_positive | position compare need positive rotation |
| qei_rotation_dir_cmp_negative | position compare need negative rotation |
| qei_rotation_dir_cmp_ignore | ignore |
| enum qei_speed_his_type |
#include <drivers/inc/hpm_qei_drv.h>
speed history type
| Enumerator | |
|---|---|
| qei_speed_his0 | Speed history0 |
| qei_speed_his1 | Speed history1 |
| qei_speed_his2 | Speed history2 |
| qei_speed_his3 | Speed history3 |
| enum qei_work_mode |
#include <drivers/inc/hpm_qei_drv.h>
qei work mode
| Enumerator | |
|---|---|
| qei_work_mode_abz | Orthogonal decoder mode |
| qei_work_mode_pd | Directional (PD) mode |
| qei_work_mode_ud | Up and Down (UD) mode |
| enum qei_z_count_inc_mode |
#include <drivers/inc/hpm_qei_drv.h>
counting mode of Z-phase counter
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
clear qei status register
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
reset zcnt, spdcnt and tmrcnt to 0
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
qei counter reset release
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable qei dma
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
enable dma request
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get qei bit status
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
| true | or false |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get read event count value
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | type | qei_counter_type_t |
| counter | value |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
read the value of each phase snapshot 0 counter
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | type | qei_counter_type_t |
| counter | value |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
read the value of each phase snapshot 1 counter
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | type | qei_counter_type_t |
| counter | value |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get current counter value
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | type | qei_counter_type_t |
| counter | value |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get current a phase status
| qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get current b phase status
| qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get current phase dir
| qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get current phcnt value
| qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get speed history
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | hist_index | qei_speed_his_type_t |
| speed | history value
|
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
get qei status
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| qei | status: |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable qei irq
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
enable qei irq
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
load phcnt, zcnt, spdcnt and tmrcnt into their read registers
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable load read trigger event
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | event_mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
enable load read trigger event
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | event_mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable trigger event
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | event_mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
enable trigger event
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | event_mask |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
pause spdcnt when PAUSE assert
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | counter_mask |
|
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
set Phase comparator value
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | cmp | phcnt position compare value |
| [in] | cmp_z | 1- postion compare not include zcnt |
| [in] | rotation_dir | qei_rotation_dir_cmp_t |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | phase_count | maximum phcnt number, phcnt will rollover to 0 when it upcount to phmax |
| [in] | mode |
|
| [in] | z_calibrate | 1- phcnt will set to phidx when Z input assert |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
set phase index
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | phase_index | phcnt reset value, phcnt will reset to phidx when phcaliz set to 1 |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
reset spdcnt/phcnt/zcnt
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | counter_mask |
|
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
set work mode
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | mode | qei_work_mode_t |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable snap
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
load phcnt, zcnt, spdcnt and tmrcnt into their snap registers
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
set spdcnt position compare value
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | cmp | spdcnt position compare value |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
config watchdog
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | timeout | watchdog timeout time |
| [in] | enable |
|
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
disable qei watchdog
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
enable qei watchdog
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
|
inlinestatic |
#include <drivers/inc/hpm_qei_drv.h>
set zcnt postion compare value
| [in] | qei_x | QEI base address, HPM_QEIx(x=0...n) |
| [in] | cmp | zcnt postion compare value |