AM263Px MCU+ SDK  10.01.00
eqep/v1/eqep.h File Reference

Go to the source code of this file.

Data Structures

struct  EQEP_SourceSelect
 

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

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 }
 
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 }
 

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)