public void SetModulationType(ModulationTypeEnum value) { try { lock (syncThread) { registers["RegOpMode"].Value = (uint)(byte)((uint)(byte)((uint)(byte)registers["RegOpMode"].Value & 159U) | (uint)(byte)((uint)(byte)value << 5)); ReadRegister(registers["RegBitrateMsb"]); ReadRegister(registers["RegBitrateLsb"]); ReadRegister(registers["RegBitrateFrac"]); } } catch (Exception ex) { OnError((byte)1, ex.Message); } }
private void OnModulationTypeChanged(ModulationTypeEnum value) { if (ModulationTypeChanged != null) ModulationTypeChanged(this, new ModulationTypeEventArg(value)); }
public static Decimal[] ComputeRxBwFreqTable(Decimal frequencyXo, ModulationTypeEnum mod) { Decimal[] numArray = new Decimal[24]; int num1 = 0; for (int index = 0; index < 8; ++index) { int num2 = 16; while (num2 <= 24) { numArray[num1++] = mod != ModulationTypeEnum.FSK ? frequencyXo / (Decimal)num2 * (Decimal)Math.Pow(2.0, (double)(index + 3)) : frequencyXo / (Decimal)num2 * (Decimal)Math.Pow(2.0, (double)(index + 2)); num2 += 4; } } return numArray; }
public static void ComputeRxBwMantExp(Decimal frequencyXo, ModulationTypeEnum mod, Decimal value, ref int mant, ref int exp) { Decimal num1 = new Decimal(0); Decimal num2 = new Decimal(10000000); for (int index = 0; index < 8; ++index) { int num3 = 16; while (num3 <= 24) { Decimal num4 = mod != ModulationTypeEnum.FSK ? frequencyXo / (Decimal)num3 * (Decimal)Math.Pow(2.0, (double)(index + 3)) : frequencyXo / (Decimal)num3 * (Decimal)Math.Pow(2.0, (double)(index + 2)); if (Math.Abs(num4 - value) < num2) { num2 = Math.Abs(num4 - value); mant = num3; exp = index; } num3 += 4; } } }
public ModulationTypeEventArg(ModulationTypeEnum value) { this.value = value; }
public static Decimal ComputeRxBw(Decimal frequencyXo, ModulationTypeEnum mod, int mant, int exp) { if (mod == ModulationTypeEnum.FSK) return frequencyXo / (Decimal)mant * (Decimal)Math.Pow(2.0, (double)(exp + 2)); return frequencyXo / (Decimal)mant * (Decimal)Math.Pow(2.0, (double)(exp + 3)); }
private void OnModulationTypeChanged(ModulationTypeEnum value) { if (ModulationTypeChanged == null) return; ModulationTypeChanged((object)this, new ModulationTypeEventArg(value)); }
public static void ComputeRxBwMantExp(decimal frequencyXo, ModulationTypeEnum mod, decimal value, ref int mant, ref int exp) { int num = 0; int num2 = 0; decimal num3 = 0M; decimal num4 = 10000000M; for (num = 0; num < 8; num++) { for (num2 = 0x10; num2 <= 0x18; num2 += 4) { if (mod == ModulationTypeEnum.FSK) num3 = frequencyXo / (num2 * ((decimal)Math.Pow(2.0, (double)(num + 2)))); else num3 = frequencyXo / (num2 * ((decimal)Math.Pow(2.0, (double)(num + 3)))); if (Math.Abs((decimal)(num3 - value)) < num4) { num4 = Math.Abs((decimal)(num3 - value)); mant = num2; exp = num; } } } }
public static decimal[] ComputeRxBwFreqTable(decimal frequencyXo, ModulationTypeEnum mod) { decimal[] numArray = new decimal[0x18]; int num = 0; int num2 = 0; int num3 = 0; for (num = 0; num < 8; num++) { for (num2 = 16; num2 <= 24; num2 += 4) { if (mod == ModulationTypeEnum.FSK) numArray[num3++] = frequencyXo / (num2 * ((decimal)Math.Pow(2.0, (double)(num + 2)))); else numArray[num3++] = frequencyXo / (num2 * ((decimal)Math.Pow(2.0, (double)(num + 3)))); } } return numArray; }
public void SetModulationType(ModulationTypeEnum value) { try { lock (syncThread) m_registers["RegDataModul"].Value = (m_registers["RegDataModul"].Value & 0xE7) | ((uint)value << 3); } catch (Exception exception) { OnError(1, exception.Message); } }