private void ReadRegister(HarpMessage message)
        {
            switch (message.Address)
            {
            case ConfigurationRegisters.Config:
                configuration.Config = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.WhoAmI:
                configuration.WhoAmI = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.HardwareVersionHigh:
                configuration.HardwareVersionHigh = message.GetPayloadByte();
                break;

            case ConfigurationRegisters.HardwareVersionLow:
                configuration.HardwareVersionLow = message.GetPayloadByte();
                break;

            case ConfigurationRegisters.FirmwareVersionHigh:
                configuration.FirmwareVersionHigh = message.GetPayloadByte();
                break;

            case ConfigurationRegisters.FirmwareVersionLow:
                configuration.FirmwareVersionLow = message.GetPayloadByte();
                break;

            case ConfigurationRegisters.SerialNumber:
                configuration.SerialNumber = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.ScreenBrightness:
                configuration.ScreenBrightness = message.GetPayloadByte();
                break;

            case ConfigurationRegisters.TriggerState:
                var triggerState = message.GetPayloadArray <byte>();
                configuration.TriggerState = TriggerHelper.ToFrameFlags(triggerState);
                break;

            case ConfigurationRegisters.TriggerStateLength:
                var triggerStateLength = message.GetPayloadByte();
                if (configuration.TriggerState?.Length != triggerStateLength)
                {
                    var array = configuration.TriggerState;
                    Array.Resize(ref array, triggerStateLength);
                    configuration.TriggerState = array;
                }
                triggerStateView.BeginInvoke((Action)SetTriggerState);
                break;

            case ConfigurationRegisters.TriggerPeriod:
                configuration.TriggerPeriod = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.TriggerTimeUpdateOutputs:
                configuration.DwellTime = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.DacL415:
                configuration.L415 = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.DacL470:
                configuration.L470 = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.DacL560:
                configuration.L560 = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.DacLaser:
                configuration.LaserAmplitude = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.Out0Conf:
                configuration.DigitalOutput0 = (DigitalOutputConfiguration)message.GetPayloadByte();
                break;

            case ConfigurationRegisters.Out1Conf:
                configuration.DigitalOutput1 = (DigitalOutputConfiguration)message.GetPayloadByte();
                break;

            case ConfigurationRegisters.In0Conf:
                configuration.DigitalInput0 = (DigitalInputConfiguration)message.GetPayloadByte();
                break;

            case ConfigurationRegisters.In1Conf:
                configuration.DigitalInput1 = (DigitalInputConfiguration)message.GetPayloadByte();
                break;

            case ConfigurationRegisters.StimWavelength:
                configuration.LaserWavelength = message.GetPayloadUInt16();
                setupLaserButton.BeginInvoke((Action)SetLaserCalibrationState);
                break;

            case ConfigurationRegisters.StimPeriod:
                configuration.PulsePeriod = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.StimOn:
                configuration.PulseWidth = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.StimReps:
                configuration.PulseCount = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.TriggerLaserOn:
                configuration.TriggerLaserOn = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.TriggerLaserOff:
                configuration.TriggerLaserOff = message.GetPayloadUInt16();
                break;

            case ConfigurationRegisters.CameraSerialNumber:
                if (message.PayloadType == PayloadType.TimestampedU64)
                {
                    configuration.CameraSerialNumber = message.GetPayloadUInt64();
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
 static ulong ProcessU64(HarpMessage input)
 {
     CheckErrors(input, PayloadType.U64);
     return(input.GetPayloadUInt64());
 }