Changed receive flushing function to not need a timeout and to work with and without interrupts
This commit is contained in:
parent
07474c7e19
commit
cf1b273549
@ -332,11 +332,19 @@ bool USART0::receiveLine( char *szBuffer, size_t sizeBufferLength, const char *s
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::flushReceive( uint16_t ui16TimeoutMS )
|
void USART0::flushReceive()
|
||||||
{
|
{
|
||||||
uint8_t ui8Received;
|
uint8_t ui8Received;
|
||||||
|
|
||||||
while( receiveByte( ui8Received, ui16TimeoutMS ) );
|
while( m_vsizeRXBufferHead != m_vsizeRXBufferTail )
|
||||||
|
{
|
||||||
|
receiveByte( ui8Received );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !( SREG & ( 1 << SREG_I ) ) && ( *m_vui8pUCSRA & ( 1 << RXC_D ) ) )
|
||||||
|
{
|
||||||
|
ui8Received = *m_vui8pUDR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) by BlackMark 2015-2016
|
* Copyright (c) by BlackMark 2015-2016
|
||||||
* Date 22/05/2016
|
* Date 24/05/2016
|
||||||
* Version 2.8
|
* Version 2.9
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USART_H
|
#ifndef USART_H
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
bool receiveByte( uint8_t &ui8Data );
|
bool receiveByte( uint8_t &ui8Data );
|
||||||
bool receiveByte( uint8_t &ui8Data, uint16_t ui16TimeoutMS );
|
bool receiveByte( uint8_t &ui8Data, uint16_t ui16TimeoutMS );
|
||||||
bool receiveLine( char *szBuffer, size_t sizeBufferLength, const char *szLineTerminator = "\r\n" );
|
bool receiveLine( char *szBuffer, size_t sizeBufferLength, const char *szLineTerminator = "\r\n" );
|
||||||
void flushReceive( uint16_t ui16TimeoutMS );
|
void flushReceive();
|
||||||
|
|
||||||
void transmitByte( uint8_t ui8Data );
|
void transmitByte( uint8_t ui8Data );
|
||||||
void transmitString( const char *szString );
|
void transmitString( const char *szString );
|
||||||
|
Loading…
Reference in New Issue
Block a user