Пример #1
0
/*****************************************************************

Routine:   SerialCharsAvailable

Inputs:		
	None.

Returns:
	int

Description:
	This routine check to see if there are characters in the input buffer
	to be read.  It is a good idea to call this routine before actually 
	reading the buffer.
*****************************************************************/
int Comm32Port::SerialCharsAvailable()
{
	/* 
	 * to get the number of avalable chararacters .
	*/
	if( !m_nNumBytes )
	{
		m_nNumBytes = SerialGetString( m_gruchInputBuffer, READ_BUFFER_SIZE );
		m_nIndexBuffer = 0;
	}
	return m_nNumBytes;

} /* SerialCharsAvailable */
Пример #2
0
/*****************************************************************

Routine:   SerialGetChar

Inputs:		
	None.

Returns:
	int

Description:
	This routine gets a single char from the input buffer of the serial
	port.  It can only get what is there so it is a good idea to check
	if there is data in the input buffer using SerialCharsAvailable
*****************************************************************/
int Comm32Port::SerialGetChar()
{
	int nRetChar = COMM_NO_DATA;

	if( !m_nNumBytes )
	{
		m_nNumBytes = SerialGetString( m_gruchInputBuffer, READ_BUFFER_SIZE );
		m_nIndexBuffer = 0;
	} /* if */

	if( m_nNumBytes > 0 )
	{
		nRetChar = m_gruchInputBuffer[m_nIndexBuffer];
		m_nIndexBuffer++;
		m_nNumBytes--;
	} /* if */

	return nRetChar;
} /* SerialGetChar */
Пример #3
0
char * serial4getstring(void)
{
    return SerialGetString(UART4);
}