Пример #1
0
/*********************************************************************************//*!
 * \brief Get a character from the reception ring buffer.
 *
 * The retrieved character if available is stored using pointer pcRxedChar.  The function
 * returns pdTRUE if a character was available and pdFALSE otherwise (in this latter case, the contents
 * referenced by pcRxedChar are not changed).
 * @param usartId - USART identifier
 * @param pcRxedChar - pointer for storing character read.
 * @return pdFALSE if a character was available in the reception ring buffer (stored at pcRXedChar) and pdFALSE otherwise.
 */
UBaseType_t usart_xgetChar( USART_ID usartId, UBaseType_t *pcRxedChar )
{
	UBaseType_t retVal = pdFALSE;
	// Get the next character from the ring buffer.  Return false if no characters are available
	if( ! ringBuffer_IsEmpty( &(usartComBuf[usartId].xRxedChars) ) )
	{
		* pcRxedChar = ringBuffer_Pop( &(usartComBuf[usartId].xRxedChars) );
		retVal = pdTRUE;
	}
	return retVal;
}
Пример #2
0
/***************************************************************************************//*!
 * \private Interrupt service routine for character transmission.
 * Transmits a character from the transmit ring buffer.  If the buffer is empty, the transmit interrupt is disabled.
 * @param usartId - USART id
 ******************************************************************************************/
void usart_tx_isr(USART_ID usartId)
{
	if( ringBuffer_IsEmpty( &(usartComBuf[usartId].xCharsForTx) ) )
	{
		// Queue empty, nothing to send.
		xmitInterrupt_Off(usartId);
	}
	else
	{
		*usartReg[usartId].udrPtr = ringBuffer_Pop( &(usartComBuf[usartId].xCharsForTx) );
	}
}
Пример #3
0
inline portBASE_TYPE xSerialGetChar( xComPortHandlePtr pxPort, unsigned portBASE_TYPE *pcRxedChar )
{
    /* Get the next character from the ring buffer.  Return false if no characters are available */

    if( ringBuffer_IsEmpty( &(pxPort->xRxedChars) ) )
    {
        return pdFALSE;
    }
    else
    {
        * pcRxedChar = ringBuffer_Pop( &(pxPort->xRxedChars) );
        return pdTRUE;
    }
}