Changeset 16776
- Timestamp:
- 06/08/13 12:55:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ftmctrl.cc
r16771 r16776 719 719 return true; 720 720 } 721 /* 721 722 722 bool SetSelectedThresholds(const int32_t *th) 723 723 { 724 724 for (int i=0; i<FTM::StaticData::kMaxPatchIdx; i++) 725 if (th[i] <0 || th[i]>FTM::StaticData::kMaxDAC)725 if (th[i]>FTM::StaticData::kMaxDAC) 726 726 return false; 727 727 … … 730 730 for (int i=0; i<=FTM::StaticData::kMaxPatchIdx; i++) 731 731 { 732 if (fBufStaticData[i/4].fDac[i%4]!=th[i]) 733 { 734 735 // Calculate offset in static data block 736 const uint16_t addr = (uintptr_t(&fStaticData[i/4].fDAC[i%4])-uintptr_t(&fStaticData))/2; 737 738 // From CmdSetRegister 739 const array<uint16_t, 2> data = {{ addr, uint16_t(th[i]) }}; 740 PostCmd(data, FTM::kCmdWrite, FTM::kCmdRegister); 741 742 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = th[i]; 743 } 744 } 745 746 // Now execute change before the static data is requested back 747 PostCmd(FTM::kCmdConfigFTU, (patch/40) | (((patch/4)%10)<<8)); 732 if (th[i]<0 || fBufStaticData[i/4].fDAC[i%4]==th[i]) 733 continue; 734 735 // Calculate offset in static data block 736 const uint16_t addr = (uintptr_t(&fStaticData[i/4].fDAC[i%4])-uintptr_t(&fStaticData))/2; 737 738 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = th[i]; 739 740 // From CmdSetRegister 741 const array<uint16_t, 2> arr = {{ addr, uint16_t(th[i]) }}; 742 PostCmd(arr, FTM::kCmdWrite, FTM::kCmdRegister); 743 PostCmd(FTM::kCmdConfigFTU, (i/40) | (((i/4)%10)<<8)); 744 } 748 745 749 746 //CmdGetRegister(addr); … … 751 748 752 749 return true; 753 }*/ 754 750 } 755 751 756 752 bool SetAllThresholds(const int32_t *th) … … 1632 1628 } 1633 1629 1630 int SetSelectedThresholds(const EventImp &evt) 1631 { 1632 if (!CheckEventSize(evt.GetSize(), "SetSelectedThresholds", 160*4)) 1633 return T::kSM_FatalError; 1634 1635 const int32_t *data = evt.Ptr<int32_t>(); 1636 if (!fFTM.SetSelectedThresholds(data)) 1637 { 1638 ostringstream msg; 1639 msg << "SetAllThresholds - Value out of range, maximum 0xffff."; 1640 T::Warn(msg); 1641 } 1642 1643 return T::GetCurrentState(); 1644 } 1645 1634 1646 int SetAllThresholds(const EventImp &evt) 1635 1647 { … … 2178 2190 "|Threshold[counts]:Threshold to be set in binary counts"); 2179 2191 2180 T::AddEvent("SET_ALL_THRESHOLDS", "I:160", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured, FTM::State::kTriggerOn) 2192 T::AddEvent("SET_SELECTED_THRESHOLDS", "I:160", FTM::State::kTriggerOn) 2193 (bind(&StateMachineFTM::SetAllThresholds, this, placeholders::_1)) 2194 ("Set the comparator thresholds. Only thresholds which are different and >=0 are sent." 2195 "|Thresholds[counts]:Threshold to be set in binary counts"); 2196 2197 T::AddEvent("SET_ALL_THRESHOLDS", "I:160", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured) 2181 2198 (bind(&StateMachineFTM::SetAllThresholds, this, placeholders::_1)) 2182 2199 ("Set the comparator thresholds"
Note:
See TracChangeset
for help on using the changeset viewer.