changeset 43:4cd9a8ca5745 staging

Fixed bug that was causing pointer corruption
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 19 May 2015 16:54:10 +0100
parents 419ce4ebfc4c
children
files core/PRU.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/PRU.cpp	Wed May 13 12:23:37 2015 +0100
+++ b/core/PRU.cpp	Tue May 19 16:54:10 2015 +0100
@@ -489,7 +489,7 @@
 			//initialize the output buffer with the values that were in the last frame of the previous output
 			for(int n = 0; n < spi_num_channels; n++){
 				for(unsigned int j = 0; j < spi_buffer_frames; j++){
-					analogOutBuffer[j*spi_buffer_frames + n] = lastAnalogOutFrame[n];
+					analogOutBuffer[j*spi_num_channels + n] = lastAnalogOutFrame[n];
 				}
 			}
         //use past digital values to initialize the array properly.
@@ -567,7 +567,7 @@
 			//initialize the output buffer with the values that were in the last frame of the previous output
 			for(int n = 0; n < spi_num_channels; n++){
 				for(unsigned int j = 0; j < spi_buffer_frames; j++){
-					analogOutBuffer[j*spi_buffer_frames + n] = lastAnalogOutFrame[n];
+					analogOutBuffer[j*spi_num_channels + n] = lastAnalogOutFrame[n];
 				}
 			}
             if(digital_enabled){