22 cout <<
"\n*************************************************************\n";
23 cout <<
"Example GInterrupt() usage\n";
24 cout <<
"***************************************************************\n";
32 bool ei_support =
true;
36 ei_support = (strstr(buf,
"IH") != 0);
41 cout <<
"No support on this bus\n";
60 cout <<
"\nPosition: " << trimmed <<
'\n';
61 e(
GCmd(g,
"SP 4000,4000"));
62 e(
GCmd(g,
"AC 1280000,1280000"));
63 e(
GCmd(g,
"DC 1280000,1280000"));
64 e(
GCmd(g,
"PR 8000,10000"));
66 cout <<
"Beginning independent motion...\n";
69 cout <<
"Motion Complete on A and B\n";
71 cout <<
"Position: " << trimmed <<
'\n';
73 return GALIL_EXAMPLE_OK;
84 unsigned char axis_mask = 0xFF;
86 int len = strlen(axes);
88 for (
int i = 0; i < len; i++)
119 sprintf(buf,
"EI %u", (
unsigned char)~axis_mask);
122 while (axis_mask != 0xFF)
GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut *front)
Wrapper around GCommand that trims the response.
GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms)
Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
Performs a command-and-response transaction on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus *status_byte)
Provides access to PCI and UDP interrupts from the controller.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
#define G_SMALL_BUFFER
Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
unsigned char GStatus
Interrupt status byte.
#define G_NO_ERROR
Return value if function succeeded.
unsigned int GSize
Size of buffers, etc.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
#define G_UNSUPPORTED_FUNCTION
Function cannot be called on this bus. E.G. GInterrupt() on serial.
const char * GCStringIn
C-string input to the library. Implies null-termination.
void e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
GReturn motion_complete(GCon g)
Uses interrupts to track when the motion of controller is completed.
int check_interrupts(GCon g, GCStringIn axes)
Monitors interrupt status on the given axes and returns when interrupts are fired.