Esempio n. 1
0
 public MatlabCalculatorExeutionFront(string chipType, string chipVer, int appUniqId)
 {
     this.InitializeComponent();
     this._pro2Calc = new Pro2Calc(chipType, chipVer, appUniqId);
     this._stopper = new Stopwatch();
     this._stopper.Reset();
     this._stopper.Start();
 }
Esempio n. 2
0
 private void fillCalculatorInput(Pro2Calc.InputParams input, Config selectedConfig, Project selectedProject)
 {
     if (input != null)
     {
         input.CrystalFrequency = (int) (this.nudXtalFrequency.Value * 1000000M);
         if (selectedConfig.CrystalTolerance == 0)
         {
             input.CrystalTolerance = 30.0;
         }
         else
         {
             input.CrystalTolerance = selectedConfig.CrystalTolerance;
         }
         input.HighPerformanceChannelFilter = High_Perf_Ch_Fil.HighPerformance;
         input.OversamplingRateTune = 0.0;
         input.ChannelFilterAutoFrequencyControl = Ch_Fil_Bw_AFC.Rx1;
         input.AntennaDiversity = false;
         input.PreamblePattern = (this.cbbModulationSource.SelectedIndex == 0) ? PM_Pattern.EZR2Packet : PM_Pattern.EZR2Direct;
         string str = selectedConfig.ModulationMode.ToString();
         if (selectedProject.Name.Contains("Unmodulated"))
         {
             str = "UnmodulatedCarrier";
         }
         if (str.Contains("FSK"))
         {
             str = "_2" + str;
         }
         input.ModulationType = (MOD_Type) Enum.Parse(typeof(MOD_Type), str, true);
         input.SymbolRate = (int) (selectedConfig.DataRate * 1000.0);
         input.FrequencyDeviation = (int) (selectedConfig.Deviation * 1000.0);
         input.Manchester = this.chbManchesterMode.Checked;
         input.AutoFrequencyControl = (this.cbbModulationSource.SelectedIndex == 0) && (this.nudPreambeLength.Value >= 5M);
         input.SymbolRateError = Rsymb_error.onePercent;
         input.ChipVersion = Chip_Version.RevB_VCOv0;
         input.RF_Frequency = (int) (this.nudCenterFrequency.Value * 1000000M);
         input.RampingTime = 0x1c;
         input.FrequencyHoppingChannelSpacing = ((int) this.nudChannelSpacing.Value) * 0x3e8;
         if (this._runMode == RunMode.AddConfig)
         {
             if (selectedConfig.CrystalTolerance == 0)
             {
                 input.OOK_Bandwidth = (int) (selectedConfig.ChannelBandwith * 1000.0);
                 input.InputRxBandwidth = selectedConfig.ModulationMode != Modulation.OOK;
             }
             else
             {
                 input.OOK_Bandwidth = 0x30d40;
                 input.InputRxBandwidth = false;
             }
         }
         else if (input.ModulationType == MOD_Type.OOK)
         {
             input.OOK_Bandwidth = (int) (selectedConfig.ChannelBandwith * 1000.0);
             input.InputRxBandwidth = selectedConfig.ModulationMode != Modulation.OOK;
         }
         else
         {
             input.OOK_Bandwidth = 0x30d40;
             input.InputRxBandwidth = false;
         }
         input.HighPerformanceDividerMode = false;
         input.BitErrorRateTest = false;
         input.RawDataOutput = false;
         input.DataSource = 0;
         byte num = 0;
         byte num2 = 0;
         byte num3 = 0;
         if (this.cbbModulationSource.SelectedItem.ToString().Contains("Packet"))
         {
             num = 0;
         }
         else
         {
             num = 1;
         }
         if (selectedProject.Name.Contains("PN9"))
         {
             num = 2;
         }
         if (this.cbbModulationSource.SelectedItem.ToString().Contains("Direct"))
         {
             if (this.cbbGpio1.SelectedItem.ToString().Contains("(4)"))
             {
                 num2 = (byte) (num2 | 1);
             }
             else if (this.cbbGpio2.SelectedItem.ToString().Contains("(4)"))
             {
                 num2 = (byte) (num2 | 2);
             }
             else if (this.cbbGpio3.SelectedItem.ToString().Contains("(4)"))
             {
                 num2 = (byte) (num2 | 3);
             }
         }
         num2 = (byte) (num2 << 2);
         num3 = (byte) (num3 << 4);
         input.DataSource = (num3 | num2) | num;
         input.IqCalibrationNeeded = false;
     }
 }
Esempio n. 3
0
        private void fillCalculatorInput(Pro2Calc.InputParams input)
        {
            if (input != null)
            {
                input.CrystalFrequency = (int) (this.nudXtalFrequency.Value * 1000000M);
                input.CrystalTolerance = (double) this.nudXtalTolerance.Value;
                input.IntermediateFrequencyMode = (IF_Mode) Enum.Parse(typeof(IF_Mode), this.cbbIFMode.SelectedItem.ToString(), true);
                input.HighPerformanceChannelFilter = this.chbEnableHighChFilt.Checked ? High_Perf_Ch_Fil.HighPerformance : High_Perf_Ch_Fil.Normal;
                input.OversamplingRateTune = (double) this.nudOSRTune.Value;
                input.ChannelFilterAutoFrequencyControl = this.chbChFilBwAFC.Checked ? Ch_Fil_Bw_AFC.Rx2 : Ch_Fil_Bw_AFC.Rx1;
                input.AntennaDiversity = this.cbbAntennaDiversity.SelectedIndex != 0;
                int index = this.pmPatternValues.IndexOf(this.cbbPmPattern.SelectedItem.ToString());
                if (index == 4)
                {
                    index = 15;
                }
                input.PreamblePattern = (PM_Pattern) index;
                string str = this.cbbModulationType.SelectedItem.ToString();
                if ((str.Length > 0) && char.IsDigit(str[0]))
                {
                    str = "_" + str;
                }
                else
                {
                    str = str.Replace(" ", "");
                }
                input.ModulationType = (MOD_Type) Enum.Parse(typeof(MOD_Type), str, true);
                input.SymbolRate = (int) (this.nudDataRate.Value * 1000M);
                if (this.lblDeviation.Text.StartsWith("Dev"))
                {
                    input.FrequencyDeviation = (int) (this.nudDeviation.Value * 1000M);
                }
                else
                {
                    input.FrequencyDeviation = input.SymbolRate * 10;
                }
                if (this.lblDeviation.Text.StartsWith("OOK"))
                {
                    input.OOK_Bandwidth = (int) (this.nudDeviation.Value * 1000M);
                }
                else if (this.chbEnterRxBw.Checked)
                {
                    input.OOK_Bandwidth = (int) (this.nudRxBw.Value * 1000M);
                }
                else
                {
                    input.OOK_Bandwidth = 0x30d40;
                }
                input.Manchester = (this.cbbManchesterMode.SelectedItem != null) && (this.cbbManchesterMode.SelectedItem.ToString() == "On");
                input.AutoFrequencyControl = this.chbEnableAFC.Checked;
                switch (this.cbbDataRateError.SelectedIndex)
                {
                    case 0:
                        input.SymbolRateError = Rsymb_error.onePercent;
                        break;

                    case 1:
                        input.SymbolRateError = Rsymb_error.tenPercent;
                        break;

                    case 2:
                        input.SymbolRateError = Rsymb_error.twentyPercent;
                        break;

                    default:
                        input.SymbolRateError = Rsymb_error.twentyPercent;
                        break;
                }
                input.ChipVersion = (Chip_Version) this.cbbChipVersion.SelectedIndex;
                input.RF_Frequency = (int) (this.nudCenterFrequency.Value * 1000000M);
                input.RampingTime = (int) this.nudPaRampTime.Value;
                if (this.chbEnableAdvancedSettings.Checked)
                {
                    input.FrequencyHoppingChannelSpacing = ((int) this.nudChannelSpacing.Value) * 0x3e8;
                }
                else
                {
                    input.FrequencyHoppingChannelSpacing = 0;
                }
                input.InputRxBandwidth = this.chbEnterRxBw.Checked;
                input.HighPerformanceDividerMode = this.chbHiPerfDivider.Checked;
                input.BitErrorRateTest = this.chbEnableBER.Checked;
                input.RawDataOutput = this.chbEnableRawDataOut.Checked;
                byte num2 = 0;
                byte num3 = 0;
                byte num4 = 0;
                if (this.cbbModulationMode.SelectedItem.ToString().StartsWith("FIFO"))
                {
                    num2 = 0;
                }
                else if (this.cbbModulationMode.SelectedItem.ToString().Contains("PN9"))
                {
                    num2 = 2;
                }
                else
                {
                    num2 = 1;
                }
                if (this.cbbModulationMode.SelectedItem.ToString().Contains("Direct") || this.cbbModulationMode.SelectedItem.ToString().Contains("Raw"))
                {
                    if (this.cbbGpio1.SelectedItem.ToString().Contains("(4)"))
                    {
                        num3 = (byte) (num3 | 1);
                    }
                    else if (this.cbbGpio2.SelectedItem.ToString().Contains("(4)"))
                    {
                        num3 = (byte) (num3 | 2);
                    }
                    else if (this.cbbGpio3.SelectedItem.ToString().Contains("(4)"))
                    {
                        num3 = (byte) (num3 | 3);
                    }
                }
                num3 = (byte) (num3 << 2);
                if (this.cbbModulationMode.SelectedItem.ToString().Contains("Raw"))
                {
                    num4 = 1;
                }
                num4 = (byte) (num4 << 4);
                input.DataSource = (num4 | num3) | num2;
                input.IqCalibrationNeeded = this.chbEnableIqCalibration.Checked;
            }
        }
Esempio n. 4
0
        private void fillCalculatorInput(Pro2Calc.InputParams input)
        {
            string str;
            if (input == null)
            {
                return;
            }
            input.CrystalFrequency = (int) (nudCrystalFrequency.Value * 1000000M);
            input.CrystalTolerance = (((double) nudCrystalToleranceTX.Value) + ((double) nudCrystalToleranceRX.Value)) / 2.0;
            input.IntermediateFrequencyMode = (IF_Mode) Enum.Parse(typeof(IF_Mode), cbbIfMode.SelectedItem.ToString(), true);
            input.HighPerformanceChannelFilter = chbEnableHighPerformanceChannelFilter.Checked ? High_Perf_Ch_Fil.HighPerformance : High_Perf_Ch_Fil.Normal;
            input.OversamplingRateTune = (double) nudOsrTune.Value;
            input.ChannelFilterAutoFrequencyControl = chbEnableAdaptiveChannelFilterBandwidth.Checked ? Ch_Fil_Bw_AFC.Rx2 : Ch_Fil_Bw_AFC.Rx1;
            input.AntennaDiversity = chbEnableAntennaDiversity.Checked;
            if (!cbbPreamblePattern.Enabled)
            {
                input.PreamblePattern = PM_Pattern.OneZero;
            }
            else
            {
                switch (cbbPreamblePattern.SelectedIndex)
                {
                    case 1:
                    case 3:
                        input.PreamblePattern = PM_Pattern.RandomOrNone;
                        goto Label_0133;

                    case 2:
                        input.PreamblePattern = PM_Pattern.Random;
                        goto Label_0133;
                }
                input.PreamblePattern = PM_Pattern.OneZero;
            }
            Label_0133:
            str = cbbModulationType.SelectedItem.ToString();
            if (str.Contains("FSK"))
            {
                str = "_" + str;
            }
            input.ModulationType = (_selectedProject.Name == "Unmodulated carrier") ? MOD_Type.UnmodulatedCarrier : ((MOD_Type) Enum.Parse(typeof(MOD_Type), str, true));
            input.SymbolRate = (int) (nudDataRate.Value * 1000M);
            input.FrequencyDeviation = (cbbModulationType.SelectedItem.ToString() == "OOK") ? (input.SymbolRate * 10) : ((int) (nudDeviation.Value * 1000M));
            input.OOK_Bandwidth = (int) (nudBandwidth.Value * 1000M);
            input.Manchester = pccPacketHandlerConfigurator.isMancheserMode();
            input.AutoFrequencyControl = chbEnablePllAFC.Checked;
            switch (cbbDataRateError.SelectedIndex)
            {
                case 0:
                    input.SymbolRateError = Rsymb_error.onePercent;
                    break;

                case 1:
                    input.SymbolRateError = Rsymb_error.tenPercent;
                    break;

                case 2:
                    input.SymbolRateError = Rsymb_error.twentyPercent;
                    break;

                default:
                    input.SymbolRateError = Rsymb_error.twentyPercent;
                    break;
            }
            input.ChipVersion = (Chip_Version) Enum.Parse(typeof(Chip_Version), _chipDescriptor.ChipVersion, true);
            input.RF_Frequency = (int) (nudCenterFrequency.Value * 1000000M);
            input.RampingTime = (int) nudPaRampTC.Value;
            input.FrequencyHoppingChannelSpacing = (int) (nudChannelSpacing.Value * 1000M);
            input.InputRxBandwidth = chbManualRxBandwidth.Checked;
            input.HighPerformanceDividerMode = true;
            input.BitErrorRateTest = chbEnableBerMode.Checked;
            input.RawDataOutput = chbEnableRawUntimedData.Checked;
            byte num = 0;
            byte num2 = 0;
            byte num3 = 0;
            if (_selectedProject.ModulationMode == ModulationMode.FIFO)
            {
                num = 0;
            }
            else if (_selectedProject.ModulationMode == ModulationMode.PN9)
            {
                num = 2;
            }
            else
            {
                num = 1;
            }
            if ((_selectedProject.ModulationMode == ModulationMode.DirectSync) || (_selectedProject.ModulationMode == ModulationMode.DirectAsync))
            {
                if (cbbGpio1.SelectedItem.ToString().Contains("(4)"))
                {
                    num2 = (byte) (num2 | 1);
                }
                else if (cbbGpio2.SelectedItem.ToString().Contains("(4)"))
                {
                    num2 = (byte) (num2 | 2);
                }
                else if (cbbGpio3.SelectedItem.ToString().Contains("(4)"))
                {
                    num2 = (byte) (num2 | 3);
                }
            }
            num2 = (byte) (num2 << 2);
            if (_selectedProject.ModulationMode == ModulationMode.DirectAsync)
            {
                num3 = 1;
            }
            num3 = (byte) (num3 << 4);
            input.DataSource = (num3 | num2) | num;
            input.IqCalibrationNeeded = chbEnableIqCalibration.Checked;
        }