SICS-195
countdriv.h CounterDriver: iControlMonitor id (default=0) countdriv.c CreateCounterDriver: set the default control monitor to channel zero counter.h counter.c Commands to get and set the control monitor GetCounts return the counts from the current control monitor, ie iControlMonitor TODO loadCountData, get time from controlling monitor. scan.c Set control monitor on counter when setting scan channel multicounter.c MMCStart, set slave monitors with a timer preset of about a year to make sure that they don't stop before the controlling monitor. r2642 | ffr | 2008-07-10 15:21:21 +1000 (Thu, 10 Jul 2008) | 20 lines
This commit is contained in:
committed by
Douglas Clowes
parent
0f96e4f82f
commit
cff9290272
34
counter.c
34
counter.c
@@ -609,6 +609,17 @@
|
||||
assert(self);
|
||||
return self->pDriv->iNoOfMonitors;
|
||||
}
|
||||
int GetControlMonitor(pCounter self) {
|
||||
return self->pDriv->iControlMonitor;
|
||||
}
|
||||
int SetControlMonitor(pCounter self, int channel) {
|
||||
int maxchan = self->pDriv->iNoOfMonitors - 1;
|
||||
if (channel < 0 || channel > maxchan) {
|
||||
return 0;
|
||||
}
|
||||
self->pDriv->iControlMonitor = channel;
|
||||
return 1;
|
||||
}
|
||||
#ifdef NONINTF
|
||||
extern float nintf(float f);
|
||||
#endif
|
||||
@@ -660,7 +671,7 @@
|
||||
{
|
||||
self->pCountInt->TransferData(self,pCon);
|
||||
}
|
||||
return self->pDriv->lCounts[0];
|
||||
return self->pDriv->lCounts[self->pDriv->iControlMonitor];
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
long GetMonitor(pCounter self, int iNum, SConnection *pCon)
|
||||
@@ -671,7 +682,7 @@
|
||||
{
|
||||
self->pCountInt->TransferData(self,pCon);
|
||||
}
|
||||
if( (iNum < 0) || (iNum > self->pDriv->iNoOfMonitors) )
|
||||
if( (iNum < 0) || (iNum >= self->pDriv->iNoOfMonitors) )
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
@@ -780,7 +791,9 @@
|
||||
{"send",0,{0,0}},
|
||||
{"setpar",3,{FUPATEXT,FUPAINT,FUPAFLOAT}},
|
||||
{"getpar",2,{FUPATEXT,FUPAOPT}},
|
||||
{"getnmon",0,{0,0}}
|
||||
{"getnmon",0,{0,0}},
|
||||
{"getchannel",0,{0}},
|
||||
{"setchannel",1,{FUPAINT}}
|
||||
};
|
||||
char *pMode[] = {
|
||||
"timer",
|
||||
@@ -796,7 +809,7 @@
|
||||
/* parse function args */
|
||||
argtolower(argc,argv);
|
||||
argx = &argv[1];
|
||||
iRet = EvaluateFuPa((pFuncTemplate)&ActionTemplate,23,argc-1,argx,&PaRes);
|
||||
iRet = EvaluateFuPa((pFuncTemplate)&ActionTemplate,25,argc-1,argx,&PaRes);
|
||||
if(iRet < 0)
|
||||
{
|
||||
sprintf(pBueffel,"%s",PaRes.pError);
|
||||
@@ -1140,6 +1153,19 @@
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
break;
|
||||
case 23: /* getchannel */
|
||||
snprintf(pBueffel,131,"%s.getchannel = %d", argv[0], GetControlMonitor(self));
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
break;
|
||||
case 24: /* setchannel */
|
||||
if (SetControlMonitor(self, PaRes.Arg[0].iVal)) {
|
||||
return 1;
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: Invalid channel id",eError);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0); /* internal error */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user