Test program for BaseMachineUIController Library

Dependencies:   AverageAnalogIn BaseMachineUIController ExioBufferdController MCP23S17 PinDetect RotaryEncoder Sequence SequencerDisplay mbed-rtos mbed st7567LCD AT24C1024

Revision:
0:f3abbd84d67f
Child:
1:46e088b12083
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 06 22:14:03 2016 +0000
@@ -0,0 +1,68 @@
+/*
+ * main.cpp
+ * BaseMachineUIController Test
+ *
+ * mbed Rev 121 / mbed-rtos Rev 117
+ *
+ * 2016.11.06 Created
+ *
+ */
+
+#include "mbed.h"
+#include "rtos.h"
+
+#define UART_TRACE  (0)
+#include "BaseMachineUIController.h"
+
+BaseMachineUIController UIController;
+
+uint8_t step = 0;
+int isStepChanged = false;
+bool isRunning = false;
+
+void stepUp(void const* args)
+{
+    if (isRunning) {
+        step++;
+        if (step == 16)
+        {
+            step = 0;
+        }
+        UIController.setPlayingStep(step);
+    }
+}
+
+int main()
+{    
+    #if (UART_TRACE)
+    printf("*** BaseMachineUIController Test***\r\n");
+    #endif
+    
+    UIController.init();
+    
+    RtosTimer stepTimer(stepUp, osTimerPeriodic, (void *)0);
+    stepTimer.start(125);
+    
+    while (true)
+    {
+        UIController.update();
+
+        OscillatorParam osc;
+        UIController.getOscillatorParam(&osc);
+        
+        FilterParam flt;
+        UIController.getFilterParam(&flt);
+        
+        EnvelopeParam env;
+        UIController.getEnvelopeParam(&env);
+        
+        isRunning = UIController.getIsRunning();
+        
+        #if (UART_TRACE)
+        printf("%d %d ", osc.waveShape, osc.pulseWidth); 
+        printf("%d %d ", flt.cutoff, flt.resonance); 
+        printf("%d %d %d %d %d ", env.level, env.length, env.duration, env.decay, env.sustain); 
+        printf("%d %d\r\n", UIController.getBpm(), UIController.getAccentLevel());
+        #endif
+    }
+}