AM263x MCU+ SDK  08.02.00

Introduction

This module contains APIs to program and use the EQEP module.

Data Structures

struct  EQEP_SourceSelect
 

Functions

static void EQEP_enableModule (uint32_t base)
 
static void EQEP_disableModule (uint32_t base)
 
static void EQEP_setDecoderConfig (uint32_t base, uint16_t config)
 
static void EQEP_setPositionCounterConfig (uint32_t base, EQEP_PositionResetMode mode, uint32_t maxPosition)
 
static uint32_t EQEP_getPosition (uint32_t base)
 
static void EQEP_setPosition (uint32_t base, uint32_t position)
 
static int16_t EQEP_getDirection (uint32_t base)
 
static void EQEP_enableInterrupt (uint32_t base, uint16_t intFlags)
 
static void EQEP_disableInterrupt (uint32_t base, uint16_t intFlags)
 
static uint16_t EQEP_getInterruptStatus (uint32_t base)
 
static void EQEP_clearInterruptStatus (uint32_t base, uint16_t intFlags)
 
static void EQEP_forceInterrupt (uint32_t base, uint16_t intFlags)
 
static bool EQEP_getError (uint32_t base)
 
static uint16_t EQEP_getStatus (uint32_t base)
 
static void EQEP_clearStatus (uint32_t base, uint16_t statusFlags)
 
static void EQEP_setCaptureConfig (uint32_t base, EQEP_CAPCLKPrescale capPrescale, EQEP_UPEVNTPrescale evntPrescale)
 
static void EQEP_enableCapture (uint32_t base)
 
static void EQEP_disableCapture (uint32_t base)
 
static uint16_t EQEP_getCapturePeriod (uint32_t base)
 
static uint16_t EQEP_getCaptureTimer (uint32_t base)
 
static void EQEP_enableCompare (uint32_t base)
 
static void EQEP_disableCompare (uint32_t base)
 
static void EQEP_setComparePulseWidth (uint32_t base, uint16_t cycles)
 
static void EQEP_loadUnitTimer (uint32_t base, uint32_t period)
 
static void EQEP_enableUnitTimer (uint32_t base, uint32_t period)
 
static void EQEP_disableUnitTimer (uint32_t base)
 
static void EQEP_enableWatchdog (uint32_t base, uint16_t period)
 
static void EQEP_disableWatchdog (uint32_t base)
 
static void EQEP_setWatchdogTimerValue (uint32_t base, uint16_t value)
 
static uint16_t EQEP_getWatchdogTimerValue (uint32_t base)
 
static void EQEP_setPositionInitMode (uint32_t base, uint16_t initMode)
 
static void EQEP_setSWPositionInit (uint32_t base, bool initialize)
 
static void EQEP_setInitialPosition (uint32_t base, uint32_t position)
 
static void EQEP_setLatchMode (uint32_t base, uint32_t latchMode)
 
static uint32_t EQEP_getIndexPositionLatch (uint32_t base)
 
static uint32_t EQEP_getStrobePositionLatch (uint32_t base)
 
static uint32_t EQEP_getPositionLatch (uint32_t base)
 
static uint16_t EQEP_getCaptureTimerLatch (uint32_t base)
 
static uint16_t EQEP_getCapturePeriodLatch (uint32_t base)
 
static void EQEP_setQMAModuleMode (uint32_t base, EQEP_QMAMode qmaMode)
 
static void EQEP_setStrobeSource (uint32_t base, EQEP_StrobeSource strobeSrc)
 
static void EQEP_enableDirectionChangeDuringIndex (uint32_t base)
 
static void EQEP_disableDirectionChangeDuringIndex (uint32_t base)
 
static void EQEP_selectSource (uint32_t base, EQEP_SourceSelect sourceConfig)
 
static void EQEP_setEmulationMode (uint32_t base, EQEP_EmulationMode emuMode)
 
void EQEP_setCompareConfig (uint32_t base, uint16_t config, uint32_t compareValue, uint16_t cycles)
 
void EQEP_setInputPolarity (uint32_t base, bool invertQEPA, bool invertQEPB, bool invertIndex, bool invertStrobe)
 

Enumerations

enum  EQEP_PositionResetMode { EQEP_POSITION_RESET_IDX = 0x0000, EQEP_POSITION_RESET_MAX_POS = 0x1000, EQEP_POSITION_RESET_1ST_IDX = 0x2000, EQEP_POSITION_RESET_UNIT_TIME_OUT = 0x3000 }
 
enum  EQEP_CAPCLKPrescale {
  EQEP_CAPTURE_CLK_DIV_1 = 0x00, EQEP_CAPTURE_CLK_DIV_2 = 0x10, EQEP_CAPTURE_CLK_DIV_4 = 0x20, EQEP_CAPTURE_CLK_DIV_8 = 0x30,
  EQEP_CAPTURE_CLK_DIV_16 = 0x40, EQEP_CAPTURE_CLK_DIV_32 = 0x50, EQEP_CAPTURE_CLK_DIV_64 = 0x60, EQEP_CAPTURE_CLK_DIV_128 = 0x70
}
 
enum  EQEP_UPEVNTPrescale {
  EQEP_UNIT_POS_EVNT_DIV_1 = 0, EQEP_UNIT_POS_EVNT_DIV_2 = 1, EQEP_UNIT_POS_EVNT_DIV_4 = 2, EQEP_UNIT_POS_EVNT_DIV_8 = 3,
  EQEP_UNIT_POS_EVNT_DIV_16 = 4, EQEP_UNIT_POS_EVNT_DIV_32 = 5, EQEP_UNIT_POS_EVNT_DIV_64 = 6, EQEP_UNIT_POS_EVNT_DIV_128 = 7,
  EQEP_UNIT_POS_EVNT_DIV_256 = 8, EQEP_UNIT_POS_EVNT_DIV_512 = 9, EQEP_UNIT_POS_EVNT_DIV_1024 = 10, EQEP_UNIT_POS_EVNT_DIV_2048 = 11
}
 
enum  EQEP_StrobeSource { EQEP_STROBE_FROM_GPIO = 0, EQEP_STROBE_OR_ADCSOCA = 2, EQEP_STROBE_OR_ADCSOCB = 3 }
 
enum  EQEP_QMAMode { EQEP_QMA_MODE_BYPASS = 0, EQEP_QMA_MODE_1 = 1, EQEP_QMA_MODE_2 = 2 }
 
enum  EQEP_Source {
  EQEP_SOURCE_ZERO = 0x0000U, EQEP_SOURCE_DEVICE_PIN = 0x0001U, EQEP_SOURCE_PWMXBAROUT0 = 0x0002U, EQEP_SOURCE_PWMXBAROUT1 = 0x0003U,
  EQEP_SOURCE_PWMXBAROUT2 = 0x0004U, EQEP_SOURCE_PWMXBAROUT3 = 0x0005U, EQEP_SOURCE_PWMXBAROUT4 = 0x0006U, EQEP_SOURCE_PWMXBAROUT5 = 0x0007U,
  EQEP_SOURCE_PWMXBAROUT6 = 0x0008U, EQEP_SOURCE_PWMXBAROUT7 = 0x0009U, EQEP_SOURCE_PWMXBAROUT8 = 0x000AU, EQEP_SOURCE_PWMXBAROUT9 = 0x000BU,
  EQEP_SOURCE_PWMXBAROUT10 = 0x000CU, EQEP_SOURCE_PWMXBAROUT11 = 0x000DU, EQEP_SOURCE_PWMXBAROUT12 = 0x000EU, EQEP_SOURCE_PWMXBAROUT13 = 0x000FU,
  EQEP_SOURCE_PWMXBAROUT14 = 0x0010U, EQEP_SOURCE_PWMXBAROUT15 = 0x0011U, EQEP_SOURCE_PWMXBAROUT16 = 0x0012U, EQEP_SOURCE_PWMXBAROUT17 = 0x0013U,
  EQEP_SOURCE_PWMXBAROUT18 = 0x0014U, EQEP_SOURCE_PWMXBAROUT19 = 0x0015U, EQEP_SOURCE_PWMXBAROUT20 = 0x0016U, EQEP_SOURCE_PWMXBAROUT21 = 0x0017U,
  EQEP_SOURCE_PWMXBAROUT22 = 0x0018U, EQEP_SOURCE_PWMXBAROUT23 = 0x0019U, EQEP_SOURCE_PWMXBAROUT24 = 0x001AU, EQEP_SOURCE_PWMXBAROUT25 = 0x001BU,
  EQEP_SOURCE_PWMXBAROUT26 = 0x001CU, EQEP_SOURCE_PWMXBAROUT27 = 0x001DU, EQEP_SOURCE_PWMXBAROUT28 = 0x001EU, EQEP_SOURCE_PWMXBAROUT29 = 0x001FU
}
 
enum  EQEP_EmulationMode { EQEP_EMULATIONMODE_STOPIMMEDIATELY = 0, EQEP_EMULATIONMODE_STOPATROLLOVER = 1, EQEP_EMULATIONMODE_RUNFREE = 2 }
 

Macros

#define EQEP_CONFIG_QUADRATURE   (0x0000U)
 Header files. More...
 
#define EQEP_CONFIG_CLOCK_DIR   (0x4000U)
 Up-count mode, QDIR = 1. More...
 
#define EQEP_CONFIG_UP_COUNT   (0x8000U)
 Down-count mode, QDIR = 0. More...
 
#define EQEP_CONFIG_DOWN_COUNT   (0xC000U)
 
#define EQEP_CONFIG_2X_RESOLUTION   (0x0000U)
 < Count rising and falling edge More...
 
#define EQEP_CONFIG_1X_RESOLUTION   (0x0800U)
 
#define EQEP_CONFIG_NO_SWAP   (0x0000U)
 < Do not swap QEPA and QEPB More...
 
#define EQEP_CONFIG_SWAP   (0x0400U)
 
#define EQEP_COMPARE_NO_SYNC_OUT   (0x0000U)
 < Disable sync output More...
 
#define EQEP_COMPARE_IDX_SYNC_OUT   (0x2000U)
 Sync output on strobe pin. More...
 
#define EQEP_COMPARE_STROBE_SYNC_OUT   (0x3000U)
 
#define EQEP_COMPARE_NO_SHADOW   (0x0000U)
 < Disable shadow of QPOSCMP More...
 
#define EQEP_COMPARE_LOAD_ON_ZERO   (0x8000U)
 Load on QPOSCNT = QPOSCMP. More...
 
#define EQEP_COMPARE_LOAD_ON_MATCH   (0xC000U)
 
#define EQEP_INT_GLOBAL   (0x0001U)
 Global interrupt flag. 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...
 
#define EQEP_STS_UNIT_POS_EVNT   (0x0080U)
 Unit position event detected. 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...
 
#define EQEP_LATCH_CNT_READ_BY_CPU   (0x0000U)
 On position counter read. More...
 
#define EQEP_LATCH_UNIT_TIME_OUT   (0x0004U)
 On unit time-out event. More...
 
#define EQEP_LATCH_RISING_STROBE   (0x0000U)
 On rising edge of strobe. 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)
 On rising edge of index. More...
 
#define EQEP_LATCH_FALLING_INDEX   (0x0020U)
 On falling edge of index. More...
 
#define EQEP_LATCH_SW_INDEX_MARKER   (0x0030U)
 On software index marker. More...
 
#define EQEP_INIT_DO_NOTHING   (0x0000U)
 Action is disabled. More...
 
#define EQEP_INIT_RISING_STROBE   (0x0800U)
 On rising edge of strobe. More...
 
#define EQEP_INIT_EDGE_DIR_STROBE   (0x0C00U)
 On rising edge when clockwise, on falling when counter clockwise. More...
 
#define EQEP_INIT_RISING_INDEX   (0x0200U)
 On rising edge of index. More...
 
#define EQEP_INIT_FALLING_INDEX   (0x0300U)
 On falling edge of index. More...
 

Macro Definition Documentation

◆ EQEP_CONFIG_QUADRATURE

#define EQEP_CONFIG_QUADRATURE   (0x0000U)

Header files.

< Quadrature-clock mode Direction-count mode

◆ EQEP_CONFIG_CLOCK_DIR

#define EQEP_CONFIG_CLOCK_DIR   (0x4000U)

Up-count mode, QDIR = 1.

◆ EQEP_CONFIG_UP_COUNT

#define EQEP_CONFIG_UP_COUNT   (0x8000U)

Down-count mode, QDIR = 0.

◆ EQEP_CONFIG_DOWN_COUNT

#define EQEP_CONFIG_DOWN_COUNT   (0xC000U)

◆ EQEP_CONFIG_2X_RESOLUTION

#define EQEP_CONFIG_2X_RESOLUTION   (0x0000U)

< Count rising and falling edge

Count rising edge only

◆ EQEP_CONFIG_1X_RESOLUTION

#define EQEP_CONFIG_1X_RESOLUTION   (0x0800U)

◆ EQEP_CONFIG_NO_SWAP

#define EQEP_CONFIG_NO_SWAP   (0x0000U)

< Do not swap QEPA and QEPB

Swap QEPA and QEPB

◆ EQEP_CONFIG_SWAP

#define EQEP_CONFIG_SWAP   (0x0400U)

◆ EQEP_COMPARE_NO_SYNC_OUT

#define EQEP_COMPARE_NO_SYNC_OUT   (0x0000U)

< Disable sync output

Sync output on index pin

◆ EQEP_COMPARE_IDX_SYNC_OUT

#define EQEP_COMPARE_IDX_SYNC_OUT   (0x2000U)

Sync output on strobe pin.

◆ EQEP_COMPARE_STROBE_SYNC_OUT

#define EQEP_COMPARE_STROBE_SYNC_OUT   (0x3000U)

◆ EQEP_COMPARE_NO_SHADOW

#define EQEP_COMPARE_NO_SHADOW   (0x0000U)

< Disable shadow of QPOSCMP

Load on QPOSCNT = 0

◆ EQEP_COMPARE_LOAD_ON_ZERO

#define EQEP_COMPARE_LOAD_ON_ZERO   (0x8000U)

Load on QPOSCNT = QPOSCMP.

◆ EQEP_COMPARE_LOAD_ON_MATCH

#define EQEP_COMPARE_LOAD_ON_MATCH   (0xC000U)

◆ EQEP_INT_GLOBAL

#define EQEP_INT_GLOBAL   (0x0001U)

Global interrupt flag.

◆ EQEP_INT_POS_CNT_ERROR

#define EQEP_INT_POS_CNT_ERROR   (0x0002U)

Position counter error.

◆ EQEP_INT_PHASE_ERROR

#define EQEP_INT_PHASE_ERROR   (0x0004U)

Quadrature phase error.

◆ EQEP_INT_DIR_CHANGE

#define EQEP_INT_DIR_CHANGE   (0x0008U)

Quadrature direction change.

◆ EQEP_INT_WATCHDOG

#define EQEP_INT_WATCHDOG   (0x0010U)

Watchdog time-out.

◆ EQEP_INT_UNDERFLOW

#define EQEP_INT_UNDERFLOW   (0x0020U)

Position counter underflow.

◆ EQEP_INT_OVERFLOW

#define EQEP_INT_OVERFLOW   (0x0040U)

Position counter overflow.

◆ EQEP_INT_POS_COMP_READY

#define EQEP_INT_POS_COMP_READY   (0x0080U)

Position-compare ready.

◆ EQEP_INT_POS_COMP_MATCH

#define EQEP_INT_POS_COMP_MATCH   (0x0100U)

Position-compare match.

◆ EQEP_INT_STROBE_EVNT_LATCH

#define EQEP_INT_STROBE_EVNT_LATCH   (0x0200U)

Strobe event latch.

◆ EQEP_INT_INDEX_EVNT_LATCH

#define EQEP_INT_INDEX_EVNT_LATCH   (0x0400U)

Index event latch.

◆ EQEP_INT_UNIT_TIME_OUT

#define EQEP_INT_UNIT_TIME_OUT   (0x0800U)

Unit time-out.

◆ EQEP_INT_QMA_ERROR

#define EQEP_INT_QMA_ERROR   (0x1000U)

QMA error.

◆ EQEP_STS_UNIT_POS_EVNT

#define EQEP_STS_UNIT_POS_EVNT   (0x0080U)

Unit position event detected.

◆ EQEP_STS_DIR_ON_1ST_IDX

#define EQEP_STS_DIR_ON_1ST_IDX   (0x0040U)

Direction was clockwise on first index event.

◆ EQEP_STS_DIR_FLAG

#define EQEP_STS_DIR_FLAG   (0x0020U)

Direction is CW (forward)

◆ EQEP_STS_DIR_LATCH

#define EQEP_STS_DIR_LATCH   (0x0010U)

Direction was CW on index.

◆ EQEP_STS_CAP_OVRFLW_ERROR

#define EQEP_STS_CAP_OVRFLW_ERROR   (0x0008U)

Capture timer overflow.

◆ EQEP_STS_CAP_DIR_ERROR

#define EQEP_STS_CAP_DIR_ERROR   (0x0004U)

Direction changed between position capture events.

◆ EQEP_STS_1ST_IDX_FLAG

#define EQEP_STS_1ST_IDX_FLAG   (0x0002U)

First index pulse occurred.

◆ EQEP_STS_POS_CNT_ERROR

#define EQEP_STS_POS_CNT_ERROR   (0x0001U)

Position counter error.

◆ EQEP_LATCH_CNT_READ_BY_CPU

#define EQEP_LATCH_CNT_READ_BY_CPU   (0x0000U)

On position counter read.

◆ EQEP_LATCH_UNIT_TIME_OUT

#define EQEP_LATCH_UNIT_TIME_OUT   (0x0004U)

On unit time-out event.

◆ EQEP_LATCH_RISING_STROBE

#define EQEP_LATCH_RISING_STROBE   (0x0000U)

On rising edge of strobe.

◆ EQEP_LATCH_EDGE_DIR_STROBE

#define EQEP_LATCH_EDGE_DIR_STROBE   (0x0040U)

On rising edge when clockwise, on falling when counter clockwise.

◆ EQEP_LATCH_RISING_INDEX

#define EQEP_LATCH_RISING_INDEX   (0x0010U)

On rising edge of index.

◆ EQEP_LATCH_FALLING_INDEX

#define EQEP_LATCH_FALLING_INDEX   (0x0020U)

On falling edge of index.

◆ EQEP_LATCH_SW_INDEX_MARKER

#define EQEP_LATCH_SW_INDEX_MARKER   (0x0030U)

On software index marker.

◆ EQEP_INIT_DO_NOTHING

#define EQEP_INIT_DO_NOTHING   (0x0000U)

Action is disabled.

◆ EQEP_INIT_RISING_STROBE

#define EQEP_INIT_RISING_STROBE   (0x0800U)

On rising edge of strobe.

◆ EQEP_INIT_EDGE_DIR_STROBE

#define EQEP_INIT_EDGE_DIR_STROBE   (0x0C00U)

On rising edge when clockwise, on falling when counter clockwise.

◆ EQEP_INIT_RISING_INDEX

#define EQEP_INIT_RISING_INDEX   (0x0200U)

On rising edge of index.

◆ EQEP_INIT_FALLING_INDEX

#define EQEP_INIT_FALLING_INDEX   (0x0300U)

On falling edge of index.

Enumeration Type Documentation

◆ EQEP_PositionResetMode

Values that can be passed to EQEP_setPositionCounterConfig() as the mode parameter.

Enumerator
EQEP_POSITION_RESET_IDX 

Reset position on index pulse.

EQEP_POSITION_RESET_MAX_POS 

Reset position on maximum position.

EQEP_POSITION_RESET_1ST_IDX 

Reset position on the first index pulse.

EQEP_POSITION_RESET_UNIT_TIME_OUT 

Reset position on a unit time event.

◆ EQEP_CAPCLKPrescale

Values that can be passed to EQEP_setCaptureConfig() as the capPrescale parameter. CAPCLK is the capture timer clock frequency.

Enumerator
EQEP_CAPTURE_CLK_DIV_1 

CAPCLK = SYSCLKOUT/1.

EQEP_CAPTURE_CLK_DIV_2 

CAPCLK = SYSCLKOUT/2.

EQEP_CAPTURE_CLK_DIV_4 

CAPCLK = SYSCLKOUT/4.

EQEP_CAPTURE_CLK_DIV_8 

CAPCLK = SYSCLKOUT/8.

EQEP_CAPTURE_CLK_DIV_16 

CAPCLK = SYSCLKOUT/16.

EQEP_CAPTURE_CLK_DIV_32 

CAPCLK = SYSCLKOUT/32.

EQEP_CAPTURE_CLK_DIV_64 

CAPCLK = SYSCLKOUT/64.

EQEP_CAPTURE_CLK_DIV_128 

CAPCLK = SYSCLKOUT/128.

◆ EQEP_UPEVNTPrescale

Values that can be passed to EQEP_setCaptureConfig() as the evntPrescale parameter. UPEVNT is the unit position event frequency.

Enumerator
EQEP_UNIT_POS_EVNT_DIV_1 

UPEVNT = QCLK/1.

EQEP_UNIT_POS_EVNT_DIV_2 

UPEVNT = QCLK/2.

EQEP_UNIT_POS_EVNT_DIV_4 

UPEVNT = QCLK/4.

EQEP_UNIT_POS_EVNT_DIV_8 

UPEVNT = QCLK/8.

EQEP_UNIT_POS_EVNT_DIV_16 

UPEVNT = QCLK/16.

EQEP_UNIT_POS_EVNT_DIV_32 

UPEVNT = QCLK/32.

EQEP_UNIT_POS_EVNT_DIV_64 

UPEVNT = QCLK/64.

EQEP_UNIT_POS_EVNT_DIV_128 

UPEVNT = QCLK/128.

EQEP_UNIT_POS_EVNT_DIV_256 

UPEVNT = QCLK/256.

EQEP_UNIT_POS_EVNT_DIV_512 

UPEVNT = QCLK/512.

EQEP_UNIT_POS_EVNT_DIV_1024 

UPEVNT = QCLK/1024.

EQEP_UNIT_POS_EVNT_DIV_2048 

UPEVNT = QCLK/2048.

◆ EQEP_StrobeSource

Values that can be passed to EQEP_setStrobeSource() as the strobeSrc parameter.

Enumerator
EQEP_STROBE_FROM_GPIO 

Strobe signal comes from GPIO.

EQEP_STROBE_OR_ADCSOCA 

Strobe signal is OR'd with ADCSOCA.

EQEP_STROBE_OR_ADCSOCB 

Strobe signal is OR'd with ADCSOCB.

◆ EQEP_QMAMode

Values that can be passed to EQEP_setQMAModuleMode() as the qmaMode parameter.

Enumerator
EQEP_QMA_MODE_BYPASS 

QMA module is bypassed.

EQEP_QMA_MODE_1 

QMA mode-1 operation is selected.

EQEP_QMA_MODE_2 

QMA mode-2 operation is selected.

◆ EQEP_Source

Possible values of sources for QEPA,QEPB and Index signal which are passed as a structure to EQEP_selectSource() as sourceConfig

Enumerator
EQEP_SOURCE_ZERO 

Signal is 0.

EQEP_SOURCE_DEVICE_PIN 

Signal comes from Device Pin.

EQEP_SOURCE_PWMXBAROUT0 

Signal comes from PWM Xbar out 0.

EQEP_SOURCE_PWMXBAROUT1 

Signal comes from PWM Xbar out 1.

EQEP_SOURCE_PWMXBAROUT2 

Signal comes from PWM Xbar out 2.

EQEP_SOURCE_PWMXBAROUT3 

Signal comes from PWM Xbar out 3.

EQEP_SOURCE_PWMXBAROUT4 

Signal comes from PWM Xbar out 4.

EQEP_SOURCE_PWMXBAROUT5 

Signal comes from PWM Xbar out 5.

EQEP_SOURCE_PWMXBAROUT6 

Signal comes from PWM Xbar out 6.

EQEP_SOURCE_PWMXBAROUT7 

Signal comes from PWM Xbar out 7.

EQEP_SOURCE_PWMXBAROUT8 

Signal comes from PWM Xbar out 8.

EQEP_SOURCE_PWMXBAROUT9 

Signal comes from PWM Xbar out 9.

EQEP_SOURCE_PWMXBAROUT10 

Signal comes from PWM Xbar out 10.

EQEP_SOURCE_PWMXBAROUT11 

Signal comes from PWM Xbar out 11.

EQEP_SOURCE_PWMXBAROUT12 

Signal comes from PWM Xbar out 12.

EQEP_SOURCE_PWMXBAROUT13 

Signal comes from PWM Xbar out 13.

EQEP_SOURCE_PWMXBAROUT14 

Signal comes from PWM Xbar out 14.

EQEP_SOURCE_PWMXBAROUT15 

Signal comes from PWM Xbar out 15.

EQEP_SOURCE_PWMXBAROUT16 

Signal comes from PWM Xbar out 16.

EQEP_SOURCE_PWMXBAROUT17 

Signal comes from PWM Xbar out 17.

EQEP_SOURCE_PWMXBAROUT18 

Signal comes from PWM Xbar out 18.

EQEP_SOURCE_PWMXBAROUT19 

Signal comes from PWM Xbar out 19.

EQEP_SOURCE_PWMXBAROUT20 

Signal comes from PWM Xbar out 20.

EQEP_SOURCE_PWMXBAROUT21 

Signal comes from PWM Xbar out 21.

EQEP_SOURCE_PWMXBAROUT22 

Signal comes from PWM Xbar out 22.

EQEP_SOURCE_PWMXBAROUT23 

Signal comes from PWM Xbar out 23.

EQEP_SOURCE_PWMXBAROUT24 

Signal comes from PWM Xbar out 24.

EQEP_SOURCE_PWMXBAROUT25 

Signal comes from PWM Xbar out 25.

EQEP_SOURCE_PWMXBAROUT26 

Signal comes from PWM Xbar out 26.

EQEP_SOURCE_PWMXBAROUT27 

Signal comes from PWM Xbar out 27.

EQEP_SOURCE_PWMXBAROUT28 

Signal comes from PWM Xbar out 28.

EQEP_SOURCE_PWMXBAROUT29 

Signal comes from PWM Xbar out 29.

◆ EQEP_EmulationMode

Values that can be passed to EQEP_setEmulationMode() as the emuMode parameter.

Enumerator
EQEP_EMULATIONMODE_STOPIMMEDIATELY 

Counters stop immediately.

EQEP_EMULATIONMODE_STOPATROLLOVER 

Counters stop at period rollover.

EQEP_EMULATIONMODE_RUNFREE 

Counter unaffected by suspend.

Function Documentation

◆ EQEP_enableModule()

static void EQEP_enableModule ( uint32_t  base)
inlinestatic

Enables the eQEP module.

Parameters
baseis 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.

See also
EQEP_setConfig()
Returns
None.

◆ EQEP_disableModule()

static void EQEP_disableModule ( uint32_t  base)
inlinestatic

Disables the eQEP module.

Parameters
baseis the base address of the enhanced quadrature encoder pulse (eQEP) module

This function disables operation of the eQEP module.

Returns
None.

◆ EQEP_setDecoderConfig()

static void EQEP_setDecoderConfig ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Configures eQEP module's quadrature decoder unit.

Parameters
baseis the base address of the eQEP module.
configis 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:

  • EQEP_CONFIG_2X_RESOLUTION or EQEP_CONFIG_1X_RESOLUTION specify if both rising and falling edges should be counted or just rising edges.
  • EQEP_CONFIG_QUADRATURE, EQEP_CONFIG_CLOCK_DIR, EQEP_CONFIG_UP_COUNT, or 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.
  • EQEP_CONFIG_NO_SWAP or EQEP_CONFIG_SWAP to specify if the signals provided on QEPA and QEPB should be swapped before being processed.
Returns
None.

◆ EQEP_setPositionCounterConfig()

static void EQEP_setPositionCounterConfig ( uint32_t  base,
EQEP_PositionResetMode  mode,
uint32_t  maxPosition 
)
inlinestatic

Configures eQEP module position counter unit.

Parameters
baseis the base address of the eQEP module.
modeis the configuration for the eQEP module position counter.
maxPositionspecifies 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.

Returns
None.

◆ EQEP_getPosition()

static uint32_t EQEP_getPosition ( uint32_t  base)
inlinestatic

Gets the current encoder position.

Parameters
baseis 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).

Returns
The current position of the encoder.

◆ EQEP_setPosition()

static void EQEP_setPosition ( uint32_t  base,
uint32_t  position 
)
inlinestatic

Sets the current encoder position.

Parameters
baseis the base address of the eQEP module.
positionis 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.

Returns
None.

◆ EQEP_getDirection()

static int16_t EQEP_getDirection ( uint32_t  base)
inlinestatic

Gets the current direction of rotation.

Parameters
baseis 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.

Returns
Returns 1 if moving in the forward direction or -1 if moving in the reverse direction.

◆ EQEP_enableInterrupt()

static void EQEP_enableInterrupt ( uint32_t  base,
uint16_t  intFlags 
)
inlinestatic

Enables individual eQEP module interrupt sources.

Parameters
baseis the base address of the eQEP module.
intFlagsis 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:

  • EQEP_INT_POS_CNT_ERROR - Position counter error
  • EQEP_INT_PHASE_ERROR - Quadrature phase error
  • EQEP_INT_DIR_CHANGE - Quadrature direction change
  • EQEP_INT_WATCHDOG - Watchdog time-out
  • EQEP_INT_UNDERFLOW - Position counter underflow
  • EQEP_INT_OVERFLOW - Position counter overflow
  • EQEP_INT_POS_COMP_READY - Position-compare ready
  • EQEP_INT_POS_COMP_MATCH - Position-compare match
  • EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch
  • EQEP_INT_INDEX_EVNT_LATCH - Index event latch
  • EQEP_INT_UNIT_TIME_OUT - Unit time-out
Returns
None.

◆ EQEP_disableInterrupt()

static void EQEP_disableInterrupt ( uint32_t  base,
uint16_t  intFlags 
)
inlinestatic

Disables individual eQEP module interrupt sources.

Parameters
baseis the base address of the eQEP module.
intFlagsis 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:

  • EQEP_INT_POS_CNT_ERROR - Position counter error
  • EQEP_INT_PHASE_ERROR - Quadrature phase error
  • EQEP_INT_DIR_CHANGE - Quadrature direction change
  • EQEP_INT_WATCHDOG - Watchdog time-out
  • EQEP_INT_UNDERFLOW - Position counter underflow
  • EQEP_INT_OVERFLOW - Position counter overflow
  • EQEP_INT_POS_COMP_READY - Position-compare ready
  • EQEP_INT_POS_COMP_MATCH - Position-compare match
  • EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch
  • EQEP_INT_INDEX_EVNT_LATCH - Index event latch
  • EQEP_INT_UNIT_TIME_OUT - Unit time-out
Returns
None.

◆ EQEP_getInterruptStatus()

static uint16_t EQEP_getInterruptStatus ( uint32_t  base)
inlinestatic

Gets the current interrupt status.

Parameters
baseis the base address of the eQEP module.

This function returns the interrupt status for the eQEP module module.

Returns
Returns the current interrupt status, enumerated as a bit field of the following values:
  • EQEP_INT_GLOBAL - Global interrupt flag
  • EQEP_INT_POS_CNT_ERROR - Position counter error
  • EQEP_INT_PHASE_ERROR - Quadrature phase error
  • EQEP_INT_DIR_CHANGE - Quadrature direction change
  • EQEP_INT_WATCHDOG - Watchdog time-out
  • EQEP_INT_UNDERFLOW - Position counter underflow
  • EQEP_INT_OVERFLOW - Position counter overflow
  • EQEP_INT_POS_COMP_READY - Position-compare ready
  • EQEP_INT_POS_COMP_MATCH - Position-compare match
  • EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch
  • EQEP_INT_INDEX_EVNT_LATCH - Index event latch
  • EQEP_INT_UNIT_TIME_OUT - Unit time-out

◆ EQEP_clearInterruptStatus()

static void EQEP_clearInterruptStatus ( uint32_t  base,
uint16_t  intFlags 
)
inlinestatic

Clears eQEP module interrupt sources.

Parameters
baseis the base address of the eQEP module.
intFlagsis 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:

  • EQEP_INT_GLOBAL - Global interrupt flag
  • EQEP_INT_POS_CNT_ERROR - Position counter error
  • EQEP_INT_PHASE_ERROR - Quadrature phase error
  • EQEP_INT_DIR_CHANGE - Quadrature direction change
  • EQEP_INT_WATCHDOG - Watchdog time-out
  • EQEP_INT_UNDERFLOW - Position counter underflow
  • EQEP_INT_OVERFLOW - Position counter overflow
  • EQEP_INT_POS_COMP_READY - Position-compare ready
  • EQEP_INT_POS_COMP_MATCH - Position-compare match
  • EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch
  • EQEP_INT_INDEX_EVNT_LATCH - Index event latch
  • EQEP_INT_UNIT_TIME_OUT - Unit time-out

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.

Returns
None.

◆ EQEP_forceInterrupt()

static void EQEP_forceInterrupt ( uint32_t  base,
uint16_t  intFlags 
)
inlinestatic

Forces individual eQEP module interrupts.

Parameters
baseis the base address of the eQEP module.
intFlagsis 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:

  • EQEP_INT_POS_CNT_ERROR
  • EQEP_INT_PHASE_ERROR
  • EQEP_INT_DIR_CHANGE
  • EQEP_INT_WATCHDOG
  • EQEP_INT_UNDERFLOW
  • EQEP_INT_OVERFLOW
  • EQEP_INT_POS_COMP_READY
  • EQEP_INT_POS_COMP_MATCH
  • EQEP_INT_STROBE_EVNT_LATCH
  • EQEP_INT_INDEX_EVNT_LATCH
  • EQEP_INT_UNIT_TIME_OUT
Returns
None.

◆ EQEP_getError()

static bool EQEP_getError ( uint32_t  base)
inlinestatic

Gets the encoder error indicator.

Parameters
baseis 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.

Returns
Returns true if an error has occurred and false otherwise.

◆ EQEP_getStatus()

static uint16_t EQEP_getStatus ( uint32_t  base)
inlinestatic

Returns content of the eQEP module status register

Parameters
baseis 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:

  • EQEP_STS_UNIT_POS_EVNT - Unit position event detected
  • EQEP_STS_DIR_ON_1ST_IDX - If set, clockwise rotation (forward movement) occurred on the first index event
  • EQEP_STS_DIR_FLAG - If set, movement is clockwise rotation
  • EQEP_STS_DIR_LATCH - If set, clockwise rotation occurred on last index event marker
  • EQEP_STS_CAP_OVRFLW_ERROR - Overflow occurred in eQEP capture timer
  • EQEP_STS_CAP_DIR_ERROR - Direction change occurred between position capture events
  • EQEP_STS_1ST_IDX_FLAG - Set by the occurrence of the first index pulse
  • EQEP_STS_POS_CNT_ERROR - Position counter error occurred
Returns
Returns the value of the QEP status register.

◆ EQEP_clearStatus()

static void EQEP_clearStatus ( uint32_t  base,
uint16_t  statusFlags 
)
inlinestatic

Clears selected fields of the eQEP module status register

Parameters
baseis the base address of the eQEP module.
statusFlagsis 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:

  • EQEP_STS_UNIT_POS_EVNT - Unit position event detected
  • EQEP_STS_CAP_OVRFLW_ERROR - Overflow occurred in eQEP capture timer
  • EQEP_STS_CAP_DIR_ERROR - Direction change occurred between position capture events
  • EQEP_STS_1ST_IDX_FLAG - Set by the occurrence of the first index pulse
Note
Only the above status fields can be cleared. All others are read-only, non-sticky fields.
Returns
None.

◆ EQEP_setCaptureConfig()

static void EQEP_setCaptureConfig ( uint32_t  base,
EQEP_CAPCLKPrescale  capPrescale,
EQEP_UPEVNTPrescale  evntPrescale 
)
inlinestatic

Configures eQEP module edge-capture unit.

Parameters
baseis the base address of the eQEP module.
capPrescaleis the prescaler setting of the eQEP capture timer clk.
evntPrescaleis 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.

Returns
None.

◆ EQEP_enableCapture()

static void EQEP_enableCapture ( uint32_t  base)
inlinestatic

Enables the eQEP module edge-capture unit.

Parameters
baseis the base address of the eQEP module.

This function enables operation of the eQEP module's edge-capture unit.

Returns
None.

◆ EQEP_disableCapture()

static void EQEP_disableCapture ( uint32_t  base)
inlinestatic

Disables the eQEP module edge-capture unit.

Parameters
baseis the base address of the eQEP module.

This function disables operation of the eQEP module's edge-capture unit.

Returns
None.

◆ EQEP_getCapturePeriod()

static uint16_t EQEP_getCapturePeriod ( uint32_t  base)
inlinestatic

Gets the encoder capture period.

Parameters
baseis the base address of the eQEP module.

This function returns the period count value between the last successive eQEP position events.

Returns
The period count value between the last successive position events.

◆ EQEP_getCaptureTimer()

static uint16_t EQEP_getCaptureTimer ( uint32_t  base)
inlinestatic

Gets the encoder capture timer value.

Parameters
baseis the base address of the eQEP module.

This function returns the time base for the edge capture unit.

Returns
The capture timer value.

◆ EQEP_enableCompare()

static void EQEP_enableCompare ( uint32_t  base)
inlinestatic

Enables the eQEP module position-compare unit.

Parameters
baseis the base address of the eQEP module.

This function enables operation of the eQEP module's position-compare unit.

Returns
None.

◆ EQEP_disableCompare()

static void EQEP_disableCompare ( uint32_t  base)
inlinestatic

Disables the eQEP module position-compare unit.

Parameters
baseis the base address of the eQEP module.

This function disables operation of the eQEP module's position-compare unit.

Returns
None.

◆ EQEP_setComparePulseWidth()

static void EQEP_setComparePulseWidth ( uint32_t  base,
uint16_t  cycles 
)
inlinestatic

Configures the position-compare unit's sync output pulse width.

Parameters
baseis the base address of the eQEP module.
cyclesis 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.

Returns
None.

◆ EQEP_loadUnitTimer()

static void EQEP_loadUnitTimer ( uint32_t  base,
uint32_t  period 
)
inlinestatic

Loads the eQEP module unit timer period as number of SYSCLK cycles.

Parameters
baseis the base address of the eQEP module.
periodis period value at which a unit time-out interrupt is set.

This function sets the unit time-out interrupt when it matches the value specified by period The unit timer is clocked by SYSCLKOUT

Returns
None.

◆ EQEP_enableUnitTimer()

static void EQEP_enableUnitTimer ( uint32_t  base,
uint32_t  period 
)
inlinestatic

Enables the eQEP module unit timer.

Parameters
baseis the base address of the eQEP module.
periodis 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.

Returns
None.

◆ EQEP_disableUnitTimer()

static void EQEP_disableUnitTimer ( uint32_t  base)
inlinestatic

Disables the eQEP module unit timer.

Parameters
baseis the base address of the eQEP module.

This function disables operation of the eQEP module's peripheral unit timer.

Returns
None.

◆ EQEP_enableWatchdog()

static void EQEP_enableWatchdog ( uint32_t  base,
uint16_t  period 
)
inlinestatic

Enables the eQEP module watchdog timer.

Parameters
baseis the base address of the eQEP module.
periodis 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.

Note
When selecting period, note that the watchdog timer is clocked from SYSCLKOUT/64.
Returns
None.

◆ EQEP_disableWatchdog()

static void EQEP_disableWatchdog ( uint32_t  base)
inlinestatic

Disables the eQEP module watchdog timer.

Parameters
baseis the base address of the eQEP module.

This function disables operation of the eQEP module's peripheral watchdog timer.

Returns
None.

◆ EQEP_setWatchdogTimerValue()

static void EQEP_setWatchdogTimerValue ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the eQEP module watchdog timer value.

Parameters
baseis the base address of the eQEP module.
valueis the value to be written to the watchdog timer.

This function sets the eQEP module's watchdog timer value.

Returns
None.

◆ EQEP_getWatchdogTimerValue()

static uint16_t EQEP_getWatchdogTimerValue ( uint32_t  base)
inlinestatic

Gets the eQEP module watchdog timer value.

Parameters
baseis the base address of the eQEP module.
Returns
Returns the current watchdog timer value.

◆ EQEP_setPositionInitMode()

static void EQEP_setPositionInitMode ( uint32_t  base,
uint16_t  initMode 
)
inlinestatic

Configures the mode in which the position counter is initialized.

Parameters
baseis the base address of the eQEP module.
initModeis 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.

  • EQEP_INIT_RISING_STROBE or EQEP_INIT_EDGE_DIR_STROBE specify which strobe event will initialize the position counter.
  • EQEP_INIT_RISING_INDEX or EQEP_INIT_FALLING_INDEX specify which index event will initialize the position counter.

Use EQEP_setSWPositionInit() to cause a software initialization and EQEP_setInitialPosition() to set the value that gets loaded into the position counter upon initialization.

Returns
None.

◆ EQEP_setSWPositionInit()

static void EQEP_setSWPositionInit ( uint32_t  base,
bool  initialize 
)
inlinestatic

Sets the software initialization of the encoder position counter.

Parameters
baseis the base address of the eQEP module.
initializeis 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().

Returns
None.

◆ EQEP_setInitialPosition()

static void EQEP_setInitialPosition ( uint32_t  base,
uint32_t  position 
)
inlinestatic

Sets the init value for the encoder position counter.

Parameters
baseis the base address of the eQEP module.
positionis 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.

Returns
None.

◆ EQEP_setLatchMode()

static void EQEP_setLatchMode ( uint32_t  base,
uint32_t  latchMode 
)
inlinestatic

Configures the quadrature modes in which the position count can be latched.

Parameters
baseis the base address of the eQEP module.
latchModeis 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.

  • EQEP_LATCH_CNT_READ_BY_CPU or EQEP_LATCH_UNIT_TIME_OUT specify the event that latches the position counter. This latch register can be read using EQEP_getPositionLatch(). The capture timer and capture period are also latched based on this setting, and can be read using EQEP_getCaptureTimerLatch() and EQEP_getCapturePeriodLatch().
  • EQEP_LATCH_RISING_STROBE or EQEP_LATCH_EDGE_DIR_STROBE specify which strobe event will latch the position counter into the strobe position latch register. This register can be read with EQEP_getStrobePositionLatch().
  • EQEP_LATCH_RISING_INDEX, EQEP_LATCH_FALLING_INDEX, or EQEP_LATCH_SW_INDEX_MARKER specify which index event will latch the position counter into the index position latch register. This register can be read with EQEP_getIndexPositionLatch().
Returns
None.

◆ EQEP_getIndexPositionLatch()

static uint32_t EQEP_getIndexPositionLatch ( uint32_t  base)
inlinestatic

Gets the encoder position that was latched on an index event.

Parameters
baseis 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().

Returns
The position count latched on an index event.

◆ EQEP_getStrobePositionLatch()

static uint32_t EQEP_getStrobePositionLatch ( uint32_t  base)
inlinestatic

Gets the encoder position that was latched on a strobe event.

Parameters
baseis 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().

Returns
The position count latched on a strobe event.

◆ EQEP_getPositionLatch()

static uint32_t EQEP_getPositionLatch ( uint32_t  base)
inlinestatic

Gets the encoder position that was latched on a unit time-out event.

Parameters
baseis 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.

Returns
The position count latch register value.

◆ EQEP_getCaptureTimerLatch()

static uint16_t EQEP_getCaptureTimerLatch ( uint32_t  base)
inlinestatic

Gets the encoder capture timer latch.

Parameters
baseis 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().

Returns
The edge-capture timer latch value.

◆ EQEP_getCapturePeriodLatch()

static uint16_t EQEP_getCapturePeriodLatch ( uint32_t  base)
inlinestatic

Gets the encoder capture period latch.

Parameters
baseis 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().

Returns
The edge-capture period latch value.

◆ EQEP_setQMAModuleMode()

static void EQEP_setQMAModuleMode ( uint32_t  base,
EQEP_QMAMode  qmaMode 
)
inlinestatic

Set the quadrature mode adapter (QMA) module mode

Parameters
baseis the base address of the eQEP module.
qmaModeis 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_setConfig().

Returns
None.

◆ EQEP_setStrobeSource()

static void EQEP_setStrobeSource ( uint32_t  base,
EQEP_StrobeSource  strobeSrc 
)
inlinestatic

Set the strobe input source of the eQEP module.

Parameters
baseis the base address of the eQEP module.
strobeSrcis 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

  • EQEP_STROBE_FROM_GPIO - The strobe is used as-is after passing through the polarity select logic.
  • EQEP_STROBE_OR_ADCSOCA - The strobe is OR'd with the ADCSOCA signal after passing through the polarity select logic.
  • EQEP_STROBE_OR_ADCSOCB - The strobe is OR'd with the ADCSOCB signal after passing through the polarity select logic.
Returns
None.

◆ EQEP_enableDirectionChangeDuringIndex()

static void EQEP_enableDirectionChangeDuringIndex ( uint32_t  base)
inlinestatic

Enables the index direction enhancement mode of the eQEP module

Parameters
baseis the base address of the eQEP module.

This function enables the enhancement mode for direction change during Index event

Returns
None.

◆ EQEP_disableDirectionChangeDuringIndex()

static void EQEP_disableDirectionChangeDuringIndex ( uint32_t  base)
inlinestatic

Disables the index direction enhancement mode of the eQEP module

Parameters
baseis the base address of the eQEP module.

This function disables the enhancement mode for direction change during Index event

Returns
None.

◆ EQEP_selectSource()

static void EQEP_selectSource ( uint32_t  base,
EQEP_SourceSelect  sourceConfig 
)
inlinestatic

Selects the source for eQEPA/B/I signals

Parameters
baseis the base address of the enhanced quadrature encoder pulse (eQEP) module
sourceConfigis the structure that contains source configuration

This function configures the sources for QEPA,QEPB and Index of eQEP module

Returns
None.

◆ EQEP_setEmulationMode()

static void EQEP_setEmulationMode ( uint32_t  base,
EQEP_EmulationMode  emuMode 
)
inlinestatic

Set the emulation mode of the eQEP module.

Parameters
baseis the base address of the eQEP module.
emuModeis 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:

  • EQEP_EMULATIONMODE_STOPIMMEDIATELY - The position counter, watchdog counter, unit timer, and capture timer all stop immediately.
  • 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.
  • EQEP_EMULATIONMODE_RUNFREE - The position counter, watchdog counter, unit timer, and capture timer are all unaffected by an emulation suspend.
Returns
None.

◆ EQEP_setCompareConfig()

void EQEP_setCompareConfig ( uint32_t  base,
uint16_t  config,
uint32_t  compareValue,
uint16_t  cycles 
)

Configures eQEP module position-compare unit.

Parameters
baseis the base address of the eQEP module.
configis the configuration for the eQEP module position-compare unit. See below for a description of this parameter.
compareValueis the value to which the position count value is compared for a position-compare event.
cyclesis 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:

  • EQEP_COMPARE_NO_SYNC_OUT, EQEP_COMPARE_IDX_SYNC_OUT, or EQEP_COMPARE_STROBE_SYNC_OUT specify if there is a sync output pulse and which pin should be used.
  • EQEP_COMPARE_NO_SHADOW, EQEP_COMPARE_LOAD_ON_ZERO, or 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.

Note
You can set the sync pulse width independently using the EQEP_setComparePulseWidth() function.
Returns
None.

◆ EQEP_setInputPolarity()

void EQEP_setInputPolarity ( uint32_t  base,
bool  invertQEPA,
bool  invertQEPB,
bool  invertIndex,
bool  invertStrobe 
)

Sets the polarity of the eQEP module's input signals.

Parameters
baseis the base address of the eQEP module.
invertQEPAis the flag to negate the QEPA input.
invertQEPBis the flag to negate the QEPA input.
invertIndexis the flag to negate the index input.
invertStrobeis 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.

Returns
None.