This module contains APIs to program and use the EQEP module.
Files | |
file | eqep/v0/eqep.h |
EQEP Driver API/interface file. | |
Functions | |
void | EQEP_enableModule (uint32_t baseAddr) |
Enables the eQEP module. More... | |
void | EQEP_disableModule (uint32_t baseAddr) |
Disables the eQEP module. More... | |
void | EQEP_setDecoderConfig (uint32_t baseAddr, uint16_t config) |
Configures eQEP module's quadrature decoder unit. More... | |
void | EQEP_setPositionCounterConfig (uint32_t baseAddr, eqepPositionResetMode_t mode, uint32_t maxPosition) |
Configures eQEP module position counter unit. More... | |
uint32_t | EQEP_getPosition (uint32_t baseAddr) |
Gets the current encoder position. More... | |
void | EQEP_setPosition (uint32_t baseAddr, uint32_t position) |
Sets the current encoder position. More... | |
int32_t | EQEP_getDirection (uint32_t baseAddr) |
Gets the current direction of rotation. More... | |
void | EQEP_enableInterrupt (uint32_t baseAddr, uint16_t intFlags) |
Enables individual eQEP module interrupt sources. More... | |
void | EQEP_disableInterrupt (uint32_t baseAddr, uint16_t intFlags) |
Disables individual eQEP module interrupt sources. More... | |
uint16_t | EQEP_getEnabledInterrupt (uint32_t baseAddr) |
Get Enabled interrupts of eQEP module. More... | |
uint16_t | EQEP_getInterruptStatus (uint32_t baseAddr) |
Gets the current interrupt status. More... | |
void | EQEP_clearInterruptStatus (uint32_t baseAddr, uint16_t intFlags) |
Clears eQEP module interrupt sources. More... | |
void | EQEP_forceInterrupt (uint32_t baseAddr, uint16_t intFlags) |
Forces individual eQEP module interrupts. More... | |
Bool | EQEP_isErrorSet (uint32_t baseAddr) |
Gets the encoder error indicator. More... | |
uint32_t | EQEP_getStatus (uint32_t baseAddr) |
Returns content of the eQEP module status register. More... | |
void | EQEP_clearStatus (uint32_t baseAddr, uint16_t statusFlags) |
Clears selected fields of the eQEP module status register. More... | |
void | EQEP_setCaptureConfig (uint32_t baseAddr, eqepCapClkPrescale_t capPrescale, eqeqUpEvntPrescale_t evntPrescale) |
Configures eQEP module edge-capture unit. More... | |
void | EQEP_enableCapture (uint32_t baseAddr) |
Enables the eQEP module edge-capture unit. More... | |
void | EQEP_disableCapture (uint32_t baseAddr) |
Disables the eQEP module edge-capture unit. More... | |
uint32_t | EQEP_getCapturePeriod (uint32_t baseAddr) |
Gets the encoder capture period. More... | |
uint32_t | EQEP_getCaptureTimer (uint32_t baseAddr) |
Gets the encoder capture timer value. More... | |
void | EQEP_enableCompare (uint32_t baseAddr) |
Enables the eQEP module position-compare unit. More... | |
void | EQEP_disableCompare (uint32_t baseAddr) |
Disables the eQEP module position-compare unit. More... | |
int32_t | EQEP_setComparePulseWidth (uint32_t baseAddr, uint16_t cycles) |
Configures the position-compare unit's sync output pulse width. More... | |
void | EQEP_enableUnitTimer (uint32_t baseAddr, uint32_t period) |
Enables the eQEP module unit timer. More... | |
void | EQEP_disableUnitTimer (uint32_t baseAddr) |
Disables the eQEP module unit timer. More... | |
void | EQEP_enableWatchdog (uint32_t baseAddr, uint16_t period) |
Enables the eQEP module watchdog timer. More... | |
void | EQEP_disableWatchdog (uint32_t baseAddr) |
Disables the eQEP module watchdog timer. More... | |
void | EQEP_setWatchdogTimerValue (uint32_t baseAddr, uint16_t value) |
Sets the eQEP module watchdog timer value. More... | |
uint32_t | EQEP_getWatchdogTimerValue (uint32_t baseAddr) |
Gets the eQEP module watchdog timer value. More... | |
void | EQEP_setPositionInitMode (uint32_t baseAddr, uint16_t initMode) |
Configures the mode in which the position counter is initialized. More... | |
void | EQEP_setSWPositionInit (uint32_t baseAddr, Bool initialize) |
Sets the software initialization of the encoder position counter. More... | |
void | EQEP_setInitialPosition (uint32_t baseAddr, uint32_t position) |
Sets the init value for the encoder position counter. More... | |
void | EQEP_setLatchMode (uint32_t baseAddr, uint32_t latchMode) |
Configures the quadrature modes in which the position count can be latched. More... | |
uint32_t | EQEP_getIndexPositionLatch (uint32_t baseAddr) |
Gets the encoder position that was latched on an index event. More... | |
uint32_t | EQEP_getStrobePositionLatch (uint32_t baseAddr) |
Gets the encoder position that was latched on a strobe event. More... | |
uint32_t | EQEP_getPositionLatch (uint32_t baseAddr) |
Gets the encoder position that was latched on a unit time-out event. More... | |
uint32_t | EQEP_getCaptureTimerLatch (uint32_t baseAddr) |
Gets the encoder capture timer latch. More... | |
uint32_t | EQEP_getCapturePeriodLatch (uint32_t baseAddr) |
Gets the encoder capture period latch. More... | |
void | EQEP_setQMAModuleMode (uint32_t baseAddr, eqepQmaMode_t qmaMode) |
Set the quadrature mode adapter (QMA) module mode. More... | |
void | EQEP_setStrobeSource (uint32_t baseAddr, eqepStrobeSource_t strobeSrc) |
Set the strobe input source of the eQEP module. More... | |
void | EQEP_setEmulationMode (uint32_t baseAddr, eqepEmulationMode_t emuMode) |
Set the emulation mode of the eQEP module. More... | |
void | EQEP_setCompareConfig (uint32_t baseAddr, uint16_t config, uint32_t compareValue, uint16_t cycles) |
Configures eQEP module position-compare unit. More... | |
void | EQEP_setInputPolarity (uint32_t baseAddr, Bool invertQEPA, Bool invertQEPB, Bool invertIndex, Bool invertStrobe) |
Sets the polarity of the eQEP module's input signals. More... | |
EQEP Decoder Configuration | |
#define | EQEP_CONFIG_QUADRATURE (0x0000U) |
Values that can be passed to EQEP_setDecoderConfig() as the config parameter. More... | |
#define | EQEP_CONFIG_CLOCK_DIR (0x4000U) |
Quadrature-clock Direction-count mode. More... | |
#define | EQEP_CONFIG_UP_COUNT (0x8000U) |
Up-count mode, QDIR = 1. More... | |
#define | EQEP_CONFIG_DOWN_COUNT (0xC000U) |
Down-count mode, QDIR = 0. More... | |
#define | EQEP_CONFIG_2X_RESOLUTION (0x0000U) |
Resolution Count rising and falling edge. More... | |
#define | EQEP_CONFIG_1X_RESOLUTION (0x0800U) |
Resolution Count rising edge only. More... | |
#define | EQEP_CONFIG_NO_SWAP (0x0000U) |
Do not swap QEPA and QEPB. More... | |
#define | EQEP_CONFIG_SWAP (0x0400U) |
Swap QEPA and QEPB. More... | |
EQEP Compare Configuration | |
#define | EQEP_COMPARE_NO_SYNC_OUT (0x0000U) |
Values that can be passed to EQEP_setCompareConfig() as the config parameter. More... | |
#define | EQEP_COMPARE_IDX_SYNC_OUT (0x2000U) |
Sync output on index pin. More... | |
#define | EQEP_COMPARE_STROBE_SYNC_OUT (0x3000U) |
Sync output on strobe pin. More... | |
#define | EQEP_COMPARE_NO_SHADOW (0x0000U) |
Disable shadow of QPOSCMP. More... | |
#define | EQEP_COMPARE_LOAD_ON_ZERO (0x8000U) |
Load on QPOSCNT = 0. More... | |
#define | EQEP_COMPARE_LOAD_ON_MATCH (0xC000U) |
Load on QPOSCNT = QPOSCMP. More... | |
EQEP Interrupt Sources | |
#define | EQEP_INT_GLOBAL (0x0001U) |
Values that can be passed to EQEP_enableInterrupt(), EQEP_disableInterrupt(), and EQEP_clearInterruptStatus() as the intFlags parameter and returned by EQEP_clearInterruptStatus(). More... | |
#define | EQEP_INT_POS_CNT_ERROR (0x0002U) |
Position counter error. More... | |
#define | EQEP_INT_PHASE_ERROR (0x0004U) |
Quadrature phase error. More... | |
#define | EQEP_INT_DIR_CHANGE (0x0008U) |
Quadrature direction change. More... | |
#define | EQEP_INT_WATCHDOG (0x0010U) |
Watchdog time-out. More... | |
#define | EQEP_INT_UNDERFLOW (0x0020U) |
Position counter underflow. More... | |
#define | EQEP_INT_OVERFLOW (0x0040U) |
Position counter overflow. More... | |
#define | EQEP_INT_POS_COMP_READY (0x0080U) |
Position-compare ready. More... | |
#define | EQEP_INT_POS_COMP_MATCH (0x0100U) |
Position-compare match. More... | |
#define | EQEP_INT_STROBE_EVNT_LATCH (0x0200U) |
Strobe event latch. More... | |
#define | EQEP_INT_INDEX_EVNT_LATCH (0x0400U) |
Index event latch. More... | |
#define | EQEP_INT_UNIT_TIME_OUT (0x0800U) |
Unit time-out. More... | |
#define | EQEP_INT_QMA_ERROR (0x1000U) |
QMA error. More... | |
EQEP Get Module Status | |
#define | EQEP_STS_UNIT_POS_EVNT (0x0080U) |
Values that can be returned by EQEP_getStatus(). More... | |
#define | EQEP_STS_DIR_ON_1ST_IDX (0x0040U) |
Direction was clockwise on first index event. More... | |
#define | EQEP_STS_DIR_FLAG (0x0020U) |
Direction is CW (forward) More... | |
#define | EQEP_STS_DIR_LATCH (0x0010U) |
Direction was CW on index. More... | |
#define | EQEP_STS_CAP_OVRFLW_ERROR (0x0008U) |
Capture timer overflow. More... | |
#define | EQEP_STS_CAP_DIR_ERROR (0x0004U) |
Direction changed between position capture events. More... | |
#define | EQEP_STS_1ST_IDX_FLAG (0x0002U) |
First index pulse occurred. More... | |
#define | EQEP_STS_POS_CNT_ERROR (0x0001U) |
Position counter error. More... | |
EQEP Set Latch Mode | |
#define | EQEP_LATCH_CNT_READ_BY_CPU (0x0000U) |
Values that can be passed to EQEP_setLatchMode() as the latchMode parameter. More... | |
#define | EQEP_LATCH_UNIT_TIME_OUT (0x0004U) |
On position counter read. More... | |
#define | EQEP_LATCH_RISING_STROBE (0x0000U) |
On unit time-out event. More... | |
#define | EQEP_LATCH_EDGE_DIR_STROBE (0x0040U) |
On rising edge when clockwise, on falling when counter clockwise. More... | |
#define | EQEP_LATCH_RISING_INDEX (0x0010U) |
Index position counter latch event. More... | |
#define | EQEP_LATCH_FALLING_INDEX (0x0020U) |
On rising edge of index. More... | |
#define | EQEP_LATCH_SW_INDEX_MARKER (0x0030U) |
On falling edge of index. More... | |
EQEP Set Position Init Mode | |
#define | EQEP_INIT_DO_NOTHING (0x0000U) |
Values that can be passed to EQEP_setPositionInitMode() as the initMode parameter. More... | |
#define | EQEP_INIT_RISING_STROBE (0x0800U) |
Strobe events On rising edge of strobe. More... | |
#define | EQEP_INIT_EDGE_DIR_STROBE (0x0C00U) |
Strobe events On rising edge when clockwise, on falling when counter clockwise. More... | |
#define | EQEP_INIT_RISING_INDEX (0x0200U) |
Index events, On rising edge of index. More... | |
#define | EQEP_INIT_FALLING_INDEX (0x0300U) |
Index events, On falling edge of index. More... | |
EQEP get direction | |
#define | EQEP_MOD_FORWARD_DIR (1) |
Values that can be return from EQEP_getDirection() . More... | |
#define | EQEP_MOD_BACKWARD_DIR (-1) |
Moving in the reverse direction. More... | |
EQEP Position Reset Mode | |
typedef uint32_t | eqepPositionResetMode_t |
Enum Values that can be passed to EQEP_setPositionCounterConfig() as the mode parameter. More... | |
#define | EQEP_POSITION_RESET_IDX (0x0000) |
Reset position on index pulse. More... | |
#define | EQEP_POSITION_RESET_MAX_POS (0x1000) |
Reset position on maximum position. More... | |
#define | EQEP_POSITION_RESET_1ST_IDX (0x2000) |
Reset position on the first index pulse. More... | |
#define | EQEP_POSITION_RESET_UNIT_TIME_OUT (0x3000) |
Reset position on a unit time event. More... | |
EQEP CapPrescalar parameter | |
typedef uint32_t | eqepCapClkPrescale_t |
Enum Values that can be passed to EQEP_setCaptureConfig() as the capPrescale parameter. More... | |
#define | EQEP_CAPTURE_CLK_DIV_1 (0x00) |
CAPCLK = SYSCLKOUT/1. More... | |
#define | EQEP_CAPTURE_CLK_DIV_2 (0x10) |
CAPCLK = SYSCLKOUT/2. More... | |
#define | EQEP_CAPTURE_CLK_DIV_4 (0x20) |
CAPCLK = SYSCLKOUT/4. More... | |
#define | EQEP_CAPTURE_CLK_DIV_8 (0x30) |
CAPCLK = SYSCLKOUT/8. More... | |
#define | EQEP_CAPTURE_CLK_DIV_16 (0x40) |
CAPCLK = SYSCLKOUT/16. More... | |
#define | EQEP_CAPTURE_CLK_DIV_32 (0x50) |
CAPCLK = SYSCLKOUT/32. More... | |
#define | EQEP_CAPTURE_CLK_DIV_64 (0x60) |
CAPCLK = SYSCLKOUT/64. More... | |
#define | EQEP_CAPTURE_CLK_DIV_128 (0x070) |
CAPCLK = SYSCLKOUT/128. More... | |
EQEP unit position event frequency | |
typedef uint32_t | eqeqUpEvntPrescale_t |
Enum Values that can be passed to EQEP_setCaptureConfig() as the evntPrescaleparameter. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_1 (0) |
UPEVNT = QCLK/1. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_2 (1) |
UPEVNT = QCLK/2. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_4 (2) |
UPEVNT = QCLK/4. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_8 (3) |
UPEVNT = QCLK/8. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_16 (4) |
UPEVNT = QCLK/16. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_32 (5) |
UPEVNT = QCLK/32. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_64 (6) |
UPEVNT = QCLK/64. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_128 (7) |
UPEVNT = QCLK/128. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_256 (8) |
UPEVNT = QCLK/256. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_512 (9) |
UPEVNT = QCLK/512. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_1024 (10) |
UPEVNT = QCLK/1024. More... | |
#define | EQEP_UNIT_POS_EVNT_DIV_2048 (11) |
UPEVNT = QCLK/2048. More... | |
EQEP strobeSrc parameter | |
typedef uint32_t | eqepStrobeSource_t |
Enum Values that can be passed to EQEP_setStrobeSource() as the strobeSrc parameter. More... | |
#define | EQEP_STROBE_FROM_GPIO (0) |
Strobe signal comes from GPIO. More... | |
#define | EQEP_STROBE_OR_ADCSOCA (2) |
Strobe signal is OR'd with ADCSOCA. More... | |
#define | EQEP_STROBE_OR_ADCSOCB (3) |
Strobe signal is OR'd with ADCSOCB. More... | |
EQEP qmaMode parameter | |
typedef uint32_t | eqepQmaMode_t |
Enum Values that can be passed to EQEP_setQMAModuleMode() as the qmaMode parameter. More... | |
#define | EQEP_QMA_MODE_BYPASS (0) |
QMA module is bypassed. More... | |
#define | EQEP_QMA_MODE_1 (1) |
QMA mode-1 operation is selected. More... | |
#define | EQEP_QMA_MODE_2 (2) |
QMA mode-2 operation is selected. More... | |
EQEP emuMode parameter | |
typedef uint32_t | eqepEmulationMode_t |
Enum Values that can be passed to EQEP_setEmulationMode() as the emuMode parameter. More... | |
#define | EQEP_EMULATIONMODE_STOPIMMEDIATELY (0) |
Counters stop immediately. More... | |
#define | EQEP_EMULATIONMODE_STOPATROLLOVER (1) |
Counters stop at period rollover. More... | |
#define | EQEP_EMULATIONMODE_RUNFREE (2) |
Counter unaffected by suspend. More... | |
EQEP direction | |
#define | EQEP_DIR_ANTI_CLOCKWISE (CSL_EQEP_QEPSTS_TYPE1_QDF_VAL_QDF_COUNTERCLK) |
Moving in the anticlockwise direction. More... | |
#define | EQEP_DIR_CLOCKWISE (CSL_EQEP_QEPSTS_TYPE1_QDF_VAL_QDF_CLK) |
Moving in the clockwise direction. More... | |
#define EQEP_CONFIG_QUADRATURE (0x0000U) |
Values that can be passed to EQEP_setDecoderConfig() as the config parameter.
Operation Mode
#define EQEP_CONFIG_CLOCK_DIR (0x4000U) |
Quadrature-clock Direction-count mode.
#define EQEP_CONFIG_UP_COUNT (0x8000U) |
Up-count mode, QDIR = 1.
#define EQEP_CONFIG_DOWN_COUNT (0xC000U) |
Down-count mode, QDIR = 0.
#define EQEP_CONFIG_2X_RESOLUTION (0x0000U) |
Resolution Count rising and falling edge.
#define EQEP_CONFIG_1X_RESOLUTION (0x0800U) |
Resolution Count rising edge only.
#define EQEP_CONFIG_NO_SWAP (0x0000U) |
Do not swap QEPA and QEPB.
#define EQEP_CONFIG_SWAP (0x0400U) |
Swap QEPA and QEPB.
#define EQEP_COMPARE_NO_SYNC_OUT (0x0000U) |
Values that can be passed to EQEP_setCompareConfig() as the config parameter.
Sync pulse pin, Disable sync output
#define EQEP_COMPARE_IDX_SYNC_OUT (0x2000U) |
Sync output on index pin.
#define EQEP_COMPARE_STROBE_SYNC_OUT (0x3000U) |
Sync output on strobe pin.
#define EQEP_COMPARE_NO_SHADOW (0x0000U) |
Disable shadow of QPOSCMP.
#define EQEP_COMPARE_LOAD_ON_ZERO (0x8000U) |
Load on QPOSCNT = 0.
#define EQEP_COMPARE_LOAD_ON_MATCH (0xC000U) |
Load on QPOSCNT = QPOSCMP.
#define EQEP_INT_GLOBAL (0x0001U) |
Values that can be passed to EQEP_enableInterrupt(), EQEP_disableInterrupt(), and EQEP_clearInterruptStatus() as the intFlags parameter and returned by EQEP_clearInterruptStatus().
Global interrupt flag
#define EQEP_INT_POS_CNT_ERROR (0x0002U) |
Position counter error.
#define EQEP_INT_PHASE_ERROR (0x0004U) |
Quadrature phase error.
#define EQEP_INT_DIR_CHANGE (0x0008U) |
Quadrature direction change.
#define EQEP_INT_WATCHDOG (0x0010U) |
Watchdog time-out.
#define EQEP_INT_UNDERFLOW (0x0020U) |
Position counter underflow.
#define EQEP_INT_OVERFLOW (0x0040U) |
Position counter overflow.
#define EQEP_INT_POS_COMP_READY (0x0080U) |
Position-compare ready.
#define EQEP_INT_POS_COMP_MATCH (0x0100U) |
Position-compare match.
#define EQEP_INT_STROBE_EVNT_LATCH (0x0200U) |
Strobe event latch.
#define EQEP_INT_INDEX_EVNT_LATCH (0x0400U) |
Index event latch.
#define EQEP_INT_UNIT_TIME_OUT (0x0800U) |
Unit time-out.
#define EQEP_INT_QMA_ERROR (0x1000U) |
QMA error.
#define EQEP_STS_UNIT_POS_EVNT (0x0080U) |
Values that can be returned by EQEP_getStatus().
Unit position event detected
#define EQEP_STS_DIR_ON_1ST_IDX (0x0040U) |
Direction was clockwise on first index event.
#define EQEP_STS_DIR_FLAG (0x0020U) |
Direction is CW (forward)
#define EQEP_STS_DIR_LATCH (0x0010U) |
Direction was CW on index.
#define EQEP_STS_CAP_OVRFLW_ERROR (0x0008U) |
Capture timer overflow.
#define EQEP_STS_CAP_DIR_ERROR (0x0004U) |
Direction changed between position capture events.
#define EQEP_STS_1ST_IDX_FLAG (0x0002U) |
First index pulse occurred.
#define EQEP_STS_POS_CNT_ERROR (0x0001U) |
Position counter error.
#define EQEP_LATCH_CNT_READ_BY_CPU (0x0000U) |
Values that can be passed to EQEP_setLatchMode() as the latchMode parameter.
Position counter latch event
#define EQEP_LATCH_UNIT_TIME_OUT (0x0004U) |
On position counter read.
#define EQEP_LATCH_RISING_STROBE (0x0000U) |
On unit time-out event.
Strobe position counter latch event On rising edge of strobe
#define EQEP_LATCH_EDGE_DIR_STROBE (0x0040U) |
On rising edge when clockwise, on falling when counter clockwise.
#define EQEP_LATCH_RISING_INDEX (0x0010U) |
Index position counter latch event.
#define EQEP_LATCH_FALLING_INDEX (0x0020U) |
On rising edge of index.
#define EQEP_LATCH_SW_INDEX_MARKER (0x0030U) |
On falling edge of index.
#define EQEP_INIT_DO_NOTHING (0x0000U) |
Values that can be passed to EQEP_setPositionInitMode() as the initMode parameter.
Action is disabled
#define EQEP_INIT_RISING_STROBE (0x0800U) |
Strobe events On rising edge of strobe.
#define EQEP_INIT_EDGE_DIR_STROBE (0x0C00U) |
Strobe events On rising edge when clockwise, on falling when counter clockwise.
#define EQEP_INIT_RISING_INDEX (0x0200U) |
Index events, On rising edge of index.
#define EQEP_INIT_FALLING_INDEX (0x0300U) |
Index events, On falling edge of index.
#define EQEP_MOD_FORWARD_DIR (1) |
Values that can be return from EQEP_getDirection() .
Moving in the forward direction
#define EQEP_MOD_BACKWARD_DIR (-1) |
Moving in the reverse direction.
#define EQEP_POSITION_RESET_IDX (0x0000) |
Reset position on index pulse.
#define EQEP_POSITION_RESET_MAX_POS (0x1000) |
Reset position on maximum position.
#define EQEP_POSITION_RESET_1ST_IDX (0x2000) |
Reset position on the first index pulse.
#define EQEP_POSITION_RESET_UNIT_TIME_OUT (0x3000) |
Reset position on a unit time event.
#define EQEP_CAPTURE_CLK_DIV_1 (0x00) |
CAPCLK = SYSCLKOUT/1.
#define EQEP_CAPTURE_CLK_DIV_2 (0x10) |
CAPCLK = SYSCLKOUT/2.
#define EQEP_CAPTURE_CLK_DIV_4 (0x20) |
CAPCLK = SYSCLKOUT/4.
#define EQEP_CAPTURE_CLK_DIV_8 (0x30) |
CAPCLK = SYSCLKOUT/8.
#define EQEP_CAPTURE_CLK_DIV_16 (0x40) |
CAPCLK = SYSCLKOUT/16.
#define EQEP_CAPTURE_CLK_DIV_32 (0x50) |
CAPCLK = SYSCLKOUT/32.
#define EQEP_CAPTURE_CLK_DIV_64 (0x60) |
CAPCLK = SYSCLKOUT/64.
#define EQEP_CAPTURE_CLK_DIV_128 (0x070) |
CAPCLK = SYSCLKOUT/128.
#define EQEP_UNIT_POS_EVNT_DIV_1 (0) |
UPEVNT = QCLK/1.
#define EQEP_UNIT_POS_EVNT_DIV_2 (1) |
UPEVNT = QCLK/2.
#define EQEP_UNIT_POS_EVNT_DIV_4 (2) |
UPEVNT = QCLK/4.
#define EQEP_UNIT_POS_EVNT_DIV_8 (3) |
UPEVNT = QCLK/8.
#define EQEP_UNIT_POS_EVNT_DIV_16 (4) |
UPEVNT = QCLK/16.
#define EQEP_UNIT_POS_EVNT_DIV_32 (5) |
UPEVNT = QCLK/32.
#define EQEP_UNIT_POS_EVNT_DIV_64 (6) |
UPEVNT = QCLK/64.
#define EQEP_UNIT_POS_EVNT_DIV_128 (7) |
UPEVNT = QCLK/128.
#define EQEP_UNIT_POS_EVNT_DIV_256 (8) |
UPEVNT = QCLK/256.
#define EQEP_UNIT_POS_EVNT_DIV_512 (9) |
UPEVNT = QCLK/512.
#define EQEP_UNIT_POS_EVNT_DIV_1024 (10) |
UPEVNT = QCLK/1024.
#define EQEP_UNIT_POS_EVNT_DIV_2048 (11) |
UPEVNT = QCLK/2048.
#define EQEP_STROBE_FROM_GPIO (0) |
Strobe signal comes from GPIO.
#define EQEP_STROBE_OR_ADCSOCA (2) |
Strobe signal is OR'd with ADCSOCA.
#define EQEP_STROBE_OR_ADCSOCB (3) |
Strobe signal is OR'd with ADCSOCB.
#define EQEP_QMA_MODE_BYPASS (0) |
QMA module is bypassed.
#define EQEP_QMA_MODE_1 (1) |
QMA mode-1 operation is selected.
#define EQEP_QMA_MODE_2 (2) |
QMA mode-2 operation is selected.
#define EQEP_EMULATIONMODE_STOPIMMEDIATELY (0) |
Counters stop immediately.
#define EQEP_EMULATIONMODE_STOPATROLLOVER (1) |
Counters stop at period rollover.
#define EQEP_EMULATIONMODE_RUNFREE (2) |
Counter unaffected by suspend.
#define EQEP_DIR_ANTI_CLOCKWISE (CSL_EQEP_QEPSTS_TYPE1_QDF_VAL_QDF_COUNTERCLK) |
Moving in the anticlockwise direction.
#define EQEP_DIR_CLOCKWISE (CSL_EQEP_QEPSTS_TYPE1_QDF_VAL_QDF_CLK) |
Moving in the clockwise direction.
typedef uint32_t eqepPositionResetMode_t |
Enum Values that can be passed to EQEP_setPositionCounterConfig() as the mode parameter.
typedef uint32_t eqepCapClkPrescale_t |
Enum Values that can be passed to EQEP_setCaptureConfig() as the capPrescale parameter.
CAPCLK is the capture timer clock frequency.
typedef uint32_t eqeqUpEvntPrescale_t |
Enum Values that can be passed to EQEP_setCaptureConfig() as the evntPrescaleparameter.
UPEVNT is the unit position event frequency.
typedef uint32_t eqepStrobeSource_t |
Enum Values that can be passed to EQEP_setStrobeSource() as the strobeSrc parameter.
typedef uint32_t eqepQmaMode_t |
Enum Values that can be passed to EQEP_setQMAModuleMode() as the qmaMode parameter.
typedef uint32_t eqepEmulationMode_t |
Enum Values that can be passed to EQEP_setEmulationMode() as the emuMode parameter.
void EQEP_enableModule | ( | uint32_t | baseAddr | ) |
Enables the eQEP module.
baseAddr | is the base address of the eQEP module. |
This function enables operation of the enhanced quadrature encoder pulse (eQEP) module. The module must be configured before it is enabled.
void EQEP_disableModule | ( | uint32_t | baseAddr | ) |
Disables the eQEP module.
baseAddr | is the base address of the enhanced quadrature encoder pulse (eQEP) module |
This function disables operation of the eQEP module.
void EQEP_setDecoderConfig | ( | uint32_t | baseAddr, |
uint16_t | config | ||
) |
Configures eQEP module's quadrature decoder unit.
baseAddr | is the base address of the eQEP module. |
config | is the configuration for the eQEP module decoder unit. |
This function 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:
void EQEP_setPositionCounterConfig | ( | uint32_t | baseAddr, |
eqepPositionResetMode_t | mode, | ||
uint32_t | maxPosition | ||
) |
Configures eQEP module position counter unit.
baseAddr | is the base address of the eQEP module. |
mode | is the configuration for the eQEP module position counter. |
maxPosition | specifies the maximum position value. |
This function configures the operation of the eQEP module position counter. The mode parameter determines the event on which the position counter gets reset. It should be passed one of the following values: EQEP_POSITION_RESET_IDX, EQEP_POSITION_RESET_MAX_POS, EQEP_POSITION_RESET_1ST_IDX, or EQEP_POSITION_RESET_UNIT_TIME_OUT.
maxPosition is the maximum value of the position counter and is the value used to reset the position capture when moving in the reverse (negative) direction.
uint32_t EQEP_getPosition | ( | uint32_t | baseAddr | ) |
Gets the current encoder position.
baseAddr | is the base address of the eQEP module. |
This function returns the current position of the encoder. Depending upon the configuration of the encoder, and the incident of an index pulse, this value may or may not contain the expected data (that is, if in reset on index mode, if an index pulse has not been encountered, the position counter is not yet aligned with the index pulse).
void EQEP_setPosition | ( | uint32_t | baseAddr, |
uint32_t | position | ||
) |
Sets the current encoder position.
baseAddr | is the base address of the eQEP module. |
position | is the new position for the encoder. |
This function sets the current position of the encoder; the encoder position is then measured relative to this value.
int32_t EQEP_getDirection | ( | uint32_t | baseAddr | ) |
Gets the current direction of rotation.
baseAddr | is the base address of the eQEP module. |
This function 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.
void EQEP_enableInterrupt | ( | uint32_t | baseAddr, |
uint16_t | intFlags | ||
) |
Enables individual eQEP module interrupt sources.
baseAddr | is the base address of the eQEP module. |
intFlags | is a bit mask of the interrupt sources to be enabled. |
This function enables eQEP module interrupt sources. The intFlags parameter can be any of the following values OR'd together:
void EQEP_disableInterrupt | ( | uint32_t | baseAddr, |
uint16_t | intFlags | ||
) |
Disables individual eQEP module interrupt sources.
baseAddr | is the base address of the eQEP module. |
intFlags | is a bit mask of the interrupt sources to be disabled. |
This function disables eQEP module interrupt sources. The intFlags parameter can be any of the following values OR'd together:
uint16_t EQEP_getEnabledInterrupt | ( | uint32_t | baseAddr | ) |
Get Enabled interrupts of eQEP module.
baseAddr | is the base address of the eQEP module. |
uint16_t EQEP_getInterruptStatus | ( | uint32_t | baseAddr | ) |
Gets the current interrupt status.
baseAddr | is the base address of the eQEP module. |
This function returns the interrupt status for the eQEP module module.
void EQEP_clearInterruptStatus | ( | uint32_t | baseAddr, |
uint16_t | intFlags | ||
) |
Clears eQEP module interrupt sources.
baseAddr | is the base address of the eQEP module. |
intFlags | is a bit mask of the interrupt sources to be cleared. |
This function clears eQEP module interrupt flags. The intFlags parameter can be any of the following values OR'd together:
Note that the EQEP_INT_GLOBAL value is the global interrupt flag. In order to get any further eQEP interrupts, this flag must be cleared.
void EQEP_forceInterrupt | ( | uint32_t | baseAddr, |
uint16_t | intFlags | ||
) |
Forces individual eQEP module interrupts.
baseAddr | is the base address of the eQEP module. |
intFlags | is a bit mask of the interrupt sources to be forced. |
This function forces eQEP module interrupt flags. The intFlags parameter can be any of the following values OR'd together:
Bool EQEP_isErrorSet | ( | uint32_t | baseAddr | ) |
Gets the encoder error indicator.
baseAddr | is the base address of the eQEP module. |
This function 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.
uint32_t EQEP_getStatus | ( | uint32_t | baseAddr | ) |
Returns content of the eQEP module status register.
baseAddr | is the base address of the eQEP module. |
This function returns the contents of the status register. The value it returns is an OR of the following values:
void EQEP_clearStatus | ( | uint32_t | baseAddr, |
uint16_t | statusFlags | ||
) |
Clears selected fields of the eQEP module status register.
baseAddr | is the base address of the eQEP module. |
statusFlags | is the bit mask of the status flags to be cleared. |
This function clears the status register fields indicated by statusFlags. The statusFlags parameter is the logical OR of any of the following:
void EQEP_setCaptureConfig | ( | uint32_t | baseAddr, |
eqepCapClkPrescale_t | capPrescale, | ||
eqeqUpEvntPrescale_t | evntPrescale | ||
) |
Configures eQEP module edge-capture unit.
baseAddr | is the base address of the eQEP module. |
capPrescale | is the prescaler setting of the eQEP capture timer clk. |
evntPrescale | is the prescaler setting of the unit position event frequency. |
This function configures the operation of the eQEP module edge-capture unit. The capPrescale parameter provides the configuration of the eQEP capture timer clock rate. It determines by which power of 2 between 1 and 128 inclusive SYSCLKOUT is divided. The macros for this parameter are in the format of EQEP_CAPTURE_CLK_DIV_X, where X is the divide value. For example, EQEP_CAPTURE_CLK_DIV_32 will give a capture timer clock frequency that is SYSCLKOUT/32.
The evntPrescale parameter determines how frequently a unit position event occurs. The macro that can be passed this parameter is in the format EQEP_UNIT_POS_EVNT_DIV_X, where X is the number of quadrature clock periods between unit position events. For example, EQEP_UNIT_POS_EVNT_DIV_16 will result in a unit position event frequency of QCLK/16.
void EQEP_enableCapture | ( | uint32_t | baseAddr | ) |
Enables the eQEP module edge-capture unit.
baseAddr | is the base address of the eQEP module. |
This function enables operation of the eQEP module's edge-capture unit.
void EQEP_disableCapture | ( | uint32_t | baseAddr | ) |
Disables the eQEP module edge-capture unit.
baseAddr | is the base address of the eQEP module. |
This function disables operation of the eQEP module's edge-capture unit.
uint32_t EQEP_getCapturePeriod | ( | uint32_t | baseAddr | ) |
Gets the encoder capture period.
baseAddr | is the base address of the eQEP module. |
This function returns the period count value between the last successive eQEP position events.
uint32_t EQEP_getCaptureTimer | ( | uint32_t | baseAddr | ) |
Gets the encoder capture timer value.
baseAddr | is the base address of the eQEP module. |
This function returns the time base for the edge capture unit.
void EQEP_enableCompare | ( | uint32_t | baseAddr | ) |
Enables the eQEP module position-compare unit.
baseAddr | is the base address of the eQEP module. |
This function enables operation of the eQEP module's position-compare unit.
void EQEP_disableCompare | ( | uint32_t | baseAddr | ) |
Disables the eQEP module position-compare unit.
baseAddr | is the base address of the eQEP module. |
This function disables operation of the eQEP module's position-compare unit.
int32_t EQEP_setComparePulseWidth | ( | uint32_t | baseAddr, |
uint16_t | cycles | ||
) |
Configures the position-compare unit's sync output pulse width.
baseAddr | is the base address of the eQEP module. |
cycles | is the width of the pulse that can be generated on a position-compare event. It is in units of 4 SYSCLKOUT cycles. |
This function 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.
void EQEP_enableUnitTimer | ( | uint32_t | baseAddr, |
uint32_t | period | ||
) |
Enables the eQEP module unit timer.
baseAddr | is the base address of the eQEP module. |
period | is period value at which a unit time-out interrupt is set. |
This function 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.
void EQEP_disableUnitTimer | ( | uint32_t | baseAddr | ) |
Disables the eQEP module unit timer.
baseAddr | is the base address of the eQEP module. |
This function disables operation of the eQEP module's peripheral unit timer.
void EQEP_enableWatchdog | ( | uint32_t | baseAddr, |
uint16_t | period | ||
) |
Enables the eQEP module watchdog timer.
baseAddr | is the base address of the eQEP module. |
period | is watchdog period value at which a time-out will occur if no quadrature-clock event is detected. |
This function enables operation of the eQEP module's peripheral watchdog timer.
void EQEP_disableWatchdog | ( | uint32_t | baseAddr | ) |
Disables the eQEP module watchdog timer.
baseAddr | is the base address of the eQEP module. |
This function disables operation of the eQEP module's peripheral watchdog timer.
void EQEP_setWatchdogTimerValue | ( | uint32_t | baseAddr, |
uint16_t | value | ||
) |
Sets the eQEP module watchdog timer value.
baseAddr | is the base address of the eQEP module. |
value | is the value to be written to the watchdog timer. |
This function sets the eQEP module's watchdog timer value.
uint32_t EQEP_getWatchdogTimerValue | ( | uint32_t | baseAddr | ) |
Gets the eQEP module watchdog timer value.
baseAddr | is the base address of the eQEP module. |
void EQEP_setPositionInitMode | ( | uint32_t | baseAddr, |
uint16_t | initMode | ||
) |
Configures the mode in which the position counter is initialized.
baseAddr | is the base address of the eQEP module. |
initMode | is the configuration for initializing the position count. See below for a description of this parameter. |
This function configures the events on which the position count can be initialized. The initMode parameter provides the mode as either EQEP_INIT_DO_NOTHING (no action configured) or one of the following strobe events, index events, or a logical OR of both a strobe event and an index event.
Use EQEP_setSWPositionInit() to cause a software initialization and EQEP_setInitialPosition() to set the value that gets loaded into the position counter upon initialization.
void EQEP_setSWPositionInit | ( | uint32_t | baseAddr, |
Bool | initialize | ||
) |
Sets the software initialization of the encoder position counter.
baseAddr | is the base address of the eQEP module. |
initialize | is a flag to specify if software initialization of the position counter is enabled. |
This function does 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 EQEP_setInitialPosition(). Additional initialization causes can be configured with EQEP_setPositionInitMode().
void EQEP_setInitialPosition | ( | uint32_t | baseAddr, |
uint32_t | position | ||
) |
Sets the init value for the encoder position counter.
baseAddr | is the base address of the eQEP module. |
position | is the value to be written to the position counter upon. initialization. |
This function sets the init value for position of the encoder. See EQEP_setPositionInitMode() to set the initialization cause or EQEP_setSWPositionInit() to cause a software initialization.
void EQEP_setLatchMode | ( | uint32_t | baseAddr, |
uint32_t | latchMode | ||
) |
Configures the quadrature modes in which the position count can be latched.
baseAddr | is the base address of the eQEP module. |
latchMode | is the configuration for latching of the position count and several other registers. See below for a description of this parameter. |
This function 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.
uint32_t EQEP_getIndexPositionLatch | ( | uint32_t | baseAddr | ) |
Gets the encoder position that was latched on an index event.
baseAddr | is the base address of the eQEP module. |
This function returns the value in the index position latch register. The position counter is latched into this register on either a rising index edge, a falling index edge, or a software index marker. This is configured using EQEP_setLatchMode().
uint32_t EQEP_getStrobePositionLatch | ( | uint32_t | baseAddr | ) |
Gets the encoder position that was latched on a strobe event.
baseAddr | is the base address of the eQEP module. |
This function returns the value in the strobe position latch register. The position counter can be configured to be latched into this register on rising strobe edges only or on rising strobe edges while moving clockwise and falling strobe edges while moving counter-clockwise. This is configured using EQEP_setLatchMode().
uint32_t EQEP_getPositionLatch | ( | uint32_t | baseAddr | ) |
Gets the encoder position that was latched on a unit time-out event.
baseAddr | is the base address of the eQEP module. |
This function returns the value in the position latch register. The position counter is latched into this register either on a unit time-out event.
uint32_t EQEP_getCaptureTimerLatch | ( | uint32_t | baseAddr | ) |
Gets the encoder capture timer latch.
baseAddr | is the base address of the eQEP module. |
This function returns the value in the capture timer latch register. The capture timer value is latched into this register either on a unit time-out event or upon the CPU reading the eQEP position counter. This is configured using EQEP_setLatchMode().
uint32_t EQEP_getCapturePeriodLatch | ( | uint32_t | baseAddr | ) |
Gets the encoder capture period latch.
baseAddr | is the base address of the eQEP module. |
This function returns the value in the capture period latch register. The capture period value is latched into this register either on a unit time-out event or upon the CPU reading the eQEP position counter. This is configured using EQEP_setLatchMode().
void EQEP_setQMAModuleMode | ( | uint32_t | baseAddr, |
eqepQmaMode_t | qmaMode | ||
) |
Set the quadrature mode adapter (QMA) module mode.
baseAddr | is the base address of the eQEP module. |
qmaMode | is the mode in which the QMA module will operate. |
This function sets the quadrature mode adapter module mode. The possible modes are passed to the function through the qmaMode parameter which can take the values EQEP_QMA_MODE_BYPASS, EQEP_QMA_MODE_1, or EQEP_QMA_MODE_2.
To use the QMA module, you must first put the eQEP module into direction-count mode (EQEP_CONFIG_CLOCK_DIR) using EQEP_setDecoderConfig().
void EQEP_setStrobeSource | ( | uint32_t | baseAddr, |
eqepStrobeSource_t | strobeSrc | ||
) |
Set the strobe input source of the eQEP module.
baseAddr | is the base address of the eQEP module. |
strobeSrc | is the source of the strobe signal. |
This function sets the source of the eQEP module's strobe signal. The possible values of the strobeSrc parameter are
void EQEP_setEmulationMode | ( | uint32_t | baseAddr, |
eqepEmulationMode_t | emuMode | ||
) |
Set the emulation mode of the eQEP module.
baseAddr | is the base address of the eQEP module. |
emuMode | is the mode operation upon an emulation suspend. |
This function sets the eQEP module's emulation mode. This mode determines how the timers are affected by an emulation suspend. Valid values for the emuMode parameter are the following:
void EQEP_setCompareConfig | ( | uint32_t | baseAddr, |
uint16_t | config, | ||
uint32_t | compareValue, | ||
uint16_t | cycles | ||
) |
Configures eQEP module position-compare unit.
baseAddr | is the base address of the eQEP module. |
config | is the configuration for the eQEP module position-compare unit. See below for a description of this parameter. |
compareValue | is the value to which the position count value is compared for a position-compare event. |
cycles | is the width of the pulse that can be generated on a position-compare event. It is in units of 4 SYSCLKOUT cycles. |
This function 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:
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.
void EQEP_setInputPolarity | ( | uint32_t | baseAddr, |
Bool | invertQEPA, | ||
Bool | invertQEPB, | ||
Bool | invertIndex, | ||
Bool | invertStrobe | ||
) |
Sets the polarity of the eQEP module's input signals.
baseAddr | is the base address of the eQEP module. |
invertQEPA | is the flag to negate the QEPA input. |
invertQEPB | is the flag to negate the QEPA input. |
invertIndex | is the flag to negate the index input. |
invertStrobe | is the flag to negate the strobe input. |
This function 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.