/* cclmom.c This subroutine supports momentary pushbuttons. */ #include #include #include #include #include #include #include static long Icclmom(subRecord *psub) { psub->val = 0.0; return(0); } static long Scclmom(subRecord *psub) { /***********/ if(psub->val == 1 && psub->e < 8) { psub->val = 1; psub->e++; } else { if(psub->e == 8) { psub->val = 0; psub->e = 0; } if(psub->a == 1) psub->d++; else { if(psub->d == 20) psub->d = 0; if(psub->d > 0) psub->d++; if(psub->d > 0 && psub->b == 1) { psub->val = 1; psub->e++; psub->d = 0; } else if(psub->d > 0 && psub->c == 1) { psub->val = 0; psub->d = 0; } else if(psub->d == 0) psub->val = 0; } } return(0); } static registryFunctionRef cclmomRef[] = { {"Icclmom",(REGISTRYFUNCTION)Icclmom}, {"Scclmom",(REGISTRYFUNCTION)Scclmom} }; void cclmom_reg(void) {registryFunctionRefAdd(cclmomRef,NELEMENTS(cclmomRef));} epicsExportRegistrar(cclmom_reg);