Change RingBuffer to have buffer size of 128 and also set its members volatile since they are all accessed and modified in interrupt handlers.

This commit is contained in:
Collin Kidder 2014-12-23 22:36:35 -05:00
parent 065459c18f
commit 4eb05c303b
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@
RingBuffer::RingBuffer( void ) RingBuffer::RingBuffer( void )
{ {
memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; memset( (void *)_aucBuffer, 0, SERIAL_BUFFER_SIZE ) ;
_iHead=0 ; _iHead=0 ;
_iTail=0 ; _iTail=0 ;
} }

View File

@ -25,14 +25,14 @@
// using a ring buffer (I think), in which head is the index of the location // using a ring buffer (I think), in which head is the index of the location
// to which to write the next incoming character and tail is the index of the // to which to write the next incoming character and tail is the index of the
// location from which to read. // location from which to read.
#define SERIAL_BUFFER_SIZE 64 #define SERIAL_BUFFER_SIZE 128
class RingBuffer class RingBuffer
{ {
public: public:
uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; volatile uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ;
int _iHead ; volatile int _iHead ;
int _iTail ; volatile int _iTail ;
public: public:
RingBuffer( void ) ; RingBuffer( void ) ;