FACT++  1.0
bool ConnectionFTM::SetNoutof4 ( int32_t  patch,
int32_t  value 
)
inline

Definition at line 768 of file ftmctrl.cc.

References data, fDAC, i, FTM::kCmdConfigFTU, FTM::kCmdRegister, FTM::kCmdWrite, FTM::StaticData::kMaxDAC, and FTM::StaticData::kMaxMultiplicity.

769  {
771  return false;
772 
773  if (value<0 || value>FTM::StaticData::kMaxDAC)
774  return false;
775 
776  if (patch<0)
777  {
779 
780  bool ident = true;
781  for (int i=0; i<FTM::StaticData::kMaxMultiplicity; i++)
782  if (data[i].fDAC[4] != value)
783  {
784  ident = false;
785  break;
786  }
787 
788  if (ident)
789  return true;
790 
791  for (int i=0; i<=FTM::StaticData::kMaxMultiplicity; i++)
792  data[i].fDAC[4] = value;
793 
794  // Maybe move to a "COMMIT" command?
796 
797  return true;
798  }
799 
800  /*
801  if (data[patch/4].fDAC[patch%4] == value)
802  return true;
803 
804  data[patch/4].fDAC[patch%4] = value;
805 
806  CmdSendStatDat(data);
807  return true;
808  */
809 
810  // Calculate offset in static data block
811  const uint16_t addr = (uintptr_t(&fStaticData[patch].fDAC[4])-uintptr_t(&fStaticData))/2;
812 
813  // From CmdSetRegister
814  const array<uint16_t, 2> data = {{ addr, uint16_t(value) }};
816 
817  reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = value;
818 
819  // Now execute change before the static data is requested back
820  PostCmd(FTM::kCmdConfigFTU, (patch/40) | (((patch/4)%10)<<8));
821 
822  //CmdGetRegister(addr);
823  CmdReqStatDat();
824 
825  return true;
826  }
int i
Definition: db_dim_client.c:21
FTM::StaticData fBufStaticData
Definition: ftmctrl.cc:57
void CmdReqStatDat()
Definition: ftmctrl.cc:505
void PostCmd(array< uint16_t, N > dat, uint16_t u1=0, uint16_t u2=0, uint16_t u3=0, uint16_t u4=0)
Definition: ftmctrl.cc:425
Specifies that a register is read/written.
Definition: HeadersFTM.h:71
Minimum required trigger multiplicity.
Definition: HeadersFTM.h:183
FTM::StaticData fStaticData
Definition: ftmctrl.cc:53
float data[4 *1440]
Send data.
Definition: HeadersFTM.h:59
Configure single FTU board.
Definition: HeadersFTM.h:65
void CmdSendStatDat(const FTM::StaticData &data)
Definition: ftmctrl.cc:510
uint16_t fDAC[5]
enable of 4x9 pixels coded as 4x9bits
Definition: HeadersFTM.h:187