00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "extintf.h"
00015 #include "parport.h"
00016 #include "dro.h"
00017
00018
00019 #ifndef __GNUC__
00020 #ifndef __attribute__
00021 #define __attribute__(x)
00022 #endif
00023 #endif
00024
00025 static char __attribute__((unused)) ident[] = "$Id: extsmdromot.c,v 1.2 2000/10/27 20:34:42 terrylr Exp $";
00026
00027 #define STEPPER_MAX 6
00028
00029 int extMotInit(const char * stuff)
00030 {
00031 if (0 != pptDioInit(0)) {
00032 return -1;
00033 }
00034
00035 if (0 != LS7266Init()) {
00036 return -1;
00037 }
00038
00039 return 0;
00040 }
00041
00042 int extMotQuit()
00043 {
00044 return pptDioQuit();
00045 }
00046
00047 int extDacNum()
00048 {
00049 return 0;
00050 }
00051
00052 int extDacWrite(int dac, double volts)
00053 {
00054 return 0;
00055 }
00056
00057 int extDacWriteAll(int max, double * volts)
00058 {
00059 return 0;
00060 }
00061
00062 int extEncoderSetIndexModel(unsigned int model)
00063 {
00064 return 0;
00065 }
00066
00067 int extEncoderNum()
00068 {
00069 return 0;
00070 }
00071
00072 int extEncoderRead(int encoder, double * counts)
00073 {
00074 if (encoder < 0 ||
00075 encoder >= DRO_MAX) {
00076 *counts = 0.0;
00077 }
00078 else {
00079 *counts = (double) LS7266Read(encoder);
00080 }
00081
00082 return 0;
00083 }
00084
00085 int extEncoderReadAll(int max, double * counts)
00086 {
00087 int t;
00088
00089 for (t = 0; t < max; t++) {
00090 if (t >= DRO_MAX) {
00091 counts[t] = 0.0;
00092 }
00093 else {
00094 counts[t] = (double) LS7266Read(t);
00095 }
00096 }
00097
00098 return 0;
00099 }
00100
00101 int extEncoderResetIndex(int encoder)
00102 {
00103 return 0;
00104 }
00105
00106 int extEncoderReadLatch(int encoder, int * flag)
00107 {
00108 *flag = 1;
00109
00110 return 0;
00111 }
00112
00113 int extEncoderReadLevel(int encoder, int * flag)
00114 {
00115 return 0;
00116 }
00117
00118 int extAmpEnable(int axis, int enable)
00119 {
00120 return 0;
00121 }
00122
00123 int extAmpFault(int axis, int * fault)
00124 {
00125 return 0;
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 int extMaxLimitSwitchRead(int axis, int * flag)
00140 {
00141 if (axis < 0 || axis >= STEPPER_MAX) {
00142 *flag = 0;
00143 return 0;
00144 }
00145
00146 pptDioRead(0, flag);
00147
00148 return 0;
00149 }
00150
00151 int extMinLimitSwitchRead(int axis, int * flag)
00152 {
00153 if (axis < 0 || axis >= STEPPER_MAX) {
00154 *flag = 0;
00155 return 0;
00156 }
00157
00158 pptDioRead(1, flag);
00159
00160 return 0;
00161 }
00162
00163 int extHomeSwitchRead(int axis, int * flag)
00164 {
00165 if (axis < 0 || axis > STEPPER_MAX) {
00166 *flag = 0;
00167 return 0;
00168 }
00169
00170 pptDioRead(2, flag);
00171
00172 return 0;
00173 }