#include "flashmagicarmcortex.h"
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
fm_results *presults;
presults = fm_version();
fm_connectoptions_com options;
fm_set_default_timeouts();
options.osc = 12.000;
sprintf_s(options.comportname, FM_MAXCOMPORTNAMELEN, "COM%d", 5);
options.baudrate = 115200;
options.selecteddevice = FM_LPC1758;
options.highspeed = 0; //1;
options.clocks = 0;
options.halfduplex = 0;
options.hwconfig = FM_HWBOOTEXEC;
options.hwt1 = 200;
options.hwt2 = 200;
options.i2caddr = 0;
options.maxbaudrate = 115200;
options.usinginterface = 0;
options.interfacetype = FM_INTERFACETYPE_NONE;
options.flashbank = 0;
options.protocoloptions = FM_PROTOCOLCOM_AUTOLF;
options.postopendelay = 0;
options.bootloaderpath[0] = NULL;
presults = fm_connect(&options, sizeof(options));
if (presults->result != FM_OK)
ShowMessage(presults->details);
}