Exemple #1
0
// Read a word in little-endian format.
bool CCPCBooster::ReadWaitWord(unsigned short &val)
{
#if _WINDOWS
	unsigned long nbBytesReceived = 0;
	BOOL fSuccess = TRUE;
	while (	nbBytesReceived != 2 && fSuccess == TRUE) 
	{
		fSuccess = ReadFile (_COMPortHandle, &val, 2, &nbBytesReceived, NULL);
	}

	return ((nbBytesReceived == 2) && fSuccess);
#else
	unsigned char byte1, byte2 ;

	if (
		ReadWaitByte(byte1) &&
		ReadWaitByte(byte2) 
	    )
	{
	    val = byte2 * 256 + byte1 ;
	    return 1 == 1 ;
	}
	else{
	    return 1 == 0 ;
	}

#endif
}
Exemple #2
0
// Read a word in little-endian format.
void CCPCBooster::ReadWaitWord(unsigned short &val)
{
	unsigned char byte1, byte2 ;

	ReadWaitByte(byte1);
	ReadWaitByte(byte2);
	val = byte2 * 256 + byte1 ;
}