예제 #1
0
        private void export_vector(program_data codigo)
        {
            string str_out = "***********************************************************************************\n" +
                             "Copie o seguinte código em seu programa em C: \n\n" +
                             "uint8_t hex_code[" + codigo.hex_code.Length.ToString() + "] = {\n";

            for (int i = 0; i < Math.Ceiling((float)(codigo.hex_code.Length) / 16); i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    if (codigo.hex_code[i * 16 + j] < 16)
                    {
                        str_out += "0x0" + codigo.hex_code[i * 16 + j].ToString("X");
                    }
                    else
                    {
                        str_out += "0x" + codigo.hex_code[i * 16 + j].ToString("X");
                    }
                    if (j == 15 && i == Math.Ceiling((float)(codigo.hex_code.Length) / 16) - 1)
                    {
                        str_out += " };";
                    }
                    else
                    {
                        str_out += ", ";
                    }
                }
                str_out += "\n";
            }
            str_out          += "\n***********************************************************************************\n";
            richTextBox2.Text = str_out;
        }
예제 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.Text = "Auxiliar de Gravador do nrf24le1";
     user_log("Aplicação Iniciada.");
     openFileDialog1.Title = "Selecione o arquivo .hex gerado pelo Keil.";
     codigo_atual          = new program_data();
 }