Driverlib EQEP API
Module: Driverlib (AM13E232X) APIs
Structures
Name |
|
|---|---|
struct |
DL_EQEP_SOURCE_SELECT |
struct |
DL_EQEP_InputConfig |
struct |
DL_EQEP_QmaConfig |
struct |
DL_EQEP_QduConfig |
struct |
DL_EQEP_PositionLatchConfig |
struct |
DL_EQEP_PositionInitializationConfig |
struct |
DL_EQEP_PositionCompareConfig |
struct |
DL_EQEP_PccuConfig |
struct |
DL_EQEP_UtimeConfig |
struct |
DL_EQEP_QcapConfig |
struct |
DL_EQEP_QwdogConfig |
struct |
DL_EQEP_InterruptConfig |
struct |
DL_EQEP_Config |
Types
Name |
|
|---|---|
enum |
DL_EQEP_POSITION_RESET_MODE { DL_EQEP_POSITION_RESET_IDX = EQEP_QEPCTL_PCRM_PCRM_INDEX, DL_EQEP_POSITION_RESET_MAX_POS = EQEP_QEPCTL_PCRM_PCRM_MAXPOS, DL_EQEP_POSITION_RESET_1ST_INDEX = EQEP_QEPCTL_PCRM_PCRM_FIRSTINDEX, DL_EQEP_POSITION_RESET_UNIT_TIME_OUT = EQEP_QEPCTL_PCRM_PCRM_TIMEEVENT} |
enum |
DL_EQEP_CAP_CLK_PRESCALE { DL_EQEP_CAPTURE_CLK_DIV_1 = EQEP_QCAPCTL_CCPS_SYSCLKOUT1, DL_EQEP_CAPTURE_CLK_DIV_2 = EQEP_QCAPCTL_CCPS_SYSCLKOUT2, DL_EQEP_CAPTURE_CLK_DIV_4 = EQEP_QCAPCTL_CCPS_SYSCLKOUT4, DL_EQEP_CAPTURE_CLK_DIV_8 = EQEP_QCAPCTL_CCPS_SYSCLKOUT8, DL_EQEP_CAPTURE_CLK_DIV_16 = EQEP_QCAPCTL_CCPS_SYSCLKOUT16, DL_EQEP_CAPTURE_CLK_DIV_32 = EQEP_QCAPCTL_CCPS_SYSCLKOUT32, DL_EQEP_CAPTURE_CLK_DIV_64 = EQEP_QCAPCTL_CCPS_SYSCLKOUT64, DL_EQEP_CAPTURE_CLK_DIV_128 = EQEP_QCAPCTL_CCPS_SYSCLKOUT128} |
enum |
DL_EQEP_UPEVNT_PRESCALE { DL_EQEP_UNIT_POS_EVNT_DIV_1 = EQEP_QCAPCTL_UPPS_QCLK1, DL_EQEP_UNIT_POS_EVNT_DIV_2 = EQEP_QCAPCTL_UPPS_QCLK2, DL_EQEP_UNIT_POS_EVNT_DIV_4 = EQEP_QCAPCTL_UPPS_QCLK4, DL_EQEP_UNIT_POS_EVNT_DIV_8 = EQEP_QCAPCTL_UPPS_QCLK8, DL_EQEP_UNIT_POS_EVNT_DIV_16 = EQEP_QCAPCTL_UPPS_QCLK16, DL_EQEP_UNIT_POS_EVNT_DIV_32 = EQEP_QCAPCTL_UPPS_QCLK32, DL_EQEP_UNIT_POS_EVNT_DIV_64 = EQEP_QCAPCTL_UPPS_QCLK64, DL_EQEP_UNIT_POS_EVNT_DIV_128 = EQEP_QCAPCTL_UPPS_QCLK128, DL_EQEP_UNIT_POS_EVNT_DIV_256 = EQEP_QCAPCTL_UPPS_QCLK256, DL_EQEP_UNIT_POS_EVNT_DIV_512 = EQEP_QCAPCTL_UPPS_QCLK512, DL_EQEP_UNIT_POS_EVNT_DIV_1024 = EQEP_QCAPCTL_UPPS_QCLK1024, DL_EQEP_UNIT_POS_EVNT_DIV_2048 = EQEP_QCAPCTL_UPPS_QCLK2048} |
enum |
DL_EQEP_STROBE_SOURCE { DL_EQEP_STROBE_FROM_GPIO = EQEP_QEPSTROBESEL_STROBESEL_QS_AFTER_POL_MUX, DL_EQEP_STROBE_OR_ADCSOCA = EQEP_QEPSTROBESEL_STROBESEL_ADCSOCA_AS_QS, DL_EQEP_STROBE_OR_ADCSOCB = EQEP_QEPSTROBESEL_STROBESEL_ADCSOCB_AS_QS} |
enum |
DL_EQEP_QMA_MODE { DL_EQEP_QMA_MODE_BYPASS = 0U, DL_EQEP_QMA_MODE_1 = 1U, DL_EQEP_QMA_MODE_2 = 2U} |
enum |
DL_EQEP_EMULATION_MODE { DL_EQEP_EMULATIONMODE_STOPIMMEDIATELY = EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_0, DL_EQEP_EMULATIONMODE_STOPATROLLOVER = EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_1, DL_EQEP_EMULATIONMODE_RUNFREE = EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_2} |
enum |
DL_EQEP_SOURCE { DL_EQEP_SOURCE_INPUTXBAR = 0, DL_EQEP_SOURCE_CMPSS0_CTRIPH = 1, DL_EQEP_SOURCE_CMPSS1_CTRIPH = 2, DL_EQEP_SOURCE_CMPSS2_CTRIPH = 3, DL_EQEP_SOURCE_CMPSS3_CTRIPH = 4, DL_EQEP_SOURCE_PWMXBAR1 = 5, DL_EQEP_SOURCE_PWMXBAR2 = 6, DL_EQEP_SOURCE_PWMXBAR3 = 7, DL_EQEP_SOURCE_PWMXBAR4 = 8, DL_EQEP_SOURCE_PWMXBAR5 = 9, DL_EQEP_SOURCE_PWMXBAR6 = 10, DL_EQEP_SOURCE_PWMXBAR7 = 11, DL_EQEP_SOURCE_PWMXBAR8 = 12} |
Functions
Name |
|
|---|---|
__STATIC_INLINE void |
DL_EQEP_enableModule(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_disableModule(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setDecoderConfig(EQEP_Regs * eqep, uint16_t config) |
__STATIC_INLINE void |
DL_EQEP_setPositionCounterConfig(EQEP_Regs * eqep, DL_EQEP_POSITION_RESET_MODE mode, uint32_t maxPosition) |
__STATIC_INLINE uint32_t |
DL_EQEP_getPosition(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setPosition(EQEP_Regs * eqep, uint32_t position) |
__STATIC_INLINE int16_t |
DL_EQEP_getDirection(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_enableInterrupt(EQEP_Regs * eqep, uint16_t intFlags) |
__STATIC_INLINE void |
DL_EQEP_disableInterrupt(EQEP_Regs * eqep, uint16_t intFlags) |
__STATIC_INLINE uint16_t |
DL_EQEP_getInterruptStatus(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_clearInterruptStatus(EQEP_Regs * eqep, uint16_t intFlags) |
__STATIC_INLINE void |
DL_EQEP_forceInterrupt(EQEP_Regs * eqep, uint16_t intFlags) |
__STATIC_INLINE bool |
DL_EQEP_getError(EQEP_Regs * eqep) |
__STATIC_INLINE uint16_t |
DL_EQEP_getStatus(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_clearStatus(EQEP_Regs * eqep, uint16_t statusFlags) |
__STATIC_INLINE void |
DL_EQEP_setCaptureConfig(EQEP_Regs * eqep, DL_EQEP_CAP_CLK_PRESCALE capPrescale, DL_EQEP_UPEVNT_PRESCALE evntPrescale) |
__STATIC_INLINE void |
DL_EQEP_enableCapture(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_disableCapture(EQEP_Regs * eqep) |
__STATIC_INLINE uint16_t |
DL_EQEP_getCapturePeriod(EQEP_Regs * eqep) |
__STATIC_INLINE uint16_t |
DL_EQEP_getCaptureTimer(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_enableCompare(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_disableCompare(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setComparePulseWidth(EQEP_Regs * eqep, uint16_t cycles) |
__STATIC_INLINE void |
DL_EQEP_loadUnitTimer(EQEP_Regs * eqep, uint32_t period) |
__STATIC_INLINE void |
DL_EQEP_enableUnitTimer(EQEP_Regs * eqep, uint32_t period) |
__STATIC_INLINE void |
DL_EQEP_disableUnitTimer(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_enableWatchdog(EQEP_Regs * eqep, uint16_t period) |
__STATIC_INLINE void |
DL_EQEP_disableWatchdog(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setWatchdogTimerValue(EQEP_Regs * eqep, uint16_t value) |
__STATIC_INLINE uint16_t |
DL_EQEP_getWatchdogTimerValue(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setPositionInitMode(EQEP_Regs * eqep, uint16_t initMode) |
__STATIC_INLINE void |
DL_EQEP_setSWPositionInit(EQEP_Regs * eqep, bool initialize) |
__STATIC_INLINE void |
DL_EQEP_setInitialPosition(EQEP_Regs * eqep, uint32_t position) |
__STATIC_INLINE void |
DL_EQEP_setLatchMode(EQEP_Regs * eqep, uint32_t latchMode) |
__STATIC_INLINE uint32_t |
DL_EQEP_getIndexPositionLatch(EQEP_Regs * eqep) |
__STATIC_INLINE uint32_t |
DL_EQEP_getStrobePositionLatch(EQEP_Regs * eqep) |
__STATIC_INLINE uint32_t |
DL_EQEP_getPositionLatch(EQEP_Regs * eqep) |
__STATIC_INLINE uint16_t |
DL_EQEP_getCaptureTimerLatch(EQEP_Regs * eqep) |
__STATIC_INLINE uint16_t |
DL_EQEP_getCapturePeriodLatch(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_setQMAModuleMode(EQEP_Regs * eqep, DL_EQEP_QMA_MODE qmaMode) |
__STATIC_INLINE void |
DL_EQEP_setStrobeSource(EQEP_Regs * eqep, DL_EQEP_STROBE_SOURCE strobeSrc) |
__STATIC_INLINE void |
DL_EQEP_enableDirectionChangeDuringIndex(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_disableDirectionChangeDuringIndex(EQEP_Regs * eqep) |
__STATIC_INLINE void |
DL_EQEP_selectSource(EQEP_Regs * eqep, DL_EQEP_SOURCE_SELECT sourceConfig) |
__STATIC_INLINE void |
DL_EQEP_setEmulationMode(EQEP_Regs * eqep, DL_EQEP_EMULATION_MODE emuMode) |
void |
DL_EQEP_setCompareConfig(EQEP_Regs * eqep, uint16_t config, uint32_t compareValue, uint16_t cycles) |
void |
DL_EQEP_setInputPolarity(EQEP_Regs * eqep, bool invertQEPA, bool invertQEPB, bool invertIndex, bool invertStrobe) |
void |
DL_EQEP_initParamsSetDefault(DL_EQEP_Config * config) |
void |
DL_EQEP_init(EQEP_Regs * eqep, DL_EQEP_Config * config) |
Defines
Name |
|
|---|---|
DL_EQEP_CONFIG_QUADRATURE |
|
DL_EQEP_CONFIG_CLOCK_DIR |
|
DL_EQEP_CONFIG_UP_COUNT |
|
DL_EQEP_CONFIG_DOWN_COUNT |
|
DL_EQEP_CONFIG_2X_RESOLUTION |
|
DL_EQEP_CONFIG_1X_RESOLUTION |
|
DL_EQEP_CONFIG_NO_SWAP |
|
DL_EQEP_CONFIG_SWAP |
|
DL_EQEP_CONFIG_IGATE_DISABLE |
|
DL_EQEP_CONFIG_IGATE_ENABLE |
|
DL_EQEP_COMPARE_NO_SYNC_OUT |
|
DL_EQEP_COMPARE_IDX_SYNC_OUT |
|
DL_EQEP_COMPARE_STROBE_SYNC_OUT |
|
DL_EQEP_INT_GLOBAL |
|
DL_EQEP_INT_POS_CNT_ERROR |
|
DL_EQEP_INT_PHASE_ERROR |
|
DL_EQEP_INT_DIR_CHANGE |
|
DL_EQEP_INT_WATCHDOG |
|
DL_EQEP_INT_UNDERFLOW |
|
DL_EQEP_INT_OVERFLOW |
|
DL_EQEP_INT_POS_COMP_READY |
|
DL_EQEP_INT_POS_COMP_MATCH |
|
DL_EQEP_INT_STROBE_EVNT_LATCH |
|
DL_EQEP_INT_INDEX_EVNT_LATCH |
|
DL_EQEP_INT_UNIT_TIME_OUT |
|
DL_EQEP_INT_QMA_ERROR |
|
DL_EQEP_STS_UNIT_POS_EVNT |
|
DL_EQEP_STS_DIR_ON_1ST_IDX |
|
DL_EQEP_STS_DIR_FLAG |
|
DL_EQEP_STS_DIR_LATCH |
|
DL_EQEP_STS_CAP_OVRFLW_ERROR |
|
DL_EQEP_STS_CAP_DIR_ERROR |
|
DL_EQEP_STS_1ST_IDX_FLAG |
|
DL_EQEP_STS_POS_CNT_ERROR |
|
DL_EQEP_LATCH_CNT_READ_BY_CPU |
|
DL_EQEP_LATCH_UNIT_TIME_OUT |
|
DL_EQEP_LATCH_RISING_STROBE |
|
DL_EQEP_LATCH_EDGE_DIR_STROBE |
|
DL_EQEP_LATCH_RISING_INDEX |
|
DL_EQEP_LATCH_FALLING_INDEX |
|
DL_EQEP_LATCH_SW_INDEX_MARKER |
|
DL_EQEP_INIT_DO_NOTHING |
|
DL_EQEP_INIT_RISING_STROBE |
|
DL_EQEP_INIT_EDGE_DIR_STROBE |
|
DL_EQEP_INIT_RISING_INDEX |
|
DL_EQEP_INIT_FALLING_INDEX |
|
DL_EQEP_COMPARE_NO_SHADOW |
|
DL_EQEP_COMPARE_LOAD_ON_ZERO |
|
DL_EQEP_COMPARE_LOAD_ON_MATCH |
Types Documentation
enum DL_EQEP_POSITION_RESET_MODE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_POSITION_RESET_IDX |
EQEP_QEPCTL_PCRM_PCRM_INDEX |
Reset position counter on an index event |
DL_EQEP_POSITION_RESET_MAX_POS |
EQEP_QEPCTL_PCRM_PCRM_MAXPOS |
Reset position counter on the maximum position |
DL_EQEP_POSITION_RESET_1ST_INDEX |
EQEP_QEPCTL_PCRM_PCRM_FIRSTINDEX |
Reset position counter on the first index event |
DL_EQEP_POSITION_RESET_UNIT_TIME_OUT |
EQEP_QEPCTL_PCRM_PCRM_TIMEEVENT |
Reset position counter on a unit time event |
Position counter reset mode.
enum DL_EQEP_CAP_CLK_PRESCALE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_CAPTURE_CLK_DIV_1 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT1 |
CAPCLK = SYSCLKOUT/1 |
DL_EQEP_CAPTURE_CLK_DIV_2 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT2 |
CAPCLK = SYSCLKOUT/2 |
DL_EQEP_CAPTURE_CLK_DIV_4 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT4 |
CAPCLK = SYSCLKOUT/4 |
DL_EQEP_CAPTURE_CLK_DIV_8 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT8 |
CAPCLK = SYSCLKOUT/8 |
DL_EQEP_CAPTURE_CLK_DIV_16 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT16 |
CAPCLK = SYSCLKOUT/16 |
DL_EQEP_CAPTURE_CLK_DIV_32 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT32 |
CAPCLK = SYSCLKOUT/32 |
DL_EQEP_CAPTURE_CLK_DIV_64 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT64 |
CAPCLK = SYSCLKOUT/64 |
DL_EQEP_CAPTURE_CLK_DIV_128 |
EQEP_QCAPCTL_CCPS_SYSCLKOUT128 |
CAPCLK = SYSCLKOUT/128 |
EQEP capture timer clock prescaler.
enum DL_EQEP_UPEVNT_PRESCALE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_UNIT_POS_EVNT_DIV_1 |
EQEP_QCAPCTL_UPPS_QCLK1 |
UPEVNT = QCLK/1 |
DL_EQEP_UNIT_POS_EVNT_DIV_2 |
EQEP_QCAPCTL_UPPS_QCLK2 |
UPEVNT = QCLK/2 |
DL_EQEP_UNIT_POS_EVNT_DIV_4 |
EQEP_QCAPCTL_UPPS_QCLK4 |
UPEVNT = QCLK/4 |
DL_EQEP_UNIT_POS_EVNT_DIV_8 |
EQEP_QCAPCTL_UPPS_QCLK8 |
UPEVNT = QCLK/8 |
DL_EQEP_UNIT_POS_EVNT_DIV_16 |
EQEP_QCAPCTL_UPPS_QCLK16 |
UPEVNT = QCLK/16 |
DL_EQEP_UNIT_POS_EVNT_DIV_32 |
EQEP_QCAPCTL_UPPS_QCLK32 |
UPEVNT = QCLK/32 |
DL_EQEP_UNIT_POS_EVNT_DIV_64 |
EQEP_QCAPCTL_UPPS_QCLK64 |
UPEVNT = QCLK/64 |
DL_EQEP_UNIT_POS_EVNT_DIV_128 |
EQEP_QCAPCTL_UPPS_QCLK128 |
UPEVNT = QCLK/128 |
DL_EQEP_UNIT_POS_EVNT_DIV_256 |
EQEP_QCAPCTL_UPPS_QCLK256 |
UPEVNT = QCLK/256 |
DL_EQEP_UNIT_POS_EVNT_DIV_512 |
EQEP_QCAPCTL_UPPS_QCLK512 |
UPEVNT = QCLK/512 |
DL_EQEP_UNIT_POS_EVNT_DIV_1024 |
EQEP_QCAPCTL_UPPS_QCLK1024 |
UPEVNT = QCLK/1024 |
DL_EQEP_UNIT_POS_EVNT_DIV_2048 |
EQEP_QCAPCTL_UPPS_QCLK2048 |
UPEVNT = QCLK/2048 |
EQEP unit position event prescaler.
enum DL_EQEP_STROBE_SOURCE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_STROBE_FROM_GPIO |
EQEP_QEPSTROBESEL_STROBESEL_QS_AFTER_POL_MUX |
GPIO |
DL_EQEP_STROBE_OR_ADCSOCA |
EQEP_QEPSTROBESEL_STROBESEL_ADCSOCA_AS_QS |
Strobe signal OR’d with ADCSOCA |
DL_EQEP_STROBE_OR_ADCSOCB |
EQEP_QEPSTROBESEL_STROBESEL_ADCSOCB_AS_QS |
Strobe signal OR’d with ADCSOCB |
EQEP strobe source.
enum DL_EQEP_QMA_MODE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_QMA_MODE_BYPASS |
0U |
QMA module is bypassed |
DL_EQEP_QMA_MODE_1 |
1U |
QMA mode-1 operation |
DL_EQEP_QMA_MODE_2 |
2U |
QMA mode-2 operation |
EQEP QMA modes.
enum DL_EQEP_EMULATION_MODE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_EMULATIONMODE_STOPIMMEDIATELY |
EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_0 |
Counters stop immediately on emulation suspend |
DL_EQEP_EMULATIONMODE_STOPATROLLOVER |
EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_1 |
Counters stop at period rollover on emulation suspend |
DL_EQEP_EMULATIONMODE_RUNFREE |
EQEP_QEPCTL_FREE_SOFT_FREE_SOFT_2 |
Counters unaffected by emulation suspend |
EQEP emulation mode.
enum DL_EQEP_SOURCE
Enumerator |
Value |
Description |
|---|---|---|
DL_EQEP_SOURCE_INPUTXBAR |
0 |
Signal comes from INPUTXBAR |
DL_EQEP_SOURCE_CMPSS0_CTRIPH |
1 |
Signal comes from CMPSS0_CTRIPH |
DL_EQEP_SOURCE_CMPSS1_CTRIPH |
2 |
Signal comes from CMPSS1_CTRIPH |
DL_EQEP_SOURCE_CMPSS2_CTRIPH |
3 |
Signal comes from CMPSS2_CTRIPH |
DL_EQEP_SOURCE_CMPSS3_CTRIPH |
4 |
Signal comes from CMPSS3_CTRIPH |
DL_EQEP_SOURCE_PWMXBAR1 |
5 |
Signal comes from PWMXBAR1 |
DL_EQEP_SOURCE_PWMXBAR2 |
6 |
Signal comes from PWMXBAR2 |
DL_EQEP_SOURCE_PWMXBAR3 |
7 |
Signal comes from PWMXBAR3 |
DL_EQEP_SOURCE_PWMXBAR4 |
8 |
Signal comes from PWMXBAR4 |
DL_EQEP_SOURCE_PWMXBAR5 |
9 |
Signal comes from PWMXBAR5 |
DL_EQEP_SOURCE_PWMXBAR6 |
10 |
Signal comes from PWMXBAR6 |
DL_EQEP_SOURCE_PWMXBAR7 |
11 |
Signal comes from PWMXBAR7 |
DL_EQEP_SOURCE_PWMXBAR8 |
12 |
Signal comes from PWMXBAR8 |
EQEP source selection.
Functions Documentation
function DL_EQEP_enableModule
__STATIC_INLINE void DL_EQEP_enableModule(
EQEP_Regs * eqep
)
Enables the eQEP module.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API enables operation of the enhanced quadrature encoder pulse (eQEP) module. The module must be configured before it is enabled.
function DL_EQEP_disableModule
__STATIC_INLINE void DL_EQEP_disableModule(
EQEP_Regs * eqep
)
Disables the eQEP module.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API disables operation of the enhanced quadrature encoder pulse (eQEP) module.
function DL_EQEP_setDecoderConfig
__STATIC_INLINE void DL_EQEP_setDecoderConfig(
EQEP_Regs * eqep,
uint16_t config
)
Configures eQEP module’s quadrature decoder unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
config Configuration for the eQEP module decoder unit. Logical OR of bit masks [DL_EQEP_RESOLUTION], [DL_EQEP_OPEARTION_MODE], [DL_EQEP_SWAP], [DL_EQEP_IGATE]
This API configures the operation of the eQEP module’s quadrature decoder unit. The config parameter provides the configuration of the decoder and is the logical OR of several values:
DL_EQEP_CONFIG_2X_RESOLUTION or DL_EQEP_CONFIG_1X_RESOLUTION specify if both rising and falling edges should be counted or just rising edges.
DL_EQEP_CONFIG_QUADRATURE, DL_EQEP_CONFIG_CLOCK_DIR, DL_EQEP_CONFIG_UP_COUNT, or DL_EQEP_CONFIG_DOWN_COUNT specify if quadrature signals are being provided on QEPA and QEPB, if a direction signal and a clock are being provided, or if the direction should be hard-wired for a single direction with QEPA used for input.
DL_EQEP_CONFIG_NO_SWAP or DL_EQEP_CONFIG_SWAP to specify if the signals provided on QEPA and QEPB should be swapped before being processed.
DL_EQEP_CONFIG_IGATE_DISABLE or DL_EQEP_CONFIG_IGATE_ENABLE to specify if the gating of the index pulse should be enabled or disabled
function DL_EQEP_setPositionCounterConfig
__STATIC_INLINE void DL_EQEP_setPositionCounterConfig(
EQEP_Regs * eqep,
DL_EQEP_POSITION_RESET_MODE mode,
uint32_t maxPosition
)
Configures eQEP position counter unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
mode Position counter reset mode that determines which event will reset the position counter
maxPosition Maximum position value used to reset the position counter when moving in the reverse direction
This API configures the operation of the eQEP position counter. The reset mode specifies the event on which the position counter is reset.
function DL_EQEP_getPosition
__STATIC_INLINE uint32_t DL_EQEP_getPosition(
EQEP_Regs * eqep
)
Gets the current encoder position.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The current position of the encoder
This API returns the current position of the encoder. Depending upon the configuration of the encoder and the occurrence of an index pulse, this value may or may not contain the expected data (that is, if in reset on index mode and an index pulse has not been encountered, the position counter is not yet aligned with the index pulse).
function DL_EQEP_setPosition
__STATIC_INLINE void DL_EQEP_setPosition(
EQEP_Regs * eqep,
uint32_t position
)
Sets the current encoder position.
Parameters:
eqep Pointer to the register overlay for the peripheral
position is the new position value for the encoder
This API sets the current position of the encoder. The encoder position is then measured relative to this value.
function DL_EQEP_getDirection
__STATIC_INLINE int16_t DL_EQEP_getDirection(
EQEP_Regs * eqep
)
Gets the current direction of rotation.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: Returns 1 if moving in the forward/clockwise direction or -1 if moving in the reverse/counter-clockwise direction
This API returns the current direction of rotation. In this case, current means the most recently detected direction of the encoder; it may not be presently moving but this is the direction it last moved before it stopped.
function DL_EQEP_enableInterrupt
__STATIC_INLINE void DL_EQEP_enableInterrupt(
EQEP_Regs * eqep,
uint16_t intFlags
)
Enables individual eQEP interrupts.
Parameters:
eqep Pointer to the register overlay for the peripheral
intFlags Bit mask of the interrupt sources to be enabled. The parameter can be any of the following values: [DL_EQEP_INT] except DL_EQEP_INT_GLOBAL
This API enables the specified eQEP interrupts.
function DL_EQEP_disableInterrupt
__STATIC_INLINE void DL_EQEP_disableInterrupt(
EQEP_Regs * eqep,
uint16_t intFlags
)
Disables individual eQEP interrupts.
Parameters:
eqep Pointer to the register overlay for the peripheral
intFlags Bit mask of the interrupt sources to be disabled. The parameter can be any of the following values: [DL_EQEP_INT] except DL_EQEP_INT_GLOBAL
This API disables the specified eQEP interrupts.
function DL_EQEP_getInterruptStatus
__STATIC_INLINE uint16_t DL_EQEP_getInterruptStatus(
EQEP_Regs * eqep
)
Returns the current interrupt status.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: Returns the current interrupt status, enumerated as a bit field of values defined in [DL_EQEP_INT]
This API returns the interrupt status for the eQEP module.
function DL_EQEP_clearInterruptStatus
__STATIC_INLINE void DL_EQEP_clearInterruptStatus(
EQEP_Regs * eqep,
uint16_t intFlags
)
Clears eQEP interrupt sources.
Parameters:
eqep Pointer to the register overlay for the peripheral
intFlags Bit mask of the interrupt sources to be cleared. The parameter can be any of the following values OR’d together: [DL_EQEP_INT]
Note: The DL_EQEP_INT_GLOBAL value is the global interrupt flag. In order to get any further eQEP interrupts, this flag must be cleared.
This API clears eQEP interrupt flags.
function DL_EQEP_forceInterrupt
__STATIC_INLINE void DL_EQEP_forceInterrupt(
EQEP_Regs * eqep,
uint16_t intFlags
)
Forces individual eQEP module interrupts.
Parameters:
eqep Pointer to the register overlay for the peripheral
intFlags Bit mask of the interrupt sources to be forced. The parameter can be any of the following values OR’d together: [DL_EQEP_INT] except DL_EQEP_INT_GLOBAL
This API forces eQEP module interrupt flags.
function DL_EQEP_getError
__STATIC_INLINE bool DL_EQEP_getError(
EQEP_Regs * eqep
)
Returns the encoder error indicator.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: Returns true if an error has occurred and false otherwise
This API returns the error indicator for the eQEP module. It is an error for both of the signals of the quadrature input to change at the same time.
function DL_EQEP_getStatus
__STATIC_INLINE uint16_t DL_EQEP_getStatus(
EQEP_Regs * eqep
)
Returns the eQEP module status register content.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: Returns the value of the QEP status register [DL_EQEP_STS]
function DL_EQEP_clearStatus
__STATIC_INLINE void DL_EQEP_clearStatus(
EQEP_Regs * eqep,
uint16_t statusFlags
)
Clears selected fields of the eQEP module status register.
Parameters:
eqep Pointer to the register overlay for the peripheral
statusFlags Bit mask of the status flags to be cleared. The parameter can be any of the following values OR’d together:
DL_EQEP_STS_UNIT_POS_EVNT - Unit position event detected
DL_EQEP_STS_CAP_OVRFLW_ERROR - Overflow occurred in eQEP capture timer
DL_EQEP_STS_CAP_DIR_ERROR - Direction change occurred between position capture events
DL_EQEP_STS_1ST_IDX_FLAG - Set by the occurrence of the first index pulse
This API clears the status register fields indicated by statusFlags. Only certain status fields can be cleared. All others are read-only, non-sticky fields.
function DL_EQEP_setCaptureConfig
__STATIC_INLINE void DL_EQEP_setCaptureConfig(
EQEP_Regs * eqep,
DL_EQEP_CAP_CLK_PRESCALE capPrescale,
DL_EQEP_UPEVNT_PRESCALE evntPrescale
)
Configures eQEP module edge-capture unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
capPrescale Prescaler setting of the eQEP capture timer clock
evntPrescale Prescaler setting of the unit position event frequency
This API configures the operation of the eQEP module edge-capture unit.
function DL_EQEP_enableCapture
__STATIC_INLINE void DL_EQEP_enableCapture(
EQEP_Regs * eqep
)
Enables the eQEP module edge-capture unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API enables operation of the eQEP module’s edge-capture unit.
function DL_EQEP_disableCapture
__STATIC_INLINE void DL_EQEP_disableCapture(
EQEP_Regs * eqep
)
Disables the eQEP module edge-capture unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API disables operation of the eQEP module’s edge-capture unit.
function DL_EQEP_getCapturePeriod
__STATIC_INLINE uint16_t DL_EQEP_getCapturePeriod(
EQEP_Regs * eqep
)
Gets the encoder capture period.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The period count value between the last successive position events
function DL_EQEP_getCaptureTimer
__STATIC_INLINE uint16_t DL_EQEP_getCaptureTimer(
EQEP_Regs * eqep
)
Gets the encoder capture timer value.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The capture timer value
function DL_EQEP_enableCompare
__STATIC_INLINE void DL_EQEP_enableCompare(
EQEP_Regs * eqep
)
Enables the eQEP module position-compare unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API enables operation of the eQEP module’s position-compare unit.
function DL_EQEP_disableCompare
__STATIC_INLINE void DL_EQEP_disableCompare(
EQEP_Regs * eqep
)
Disables the eQEP module position-compare unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API disables operation of the eQEP module’s position-compare unit.
function DL_EQEP_setComparePulseWidth
__STATIC_INLINE void DL_EQEP_setComparePulseWidth(
EQEP_Regs * eqep,
uint16_t cycles
)
Configures the position-compare unit’s sync output pulse width.
Parameters:
eqep Pointer to the register overlay for the peripheral
cycles The width of the pulse that can be generated on a position-compare event. It is in units of 4 SYSCLKOUT cycles.
This API configures the width of the sync output pulse. The width of the pulse will be cycles * 4 * the width of a SYSCLKOUT cycle. The maximum width is 4096 * 4 * SYSCLKOUT cycles.
function DL_EQEP_loadUnitTimer
__STATIC_INLINE void DL_EQEP_loadUnitTimer(
EQEP_Regs * eqep,
uint32_t period
)
Loads the eQEP module unit timer period as number of SYSCLK cycles.
Parameters:
eqep Pointer to the register overlay for the peripheral
period Period value at which a unit time-out interrupt is set
This API sets the unit time-out interrupt when it matches the value specified by period. The unit timer is clocked by SYSCLKOUT.
function DL_EQEP_enableUnitTimer
__STATIC_INLINE void DL_EQEP_enableUnitTimer(
EQEP_Regs * eqep,
uint32_t period
)
Enables the eQEP module unit timer.
Parameters:
eqep Pointer to the register overlay for the peripheral
period Period value at which a unit time-out interrupt is set
This API enables operation of the eQEP module’s peripheral unit timer. The unit timer is clocked by SYSCLKOUT and will set the unit time-out interrupt when it matches the value specified by period.
function DL_EQEP_disableUnitTimer
__STATIC_INLINE void DL_EQEP_disableUnitTimer(
EQEP_Regs * eqep
)
Disables the eQEP module unit timer.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API disables operation of the eQEP module’s peripheral unit timer.
function DL_EQEP_enableWatchdog
__STATIC_INLINE void DL_EQEP_enableWatchdog(
EQEP_Regs * eqep,
uint16_t period
)
Enables the eQEP module watchdog timer.
Parameters:
eqep Pointer to the register overlay for the peripheral
period Watchdog period value at which a time-out will occur if no quadrature-clock event is detected
Note: When selecting period, note that the watchdog timer is clocked from SYSCLKOUT/64.
This API enables operation of the eQEP module’s peripheral watchdog timer.
function DL_EQEP_disableWatchdog
__STATIC_INLINE void DL_EQEP_disableWatchdog(
EQEP_Regs * eqep
)
Disables the eQEP module watchdog timer.
Parameters:
eqep Pointer to the register overlay for the peripheral
This API disables operation of the eQEP module’s peripheral watchdog timer.
function DL_EQEP_setWatchdogTimerValue
__STATIC_INLINE void DL_EQEP_setWatchdogTimerValue(
EQEP_Regs * eqep,
uint16_t value
)
Sets the eQEP module watchdog timer value.
Parameters:
eqep Pointer to the register overlay for the peripheral
value The value to be written to the watchdog timer
function DL_EQEP_getWatchdogTimerValue
__STATIC_INLINE uint16_t DL_EQEP_getWatchdogTimerValue(
EQEP_Regs * eqep
)
Gets the eQEP module watchdog timer value.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The current watchdog timer value
function DL_EQEP_setPositionInitMode
__STATIC_INLINE void DL_EQEP_setPositionInitMode(
EQEP_Regs * eqep,
uint16_t initMode
)
Configures the mode in which the position counter is initialized.
Parameters:
eqep Pointer to the register overlay for the peripheral
initMode Configuration for initializing the position count [DL_EQEP_INIT_MODE]
This API configures the events on which the position count can be initialized. The initMode parameter specifies the initialization condition, which can be:
No action (do nothing)
Strobe event initialization
Index event initialization
A logical OR of both a strobe event and an index event
Initialization modes include:
DL_EQEP_INIT_DO_NOTHING: No initialization action
Strobe event initialization modes:
DL_EQEP_INIT_RISING_STROBE: Initialize on rising edge of strobe
DL_EQEP_INIT_EDGE_DIR_STROBE: Initialize On rising edge when clockwise, on falling when counter clockwise
Index event initialization modes:
DL_EQEP_INIT_RISING_INDEX: Initialize on rising edge of index
DL_EQEP_INIT_FALLING_INDEX: Initialize on falling edge of index
Use DL_EQEP_setSWPositionInit() to cause a software initialization and DL_EQEP_setInitialPosition() to set the value that gets loaded into the position counter upon initialization.
function DL_EQEP_setSWPositionInit
__STATIC_INLINE void DL_EQEP_setSWPositionInit(
EQEP_Regs * eqep,
bool initialize
)
Sets the software initialization of the encoder position counter.
Parameters:
eqep Pointer to the register overlay for the peripheral
initialize Flag to specify if software initialization of the position counter is enabled
true: Perform software initialization
false: Clear software initialization bit
This API performs a software initialization of the position counter when the initialize parameter is true. When false, the QEPCTL[SWI] bit is cleared and no action is taken.
The init value to be loaded into the position counter can be set with DL_EQEP_setInitialPosition(). Additional initialization causes can be configured with DL_EQEP_setPositionInitMode().
function DL_EQEP_setInitialPosition
__STATIC_INLINE void DL_EQEP_setInitialPosition(
EQEP_Regs * eqep,
uint32_t position
)
Sets the initial value for the encoder position counter.
Parameters:
eqep Pointer to the register overlay for the peripheral
position Value to be written to the position counter upon initialization
This API sets the initialization value for the position of the encoder. Use DL_EQEP_setPositionInitMode() to set the initialization cause or DL_EQEP_setSWPositionInit() to cause a software initialization.
function DL_EQEP_setLatchMode
__STATIC_INLINE void DL_EQEP_setLatchMode(
EQEP_Regs * eqep,
uint32_t latchMode
)
Configures the position counter latch modes.
Parameters:
eqep Pointer to the register overlay for the peripheral
latchMode Configuration for latching of the position counter and several other registers [DL_EQEP_LATCH_MODE]
This API configures the events on which the position count and several other registers can be latched. The latchMode parameter provides the mode as the logical OR of several values:
Position Counter Latch:
DL_EQEP_LATCH_CNT_READ_BY_CPU: Latch when CPU reads position counter
DL_EQEP_LATCH_UNIT_TIME_OUT: Latch on unit timer time-out event The capture timer and capture period are also latched based on this setting, and can be read using DL_EQEP_getCaptureTimerLatch() and DL_EQEP_getCapturePeriodLatch().
Strobe Event Latch:
DL_EQEP_LATCH_RISING_STROBE: Latch position counter on rising edge of strobe signal into the strobe position latch register
DL_EQEP_LATCH_EDGE_DIR_STROBE: Latch position counter based on rotation direction into the strobe position latch register This register can be read with DL_EQEP_getStrobePositionLatch().
Index Event Latch:
DL_EQEP_LATCH_RISING_INDEX: Latch position counter on rising edge of index signal into the index position latch register
DL_EQEP_LATCH_FALLING_INDEX: Latch position counter on falling edge of index signal into the index position latch register
DL_EQEP_LATCH_SW_INDEX_MARKER: Latch position counter via software index marker This register can be read with DL_EQEP_getIndexPositionLatch().
function DL_EQEP_getIndexPositionLatch
__STATIC_INLINE uint32_t DL_EQEP_getIndexPositionLatch(
EQEP_Regs * eqep
)
Gets the encoder position that was latched on an index event.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The position count latched on an index event
This API returns the value in the index position latch register. The position counter is latched into this register based on configuration set by DL_EQEP_setLatchMode():
Rising index edge
Falling index edge
Software index marker
function DL_EQEP_getStrobePositionLatch
__STATIC_INLINE uint32_t DL_EQEP_getStrobePositionLatch(
EQEP_Regs * eqep
)
Gets the encoder position that was latched on a strobe event.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The position count latched on a strobe event
This API returns the value in the strobe position latch register. The position counter can be configured to be latched based on different strobe events as set by DL_EQEP_setLatchMode():
Rising strobe edges
Rising strobe edges while moving clockwise
Falling strobe edges while moving counter-clockwise
function DL_EQEP_getPositionLatch
__STATIC_INLINE uint32_t DL_EQEP_getPositionLatch(
EQEP_Regs * eqep
)
Gets the encoder position that was latched on a unit time-out event.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The position count latch register value
This API returns the value in the position latch register. The position counter is latched into this register based on the unit time-out event configuration set by DL_EQEP_setLatchMode().
function DL_EQEP_getCaptureTimerLatch
__STATIC_INLINE uint16_t DL_EQEP_getCaptureTimerLatch(
EQEP_Regs * eqep
)
Gets the encoder capture timer latch.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The edge-capture timer latch value
This API returns the value in the capture timer latch register. The capture timer value is latched into this register based on the configuration set by DL_EQEP_setLatchMode():
On unit time-out event
Upon reading the eQEP position counter
function DL_EQEP_getCapturePeriodLatch
__STATIC_INLINE uint16_t DL_EQEP_getCapturePeriodLatch(
EQEP_Regs * eqep
)
Gets the encoder capture period latch.
Parameters:
eqep Pointer to the register overlay for the peripheral
Return: The edge-capture period latch value
This API returns the value in the capture period latch register. The capture period value is latched into this register based on the configuration set by DL_EQEP_setLatchMode():
On unit time-out event
Upon reading the eQEP position counter
function DL_EQEP_setQMAModuleMode
__STATIC_INLINE void DL_EQEP_setQMAModuleMode(
EQEP_Regs * eqep,
DL_EQEP_QMA_MODE qmaMode
)
Sets the quadrature mode adapter (QMA) module mode.
Parameters:
eqep Pointer to the register overlay for the peripheral
qmaMode The mode in which the QMA module will operate
This API sets the quadrature mode adapter module mode. The possible modes are passed to the function through the qmaMode parameter.
To use the QMA module, you must first put the eQEP module into direction-count mode (DL_EQEP_CONFIG_CLOCK_DIR) using DL_EQEP_setDecoderConfig().
function DL_EQEP_setStrobeSource
__STATIC_INLINE void DL_EQEP_setStrobeSource(
EQEP_Regs * eqep,
DL_EQEP_STROBE_SOURCE strobeSrc
)
Sets the strobe input source of the eQEP module.
Parameters:
eqep Pointer to the register overlay for the peripheral
strobeSrc The source of the strobe signal
This API sets the source of the eQEP module’s strobe signal. The possible values of the strobeSrc parameter are:
DL_EQEP_STROBE_FROM_GPIO - The strobe is used as-is after passing through the polarity select logic.
DL_EQEP_STROBE_OR_ADCSOCA - The strobe is OR’d with the ADCSOCA signal after passing through the polarity select logic.
DL_EQEP_STROBE_OR_ADCSOCB - The strobe is OR’d with the ADCSOCB signal after passing through the polarity select logic.
function DL_EQEP_enableDirectionChangeDuringIndex
__STATIC_INLINE void DL_EQEP_enableDirectionChangeDuringIndex(
EQEP_Regs * eqep
)
Enables the enhancement mode for direction change during Index event.
Parameters:
eqep Pointer to the register overlay for the peripheral
function DL_EQEP_disableDirectionChangeDuringIndex
__STATIC_INLINE void DL_EQEP_disableDirectionChangeDuringIndex(
EQEP_Regs * eqep
)
Disables the enhancement mode for direction change during Index event.
Parameters:
eqep Pointer to the register overlay for the peripheral
function DL_EQEP_selectSource
__STATIC_INLINE void DL_EQEP_selectSource(
EQEP_Regs * eqep,
DL_EQEP_SOURCE_SELECT sourceConfig
)
Selects the source for eQEPA, eQEPB, and eQEPI signals.
Parameters:
eqep Pointer to the register overlay for the peripheral
sourceConfig Structure containing source configuration for QEPA, QEPB, and Index signals
This API configures the sources for QEPA, QEPB, and Index signals of the eQEP module.
function DL_EQEP_setEmulationMode
__STATIC_INLINE void DL_EQEP_setEmulationMode(
EQEP_Regs * eqep,
DL_EQEP_EMULATION_MODE emuMode
)
Sets the emulation mode of the eQEP module.
Parameters:
eqep Pointer to the register overlay for the peripheral
emuMode The emulation mode to set
This APU sets the eQEP module’s emulation mode. This mode determines how the timers are affected by an emulation suspend.
The following emulation modes are available:
DL_EQEP_EMULATIONMODE_STOPIMMEDIATELY - The position counter, watchdog counter, unit timer, and capture timer all stop immediately.
DL_EQEP_EMULATIONMODE_STOPATROLLOVER - The position counter, watchdog counter, unit timer all count until period rollover. The capture timer counts until the next unit period event.
DL_EQEP_EMULATIONMODE_RUNFREE - The position counter, watchdog counter, unit timer, and capture timer are all unaffected by an emulation suspend.
function DL_EQEP_setCompareConfig
void DL_EQEP_setCompareConfig(
EQEP_Regs * eqep,
uint16_t config,
uint32_t compareValue,
uint16_t cycles
)
Configures eQEP module position-compare unit.
Parameters:
eqep Pointer to the register overlay for the peripheral
config Configuration for the eQEP module position-compare unit
compareValue Value to which the position count value is compared
cycles Width of the pulse that can be generated on a position-compare event, in units of 4 SYSCLKOUT cycles
Note: You can set the sync pulse width independently using the DL_EQEP_setComparePulseWidth() API.
This API configures the operation of the eQEP module position-compare unit. The config parameter provides the configuration of the position-compare unit and is the logical OR of several values:
DL_EQEP_COMPARE_NO_SYNC_OUT, DL_EQEP_COMPARE_IDX_SYNC_OUT, or DL_EQEP_COMPARE_STROBE_SYNC_OUT specify if there is a sync output pulse and which pin should be used.
DL_EQEP_COMPARE_NO_SHADOW, DL_EQEP_COMPARE_LOAD_ON_ZERO, or DL_EQEP_COMPARE_LOAD_ON_MATCH specify if a shadow is enabled and when should the load should occur–QPOSCNT = 0 or QPOSCNT = QPOSCOMP.
The cycles is used to select the width of the sync output pulse. The width of the resulting pulse will be cycles * 4 * the width of a SYSCLKOUT cycle. The maximum width is 4096 * 4 * SYSCLKOUT cycles.
function DL_EQEP_setInputPolarity
void DL_EQEP_setInputPolarity(
EQEP_Regs * eqep,
bool invertQEPA,
bool invertQEPB,
bool invertIndex,
bool invertStrobe
)
Sets the polarity of the eQEP module’s input signals.
Parameters:
eqep Pointer to the register overlay for the peripheral
invertQEPA Flag to negate the QEPA input
true: Negate QEPA input
false: Do not negate QEPA input
invertQEPB Flag to negate the QEPB input
true: Negate QEPB input
false: Do not negate QEPB input
invertIndex Flag to negate the index input
true: Negate index input
false: Do not negate index input
invertStrobe Flag to negate the strobe input
true: Negate strobe input
false: Do not negate strobe input
This API configures the polarity of the inputs to the eQEP module. To negate the polarity of any of the input signals, pass true into its corresponding parameter in this function. Pass false to leave it as-is.
function DL_EQEP_initParamsSetDefault
void DL_EQEP_initParamsSetDefault(
DL_EQEP_Config * config
)
Initializes the EQEP configuration parameters.
Parameters:
config Pointer to the EQEP configuration structure.
This function initializes all the parameters of the EQEP configuration structure to their default values.
function DL_EQEP_init
void DL_EQEP_init(
EQEP_Regs * eqep,
DL_EQEP_Config * config
)
Initializes the EQEP module.
Parameters:
eqep Pointer to the EQEP register overlay
config Pointer to the EQEP configuration structure
This function configures the EQEP module according to the provided configuration.
Macros Documentation
define DL_EQEP_CONFIG_QUADRATURE
#define DL_EQEP_CONFIG_QUADRATURE EQEP_QDECCTL_QSRC_QUAD_COUNT_MODE
Quadrature-clock mode.
define DL_EQEP_CONFIG_CLOCK_DIR
#define DL_EQEP_CONFIG_CLOCK_DIR EQEP_QDECCTL_QSRC_DIRECT_COUNT_MODE
Direction-count mode.
define DL_EQEP_CONFIG_UP_COUNT
#define DL_EQEP_CONFIG_UP_COUNT EQEP_QDECCTL_QSRC_UP_COUNT_MODE
Up-count mode, QDIR = 1.
define DL_EQEP_CONFIG_DOWN_COUNT
#define DL_EQEP_CONFIG_DOWN_COUNT EQEP_QDECCTL_QSRC_DOWN_COUNT_MODE
Down-count mode, QDIR = 0.
define DL_EQEP_CONFIG_2X_RESOLUTION
#define DL_EQEP_CONFIG_2X_RESOLUTION EQEP_QDECCTL_XCR_XCR_2XRESOL
Count rising and falling edge.
define DL_EQEP_CONFIG_1X_RESOLUTION
#define DL_EQEP_CONFIG_1X_RESOLUTION EQEP_QDECCTL_XCR_XCR_1XRESOL
Count rising edge only.
define DL_EQEP_CONFIG_NO_SWAP
#define DL_EQEP_CONFIG_NO_SWAP EQEP_QDECCTL_SWAP_SWAP_DISABLE
Do not swap QEPA and QEPB.
define DL_EQEP_CONFIG_SWAP
#define DL_EQEP_CONFIG_SWAP EQEP_QDECCTL_SWAP_SWAP_ENABLE
Swap QEPA and QEPB.
define DL_EQEP_CONFIG_IGATE_DISABLE
#define DL_EQEP_CONFIG_IGATE_DISABLE EQEP_QDECCTL_IGATE_IGATE_DISABLE
Disable gating of Index pulse.
define DL_EQEP_CONFIG_IGATE_ENABLE
#define DL_EQEP_CONFIG_IGATE_ENABLE EQEP_QDECCTL_IGATE_IGATE_ENABLE
Gate the index pin with strobe.
define DL_EQEP_COMPARE_NO_SYNC_OUT
#define DL_EQEP_COMPARE_NO_SYNC_OUT EQEP_QDECCTL_SOEN_SYNC_DISABLE
Disable sync output.
define DL_EQEP_COMPARE_IDX_SYNC_OUT
#define DL_EQEP_COMPARE_IDX_SYNC_OUT (EQEP_QDECCTL_SOEN_SYNC_ENABLE | EQEP_QDECCTL_SPSEL_INDEX_PIN)
Sync output on index pin.
define DL_EQEP_COMPARE_STROBE_SYNC_OUT
#define DL_EQEP_COMPARE_STROBE_SYNC_OUT (EQEP_QDECCTL_SOEN_SYNC_ENABLE | EQEP_QDECCTL_SPSEL_STROBE_PIN)
Sync output on strobe pin.
define DL_EQEP_INT_GLOBAL
#define DL_EQEP_INT_GLOBAL 0x0001U
Global interrupt.
define DL_EQEP_INT_POS_CNT_ERROR
#define DL_EQEP_INT_POS_CNT_ERROR 0x0002U
Position counter error interrupt.
define DL_EQEP_INT_PHASE_ERROR
#define DL_EQEP_INT_PHASE_ERROR 0x0004U
Quadrature phase error interrupt.
define DL_EQEP_INT_DIR_CHANGE
#define DL_EQEP_INT_DIR_CHANGE 0x0008U
Quadrature direction change interrupt.
define DL_EQEP_INT_WATCHDOG
#define DL_EQEP_INT_WATCHDOG 0x0010U
Watchdog time-out interrupt.
define DL_EQEP_INT_UNDERFLOW
#define DL_EQEP_INT_UNDERFLOW 0x0020U
Position counter underflow interrupt.
define DL_EQEP_INT_OVERFLOW
#define DL_EQEP_INT_OVERFLOW 0x0040U
Position counter overflow interrupt.
define DL_EQEP_INT_POS_COMP_READY
#define DL_EQEP_INT_POS_COMP_READY 0x0080U
Position-compare ready interrupt.
define DL_EQEP_INT_POS_COMP_MATCH
#define DL_EQEP_INT_POS_COMP_MATCH 0x0100U
Position-compare match interrupt.
define DL_EQEP_INT_STROBE_EVNT_LATCH
#define DL_EQEP_INT_STROBE_EVNT_LATCH 0x0200U
Strobe event latch interrupt.
define DL_EQEP_INT_INDEX_EVNT_LATCH
#define DL_EQEP_INT_INDEX_EVNT_LATCH 0x0400U
Index event latch interrupt.
define DL_EQEP_INT_UNIT_TIME_OUT
#define DL_EQEP_INT_UNIT_TIME_OUT 0x0800U
Unit time-out interrupt.
define DL_EQEP_INT_QMA_ERROR
#define DL_EQEP_INT_QMA_ERROR 0x1000U
QMA error interrupt.
define DL_EQEP_STS_UNIT_POS_EVNT
#define DL_EQEP_STS_UNIT_POS_EVNT EQEP_QEPSTS_UPEVNT_UPEVNT_DETCT
Unit position event status.
define DL_EQEP_STS_DIR_ON_1ST_IDX
#define DL_EQEP_STS_DIR_ON_1ST_IDX EQEP_QEPSTS_FIDF_FIDF_CLK
Direction was clockwise on first index event.
define DL_EQEP_STS_DIR_FLAG
#define DL_EQEP_STS_DIR_FLAG EQEP_QEPSTS_QDF_QDF_CLK
CW (forward) Direction status.
define DL_EQEP_STS_DIR_LATCH
#define DL_EQEP_STS_DIR_LATCH EQEP_QEPSTS_QDLF_QDLF_CLK
Direction was CW on last index event marker.
define DL_EQEP_STS_CAP_OVRFLW_ERROR
#define DL_EQEP_STS_CAP_OVRFLW_ERROR EQEP_QEPSTS_COEF_COEF_OVF
Capture timer overflow status.
define DL_EQEP_STS_CAP_DIR_ERROR
#define DL_EQEP_STS_CAP_DIR_ERROR EQEP_QEPSTS_CDEF_CDEF_DIRECT
Direction change between position capture events status.
define DL_EQEP_STS_1ST_IDX_FLAG
#define DL_EQEP_STS_1ST_IDX_FLAG EQEP_QEPSTS_FIMF_FIMF_SETINDEX
First index pulse status.
define DL_EQEP_STS_POS_CNT_ERROR
#define DL_EQEP_STS_POS_CNT_ERROR EQEP_QEPSTS_PCEF_PCEF_ERROR
Position counter error status.
define DL_EQEP_LATCH_CNT_READ_BY_CPU
#define DL_EQEP_LATCH_CNT_READ_BY_CPU EQEP_QEPCTL_QCLM_QCLM_CPU
Latch on position counter read.
define DL_EQEP_LATCH_UNIT_TIME_OUT
#define DL_EQEP_LATCH_UNIT_TIME_OUT EQEP_QEPCTL_QCLM_QCLM_TIMEOUT
Latch on unit time-out event.
define DL_EQEP_LATCH_RISING_STROBE
#define DL_EQEP_LATCH_RISING_STROBE EQEP_QEPCTL_SEL_SEL_QEPSRISING
Latch on rising edge of strobe.
define DL_EQEP_LATCH_EDGE_DIR_STROBE
#define DL_EQEP_LATCH_EDGE_DIR_STROBE EQEP_QEPCTL_SEL_SEL_QEPSCLOCK
Latch on rising edge when clockwise, on falling when counter clockwise.
define DL_EQEP_LATCH_RISING_INDEX
#define DL_EQEP_LATCH_RISING_INDEX EQEP_QEPCTL_IEL_IEL_POSRISING
Latch on rising edge of index.
define DL_EQEP_LATCH_FALLING_INDEX
#define DL_EQEP_LATCH_FALLING_INDEX EQEP_QEPCTL_IEL_IEL_POSFALLING
Latch on falling edge of index.
define DL_EQEP_LATCH_SW_INDEX_MARKER
#define DL_EQEP_LATCH_SW_INDEX_MARKER EQEP_QEPCTL_IEL_IEL_SIM
Latch on software index marker.
define DL_EQEP_INIT_DO_NOTHING
#define DL_EQEP_INIT_DO_NOTHING 0x0000U
Action is disabled.
define DL_EQEP_INIT_RISING_STROBE
#define DL_EQEP_INIT_RISING_STROBE EQEP_QEPCTL_SEI_SEI_INITQEPSRISING
Initialize on rising edge of strobe.
define DL_EQEP_INIT_EDGE_DIR_STROBE
#define DL_EQEP_INIT_EDGE_DIR_STROBE EQEP_QEPCTL_SEI_SEI_INITQEPSCLOCK
Initialize on rising edge when clockwise, on falling when counter clockwise.
define DL_EQEP_INIT_RISING_INDEX
#define DL_EQEP_INIT_RISING_INDEX EQEP_QEPCTL_IEI_IEI_INITRISING
Initialize on rising edge of index.
define DL_EQEP_INIT_FALLING_INDEX
#define DL_EQEP_INIT_FALLING_INDEX EQEP_QEPCTL_IEI_IEI_INITFALLING
Initialize on falling edge of index.
define DL_EQEP_COMPARE_NO_SHADOW
#define DL_EQEP_COMPARE_NO_SHADOW EQEP_QPOSCTL_PCSHDW_PCSHDW_DISABLE
Disable shadow of QPOSCMP.
Shadow register use
define DL_EQEP_COMPARE_LOAD_ON_ZERO
#define DL_EQEP_COMPARE_LOAD_ON_ZERO (EQEP_QPOSCTL_PCSHDW_PCSHDW_ENABLE | EQEP_QPOSCTL_PCLOAD_PCLOAD_0)
Load on QPOSCNT = 0.
define DL_EQEP_COMPARE_LOAD_ON_MATCH
#define DL_EQEP_COMPARE_LOAD_ON_MATCH (EQEP_QPOSCTL_PCSHDW_PCSHDW_ENABLE | EQEP_QPOSCTL_PCLOAD_PCLOAD_QPOSCMP)
Load on QPOSCNT = QPOSCMP.