26 #define OPENEL_SW_SURFACE_FRIEND (1) 42 printf(
"HalSetPosition()\n");
46 printf(
"this=%x\n",
this);
51 uint32_t physicalPortID;
75 uint32_t physicalPortID;
102 int32_t elMotorSetCtlMode(uint32_t portID,uint32_t mode);
111 uint32_t elMotorGetCtlMode(uint32_t portID);
124 int32_t elMotorSetBrake_I32(uint32_t portID,uint32_t ctlAftBrk,int32_t tmDec) {
128 uint32_t physicalPortID;
136 int32_t elMotorSetBrake_F64(uint32_t portID,uint32_t ctlAftBrk,
double tmDec) {
140 uint32_t physicalPortID;
145 int32_t tmDecI32 = (int32_t)( tmDec/1000.0 );
159 int32_t elMotorSetPosition_I32(uint32_t portID,int32_t position,int32_t speed,int32_t tmAcc) {
163 uint32_t physicalPortID;
181 int32_t elMotorSetPosition_F64(uint32_t portID,
double position,
double speed,
double tmAcc) {
182 int32_t posI32,speedI32,tmAccI32;
188 uint32_t physicalPortID;
195 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
197 posI32 = (int32_t)( kMov * position );
198 speedI32 = (int32_t)( kMov * speed );
199 tmAccI32 = (int32_t)( 1000.0 * tmAcc );
201 return pMotorFbl->
pFncSetPosition(physicalPortID,posI32,speedI32,tmAccI32);
214 int32_t elMotorSetSpeed_I32(uint32_t portID,int32_t speed,int32_t tmAcc) {
218 uint32_t physicalPortID;
235 int32_t elMotorSetSpeed_F64(uint32_t portID,
double speed,
double tmAcc) {
236 int32_t speedI32,tmAccI32;
242 uint32_t physicalPortID;
249 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
251 speedI32 = (int32_t)( kMov * speed );
252 tmAccI32 = (int32_t)( 1000.0 * tmAcc );
254 return pMotorFbl->pFncSetSpeed(physicalPortID,speedI32,tmAccI32);
315 int32_t elMotorGetPosition_I32(uint32_t portID,uint32_t idx,int32_t *pOutPos) {
319 uint32_t physicalPortID;
335 int32_t elMotorGetPosition_F64(uint32_t portID,uint32_t idx,
double *pOutPosition) {
343 uint32_t physicalPortID;
350 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
352 *pOutPosition = (double)posI32/kMov;
364 int32_t elMotorGetSpeed_I32(uint32_t portID,int32_t idx,int32_t *pOutSpeed) {
368 uint32_t physicalPortID;
384 int32_t elMotorGetSpeed_F64(uint32_t portID,int32_t idx,
double *pOutSpeed) {
392 uint32_t physicalPortID;
399 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
400 retVal = pMotorFbl->pFncGetSpeed(physicalPortID,idx,&speedI32);
401 *pOutSpeed = (double)speedI32/kMov;
410 int32_t elMotorGoHome_I32(uint32_t portID,uint32_t idx,int32_t speed) {
411 uint32_t physicalPortID;
424 int32_t elMotorGoHome_F64(uint32_t portID,uint32_t idx,
double speed) {
428 uint32_t physicalPortID;
434 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
436 speedI32 = (int32_t)( kMov * speed );
447 int32_t elMotorSetCallBack_I32(uint32_t portID,uint32_t idx,ELMOTOR_P_FNC_CALLBACK pFncCB,int32_t val) {
451 uint32_t physicalPortID;
465 int32_t elMotorSetCallBack_F64(uint32_t portID,uint32_t idx,ELMOTOR_P_FNC_CALLBACK pFncCB,
double val) {
472 uint32_t physicalPortID;
478 pMotorFbl->pFncGetParam(physicalPortID,ELMOTOR_PRM_K_MOVE, &kMov,
sizeof(kMov) );
479 valI32 = (int32_t)( kMov*val );
480 return pMotorFbl->pFncSetCallBack(physicalPortID,idx,pFncCB,valI32);
494 int32_t elMotorSetParam_U16(uint32_t portID,uint32_t prmID,uint16_t val) {
498 uint32_t physicalPortID;
505 int32_t elMotorSetParam_I16(uint32_t portID,uint32_t prmID,int16_t val) {
509 uint32_t physicalPortID;
516 int32_t elMotorSetParam_U32(uint32_t portID,uint32_t prmID,uint32_t val) {
520 uint32_t physicalPortID;
527 int32_t elMotorSetParam_I32(uint32_t portID,uint32_t prmID,uint32_t val) {
531 uint32_t physicalPortID;
538 int32_t elMotorSetParam_F32(uint32_t portID,uint32_t prmID,
float val) {
542 uint32_t physicalPortID;
549 int32_t elMotorSetParam_F64(uint32_t portID,uint32_t prmID,
double val) {
553 uint32_t physicalPortID;
567 int32_t elMotorGetParam_U16(uint32_t portID,uint32_t prmID,uint16_t *pOutVal) {
571 uint32_t physicalPortID;
576 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
578 int32_t elMotorGetParam_I16(uint32_t portID,uint32_t prmID,int16_t *pOutVal) {
582 uint32_t physicalPortID;
587 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
589 int32_t elMotorGetParam_U32(uint32_t portID,uint32_t prmID,uint32_t *pOutVal) {
593 uint32_t physicalPortID;
598 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
600 int32_t elMotorGetParam_I32(uint32_t portID,uint32_t prmID,int32_t *pOutVal) {
604 uint32_t physicalPortID;
609 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
611 int32_t elMotorGetParam_F32(uint32_t portID,uint32_t prmID,
float *pOutVal) {
615 uint32_t physicalPortID;
620 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
622 int32_t elMotorGetParam_F64(uint32_t portID,uint32_t prmID,
double *pOutVal) {
626 uint32_t physicalPortID;
631 return elPortTbl[portID].
fncTbl.
pMotor->pFncGetParam(physicalPortID,prmID,pOutVal,
sizeof(*pOutVal) );
struct elPort_st elPortTbl[EL_PORT_ID_MAX]
struct elMotorFncTblSt * pMotor
OpenEL Common Header File 3.0.0.
HALCOMPONENT_CORE_T halComponent_core
enum ReturnCode HalGetPosition(HALCOMPONENT_T *halComponent, halfloat *position)
int32_t elGetPhyicalPortID(uint32_t portID, uint32_t PropertyID)
enum ReturnCode HalSetPosition(HALCOMPONENT_T *halComponent, halfloat position)
enum ReturnCode(* pFncGetPosition)(HALCOMPONENT_T **halComponent, halfloat **position)
enum ReturnCode(* pFncSetPosition)(HALCOMPONENT_T **halComponent, halfloat position)