KIK 01 Prototype 05

Dependencies:   AverageMCP3008 mbed-rtos mbed mcp3008

Fork of KIK01_Proto03 by Ryo Od

Files at this revision

API Documentation at this revision

Comitter:
ryood
Date:
Sat Oct 21 03:50:56 2017 +0000
Parent:
30:1291e20b1c53
Commit message:
clean up

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1291e20b1c53 -r 3c7e1cd0d947 main.cpp
--- a/main.cpp	Thu Oct 19 08:01:49 2017 +0000
+++ b/main.cpp	Sat Oct 21 03:50:56 2017 +0000
@@ -19,17 +19,19 @@
 #define UART_TRACE      (1)
 #define PIN_CHECK       (1)
 #define TITLE_STR1      ("KIK01 Kick Machine")
-#define TITLE_STR2      ("20171019")
+#define TITLE_STR2      ("20171020")
 
 #define PI_F            (3.1415926f)
 
 #define MCP3008_SPI_SPEED       (1312500)
 #define AD8402_SPI_SPEED        (10000000)
-#define ENVELOPE_UPDATE_RATE    (8000)  //  Hz
+#define ENVELOPE_UPDATE_RATE    (32000)  //  Hz
 
 #define AD8402_RMAX (10000.0f)
 #define AD8402_RMIN (50.0f)
 
+#define AVERAGE_BUFFER_SIZE (4)
+
 AnalogOut Dac1(PA_4);
 AnalogOut Dac2(PA_5);
 
@@ -44,9 +46,9 @@
 MCP3008 Adc1(&SpiMAdc, PB_10);
 MCP3008 Adc2(&SpiMAdc, PA_8);
 MCP3008 Adc3(&SpiMAdc, PA_9);
-AverageMCP3008 AvgAdc1(&Adc1, 8); 
-AverageMCP3008 AvgAdc2(&Adc2, 8); 
-AverageMCP3008 AvgAdc3(&Adc3, 8); 
+AverageMCP3008 AvgAdc1(&Adc1, AVERAGE_BUFFER_SIZE); 
+AverageMCP3008 AvgAdc2(&Adc2, AVERAGE_BUFFER_SIZE); 
+AverageMCP3008 AvgAdc3(&Adc3, AVERAGE_BUFFER_SIZE); 
 
 // Sync
 DigitalOut SyncPin(PA_10);
@@ -222,15 +224,15 @@
 #if UART_TRACE
         printf("%.1f\t%d\t", bpm, envelopeLength);
 
-        printf("%d\t%d\t", amplitudeParam.attack, amplitudeParam.release);
+        printf("| %d\t%d\t", amplitudeParam.attack, amplitudeParam.release);
         printf("%.2f\t%.2f\t%.2f\t", amplitudeParam.v0, amplitudeParam.v1, amplitudeParam.v2);
         printf("%.2f\t%.2f\t", amplitudeParam.attackTauRatio, amplitudeParam.releaseTauRatio);
 
-        printf("%d\t%d\t", frequencyParam.attack, frequencyParam.release);
+        printf("| %d\t%d\t", frequencyParam.attack, frequencyParam.release);
         printf("%.2f\t%.2f\t%.2f\t", frequencyParam.v0, frequencyParam.v1, frequencyParam.v2);
         printf("%.2f\t%.2f\t", frequencyParam.attackTauRatio, frequencyParam.releaseTauRatio);
         
-        printf("%d\t%d\t", noiseAmplitudeParam.attack, noiseAmplitudeParam.release);
+        printf("| %d\t%d\t", noiseAmplitudeParam.attack, noiseAmplitudeParam.release);
         printf("%.2f\t%.2f\t%.2f\t", noiseAmplitudeParam.v0, noiseAmplitudeParam.v1, noiseAmplitudeParam.v2);
         printf("%.2f\t%.2f\r\n", noiseAmplitudeParam.attackTauRatio, noiseAmplitudeParam.releaseTauRatio);
 #endif