HPM SDK
HPMicro Software Development Kit
hpm_qeiv2_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023-2025 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_QEIV2_DRV_H
9 #define HPM_QEIV2_DRV_H
10 
11 #include "hpm_common.h"
12 #include "hpm_soc_ip_feature.h"
13 #include "hpm_qeiv2_regs.h"
20 #define QEIV2_EVENT_WDOG_FLAG_MASK (1U << 31U)
21 #define QEIV2_EVENT_HOME_FLAG_MASK (1U << 30U)
22 #define QEIV2_EVENT_POSITION_COMPARE_FLAG_MASK (1U << 29U)
23 #define QEIV2_EVENT_Z_PHASE_FLAG_MASK (1U << 28U)
24 #define QEIV2_EVENT_Z_MISS_FLAG_MASK (1U << 27U)
25 #define QEIV2_EVENT_WIDTH_TIME_FLAG_MASK (1U << 26U)
26 #define QEIV2_EVENT_POSITION2_COMPARE_FLAG_MASK (1U << 25U)
27 #define QEIV2_EVENT_DIR_CHG_FLAG_MASK (1U << 24U)
28 #define QEIV2_EVENT_CYCLE0_FLAG_MASK (1U << 23U)
29 #define QEIV2_EVENT_CYCLE1_FLAG_MASK (1U << 22U)
30 #define QEIV2_EVENT_PULSE0_FLAG_MASK (1U << 21U)
31 #define QEIV2_EVENT_PULSE1_FLAG_MASK (1U << 20U)
32 #define QEIV2_EVENT_HOME2_FLAG_MASK (1U << 19U)
33 #define QEIV2_EVENT_FAULT_FLAG_MASK (1U << 18U)
39 typedef enum qeiv2_work_mode {
48 
53 typedef enum qeiv2_spd_tmr_content {
57 
62 typedef enum qeiv2_rotate_dir {
71 typedef enum qeiv2_position_dir {
84 
89 typedef enum qeiv2_counter_type {
95 
100 typedef enum qeiv2_filter_mode {
107 
112 typedef enum qeiv2_filter_phase {
125 typedef enum qeiv2_uvw_pos_opt {
129 
130 typedef enum qeiv2_uvw_pos_sel {
140 #define QEIV2_UVW_POS_OPT_CUR_SEL_LOW 0u
141 #define QEIV2_UVW_POS_OPT_CUR_SEL_HIGH 1u
142 #define QEIV2_UVW_POS_OPT_CUR_SEL_EDGE 2u
143 #define QEIV2_UVW_POS_OPT_NEX_SEL_LOW 0u
144 #define QEIV2_UVW_POS_OPT_NEX_SEL_HIGH 3u
145 
146 typedef enum qeiv2_uvw_pos_idx {
155 #if defined(HPM_IP_FEATURE_QEIV2_ADC_SW_INJECT) && HPM_IP_FEATURE_QEIV2_ADC_SW_INJECT
156 typedef enum qeiv2_adc_sw_inject_en {
157  qeiv2_sw_inject_adcx = QEIV2_ADC_INJECT_CTRL_ADCX_INJ_VALID_MASK,
159 } qeiv2_adc_sw_inject_en_t;
160 #endif
161 
165 typedef struct {
168  qeiv2_z_count_work_mode_t z_count_inc_mode;
169  uint32_t phcnt_max;
170  bool z_cali_enable;
171  bool z_cali_ignore_ab;
172  uint32_t phcnt_idx;
178 typedef struct {
192 typedef struct {
203 typedef struct {
204  uint32_t phcnt_cmp_value;
208  uint32_t zcmp_value;
210 
215 typedef struct {
216  uint32_t pos_cmp_value;
220 
224 typedef struct {
226  qeiv2_uvw_pos_sel_t u_pos_sel[6];
227  qeiv2_uvw_pos_sel_t v_pos_sel[6];
228  qeiv2_uvw_pos_sel_t w_pos_sel[6];
229  uint32_t pos_cfg[6];
231 
235 typedef struct {
236  uint8_t adc_select;
237  uint8_t adc_channel;
238  int16_t param0;
239  int16_t param1;
240  uint32_t offset;
242 
243 #ifdef __cplusplus
244 extern "C" {
245 #endif
246 
253 {
254  qeiv2_x->CR |= QEIV2_CR_READ_MASK;
255 }
256 
266 {
267  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_ZCNTCFG_MASK) | QEIV2_CR_ZCNTCFG_SET(mode);
268 }
269 
277 static inline void qeiv2_config_phmax_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
278 {
279  uint32_t tmp;
280 
281  if (phmax > 0u) {
282  phmax--;
283  }
284  qeiv2_x->PHCFG = QEIV2_PHCFG_PHMAX_SET(phmax);
285  if (phmax == 0u) {
286  qeiv2_x->PHASE_PARAM = 0xFFFFFFFFu;
287  } else {
288  tmp = (0x80000000u / (phmax + 1u));
289  tmp <<= 1u;
291  }
292 }
293 
300 static inline void qeiv2_config_phmax(QEIV2_Type *qeiv2_x, uint32_t phmax)
301 {
302  if (phmax > 0u) {
303  phmax--;
304  }
305  qeiv2_x->PHCFG = QEIV2_PHCFG_PHMAX_SET(phmax);
306 }
307 
314 static inline void qeiv2_config_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
315 {
316  uint32_t tmp;
317 
318  if (phmax > 0u) {
319  phmax--;
320  }
321  if (phmax == 0u) {
322  qeiv2_x->PHASE_PARAM = 0xFFFFFFFFu;
323  } else {
324  tmp = (0x80000000u / (phmax + 1u));
325  tmp <<= 1u;
327  }
328 }
329 
338 static inline void qeiv2_config_z_phase_calibration(QEIV2_Type *qeiv2_x, uint32_t phidx, bool enable, bool ignore_ab)
339 {
340  uint32_t tmp = qeiv2_x->CR;
341  qeiv2_x->PHIDX = QEIV2_PHIDX_PHIDX_SET(phidx);
342  if (enable) {
343  tmp |= QEIV2_CR_PHCALIZ_MASK;
344  } else {
345  tmp &= ~QEIV2_CR_PHCALIZ_MASK;
346  }
347  if (ignore_ab) {
349  } else {
350  tmp &= ~QEIV2_CR_Z_ONLY_EN_MASK;
351  }
352  qeiv2_x->CR = tmp;
353 }
354 
366 static inline void qeiv2_pause_counter(QEIV2_Type *qeiv2_x, uint32_t counter_mask, bool enable)
367 {
368  if (enable) {
369  qeiv2_x->CR |= counter_mask;
370  } else {
371  qeiv2_x->CR &= ~counter_mask;
372  }
373 }
374 
381 static inline void qeiv2_pause_pos_counter_on_fault(QEIV2_Type *qeiv2_x, bool enable)
382 {
383  if (enable) {
384  qeiv2_x->CR |= QEIV2_CR_FAULTPOS_MASK;
385  } else {
386  qeiv2_x->CR &= ~QEIV2_CR_FAULTPOS_MASK;
387  }
388 }
389 
395 static inline void qeiv2_enable_snap(QEIV2_Type *qeiv2_x)
396 {
397  qeiv2_x->CR |= QEIV2_CR_SNAPEN_MASK;
398 }
399 
405 static inline void qeiv2_disable_snap(QEIV2_Type *qeiv2_x)
406 {
407  qeiv2_x->CR &= ~QEIV2_CR_SNAPEN_MASK;
408 }
409 
415 static inline void qeiv2_reset_counter(QEIV2_Type *qeiv2_x)
416 {
417  qeiv2_x->CR |= QEIV2_CR_RSTCNT_MASK;
418 }
419 
425 static inline void qeiv2_release_counter(QEIV2_Type *qeiv2_x)
426 {
427  qeiv2_x->CR &= ~QEIV2_CR_RSTCNT_MASK;
428 }
429 
437 {
438  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_RD_SEL_MASK) | QEIV2_CR_RD_SEL_SET(content);
439 }
440 
447 static inline bool qeiv2_check_spd_tmr_as_pos_angle(QEIV2_Type *qeiv2_x)
448 {
449  return ((qeiv2_x->CR & QEIV2_CR_RD_SEL_MASK) != 0) ? true : false;
450 }
451 
458 static inline void qeiv2_set_work_mode(QEIV2_Type *qeiv2_x, qeiv2_work_mode_t mode)
459 {
460  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_ENCTYP_MASK) | QEIV2_CR_ENCTYP_SET(mode);
461 }
462 
473 static inline void qeiv2_config_wdog(QEIV2_Type *qeiv2_x, uint32_t timeout, uint8_t clr_phcnt, bool enable)
474 {
475  uint32_t tmp;
476  tmp = QEIV2_WDGCFG_WDGTO_SET(timeout) | QEIV2_WDGCFG_WDOG_CFG_SET(clr_phcnt);
477  if (enable) {
479  } else {
480  tmp &= ~QEIV2_WDGCFG_WDGEN_MASK;
481  }
482  qeiv2_x->WDGCFG = tmp;
483 }
484 
505 static inline void qeiv2_enable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
506 {
507  qeiv2_x->TRGOEN |= event_mask;
508 }
509 
530 static inline void qeiv2_disable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
531 {
532  qeiv2_x->TRGOEN &= ~event_mask;
533 }
534 
555 static inline void qeiv2_enable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
556 {
557  qeiv2_x->READEN |= event_mask;
558 }
559 
580 static inline void qeiv2_disable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
581 {
582  qeiv2_x->READEN &= ~event_mask;
583 }
584 
605 static inline void qeiv2_enable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
606 {
607  qeiv2_x->DMAEN |= mask;
608 }
609 
630 static inline void qeiv2_disable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
631 {
632  qeiv2_x->DMAEN &= ~mask;
633 }
634 
655 static inline void qeiv2_clear_status(QEIV2_Type *qeiv2_x, uint32_t mask)
656 {
657  qeiv2_x->SR = mask;
658 }
659 
680 static inline uint32_t qeiv2_get_status(QEIV2_Type *qeiv2_x)
681 {
682  return qeiv2_x->SR;
683 }
684 
706 static inline bool qeiv2_get_bit_status(QEIV2_Type *qeiv2_x, uint32_t mask)
707 {
708  return ((qeiv2_x->SR & mask) == mask) ? true : false;
709 }
710 
731 static inline void qeiv2_enable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
732 {
733  qeiv2_x->IRQEN |= mask;
734 }
735 
756 static inline void qeiv2_disable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
757 {
758  qeiv2_x->IRQEN &= ~mask;
759 }
760 
768 static inline uint32_t qeiv2_get_current_count(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
769 {
770  return *(&qeiv2_x->COUNT[QEIV2_COUNT_CURRENT].Z + type);
771 }
772 
779 static inline uint32_t qeiv2_get_current_phase_phcnt(QEIV2_Type *qeiv2_x)
780 {
782 }
783 
790 static inline bool qeiv2_get_current_phase_a_level(QEIV2_Type *qeiv2_x)
791 {
793 }
794 
801 static inline bool qeiv2_get_current_phase_b_level(QEIV2_Type *qeiv2_x)
802 {
804 }
805 
812 static inline bool qeiv2_get_current_phase_dir(QEIV2_Type *qeiv2_x)
813 {
815 }
816 
817 
825 static inline uint32_t qeiv2_get_count_on_read_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
826 {
827  return *(&(qeiv2_x->COUNT[QEIV2_COUNT_READ].Z) + type);
828 }
829 
837 static inline uint32_t qeiv2_get_count_on_snap0_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
838 {
839  return *(&qeiv2_x->COUNT[QEIV2_COUNT_SNAP0].Z + type);
840 }
841 
849 static inline uint32_t qeiv2_get_count_on_snap1_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
850 {
851  return *(&qeiv2_x->COUNT[QEIV2_COUNT_SNAP1].Z + type);
852 }
853 
860 static inline void qeiv2_set_z_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
861 {
862  qeiv2_x->ZCMP = QEIV2_ZCMP_ZCMP_SET(cmp);
863 }
864 
871 static inline void qeiv2_set_phcnt_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
872 {
873  qeiv2_x->PHCMP = QEIV2_PHCMP_PHCMP_SET(cmp);
874 }
875 
884 static inline void qeiv2_set_spd_pos_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
885 {
886  qeiv2_x->SPDCMP = QEIV2_SPDCMP_SPDCMP_SET(cmp);
887 }
888 
903 static inline void qeiv2_set_cmp_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp,
904  bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
905 {
910  | QEIV2_MATCH_CFG_SPDCMPDIS_SET(ignore_spdposcmp)
911  | QEIV2_MATCH_CFG_DIRCMPDIS_SET(ignore_rotate_dir) | QEIV2_MATCH_CFG_DIRCMP_SET(rotate_dir)
913 }
914 
921 static inline void qeiv2_set_z_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
922 {
923  qeiv2_x->ZCMP2 = QEIV2_ZCMP2_ZCMP2_SET(cmp);
924 }
925 
932 static inline void qeiv2_set_phcnt_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
933 {
934  qeiv2_x->PHCMP2 = QEIV2_PHCMP2_PHCMP2_SET(cmp);
935 }
936 
943 static inline void qeiv2_set_spd_pos_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
944 {
945  qeiv2_x->SPDCMP2 = QEIV2_SPDCMP2_SPDCMP2_SET(cmp);
946 }
947 
962 static inline void qeiv2_set_cmp2_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp,
963  bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
964 {
969  | QEIV2_MATCH_CFG_SPDCMP2DIS_SET(ignore_spdposcmp)
970  | QEIV2_MATCH_CFG_DIRCMP2DIS_SET(ignore_rotate_dir) | QEIV2_MATCH_CFG_DIRCMP2_SET(rotate_dir)
972 }
973 
984 static inline void qeiv2_config_abz_uvw_signal_edge(QEIV2_Type *qeiv2_x, bool siga_en, bool sigb_en, bool sigz_en, bool posedge_en, bool negedge_en)
985 {
989  | QEIV2_QEI_CFG_POSIDGE_EN_SET(posedge_en) | QEIV2_QEI_CFG_NEGEDGE_EN_SET(negedge_en));
990 }
991 
998 static inline void qeiv2_set_pulse0_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
999 {
1000  qeiv2_x->PULSE0_NUM = QEIV2_PULSE0_NUM_PULSE0_NUM_SET(pulse_num);
1001 }
1002 
1009 static inline uint32_t qeiv2_get_pulse0_cycle_snap0(QEIV2_Type *qeiv2_x)
1010 {
1011  return qeiv2_x->CYCLE0_SNAP0;
1012 }
1013 
1020 static inline uint32_t qeiv2_get_pulse0_cycle_snap1(QEIV2_Type *qeiv2_x)
1021 {
1022  return qeiv2_x->CYCLE0_SNAP1;
1023 }
1024 
1031 static inline void qeiv2_set_pulse1_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
1032 {
1033  qeiv2_x->PULSE1_NUM = QEIV2_PULSE1_NUM_PULSE1_NUM_SET(pulse_num);
1034 }
1035 
1042 static inline uint32_t qeiv2_get_pulse1_cycle_snap0(QEIV2_Type *qeiv2_x)
1043 {
1044  return qeiv2_x->CYCLE1_SNAP0;
1045 }
1046 
1053 static inline uint32_t qeiv2_get_pulse1_cycle_snap1(QEIV2_Type *qeiv2_x)
1054 {
1055  return qeiv2_x->CYCLE1_SNAP1;
1056 }
1057 
1064 static inline void qeiv2_set_cycle0_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
1065 {
1066  qeiv2_x->CYCLE0_NUM = QEIV2_CYCLE0_NUM_CYCLE0_NUM_SET(cycle_num);
1067 }
1068 
1075 static inline uint32_t qeiv2_get_cycle0_pulse_snap0(QEIV2_Type *qeiv2_x)
1076 {
1077  return qeiv2_x->PULSE0_SNAP0;
1078 }
1079 
1086 static inline uint32_t qeiv2_get_cycle0_pulse_snap1(QEIV2_Type *qeiv2_x)
1087 {
1088  return qeiv2_x->PULSE0_SNAP1;
1089 }
1090 
1097 static inline uint32_t qeiv2_get_cycle0_pulse0cycle_snap0(QEIV2_Type *qeiv2_x)
1098 {
1099  return qeiv2_x->PULSE0CYCLE_SNAP0;
1100 }
1101 
1108 static inline uint32_t qeiv2_get_cycle0_pulse0cycle_snap1(QEIV2_Type *qeiv2_x)
1109 {
1110  return qeiv2_x->PULSE0CYCLE_SNAP1;
1111 }
1112 
1119 static inline void qeiv2_set_cycle1_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
1120 {
1121  qeiv2_x->CYCLE1_NUM = QEIV2_CYCLE1_NUM_CYCLE1_NUM_SET(cycle_num);
1122 }
1123 
1124 #if defined(HPM_IP_FEATURE_QEIV2_ONESHOT_MODE) && HPM_IP_FEATURE_QEIV2_ONESHOT_MODE
1129 static inline void qeiv2_disable_cycle0_oneshot_mode(QEIV2_Type *qeiv2_x)
1130 {
1132 }
1133 
1138 static inline void qeiv2_enable_cycle0_oneshot_mode(QEIV2_Type *qeiv2_x)
1139 {
1141 }
1142 
1147 static inline void qeiv2_disable_cycle1_oneshot_mode(QEIV2_Type *qeiv2_x)
1148 {
1150 }
1151 
1156 static inline void qeiv2_enable_cycle1_oneshot_mode(QEIV2_Type *qeiv2_x)
1157 {
1159 }
1160 
1165 static inline void qeiv2_disable_pulse0_oneshot_mode(QEIV2_Type *qeiv2_x)
1166 {
1168 }
1169 
1174 static inline void qeiv2_enable_pulse0_oneshot_mode(QEIV2_Type *qeiv2_x)
1175 {
1177 }
1178 
1183 static inline void qeiv2_disable_pulse1_oneshot_mode(QEIV2_Type *qeiv2_x)
1184 {
1186 }
1187 
1192 static inline void qeiv2_enable_pulse1_oneshot_mode(QEIV2_Type *qeiv2_x)
1193 {
1195 }
1196 #endif
1197 
1198 #if defined(HPM_IP_FEATURE_QEIV2_SW_RESTART_TRG) && HPM_IP_FEATURE_QEIV2_SW_RESTART_TRG
1203 static inline void qeiv2_disable_trig_cycle0(QEIV2_Type *qeiv2_x)
1204 {
1206 }
1207 
1212 static inline void qeiv2_enable_trig_cycle0(QEIV2_Type *qeiv2_x)
1213 {
1215 }
1216 
1221 static inline void qeiv2_disable_trig_cycle1(QEIV2_Type *qeiv2_x)
1222 {
1224 }
1225 
1230 static inline void qeiv2_enable_trig_cycle1(QEIV2_Type *qeiv2_x)
1231 {
1233 }
1234 
1239 static inline void qeiv2_disable_trig_pulse0(QEIV2_Type *qeiv2_x)
1240 {
1242 }
1243 
1248 static inline void qeiv2_enable_trig_pulse0(QEIV2_Type *qeiv2_x)
1249 {
1251 }
1252 
1257 static inline void qeiv2_disable_trig_pulse1(QEIV2_Type *qeiv2_x)
1258 {
1260 }
1261 
1266 static inline void qeiv2_enable_trig_pulse1(QEIV2_Type *qeiv2_x)
1267 {
1269 }
1270 
1275 static inline void qeiv2_sw_restart_cycle0(QEIV2_Type *qeiv2_x)
1276 {
1278 }
1279 
1284 static inline void qeiv2_sw_restart_cycle1(QEIV2_Type *qeiv2_x)
1285 {
1287 }
1288 
1293 static inline void qeiv2_sw_restart_pulse0(QEIV2_Type *qeiv2_x)
1294 {
1296 }
1297 
1302 static inline void qeiv2_sw_restart_pulse1(QEIV2_Type *qeiv2_x)
1303 {
1305 }
1306 #endif
1307 
1314 static inline uint32_t qeiv2_get_cycle1_pulse_snap0(QEIV2_Type *qeiv2_x)
1315 {
1316  return qeiv2_x->PULSE1_SNAP0;
1317 }
1318 
1325 static inline uint32_t qeiv2_get_cycle1_pulse_snap1(QEIV2_Type *qeiv2_x)
1326 {
1327  return qeiv2_x->PULSE1_SNAP1;
1328 }
1329 
1336 static inline uint32_t qeiv2_get_cycle1_pulse1cycle_snap0(QEIV2_Type *qeiv2_x)
1337 {
1338  return qeiv2_x->PULSE1CYCLE_SNAP0;
1339 }
1340 
1347 static inline uint32_t qeiv2_get_cycle1_pulse1cycle_snap1(QEIV2_Type *qeiv2_x)
1348 {
1349  return qeiv2_x->PULSE1CYCLE_SNAP1;
1350 }
1351 
1358 static inline void qeiv2_clear_counter_when_dir_chg(QEIV2_Type *qeiv2_x, bool enable)
1359 {
1360  if (enable) {
1362  } else {
1364  }
1365 }
1366 
1374 static inline void qeiv2_config_adcx(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
1375 {
1376  uint32_t tmp;
1379  qeiv2_x->ADCX_CFG2 = QEIV2_ADCX_CFG2_X_OFFSET_SET(config->offset);
1380  if (enable) {
1382  } else {
1384  }
1385  qeiv2_x->ADCX_CFG0 = tmp;
1386 }
1387 
1395 static inline void qeiv2_config_adcy(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
1396 {
1397  uint32_t tmp;
1400  qeiv2_x->ADCY_CFG2 = QEIV2_ADCY_CFG2_Y_OFFSET_SET(config->offset);
1401  if (enable) {
1403  } else {
1405  }
1406  qeiv2_x->ADCY_CFG0 = tmp;
1407 }
1408 
1420 void qeiv2_config_adcx_adcy_param(QEIV2_Type *qeiv2_x, float tan_delta, float cos_delta, float x_magnification, float y_magnification);
1421 
1428 static inline void qeiv2_set_adc_xy_delay(QEIV2_Type *qeiv2_x, uint32_t delay)
1429 {
1430  qeiv2_x->CAL_CFG = QEIV2_CAL_CFG_XY_DELAY_SET(delay);
1431 }
1432 
1440 static inline void qeiv2_set_position_threshold(QEIV2_Type *qeiv2_x, uint32_t threshold)
1441 {
1443 }
1444 
1452 {
1454 }
1455 
1482 static inline void qeiv2_set_uvw_position_sel(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint8_t u_pos_sel, uint8_t v_pos_sel,
1483  uint8_t w_pos_sel, bool enable)
1484 {
1485  uint32_t tmp;
1486  tmp = QEIV2_UVW_POS_CFG_U_POS_SEL_SET(u_pos_sel)
1487  | QEIV2_UVW_POS_CFG_V_POS_SEL_SET(v_pos_sel)
1488  | QEIV2_UVW_POS_CFG_W_POS_SEL_SET(w_pos_sel);
1489  if (enable) {
1491  } else {
1493  }
1494  qeiv2_x->UVW_POS_CFG[idx] = tmp;
1495 }
1496 
1505 static inline void qeiv2_set_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint32_t pos)
1506 {
1507  qeiv2_x->UVW_POS[idx] = pos;
1508 }
1509 
1516 static inline void qeiv2_set_z_phase(QEIV2_Type *qeiv2_x, uint32_t cnt)
1517 {
1518  qeiv2_x->COUNT[QEIV2_COUNT_CURRENT].Z = cnt;
1519 }
1520 
1527 static inline uint32_t qeiv2_get_z_phase(QEIV2_Type *qeiv2_x)
1528 {
1529  return qeiv2_x->COUNT[QEIV2_COUNT_CURRENT].Z;
1530 }
1531 
1538 static inline void qeiv2_set_phase_cnt(QEIV2_Type *qeiv2_x, uint32_t cnt)
1539 {
1540  qeiv2_x->PHASE_CNT = cnt;
1541 }
1542 
1549 static inline uint32_t qeiv2_get_phase_cnt(QEIV2_Type *qeiv2_x)
1550 {
1551  return qeiv2_x->PHASE_CNT;
1552 }
1553 
1562 static inline void qeiv2_update_phase_cnt(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
1563 {
1565 }
1566 
1573 static inline void qeiv2_set_position(QEIV2_Type *qeiv2_x, uint32_t pos)
1574 {
1575  qeiv2_x->POSITION = pos;
1576 }
1577 
1584 static inline uint32_t qeiv2_get_postion(QEIV2_Type *qeiv2_x)
1585 {
1586  return qeiv2_x->POSITION;
1587 }
1588 
1597 static inline void qeiv2_update_position(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
1598 {
1600 }
1601 
1608 static inline uint32_t qeiv2_get_angle(QEIV2_Type *qeiv2_x)
1609 {
1610  return qeiv2_x->ANGLE;
1611 }
1612 
1620 static inline void qeiv2_config_position_timeout(QEIV2_Type *qeiv2_x, uint32_t tm, bool enable)
1621 {
1622  uint32_t tmp;
1624  if (enable) {
1626  } else {
1628  }
1629  qeiv2_x->POS_TIMEOUT = tmp;
1630 }
1631 
1632 #if defined (HPM_IP_FEATURE_QEIV2_SIN_TOGI) && HPM_IP_FEATURE_QEIV2_SIN_TOGI
1639 static inline void qeiv2_set_togi_enable(QEIV2_Type *qeiv2_x, bool enable)
1640 {
1642 }
1643 
1654 void qeiv2_config_togi_w_param(QEIV2_Type *qeiv2_x, uint32_t signal_hz, uint32_t adc_sample_rate);
1655 #endif
1656 
1657 #if defined(HPM_IP_FEATURE_QEIV2_POS_ADJ) && HPM_IP_FEATURE_QEIV2_POS_ADJ
1664 static inline void qeiv2_set_position_adjust_value(QEIV2_Type *qeiv2_x, int32_t pos_adj)
1665 {
1666  qeiv2_x->POS_ADJ = QEIV2_POS_ADJ_POS_ADJ_SET(pos_adj);
1667 }
1668 #endif
1669 
1670 #if defined(HPM_IP_FEATURE_QEIV2_ADC_SW_INJECT) && HPM_IP_FEATURE_QEIV2_ADC_SW_INJECT
1676 static inline void qeiv2_enable_adc_sw_inject(QEIV2_Type *qeiv2_x)
1677 {
1679 }
1680 
1686 static inline void qeiv2_disable_adc_sw_inject(QEIV2_Type *qeiv2_x)
1687 {
1689 }
1690 
1701 static inline void qeiv2_inject_sw_adc(QEIV2_Type *qeiv2_x, uint32_t adcx, uint32_t adcy, qeiv2_adc_sw_inject_en_t en)
1702 {
1703  qeiv2_x->ADCX_VAL_SW = adcx;
1704  qeiv2_x->ADCY_VAL_SW = adcy;
1705  qeiv2_x->ADC_INJECT_CTRL |= en;
1706 }
1707 
1715 static inline bool qeiv2_is_pos_calc_finished(QEIV2_Type *qeiv2_x)
1716 {
1717  return (QEIV2_CALC_STATE_STATE_GET(qeiv2_x->CALC_STATE) == 0) ? true : false;
1718 }
1719 #endif
1720 
1727 void qeiv2_config_mode(QEIV2_Type *qeiv2_x, qeiv2_mode_config_t *config);
1728 
1736 
1743 void qeiv2_config_pause(QEIV2_Type *qeiv2_x, qeiv2_pause_config_t *config);
1744 
1753 
1762 
1771 
1780 
1787 
1796 
1808 void qeiv2_config_filter(QEIV2_Type *qeiv2_x, qeiv2_filter_phase_t phase, bool outinv, qeiv2_filter_mode_t mode, bool sync, uint32_t filtlen);
1809 
1810 #ifdef __cplusplus
1811 }
1812 #endif
1816 #endif /* HPM_QEIV2_DRV_H */
#define QEIV2_WDGCFG_WDGEN_MASK
Definition: hpm_qeiv2_regs.h:320
#define QEIV2_MATCH_CFG_ZCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1252
#define QEIV2_ADCX_CFG1_X_PARAM0_SET(x)
Definition: hpm_qeiv2_regs.h:1697
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1225
#define QEIV2_MATCH_CFG_ZCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1184
#define QEIV2_ZCMP2_ZCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1155
#define QEIV2_CR_ZCNTCFG_SET(x)
Definition: hpm_qeiv2_regs.h:111
#define QEIV2_ADCY_CFG1_Y_PARAM0_SET(x)
Definition: hpm_qeiv2_regs.h:1754
#define QEIV2_COUNT_PH_DIR_GET(x)
Definition: hpm_qeiv2_regs.h:1066
#define QEIV2_MATCH_CFG_DIRCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1196
#define QEIV2_ADCX_CFG1_X_PARAM1_SET(x)
Definition: hpm_qeiv2_regs.h:1688
#define QEIV2_PULSE1_NUM_PULSE1_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1450
#define QEIV2_PHASE_UPDATE_VALUE_SET(x)
Definition: hpm_qeiv2_regs.h:1884
#define QEIV2_MATCH_CFG_POS_MATCH2_OPT_MASK
Definition: hpm_qeiv2_regs.h:1304
#define QEIV2_QEI_CFG_SIGZ_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1411
#define QEIV2_POSITION_UPDATE_DEC_SET(x)
Definition: hpm_qeiv2_regs.h:1915
#define QEIV2_MATCH_CFG_DIRCMP_MASK
Definition: hpm_qeiv2_regs.h:1205
#define QEIV2_QEI_CFG_NEGEDGE_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1393
#define QEIV2_QEI_CFG_SIGZ_EN_MASK
Definition: hpm_qeiv2_regs.h:1409
#define QEIV2_QEI_CFG_SPEED_DIR_CHG_EN_MASK
Definition: hpm_qeiv2_regs.h:1362
#define QEIV2_CYCLE0_NUM_CYCLE0_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1532
#define QEIV2_UVW_POS_CFG_POS_EN_MASK
Definition: hpm_qeiv2_regs.h:1814
#define QEIV2_MATCH_CFG_ZCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1250
#define QEIV2_MATCH_CFG_DIRCMP2_MASK
Definition: hpm_qeiv2_regs.h:1268
#define QEIV2_WDGCFG_WDGTO_SET(x)
Definition: hpm_qeiv2_regs.h:344
#define QEIV2_ADCY_CFG0_Y_ADCSEL_SET(x)
Definition: hpm_qeiv2_regs.h:1717
#define QEIV2_POS_TIMEOUT_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1943
#define QEIV2_CR_Z_ONLY_EN_MASK
Definition: hpm_qeiv2_regs.h:129
#define QEIV2_COUNT_PH_ASTAT_GET(x)
Definition: hpm_qeiv2_regs.h:1076
#define QEIV2_QEI_CFG_SIGA_EN_MASK
Definition: hpm_qeiv2_regs.h:1427
#define QEIV2_MATCH_CFG_DIRCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1261
#define QEIV2_POSITION_UPDATE_VALUE_SET(x)
Definition: hpm_qeiv2_regs.h:1925
#define QEIV2_CR_ENCTYP_MASK
Definition: hpm_qeiv2_regs.h:298
#define QEIV2_QEI_CFG_SIGA_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1429
#define QEIV2_ADCX_CFG0_X_CHAN_SET(x)
Definition: hpm_qeiv2_regs.h:1678
#define QEIV2_QEI_CFG_UVW_POS_OPT0_MASK
Definition: hpm_qeiv2_regs.h:1373
#define QEIV2_PHASE_UPDATE_DEC_SET(x)
Definition: hpm_qeiv2_regs.h:1874
#define QEIV2_UVW_POS_CFG_V_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1834
#define QEIV2_MATCH_CFG_POS_MATCH2_DIR_MASK
Definition: hpm_qeiv2_regs.h:1295
#define QEIV2_PHCMP_PHCMP_SET(x)
Definition: hpm_qeiv2_regs.h:639
#define QEIV2_MATCH_CFG_DIRCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1259
#define QEIV2_MATCH_CFG_POS_MATCH2_OPT_SET(x)
Definition: hpm_qeiv2_regs.h:1306
#define QEIV2_ADCX_CFG0_X_ADCSEL_SET(x)
Definition: hpm_qeiv2_regs.h:1660
#define QEIV2_CR_ENCTYP_SET(x)
Definition: hpm_qeiv2_regs.h:300
#define QEIV2_MATCH_CFG_SPDCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1279
#define QEIV2_MATCH_CFG_POS_MATCH_DIR_SET(x)
Definition: hpm_qeiv2_regs.h:1234
#define QEIV2_SPDCMP_SPDCMP_SET(x)
Definition: hpm_qeiv2_regs.h:650
#define QEIV2_QEI_CFG_POSIDGE_EN_MASK
Definition: hpm_qeiv2_regs.h:1400
#define QEIV2_COUNT_SNAP1
Definition: hpm_qeiv2_regs.h:1964
#define QEIV2_QEI_CFG_NEGEDGE_EN_MASK
Definition: hpm_qeiv2_regs.h:1391
#define QEIV2_MATCH_CFG_POS_MATCH_OPT_SET(x)
Definition: hpm_qeiv2_regs.h:1243
#define QEIV2_CR_FAULTPOS_MASK
Definition: hpm_qeiv2_regs.h:254
#define QEIV2_QEI_CFG_SIGB_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1420
#define QEIV2_ADCY_CFG0_Y_ADC_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1724
#define QEIV2_CR_ZCNTCFG_MASK
Definition: hpm_qeiv2_regs.h:109
#define QEIV2_UVW_POS_CFG_W_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1843
#define QEIV2_MATCH_CFG_DIRCMP_SET(x)
Definition: hpm_qeiv2_regs.h:1207
#define QEIV2_COUNT_PH_BSTAT_GET(x)
Definition: hpm_qeiv2_regs.h:1086
#define QEIV2_QEI_CFG_SIGB_EN_MASK
Definition: hpm_qeiv2_regs.h:1418
#define QEIV2_QEI_CFG_POSIDGE_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1402
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS2_MASK
Definition: hpm_qeiv2_regs.h:1286
#define QEIV2_CR_RD_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:289
#define QEIV2_PHCFG_PHMAX_SET(x)
Definition: hpm_qeiv2_regs.h:311
#define QEIV2_PHASE_PARAM_PHASE_PARAM_SET(x)
Definition: hpm_qeiv2_regs.h:1786
#define QEIV2_CR_RSTCNT_MASK
Definition: hpm_qeiv2_regs.h:274
#define QEIV2_POSITION_UPDATE_INC_SET(x)
Definition: hpm_qeiv2_regs.h:1905
#define QEIV2_COUNT_CURRENT
Definition: hpm_qeiv2_regs.h:1961
#define QEIV2_COUNT_READ
Definition: hpm_qeiv2_regs.h:1962
#define QEIV2_MATCH_CFG_DIRCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1270
#define QEIV2_MATCH_CFG_SPDCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1216
#define QEIV2_WDGCFG_WDOG_CFG_SET(x)
Definition: hpm_qeiv2_regs.h:334
#define QEIV2_CR_SNAPEN_MASK
Definition: hpm_qeiv2_regs.h:264
#define QEIV2_SPDCMP2_SPDCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1175
#define QEIV2_CR_PHCALIZ_MASK
Definition: hpm_qeiv2_regs.h:119
#define QEIV2_COUNT_PH_PHCNT_GET(x)
Definition: hpm_qeiv2_regs.h:1095
#define QEIV2_ADCY_CFG1_Y_PARAM1_SET(x)
Definition: hpm_qeiv2_regs.h:1745
#define QEIV2_CAL_CFG_XY_DELAY_SET(x)
Definition: hpm_qeiv2_regs.h:1776
#define QEIV2_PHCMP2_PHCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1165
#define QEIV2_MATCH_CFG_POS_MATCH2_DIR_SET(x)
Definition: hpm_qeiv2_regs.h:1297
#define QEIV2_POS_TIMEOUT_TIMEOUT_SET(x)
Definition: hpm_qeiv2_regs.h:1955
#define QEIV2_ADCY_CFG0_Y_CHAN_SET(x)
Definition: hpm_qeiv2_regs.h:1735
#define QEIV2_ZCMP_ZCMP_SET(x)
Definition: hpm_qeiv2_regs.h:628
#define QEIV2_COUNT_SNAP0
Definition: hpm_qeiv2_regs.h:1963
#define QEIV2_ADCX_CFG0_X_ADC_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1667
#define QEIV2_MATCH_CFG_POS_MATCH_OPT_MASK
Definition: hpm_qeiv2_regs.h:1241
#define QEIV2_CYCLE1_NUM_CYCLE1_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1542
#define QEIV2_ADCX_CFG2_X_OFFSET_SET(x)
Definition: hpm_qeiv2_regs.h:1707
#define QEIV2_MATCH_CFG_SPDCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1214
#define QEIV2_POS_THRESHOLD_POS_THRESHOLD_SET(x)
Definition: hpm_qeiv2_regs.h:1796
#define QEIV2_PHASE_UPDATE_INC_SET(x)
Definition: hpm_qeiv2_regs.h:1864
#define QEIV2_MATCH_CFG_SPDCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1277
#define QEIV2_QEI_CFG_UVW_POS_OPT0_SET(x)
Definition: hpm_qeiv2_regs.h:1375
#define QEIV2_PHIDX_PHIDX_SET(x)
Definition: hpm_qeiv2_regs.h:355
#define QEIV2_MATCH_CFG_POS_MATCH_DIR_MASK
Definition: hpm_qeiv2_regs.h:1232
#define QEIV2_PULSE0_NUM_PULSE0_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1440
#define QEIV2_UVW_POS_CFG_U_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1825
#define QEIV2_ADCY_CFG2_Y_OFFSET_SET(x)
Definition: hpm_qeiv2_regs.h:1764
#define QEIV2_MATCH_CFG_DIRCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1194
#define QEIV2_CR_RD_SEL_MASK
Definition: hpm_qeiv2_regs.h:287
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS2_SET(x)
Definition: hpm_qeiv2_regs.h:1288
#define QEIV2_MATCH_CFG_ZCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1186
#define QEIV2_CR_READ_MASK
Definition: hpm_qeiv2_regs.h:98
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS_MASK
Definition: hpm_qeiv2_regs.h:1223
#define QEIV2_TOGI_CFG0_SIN_TOGI_MASK
Definition: hpm_qeiv2_regs.h:2203
#define QEIV2_QEI_CFG_PULSE0_ONESHOT_MASK
Definition: hpm_qeiv2_regs.h:1415
#define QEIV2_QEI_CFG_CYCLE1_ONESHOT_MASK
Definition: hpm_qeiv2_regs.h:1443
#define QEIV2_QEI_CFG_SW_PULSE0_RESTART_MASK
Definition: hpm_qeiv2_regs.h:1377
#define QEIV2_CALC_STATE_STATE_GET(x)
Definition: hpm_qeiv2_regs.h:2195
#define QEIV2_ADC_INJECT_CTRL_ADCX_INJ_VALID_MASK
Definition: hpm_qeiv2_regs.h:1992
#define QEIV2_QEI_CFG_TRIG_PULSE0_EN_MASK
Definition: hpm_qeiv2_regs.h:1463
#define QEIV2_TOGI_CFG0_SIN_TOGI_SET(x)
Definition: hpm_qeiv2_regs.h:2205
#define QEIV2_QEI_CFG_SW_CYCLE0_RESTART_MASK
Definition: hpm_qeiv2_regs.h:1396
#define QEIV2_QEI_CFG_SW_CYCLE1_RESTART_MASK
Definition: hpm_qeiv2_regs.h:1405
#define QEIV2_ADC_INJECT_CTRL_ADC_INJECT_EN_MASK
Definition: hpm_qeiv2_regs.h:1972
#define QEIV2_QEI_CFG_SW_PULSE1_RESTART_MASK
Definition: hpm_qeiv2_regs.h:1386
#define QEIV2_QEI_CFG_TRIG_CYCLE0_EN_MASK
Definition: hpm_qeiv2_regs.h:1482
#define QEIV2_ADC_INJECT_CTRL_ADCY_INJ_VALID_MASK
Definition: hpm_qeiv2_regs.h:1982
#define QEIV2_POS_ADJ_POS_ADJ_SET(x)
Definition: hpm_qeiv2_regs.h:2014
#define QEIV2_QEI_CFG_TRIG_PULSE1_EN_MASK
Definition: hpm_qeiv2_regs.h:1472
#define QEIV2_QEI_CFG_CYCLE0_ONESHOT_MASK
Definition: hpm_qeiv2_regs.h:1434
#define QEIV2_QEI_CFG_TRIG_CYCLE1_EN_MASK
Definition: hpm_qeiv2_regs.h:1491
#define QEIV2_QEI_CFG_PULSE1_ONESHOT_MASK
Definition: hpm_qeiv2_regs.h:1424
uint32_t hpm_stat_t
Definition: hpm_common.h:135
static void qeiv2_enable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
enable qeiv2 irq
Definition: hpm_qeiv2_drv.h:731
static void qeiv2_config_z_phase_calibration(QEIV2_Type *qeiv2_x, uint32_t phidx, bool enable, bool ignore_ab)
config phcnt calibration trigged by z phase
Definition: hpm_qeiv2_drv.h:338
enum qeiv2_position_dir qeiv2_position_dir_t
compare match position direction
static void qeiv2_update_phase_cnt(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
update phase counter value
Definition: hpm_qeiv2_drv.h:1562
static void qeiv2_clear_status(QEIV2_Type *qeiv2_x, uint32_t mask)
clear qeiv2 status register
Definition: hpm_qeiv2_drv.h:655
static void qeiv2_enable_snap(QEIV2_Type *qeiv2_x)
enable load phcnt, zcnt, spdcnt and tmrcnt into their snap registers
Definition: hpm_qeiv2_drv.h:395
hpm_stat_t qeiv2_config_position_cmp_match_condition(QEIV2_Type *qeiv2_x, qeiv2_pos_cmp_match_config_t *config)
config position compare match condition
Definition: hpm_qeiv2_drv.c:99
static void qeiv2_set_uvw_position_sel(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint8_t u_pos_sel, uint8_t v_pos_sel, uint8_t w_pos_sel, bool enable)
set config uvw position
Definition: hpm_qeiv2_drv.h:1482
static uint32_t qeiv2_get_pulse0_cycle_snap1(QEIV2_Type *qeiv2_x)
get cycle0 snap1 value
Definition: hpm_qeiv2_drv.h:1020
enum qeiv2_rotate_dir qeiv2_rotate_dir_t
compare match rotate direction
qeiv2_uvw_pos_opt
uvw position option
Definition: hpm_qeiv2_drv.h:125
static void qeiv2_set_z_phase(QEIV2_Type *qeiv2_x, uint32_t cnt)
set z phase counter value
Definition: hpm_qeiv2_drv.h:1516
enum qeiv2_uvw_pos_sel qeiv2_uvw_pos_sel_t
static void qeiv2_set_pulse0_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
set pulse0 value
Definition: hpm_qeiv2_drv.h:998
hpm_stat_t qeiv2_config_phcnt_cmp_match_condition(QEIV2_Type *qeiv2_x, qeiv2_phcnt_cmp_match_config_t *config)
config phcnt compare match condition
Definition: hpm_qeiv2_drv.c:87
qeiv2_filter_phase
filter type
Definition: hpm_qeiv2_drv.h:112
enum qeiv2_filter_mode qeiv2_filter_mode_t
filter mode
static void qeiv2_config_phmax_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
config phase max value and phase param(for position calculation). It is recommended used without z-ph...
Definition: hpm_qeiv2_drv.h:277
static uint32_t qeiv2_get_pulse1_cycle_snap0(QEIV2_Type *qeiv2_x)
get cycle1 snap0 value
Definition: hpm_qeiv2_drv.h:1042
static uint32_t qeiv2_get_cycle0_pulse0cycle_snap1(QEIV2_Type *qeiv2_x)
get pulse0cycle snap1 value
Definition: hpm_qeiv2_drv.h:1108
enum qeiv2_uvw_pos_idx qeiv2_uvw_pos_idx_t
static void qeiv2_set_phase_cnt(QEIV2_Type *qeiv2_x, uint32_t cnt)
set phase counter value
Definition: hpm_qeiv2_drv.h:1538
enum qeiv2_z_count_work_mode qeiv2_z_count_work_mode_t
counting mode of Z-phase counter
enum qeiv2_spd_tmr_content qeiv2_spd_tmr_content_t
spd and tmr read selection
static uint32_t qeiv2_get_status(QEIV2_Type *qeiv2_x)
get qeiv2 status
Definition: hpm_qeiv2_drv.h:680
static void qeiv2_set_position(QEIV2_Type *qeiv2_x, uint32_t pos)
set position value
Definition: hpm_qeiv2_drv.h:1573
enum qeiv2_counter_type qeiv2_counter_type_t
counter type
enum qeiv2_filter_phase qeiv2_filter_phase_t
filter type
static void qeiv2_set_cmp_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp, bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
set compare match options
Definition: hpm_qeiv2_drv.h:903
static void qeiv2_update_position(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
update position value
Definition: hpm_qeiv2_drv.h:1597
static uint32_t qeiv2_get_count_on_snap1_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
read the value of each phase snapshot 1 counter
Definition: hpm_qeiv2_drv.h:849
static void qeiv2_reset_counter(QEIV2_Type *qeiv2_x)
reset zcnt, spdcnt and tmrcnt to 0, reset phcnt to phidx.
Definition: hpm_qeiv2_drv.h:415
static void qeiv2_enable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
enable load read trigger event
Definition: hpm_qeiv2_drv.h:555
static void qeiv2_set_z_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set zcnt compare value
Definition: hpm_qeiv2_drv.h:860
hpm_stat_t qeiv2_config_phcnt_cmp2_match_condition(QEIV2_Type *qeiv2_x, qeiv2_phcnt_cmp_match_config_t *config)
config phcnt compare2 match condition
Definition: hpm_qeiv2_drv.c:109
static uint32_t qeiv2_get_current_phase_phcnt(QEIV2_Type *qeiv2_x)
get current phcnt value
Definition: hpm_qeiv2_drv.h:779
static bool qeiv2_get_bit_status(QEIV2_Type *qeiv2_x, uint32_t mask)
get qeiv2 bit status
Definition: hpm_qeiv2_drv.h:706
static void qeiv2_set_adc_xy_delay(QEIV2_Type *qeiv2_x, uint32_t delay)
set adcx and adcy delay
Definition: hpm_qeiv2_drv.h:1428
static void qeiv2_disable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
disable load read trigger event
Definition: hpm_qeiv2_drv.h:580
qeiv2_filter_mode
filter mode
Definition: hpm_qeiv2_drv.h:100
void qeiv2_config_h_phase(QEIV2_Type *qeiv2_x, qeiv2_h_phase_config_t *config)
config h phase signal
Definition: hpm_qeiv2_drv.c:34
qeiv2_counter_type
counter type
Definition: hpm_qeiv2_drv.h:89
static void qeiv2_config_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
config phase param for position calculation.
Definition: hpm_qeiv2_drv.h:314
void qeiv2_config_adcx_adcy_param(QEIV2_Type *qeiv2_x, float tan_delta, float cos_delta, float x_magnification, float y_magnification)
Configures the orthogonal delta and magnification for ADCX and ADCY.
Definition: hpm_qeiv2_drv.c:236
static uint32_t qeiv2_get_cycle1_pulse_snap1(QEIV2_Type *qeiv2_x)
get pulse1 snap1 value
Definition: hpm_qeiv2_drv.h:1325
static void qeiv2_set_work_mode(QEIV2_Type *qeiv2_x, qeiv2_work_mode_t mode)
set qeiv2 work mode
Definition: hpm_qeiv2_drv.h:458
static uint32_t qeiv2_get_z_phase(QEIV2_Type *qeiv2_x)
get z phase counter value
Definition: hpm_qeiv2_drv.h:1527
static uint32_t qeiv2_get_cycle0_pulse0cycle_snap0(QEIV2_Type *qeiv2_x)
get pulse0cycle snap0 value
Definition: hpm_qeiv2_drv.h:1097
static void qeiv2_select_spd_tmr_register_content(QEIV2_Type *qeiv2_x, qeiv2_spd_tmr_content_t content)
select spd and tmr register content
Definition: hpm_qeiv2_drv.h:436
static void qeiv2_load_counter_to_read_registers(QEIV2_Type *qeiv2_x)
load phcnt, zcnt, spdcnt and tmrcnt into their read registers
Definition: hpm_qeiv2_drv.h:252
static bool qeiv2_get_current_phase_dir(QEIV2_Type *qeiv2_x)
get current phase dir
Definition: hpm_qeiv2_drv.h:812
qeiv2_work_mode
qeiv2 work mode
Definition: hpm_qeiv2_drv.h:39
static void qeiv2_set_position_threshold(QEIV2_Type *qeiv2_x, uint32_t threshold)
set position threshold
Definition: hpm_qeiv2_drv.h:1440
static bool qeiv2_get_current_phase_a_level(QEIV2_Type *qeiv2_x)
get current a phase level
Definition: hpm_qeiv2_drv.h:790
static void qeiv2_config_z_phase_counter_mode(QEIV2_Type *qeiv2_x, qeiv2_z_count_work_mode_t mode)
config z phase counter increment and decrement mode
Definition: hpm_qeiv2_drv.h:265
hpm_stat_t qeiv2_config_position_cmp2_match_condition(QEIV2_Type *qeiv2_x, qeiv2_pos_cmp_match_config_t *config)
config position compare2 match condition
Definition: hpm_qeiv2_drv.c:121
enum qeiv2_uvw_pos_opt qeiv2_uvw_pos_opt_t
uvw position option
static void qeiv2_disable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
disable qeiv2 dma
Definition: hpm_qeiv2_drv.h:630
static void qeiv2_release_counter(QEIV2_Type *qeiv2_x)
release counter.
Definition: hpm_qeiv2_drv.h:425
static uint32_t qeiv2_get_angle(QEIV2_Type *qeiv2_x)
get angle value
Definition: hpm_qeiv2_drv.h:1608
static void qeiv2_config_wdog(QEIV2_Type *qeiv2_x, uint32_t timeout, uint8_t clr_phcnt, bool enable)
config watchdog
Definition: hpm_qeiv2_drv.h:473
qeiv2_z_count_work_mode
counting mode of Z-phase counter
Definition: hpm_qeiv2_drv.h:80
qeiv2_uvw_pos_idx
Definition: hpm_qeiv2_drv.h:146
qeiv2_spd_tmr_content
spd and tmr read selection
Definition: hpm_qeiv2_drv.h:53
qeiv2_position_dir
compare match position direction
Definition: hpm_qeiv2_drv.h:71
static uint32_t qeiv2_get_postion(QEIV2_Type *qeiv2_x)
get position value
Definition: hpm_qeiv2_drv.h:1584
static void qeiv2_set_cycle0_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
set cycle0 value
Definition: hpm_qeiv2_drv.h:1064
enum qeiv2_work_mode qeiv2_work_mode_t
qeiv2 work mode
static void qeiv2_pause_pos_counter_on_fault(QEIV2_Type *qeiv2_x, bool enable)
pause pos counter when fault assert
Definition: hpm_qeiv2_drv.h:381
static void qeiv2_set_spd_pos_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set spdcnt or position compare2 value. It's selected by CR register rd_sel bit.
Definition: hpm_qeiv2_drv.h:943
void qeiv2_config_mode(QEIV2_Type *qeiv2_x, qeiv2_mode_config_t *config)
config qei mode
Definition: hpm_qeiv2_drv.c:12
static void qeiv2_config_phmax(QEIV2_Type *qeiv2_x, uint32_t phmax)
config phase max value
Definition: hpm_qeiv2_drv.h:300
static void qeiv2_enable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
enable trig out trigger event
Definition: hpm_qeiv2_drv.h:505
static void qeiv2_disable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
disable qeiv2 irq
Definition: hpm_qeiv2_drv.h:756
static void qeiv2_set_z_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set zcnt compare2 value
Definition: hpm_qeiv2_drv.h:921
static bool qeiv2_get_current_phase_b_level(QEIV2_Type *qeiv2_x)
get current b phase level
Definition: hpm_qeiv2_drv.h:801
static uint32_t qeiv2_get_cycle0_pulse_snap0(QEIV2_Type *qeiv2_x)
get pulse0 snap0 value
Definition: hpm_qeiv2_drv.h:1075
static void qeiv2_set_spd_pos_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set spdcnt or position compare value. It's selected by CR register rd_sel bit.
Definition: hpm_qeiv2_drv.h:884
static uint32_t qeiv2_get_cycle0_pulse_snap1(QEIV2_Type *qeiv2_x)
get pulse0 snap1 value
Definition: hpm_qeiv2_drv.h:1086
static uint32_t qeiv2_get_phase_cnt(QEIV2_Type *qeiv2_x)
get phase counter value
Definition: hpm_qeiv2_drv.h:1549
static uint32_t qeiv2_get_cycle1_pulse1cycle_snap0(QEIV2_Type *qeiv2_x)
get pulse1cycle snap0 value
Definition: hpm_qeiv2_drv.h:1336
static void qeiv2_set_phcnt_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set phcnt compare value
Definition: hpm_qeiv2_drv.h:871
hpm_stat_t qeiv2_config_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_config_t *config)
config uvw position
Definition: hpm_qeiv2_drv.c:167
static uint32_t qeiv2_get_count_on_read_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
get read event count value
Definition: hpm_qeiv2_drv.h:825
static void qeiv2_set_cmp2_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp, bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
set compare2 match options
Definition: hpm_qeiv2_drv.h:962
qeiv2_rotate_dir
compare match rotate direction
Definition: hpm_qeiv2_drv.h:62
static void qeiv2_set_phcnt_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set phcnt compare2 value
Definition: hpm_qeiv2_drv.h:932
static void qeiv2_enable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
enable dma request
Definition: hpm_qeiv2_drv.h:605
static uint32_t qeiv2_get_cycle1_pulse1cycle_snap1(QEIV2_Type *qeiv2_x)
get pulse1cycle snap1 value
Definition: hpm_qeiv2_drv.h:1347
static void qeiv2_pause_counter(QEIV2_Type *qeiv2_x, uint32_t counter_mask, bool enable)
pause counter when pause assert
Definition: hpm_qeiv2_drv.h:366
static void qeiv2_config_abz_uvw_signal_edge(QEIV2_Type *qeiv2_x, bool siga_en, bool sigb_en, bool sigz_en, bool posedge_en, bool negedge_en)
config signal enablement and edge for speed and position measurement
Definition: hpm_qeiv2_drv.h:984
static uint32_t qeiv2_get_pulse1_cycle_snap1(QEIV2_Type *qeiv2_x)
get cycle1 snap1 value
Definition: hpm_qeiv2_drv.h:1053
static uint32_t qeiv2_get_count_on_snap0_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
read the value of each phase snapshot 0 counter
Definition: hpm_qeiv2_drv.h:837
static uint32_t qeiv2_get_pulse0_cycle_snap0(QEIV2_Type *qeiv2_x)
get cycle0 snap0 value
Definition: hpm_qeiv2_drv.h:1009
static void qeiv2_set_cycle1_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
set cycle1 value
Definition: hpm_qeiv2_drv.h:1119
static uint32_t qeiv2_get_cycle1_pulse_snap0(QEIV2_Type *qeiv2_x)
get pulse1 snap0 value
Definition: hpm_qeiv2_drv.h:1314
static void qeiv2_set_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint32_t pos)
set uvw position
Definition: hpm_qeiv2_drv.h:1505
static void qeiv2_set_uvw_position_opt(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_opt_t opt)
set uvw position option
Definition: hpm_qeiv2_drv.h:1451
static bool qeiv2_check_spd_tmr_as_pos_angle(QEIV2_Type *qeiv2_x)
check spd and tmr register content as pos and angle
Definition: hpm_qeiv2_drv.h:447
qeiv2_uvw_pos_sel
Definition: hpm_qeiv2_drv.h:130
static void qeiv2_disable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
disable trig out trigger event
Definition: hpm_qeiv2_drv.h:530
static void qeiv2_config_adcx(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
adcx config
Definition: hpm_qeiv2_drv.h:1374
static void qeiv2_set_pulse1_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
set pulse1 value
Definition: hpm_qeiv2_drv.h:1031
void qeiv2_config_pause(QEIV2_Type *qeiv2_x, qeiv2_pause_config_t *config)
config pause signal
Definition: hpm_qeiv2_drv.c:67
static void qeiv2_clear_counter_when_dir_chg(QEIV2_Type *qeiv2_x, bool enable)
enable or disable clear counter if detect direction change
Definition: hpm_qeiv2_drv.h:1358
static uint32_t qeiv2_get_current_count(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
get current counter value
Definition: hpm_qeiv2_drv.h:768
void qeiv2_config_filter(QEIV2_Type *qeiv2_x, qeiv2_filter_phase_t phase, bool outinv, qeiv2_filter_mode_t mode, bool sync, uint32_t filtlen)
config signal filter
Definition: hpm_qeiv2_drv.c:196
static void qeiv2_disable_snap(QEIV2_Type *qeiv2_x)
disable snap
Definition: hpm_qeiv2_drv.h:405
static void qeiv2_config_adcy(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
adcy config
Definition: hpm_qeiv2_drv.h:1395
void qeiv2_get_uvw_position_defconfig(qeiv2_uvw_config_t *config)
get uvw position default config
Definition: hpm_qeiv2_drv.c:131
static void qeiv2_config_position_timeout(QEIV2_Type *qeiv2_x, uint32_t tm, bool enable)
config position timeout for mmc module
Definition: hpm_qeiv2_drv.h:1620
@ qeiv2_uvw_pos_opt_current
Definition: hpm_qeiv2_drv.h:126
@ qeiv2_uvw_pos_opt_next
Definition: hpm_qeiv2_drv.h:127
@ qeiv2_filter_phase_h
Definition: hpm_qeiv2_drv.h:116
@ qeiv2_filter_phase_z
Definition: hpm_qeiv2_drv.h:115
@ qeiv2_filter_phase_f
Definition: hpm_qeiv2_drv.h:118
@ qeiv2_filter_phase_b
Definition: hpm_qeiv2_drv.h:114
@ qeiv2_filter_phase_h2
Definition: hpm_qeiv2_drv.h:117
@ qeiv2_filter_phase_a
Definition: hpm_qeiv2_drv.h:113
@ qeiv2_filter_mode_bypass
Definition: hpm_qeiv2_drv.h:101
@ qeiv2_filter_mode_burr
Definition: hpm_qeiv2_drv.h:102
@ qeiv2_filter_mode_delay
Definition: hpm_qeiv2_drv.h:103
@ qeiv2_filter_mode_peak
Definition: hpm_qeiv2_drv.h:104
@ qeiv2_filter_mode_valley
Definition: hpm_qeiv2_drv.h:105
@ qeiv2_counter_type_phase
Definition: hpm_qeiv2_drv.h:91
@ qeiv2_counter_type_timer
Definition: hpm_qeiv2_drv.h:93
@ qeiv2_counter_type_speed
Definition: hpm_qeiv2_drv.h:92
@ qeiv2_counter_type_z
Definition: hpm_qeiv2_drv.h:90
@ qeiv2_work_mode_single
Definition: hpm_qeiv2_drv.h:44
@ qeiv2_work_mode_pd
Definition: hpm_qeiv2_drv.h:41
@ qeiv2_work_mode_sincos
Definition: hpm_qeiv2_drv.h:46
@ qeiv2_work_mode_abz
Definition: hpm_qeiv2_drv.h:40
@ qeiv2_work_mode_uvw
Definition: hpm_qeiv2_drv.h:43
@ qeiv2_work_mode_sin
Definition: hpm_qeiv2_drv.h:45
@ qeiv2_work_mode_ud
Definition: hpm_qeiv2_drv.h:42
@ qeiv2_z_count_inc_on_z_input_assert
Definition: hpm_qeiv2_drv.h:81
@ qeiv2_z_count_inc_on_phase_count_max
Definition: hpm_qeiv2_drv.h:82
@ qeiv2_uvw_pos0
Definition: hpm_qeiv2_drv.h:147
@ qeiv2_uvw_pos3
Definition: hpm_qeiv2_drv.h:150
@ qeiv2_uvw_pos1
Definition: hpm_qeiv2_drv.h:148
@ qeiv2_uvw_pos4
Definition: hpm_qeiv2_drv.h:151
@ qeiv2_uvw_pos2
Definition: hpm_qeiv2_drv.h:149
@ qeiv2_uvw_pos5
Definition: hpm_qeiv2_drv.h:152
@ qeiv2_spd_tmr_as_spd_tm
Definition: hpm_qeiv2_drv.h:54
@ qeiv2_spd_tmr_as_pos_angle
Definition: hpm_qeiv2_drv.h:55
@ qeiv2_pos_dir_decrease
Definition: hpm_qeiv2_drv.h:72
@ qeiv2_pos_dir_increase
Definition: hpm_qeiv2_drv.h:73
@ qeiv2_rotate_dir_forward
Definition: hpm_qeiv2_drv.h:63
@ qeiv2_rotate_dir_reverse
Definition: hpm_qeiv2_drv.h:64
@ qeiv2_uvw_pos_sel_low
Definition: hpm_qeiv2_drv.h:131
@ qeiv2_uvw_pos_sel_high
Definition: hpm_qeiv2_drv.h:132
@ qeiv2_uvw_pos_sel_edge
Definition: hpm_qeiv2_drv.h:133
Definition: hpm_qeiv2_regs.h:12
__RW uint32_t PHCFG
Definition: hpm_qeiv2_regs.h:14
__RW uint32_t ADCX_CFG2
Definition: hpm_qeiv2_regs.h:68
__R uint32_t CYCLE1_SNAP1
Definition: hpm_qeiv2_regs.h:49
__RW uint32_t CYCLE1_NUM
Definition: hpm_qeiv2_regs.h:52
__R uint32_t PULSE0CYCLE_SNAP0
Definition: hpm_qeiv2_regs.h:58
__RW uint32_t SPDCMP
Definition: hpm_qeiv2_regs.h:21
__R uint32_t CYCLE0_SNAP1
Definition: hpm_qeiv2_regs.h:47
__RW uint32_t TOGI_CFG0
Definition: hpm_qeiv2_regs.h:97
__RW uint32_t ADCX_VAL_SW
Definition: hpm_qeiv2_regs.h:73
__R uint32_t PULSE0_SNAP0
Definition: hpm_qeiv2_regs.h:57
__RW uint32_t PULSE0_NUM
Definition: hpm_qeiv2_regs.h:40
__RW uint32_t ZCMP2
Definition: hpm_qeiv2_regs.h:32
__R uint32_t ANGLE
Definition: hpm_qeiv2_regs.h:87
__RW uint32_t PHIDX
Definition: hpm_qeiv2_regs.h:16
__RW uint32_t PHASE_CNT
Definition: hpm_qeiv2_regs.h:83
__RW uint32_t PHASE_PARAM
Definition: hpm_qeiv2_regs.h:76
__W uint32_t POSITION_UPDATE
Definition: hpm_qeiv2_regs.h:86
__RW uint32_t CYCLE0_NUM
Definition: hpm_qeiv2_regs.h:51
__RW uint32_t WDGCFG
Definition: hpm_qeiv2_regs.h:15
__RW uint32_t IRQEN
Definition: hpm_qeiv2_regs.h:24
__R uint32_t CYCLE1_SNAP0
Definition: hpm_qeiv2_regs.h:48
__RW uint32_t ADCX_CFG1
Definition: hpm_qeiv2_regs.h:67
__R uint32_t PULSE0CYCLE_SNAP1
Definition: hpm_qeiv2_regs.h:60
__RW uint32_t POS_THRESHOLD
Definition: hpm_qeiv2_regs.h:78
__RW uint32_t TRGOEN
Definition: hpm_qeiv2_regs.h:17
__R uint32_t PULSE1_SNAP0
Definition: hpm_qeiv2_regs.h:61
__RW uint32_t ADCY_CFG1
Definition: hpm_qeiv2_regs.h:71
__RW uint32_t POS_ADJ
Definition: hpm_qeiv2_regs.h:82
__RW uint32_t PULSE1_NUM
Definition: hpm_qeiv2_regs.h:41
__RW uint32_t DMAEN
Definition: hpm_qeiv2_regs.h:22
__RW uint32_t PHCMP
Definition: hpm_qeiv2_regs.h:20
__RW uint32_t ADCY_CFG2
Definition: hpm_qeiv2_regs.h:72
__RW uint32_t PHCMP2
Definition: hpm_qeiv2_regs.h:33
__RW uint32_t UVW_POS_CFG[6]
Definition: hpm_qeiv2_regs.h:81
__RW uint32_t POSITION
Definition: hpm_qeiv2_regs.h:85
__RW uint32_t ZCMP
Definition: hpm_qeiv2_regs.h:19
__RW uint32_t UVW_POS[6]
Definition: hpm_qeiv2_regs.h:80
__RW uint32_t CAL_CFG
Definition: hpm_qeiv2_regs.h:74
__R uint32_t PULSE1CYCLE_SNAP1
Definition: hpm_qeiv2_regs.h:64
__RW uint32_t READEN
Definition: hpm_qeiv2_regs.h:18
__W uint32_t PHASE_UPDATE
Definition: hpm_qeiv2_regs.h:84
__RW uint32_t MATCH_CFG
Definition: hpm_qeiv2_regs.h:35
__RW uint32_t ADCY_VAL_SW
Definition: hpm_qeiv2_regs.h:77
__R uint32_t PULSE1CYCLE_SNAP0
Definition: hpm_qeiv2_regs.h:62
struct QEIV2_Type::@335 COUNT[4]
__RW uint32_t POS_TIMEOUT
Definition: hpm_qeiv2_regs.h:88
__RW uint32_t CR
Definition: hpm_qeiv2_regs.h:13
__RW uint32_t SPDCMP2
Definition: hpm_qeiv2_regs.h:34
__RW uint32_t Z
Definition: hpm_qeiv2_regs.h:26
__RW uint32_t ADC_INJECT_CTRL
Definition: hpm_qeiv2_regs.h:79
__RW uint32_t ADCY_CFG0
Definition: hpm_qeiv2_regs.h:70
__RW uint32_t ADCX_CFG0
Definition: hpm_qeiv2_regs.h:66
__R uint32_t PULSE0_SNAP1
Definition: hpm_qeiv2_regs.h:59
__RW uint32_t SR
Definition: hpm_qeiv2_regs.h:23
__R uint32_t CALC_STATE
Definition: hpm_qeiv2_regs.h:95
__R uint32_t PULSE1_SNAP1
Definition: hpm_qeiv2_regs.h:63
__RW uint32_t QEI_CFG
Definition: hpm_qeiv2_regs.h:38
__R uint32_t CYCLE0_SNAP0
Definition: hpm_qeiv2_regs.h:46
adc config structure
Definition: hpm_qeiv2_drv.h:235
uint8_t adc_channel
Definition: hpm_qeiv2_drv.h:237
uint8_t adc_select
Definition: hpm_qeiv2_drv.h:236
int16_t param0
Definition: hpm_qeiv2_drv.h:238
int16_t param1
Definition: hpm_qeiv2_drv.h:239
uint32_t offset
Definition: hpm_qeiv2_drv.h:240
qeiv2 H phase config structure
Definition: hpm_qeiv2_drv.h:178
bool h_fall_dir_forward
Definition: hpm_qeiv2_drv.h:179
bool h_rise_dir_reverse
Definition: hpm_qeiv2_drv.h:182
bool h2_rise_dir_reverse
Definition: hpm_qeiv2_drv.h:186
bool h2_fall_dir_reverse
Definition: hpm_qeiv2_drv.h:184
bool h2_rise_dir_forward
Definition: hpm_qeiv2_drv.h:185
bool h2_fall_dir_forward
Definition: hpm_qeiv2_drv.h:183
bool h_rise_dir_forward
Definition: hpm_qeiv2_drv.h:181
bool h_fall_dir_reverse
Definition: hpm_qeiv2_drv.h:180
qeiv2 mode config structure
Definition: hpm_qeiv2_drv.h:165
uint32_t phcnt_max
Definition: hpm_qeiv2_drv.h:169
uint32_t phcnt_idx
Definition: hpm_qeiv2_drv.h:172
qeiv2_spd_tmr_content_t spd_tmr_content_sel
Definition: hpm_qeiv2_drv.h:167
qeiv2_work_mode_t work_mode
Definition: hpm_qeiv2_drv.h:166
qeiv2 pause config structure
Definition: hpm_qeiv2_drv.h:192
bool pause_valid_pause_phcnt
Definition: hpm_qeiv2_drv.h:195
bool pause_valid_pause_position
Definition: hpm_qeiv2_drv.h:193
bool pause_valid_pause_spdcnt
Definition: hpm_qeiv2_drv.h:194
bool pause_valid_pause_zcnt
Definition: hpm_qeiv2_drv.h:196
phase counter compare match config structure
Definition: hpm_qeiv2_drv.h:203
bool ignore_zcmp
Definition: hpm_qeiv2_drv.h:207
qeiv2_rotate_dir_t rotate_dir
Definition: hpm_qeiv2_drv.h:206
uint32_t zcmp_value
Definition: hpm_qeiv2_drv.h:208
uint32_t phcnt_cmp_value
Definition: hpm_qeiv2_drv.h:204
bool ignore_rotate_dir
Definition: hpm_qeiv2_drv.h:205
position compare match config structure
Definition: hpm_qeiv2_drv.h:215
uint32_t pos_cmp_value
Definition: hpm_qeiv2_drv.h:216
qeiv2_position_dir_t pos_dir
Definition: hpm_qeiv2_drv.h:218
bool ignore_pos_dir
Definition: hpm_qeiv2_drv.h:217
uvw config structure
Definition: hpm_qeiv2_drv.h:224
qeiv2_uvw_pos_opt_t pos_opt
Definition: hpm_qeiv2_drv.h:225