Skip to content

Commit 4eb05c3

Browse files
committed
Change RingBuffer to have buffer size of 128 and also set its members volatile since they are all accessed and modified in interrupt handlers.
1 parent 065459c commit 4eb05c3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

hardware/arduino/sam/cores/arduino/RingBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
RingBuffer::RingBuffer( void )
2323
{
24-
memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ;
24+
memset( (void *)_aucBuffer, 0, SERIAL_BUFFER_SIZE ) ;
2525
_iHead=0 ;
2626
_iTail=0 ;
2727
}

hardware/arduino/sam/cores/arduino/RingBuffer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
// using a ring buffer (I think), in which head is the index of the location
2626
// to which to write the next incoming character and tail is the index of the
2727
// location from which to read.
28-
#define SERIAL_BUFFER_SIZE 64
28+
#define SERIAL_BUFFER_SIZE 128
2929

3030
class RingBuffer
3131
{
3232
public:
33-
uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ;
34-
int _iHead ;
35-
int _iTail ;
33+
volatile uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ;
34+
volatile int _iHead ;
35+
volatile int _iTail ;
3636

3737
public:
3838
RingBuffer( void ) ;

0 commit comments

Comments
 (0)