An93 – Silicon Laboratories SI2493/57/34/15/04 User Manual

Page 269

Advertising
background image

AN93

Rev. 1.3

269

return;

}

void Delay(long iMs)

{

clock_t wait;

// covert ms's to clock_t by mutiplying by CLOCKS_PER_SEC/1000

wait = (clock_t)(iMs*CLOCKS_PER_SEC)/1000;

clock_t goal;

goal = wait + clock();

while( goal > clock() )

;

}

void LoadAndSendPatch(void)

{

char caOutGoing[256];

cpInputRd_temp = SendAndWaitFor("AT&T7\r", cpInputRd, "OK\r\n", 300); // Reset the modem

printf ("Current %s \n", cpInputRd); cpInputRd=cpInputRd_temp;

printf ("Loading patch:%s...\n", fnamePatch);

if ((hpPatchFile = fopen(fnamePatch, "rb")) == NULL)

{

fprintf(stderr, "The Patch File is missing.\n");

exit(1);

}

AssertRTS(true );

cpInputRd=SendAndWaitFor("ATE1\r", cpInputRd, "OK\r\n", 300);

bool bValidLine = true;

while(bValidLine)

{

bValidLine = GetFileTextLine(caOutGoing);

if(bValidLine)

cpInputRd = SendAndWaitFor(caOutGoing, cpInputRd, "OK\r\n", 3000);

}

cpInputRd = SendAndWaitFor("ATE1\r", cpInputRd, "OK\r\n", 300);

cpInputRd_temp = SendAndWaitFor("AT&T6\r", cpInputRd, "OK\r\n", 300);

printf ("Finish Loading, %s \n", cpInputRd); cpInputRd=cpInputRd_temp;

fclose(hpPatchFile);

}

// Returns FALSE when at end of file

// Stops after first LF.

bool GetFileTextLine(char *cpIn)

{

*cpIn = 0; char cpInChar[8]; cpInChar[1] = 0;

while(!feof(hpPatchFile))

Advertising
This manual is related to the following products: