Exemple #1
0
        private void btnEEWrite_Click(object sender, EventArgs e)
        {
            ushort offset    = ushort.Parse(txtOffset.Text, NumberStyles.HexNumber);
            byte   num_bytes = byte.Parse(txtNumBytes.Text, NumberStyles.HexNumber);

            if (num_bytes > txtData.Text.Length / 2)
            {
                MessageBox.Show("Error: Not enough data");
                return;
            }

            byte[] data = new byte[num_bytes];
            for (int i = 0; i < num_bytes; i++)
            {
                data[i] = byte.Parse(txtData.Text.Substring(i * 2, 2), NumberStyles.HexNumber);
            }

            HiPerfTimer t1 = new HiPerfTimer();

            t1.Start();

            int val;

            //fixed(byte* ptr = &data[0])
            val = Flex1500.WriteEEPROM(offset, data);

            t1.Stop();
            Debug.WriteLine("EEWrite: " + val + "  (" + t1.DurationMsec.ToString("f2") + ")");
        }
Exemple #2
0
        } // buttonTS3_Click (TURF)

        //===============================================================================
        private void buttonTS1_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Warning: You must have Authorization as a MARS Licensed Operator.\n",
                                              "Do you have authorization?",
                                              MessageBoxButtons.YesNo,
                                              MessageBoxIcon.Question);
            int val = 0;

            byte[] data = new byte[1];

            data[0] = 0x01;

            if (dr == DialogResult.Yes)
            {
                //  val = Flex1500.WriteEEPROM(offset, data);
                //   val = Flex1500.ReadEEPROM(offset, num_bytes, out data);

                val = Flex1500.WriteEEPROM(0x1818, data);  // x1818, 181a-1f are all FF



                /*
                 *              if (FWC.WriteTRXEEPROMByte(0x0034, 0x2D) == 0) MessageBox.Show("Error in WriteEEPROM 34");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0035, 0x05) == 0) MessageBox.Show("Error in WriteEEPROM 35");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0036, 0x00) == 0) MessageBox.Show("Error in WriteEEPROM 36");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0037, 0x00) == 0) MessageBox.Show("Error in WriteEEPROM 37");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0038, 0x0D) == 0) MessageBox.Show("Error in WriteEEPROM 38");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0039, 0x0B) == 0) MessageBox.Show("Error in WriteEEPROM 39");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003A, 0x01) == 0) MessageBox.Show("Error in WriteEEPROM 3a");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003B, 0x00) == 0) MessageBox.Show("Error in WriteEEPROM 3b");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003C, 0x78) == 0) MessageBox.Show("Error in WriteEEPROM 3c");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 */
            }



            MessageBox.Show("You must cycle power to the radio", "Cycle Power",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
        } // buttonTS1_Click
Exemple #3
0
        } // buttonTS1_Click

        private void buttonTS2_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("This will reset any MARS operate back to Normal Standard Operation\n",

                                              "Yes?",
                                              MessageBoxButtons.YesNo,
                                              MessageBoxIcon.Question);

            int val = 0;

            byte[] data = new byte[1];

            data[0] = 0xff;

            if (dr == DialogResult.Yes)
            {
                //  val = Flex1500.WriteEEPROM(offset, data);
                //   val = Flex1500.ReadEEPROM(offset, num_bytes, out data);

                val = Flex1500.WriteEEPROM(0x1818, data);


                /*
                 *              if (FWC.WriteTRXEEPROMByte(0x0034, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 34");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0035, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 35");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0036, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 36");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0037, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 37");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0038, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 38");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x0039, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 39");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003A, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 3a");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003B, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 3b");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 *              if (FWC.WriteTRXEEPROMByte(0x003C, 0xff) == 0) MessageBox.Show("Error in WriteEEPROM 3c");
                 *              txtEEPROMWrite.BackColor = SystemColors.Window;
                 *              btnEEPROMRead_Click(this, EventArgs.Empty);
                 */
            }
        } // buttonTS2_Click
Exemple #4
0
        //==========================================================================
        // TURF selector
        private void buttonTS3_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Warning: You are changing your Turf Region.\n",
                                              "Do you have authorization?",
                                              MessageBoxButtons.YesNo,
                                              MessageBoxIcon.Question);
            int val = 0;

            byte[] data = new byte[1]; // 1 byte long

            if (dr == DialogResult.Yes)
            {
                data[0] = (byte)numericUpDown1.Value;
                Debug.WriteLine("Byte value " + (byte)numericUpDown1.Value);

                val = Flex1500.WriteEEPROM(0x1819, data);
            }

            MessageBox.Show("You must close PowerSDR and cycle power to the radio. Then go to setup->General->Options->BandText Udpate", "Cycle Power",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
        } // buttonTS3_Click (TURF)
 unsafe public static int WriteEEPROM(ushort addr, byte num_bytes, byte[] buf)
 {
     byte[] b = new byte[num_bytes];
     Array.Copy(buf, b, num_bytes);
     return(Flex1500.WriteEEPROM(addr, b));
 }
 unsafe public static int WriteEEPROM(ushort addr, byte[] buf) // up to 32 bytes
 {
     return(Flex1500.WriteEEPROM(addr, buf));
 }
 unsafe public static int WriteTRXEEPROMFloat(uint offset, float val)
 {
     byte[] temp = BitConverter.GetBytes(val);
     return(Flex1500.WriteEEPROM((ushort)offset, temp));
 }
 unsafe public static int WriteTRXEEPROMUint(uint offset, uint buf)
 {
     byte[] temp = BitConverter.GetBytes(buf);
     return(Flex1500.WriteEEPROM((ushort)offset, temp));
 }