From 4eb05c303b5a9771309bd754a5f04292a25b5d1f Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Tue, 23 Dec 2014 22:36:35 -0500 Subject: [PATCH] Change RingBuffer to have buffer size of 128 and also set its members volatile since they are all accessed and modified in interrupt handlers. --- hardware/arduino/sam/cores/arduino/RingBuffer.cpp | 2 +- hardware/arduino/sam/cores/arduino/RingBuffer.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hardware/arduino/sam/cores/arduino/RingBuffer.cpp b/hardware/arduino/sam/cores/arduino/RingBuffer.cpp index f0b3ed1df..d9931c977 100644 --- a/hardware/arduino/sam/cores/arduino/RingBuffer.cpp +++ b/hardware/arduino/sam/cores/arduino/RingBuffer.cpp @@ -21,7 +21,7 @@ RingBuffer::RingBuffer( void ) { - memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; + memset( (void *)_aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; _iHead=0 ; _iTail=0 ; } diff --git a/hardware/arduino/sam/cores/arduino/RingBuffer.h b/hardware/arduino/sam/cores/arduino/RingBuffer.h index 28309df45..1a5861b0b 100644 --- a/hardware/arduino/sam/cores/arduino/RingBuffer.h +++ b/hardware/arduino/sam/cores/arduino/RingBuffer.h @@ -25,14 +25,14 @@ // 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 // location from which to read. -#define SERIAL_BUFFER_SIZE 64 +#define SERIAL_BUFFER_SIZE 128 class RingBuffer { public: - uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; - int _iHead ; - int _iTail ; + volatile uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; + volatile int _iHead ; + volatile int _iTail ; public: RingBuffer( void ) ;