Skip to content
Browse files

Some speedups

  • Loading branch information...
1 parent f513c02 commit 21732f04a13fa7d06fde1e5719d312beccdfb011 @alvieboy alvieboy committed Jun 2, 2012
Showing with 20 additions and 16 deletions.
  1. +9 −7 sketch/soundpuddle/soundpuddle.ino
  2. +11 −9 sketch/soundpuddleripple/soundpuddleripple.ino
View
16 sketch/soundpuddle/soundpuddle.ino
@@ -153,8 +153,8 @@ void _zpu_interrupt()
sampbufptr = 0;
}
}
- USPIDATA=0; // Start reading next sample
- USPIDATA=0; // Start reading next sample
+ USPIDATA16=0; // Start reading next sample
+ //USPIDATA=0; // Start reading next sample
TMR0CTL &= ~(BIT(TCTLIF));
}
@@ -276,6 +276,7 @@ void loop()
while (samp_done==0) { }
/* Set up FFT */
+ resetwindowfile();
for (i=0; i<SAMPLE_BUFFER_SIZE; i++) {
myfft.in_real[i].v= sampbuf[i];
@@ -285,7 +286,7 @@ void loop()
/* NOTE: this is where we can load the new HSV mapping, if needed */
- resetwindowfile();
+
/* Ok, release buffer, so we can keep on filling using the interrupt handler */
samp_done=0;
@@ -302,6 +303,8 @@ void loop()
myfft.in_real[0].v = 0; // we don't use DC, but use this for RGB flushing
+ controller_wait_ready();
+
for (i=1; i<FFT_POINTS/2; i++) {
FFT_type::fixed v = myfft.in_real[i];
//#if 0
@@ -341,10 +344,9 @@ void loop()
#if 0
show_rgb_fft();
#endif
- controller_wait_ready();
- outbuffer[0] = 0;
- controller_start();
- controller_wait_ready();
+ outbuffer[0] = 0;
+ controller_start();
+
run++;
}
View
20 sketch/soundpuddleripple/soundpuddleripple.ino
@@ -159,8 +159,7 @@ void _zpu_interrupt()
sampbufptr = 0;
}
}
- USPIDATA=0; // Start reading next sample
- USPIDATA=0; // Start reading next sample
+ USPIDATA16=0; // Start reading next sample
TMR0CTL &= ~(BIT(TCTLIF));
}
@@ -290,6 +289,7 @@ void loop()
while (samp_done==0) { }
/* Set up FFT */
+ resetwindowfile();
for (i=0; i<SAMPLE_BUFFER_SIZE; i++) {
myfft.in_real[i].v= sampbuf[i];
@@ -299,26 +299,26 @@ void loop()
/* NOTE: this is where we can load the new HSV mapping, if needed */
- resetwindowfile();
+
/* Ok, release buffer, so we can keep on filling using the interrupt handler */
samp_done=0;
- controller_wait_ready();
-
/* Do a FFT on the signal */
//#if 0
myfft.doFFT();
//#endif
- /* Do complex sqrt */
+ /*
Serial.print("Start run ");
Serial.println(run);
+ */
+ controller_wait_ready();
shift_buffer();
- outbuffer[0] = 0;
+// outbuffer[0] = 0;
for (z=0; z<BUFFERSIZE; z++) {
i = fftbuffermap[z];
@@ -348,8 +348,10 @@ void loop()
// Serial.println();
}
- Serial.print("End run ");
- Serial.println(run);
+ /*
+ Serial.print("End run ");
+ Serial.println(run);
+ */
#if 0
show_rgb_fft();

0 comments on commit 21732f0

Please sign in to comment.
Something went wrong with that request. Please try again.