#ifndef __ELCTR_H #define __ELCTR_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../defines.h" #ifndef __ELTEL_H #define IF_SERIAL 1 #define IF_PARALLEL 2 #define IF_PARALLELSUBRAW 0 #define IF_PARALLELSUBSMC 1 #endif #define IF_INPUTSERIAL 1 #define IF_INPUTPARALLEL 2 #define IF_INPUTJOYSTICK 3 typedef struct elctrvalues { int run; int connection; int motorrun; int motorspeed; int loopbusy; unsigned char event; int iftype; int inputiftype; int keypad; double timerintct_goto; double timerintct_correction; double az_gotospeed; double alt_gotospeed; double fr_gotospeed; double az_correctionspeed; double alt_correctionspeed; double fr_correctionspeed; double lastazhs; double lastalths; double lastfrhs; int fruse; int azleft; int altdown; int frleft; int debug; double hs_az360; double hs_az270; double hs_az180; double hs_az90; double hs_altlb; double hs_altub; double hs_alt180; double hs_alt90; double hs_fr360; double ms_perhsfr360; pid_t pid; uid_t uid; } elctrvalues; extern elctrvalues elctr; /*----- elctrif.c ------------*/ extern void ctrif_waitmicrosecs( long ms ); extern void ctrif_waitmillisecs( long ms ); extern int ctrif_StartConnection( void ); extern int ctrif_StopConnection( void ); extern int ctrif_StopMotors( void ); extern double ctrif_GetCurrentAzHS( void ); extern double ctrif_GetCurrentAltHS(void ); extern double ctrif_GetCurrentFrHS(void ); extern int ctrif_GoLeft_Fast( void ); extern int ctrif_GoUp_Fast( void ); extern int ctrif_GoDown_Fast(void ); extern int ctrif_GoRight_Fast( void ); extern int ctrif_GoLeft_Slow( void ); extern int ctrif_GoUp_Slow( void ); extern int ctrif_GoDown_Slow( void ); extern int ctrif_GoRight_Slow( void ); extern int ctrif_FrTurnRight(void ); extern int ctrif_FrTurnLeft( void ); extern int ctrif_Move( int speed,int az, int azdir,int alt, int altdir,int fr, int frdir ); extern int ctrif_AltAzGoto( double azhs, double alths); extern int ctrif_AltAzOrigin( double azhs, double alths ); extern unsigned char ctrif_Get4InputSignals(void); extern int ctrif_Step( int answer, int az, int azleft, int alt, int altdown, int fr, int frleft, double * azhs, double * alths, long ms ); /*----- config.c -------------*/ extern int ctrparsecommandline(int argc, char * argv[]); extern int ctrreadconfigfile( char *filename ); /*----- elctr.c --------------*/ extern void ctrendall( void ); extern int ctrstartall( int threaded ); /*----- loop.c ---------------*/ extern void ctrWaitTillLoopFree(void); extern void ctrDoLoopEvent( unsigned char event ); typedef void (* ELCTRKEYPADCALLBACK )( void ); /*sets callback, for event keypad - key follow*/ extern void ctrSetCB_kp_follow( ELCTRKEYPADCALLBACK cb ); /*sets callback, for event keypad - key high, and follow togheter*/ extern void ctrSetCB_kp_high_follow( ELCTRKEYPADCALLBACK cb ); /*sets callback, for a every-time-action function, wich is called, if no event present*/ extern void ctrSetCB_noevent( ELCTRKEYPADCALLBACK cb ); #endif