COMM-DRV/Lib: GetTimeout() Get the current timeout value

Description-

Get the current timeout value. This function is typically used before issuing the SetTimeout() value so that the previous value may be restored.

Syntax-

timeout = GetTimeout(port);

On Entry-

int port;

Port previously opened with InitializePort() or OpenComPort().

On Exit-

unsigned int timeout;

The current timeout.

else

0xffff If port was not initialized.

See Also-

CdrvSetTimerResolution()
SetTimeout()

Example-

#include <comm.h>

unsigned int oldtimeout;
unsigned int newtimeout=1;
int port=0;

/* Save old timeout */
if ((oldtimeout = GetTimeout(port)) == -1)
{
printf(“Port not initialized\n”);

/* Take remedial action */
}

/* Set a new timeout */
SetTimeout(port,newtimeout);
:
:

/* Restore the old pace time */
SetTimeout(port,oldtimeout);