AM243x Motor Control SDK  09.02.00

Introduction

Here is the list of encoder function APIs

Files

file  encoder.h
 Contains interface to encoder object.
 

Data Structures

struct  ENC_Handle
 Defines the ENC controller object. More...
 

Functions

ENC_Handle ENC_init (void *pMemory, const size_t numBytes)
 Initializes the ENC controller. More...
 
void ENC_setParams (ENC_Handle handle, const USER_Params *pUserParams)
 Set the controller parameters. More...
 
static void ENC_setHallGPIO (ENC_Handle handle, const uint32_t gpioHallU, const uint32_t gpioHallV, const uint32_t gpioHallW, const uint32_t gpioHallUBase, const uint32_t gpioHallVBase, const uint32_t gpioHallWBase)
 Set the hall pins and address (only needed for calibration mode) More...
 
static float32_t ENC_getSpeedElec_Hz (ENC_Handle handle)
 Runs the ENC controller. More...
 
static float32_t ENC_getElecAngle (ENC_Handle handle)
 Gets the angle from encoder. More...
 
static float32_t ENC_getState (ENC_Handle handle)
 Gets the state of the ENC controller. More...
 
static void ENC_resetState (ENC_Handle handle)
 Reset the ENC controller state. More...
 
static void ENC_setState (ENC_Handle handle, const ENC_Status_e encState)
 Sets up the ENC controller state. More...
 
static void ENC_setGPIOHallU (ENC_Handle handle, const uint32_t gpioHallU, const uint32_t gpioHallUBase)
 Set the ENC controller parameter Hall U (only needed for calibration mode) More...
 
static void ENC_setGPIOHallV (ENC_Handle handle, const uint32_t gpioHallV, const uint32_t gpioHallVBase)
 Set the ENC controller parameter Hall V (only needed for calibration mode) More...
 
static void ENC_setGPIOHallW (ENC_Handle handle, const uint32_t gpioHallW, const uint32_t gpioHallWBase)
 Set the ENC controller parameter Hall W (only needed for calibration mode) More...
 
static void ENC_setQEPHandle (ENC_Handle handle, const uint32_t qepBase)
 Set the ENC controller eqep handle. More...
 
static uint16_t ENC_getHallState (ENC_Handle handle)
 Get the hall state. More...
 
static void ENC_run (ENC_Handle handle)
 Runs the ENC controller. More...
 
static void ENC_runHall (ENC_Handle handle)
 Runs the hall of ENC controller. More...
 

Enumerations

enum  ENC_Status_e { ENC_IDLE = 0, ENC_ALIGNMENT = 1, ENC_WAIT_FOR_INDEX = 2, ENC_CALIBRATION_DONE = 3 }
 

Macros

#define ENC_inline_run   ENC_run
 
#define ENC_full_run   ENC_runHall
 

Macro Definition Documentation

◆ ENC_inline_run

#define ENC_inline_run   ENC_run

◆ ENC_full_run

#define ENC_full_run   ENC_runHall

Enumeration Type Documentation

◆ ENC_Status_e

Enumerator
ENC_IDLE 
ENC_ALIGNMENT 
ENC_WAIT_FOR_INDEX 
ENC_CALIBRATION_DONE 

Function Documentation

◆ ENC_init()

ENC_Handle ENC_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the ENC controller.

Parameters
[in]pMemoryA pointer to the memory for the ENC controller object
[in]numBytesThe number of bytes allocated for the ENC controller object, bytes
Returns
The ENC controller (ENC) object handle

◆ ENC_setParams()

void ENC_setParams ( ENC_Handle  handle,
const USER_Params pUserParams 
)

Set the controller parameters.

Parameters
[in]handleThe ENC controller handle
[in]pUserParamsThe pointer to User_Params object

◆ ENC_setHallGPIO()

static void ENC_setHallGPIO ( ENC_Handle  handle,
const uint32_t  gpioHallU,
const uint32_t  gpioHallV,
const uint32_t  gpioHallW,
const uint32_t  gpioHallUBase,
const uint32_t  gpioHallVBase,
const uint32_t  gpioHallWBase 
)
inlinestatic

Set the hall pins and address (only needed for calibration mode)

Parameters
[in]handlethe ENC Handle
[in]gpioHallUGPIO pin for Hall U
[in]gpioHallVGPIO pin for Hall V
[in]gpioHallWGPIO pin for Hall W
[in]gpioHallUBasethe GPIO base address for Hall U
[in]gpioHallVBasethe GPIO base address for Hall V
[in]gpioHallWBasethe GPIO base address for Hall W

◆ ENC_getSpeedElec_Hz()

static float32_t ENC_getSpeedElec_Hz ( ENC_Handle  handle)
inlinestatic

Runs the ENC controller.

Parameters
[in]handleThe ENC controller handle
Returns
speed from encoder

◆ ENC_getElecAngle()

static float32_t ENC_getElecAngle ( ENC_Handle  handle)
inlinestatic

Gets the angle from encoder.

Parameters
[in]handleThe ENC controller handle
Returns
angle from encoder

◆ ENC_getState()

static float32_t ENC_getState ( ENC_Handle  handle)
inlinestatic

Gets the state of the ENC controller.

Parameters
[in]handlethe ENC Handle
Returns
state from encode

◆ ENC_resetState()

static void ENC_resetState ( ENC_Handle  handle)
inlinestatic

Reset the ENC controller state.

Parameters
[in]handlethe ENC Handle

◆ ENC_setState()

static void ENC_setState ( ENC_Handle  handle,
const ENC_Status_e  encState 
)
inlinestatic

Sets up the ENC controller state.

Parameters
[in]handlethe ENC Handle
[in]encStatethe enum state of ENC controller

◆ ENC_setGPIOHallU()

static void ENC_setGPIOHallU ( ENC_Handle  handle,
const uint32_t  gpioHallU,
const uint32_t  gpioHallUBase 
)
inlinestatic

Set the ENC controller parameter Hall U (only needed for calibration mode)

Parameters
[in]handlethe ENC Handle
[in]gpioHallUGPIO pin for Hall U
[in]gpioHallUBasethe GPIO base address for Hall U

◆ ENC_setGPIOHallV()

static void ENC_setGPIOHallV ( ENC_Handle  handle,
const uint32_t  gpioHallV,
const uint32_t  gpioHallVBase 
)
inlinestatic

Set the ENC controller parameter Hall V (only needed for calibration mode)

Parameters
[in]handlethe ENC Handle
[in]gpioHallVGPIO pin for Hall V
[in]gpioHallVBasethe GPIO base address for Hall V

◆ ENC_setGPIOHallW()

static void ENC_setGPIOHallW ( ENC_Handle  handle,
const uint32_t  gpioHallW,
const uint32_t  gpioHallWBase 
)
inlinestatic

Set the ENC controller parameter Hall W (only needed for calibration mode)

Parameters
[in]handlethe ENC Handle
[in]gpioHallWGPIO pin for Hall W
[in]gpioHallWBasethe GPIO base address for Hall W

◆ ENC_setQEPHandle()

static void ENC_setQEPHandle ( ENC_Handle  handle,
const uint32_t  qepBase 
)
inlinestatic

Set the ENC controller eqep handle.

Parameters
[in]handlethe ENC Handle
[in]qepBasethe QEP handle

◆ ENC_getHallState()

static uint16_t ENC_getHallState ( ENC_Handle  handle)
inlinestatic

Get the hall state.

Parameters
[in]handlethe ENC Handle

◆ ENC_run()

static void ENC_run ( ENC_Handle  handle)
static

Runs the ENC controller.

Parameters
[in]handlethe ENC Handle

◆ ENC_runHall()

static void ENC_runHall ( ENC_Handle  handle)
static

Runs the hall of ENC controller.

Parameters
[in]handleThe ENC controller handle