# HG changeset patch # User Giulio Moro # Date 1432050850 -3600 # Node ID 4cd9a8ca57455bf45476ece70c900e23a329c577 # Parent 419ce4ebfc4c04a29dc8fafddb3d4a429226e9be Fixed bug that was causing pointer corruption diff -r 419ce4ebfc4c -r 4cd9a8ca5745 core/PRU.cpp --- 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){