private static int WriteToPipeIn(PipeInAddress pin, int len, byte[] PipeInData) { lock (dev) { return((int)dev.WriteToPipeIn((int)pin, len, PipeInData)); } }
public FpgaTimebaseTask(DeviceSettings deviceSettings, okCFrontPanel opalKellyDevice, SequenceData sequence, double masterClockPeriod, out int nSegments, bool useRfModulation, bool assymetric) : base() { com.opalkelly.frontpanel.okCFrontPanel.ErrorCode errorCode; this.opalKellyDevice = opalKellyDevice; this.masterClockPeriod = masterClockPeriod; TimestepTimebaseSegmentCollection segments = sequence.generateVariableTimebaseSegments(SequenceData.VariableTimebaseTypes.AnalogGroupControlledVariableFrequencyClock, masterClockPeriod); this.max_elapsedtime_ms = (UInt32)((sequence.SequenceDuration * 1000.0) + 100); byte[] data = FpgaTimebaseTask.createByteArray(segments, sequence, out nSegments, masterClockPeriod, assymetric); // Send the device an abort trigger. errorCode = opalKellyDevice.ActivateTriggerIn(0x40, 1); if (errorCode != okCFrontPanel.ErrorCode.NoError) { throw new Exception("Unable to set abort trigger to FPGA device. Error code " + errorCode.ToString()); } UInt16 wireInValue = 0; if (deviceSettings.StartTriggerType != DeviceSettings.TriggerType.SoftwareTrigger) { wireInValue += 1; } if (useRfModulation) { wireInValue += 2; } setWireInValue(0x00, wireInValue); setWireInValue(0x01, deviceSettings.RetriggerDebounceSamples); opalKellyDevice.UpdateWireIns(); // pipe the byte stream to the device int xfered = opalKellyDevice.WriteToPipeIn(0x80, data.Length, data); if (xfered != data.Length) { throw new Exception("Error when piping clock data to FPGA device. Sent " + xfered + " bytes instead of " + data.Length + "bytes."); } }
public FpgaTimebaseTask(DeviceSettings deviceSettings, okCFrontPanel opalKellyDevice, SequenceData sequence, double masterClockPeriod, out int nSegments, bool useRfModulation, bool assymetric) : base() { com.opalkelly.frontpanel.okCFrontPanel.ErrorCode errorCode; this.opalKellyDevice = opalKellyDevice; this.masterClockPeriod = masterClockPeriod; TimestepTimebaseSegmentCollection segments = sequence.generateVariableTimebaseSegments(SequenceData.VariableTimebaseTypes.AnalogGroupControlledVariableFrequencyClock, masterClockPeriod); this.max_elapsedtime_ms = (UInt32)((sequence.SequenceDuration * 1000.0) + 100); byte[] data = FpgaTimebaseTask.createByteArray(segments, sequence, out nSegments, masterClockPeriod, assymetric ); // Send the device an abort trigger. errorCode = opalKellyDevice.ActivateTriggerIn(0x40, 1); if (errorCode != okCFrontPanel.ErrorCode.NoError) { throw new Exception("Unable to set abort trigger to FPGA device. Error code " + errorCode.ToString()); } UInt16 wireInValue = 0; if (deviceSettings.StartTriggerType != DeviceSettings.TriggerType.SoftwareTrigger) { wireInValue += 1; } if (useRfModulation) { wireInValue += 2; } setWireInValue(0x00, wireInValue); setWireInValue(0x01, deviceSettings.RetriggerDebounceSamples); opalKellyDevice.UpdateWireIns(); // pipe the byte stream to the device int xfered = opalKellyDevice.WriteToPipeIn(0x80, data.Length, data); if (xfered != data.Length) { throw new Exception("Error when piping clock data to FPGA device. Sent " + xfered + " bytes instead of " + data.Length + "bytes."); } }