Nucleo Sequencer of my Base Machine

Dependencies:   Amp AverageAnalogIn Envelope FilterController Sequence BaseMachineComon mbed-rtos mbed

Fork of SpiSequenceSender_Test by Ryo Od

Revision:
35:0165b610796d
Parent:
34:602ee5e771e3
Child:
36:50ad7e0a9a95
--- a/main.cpp	Thu Sep 08 00:10:03 2016 +0000
+++ b/main.cpp	Fri Sep 09 02:50:00 2016 +0000
@@ -21,7 +21,7 @@
 #include "ST7565_SequencerDisplay.h"
 
 #define TITLE_STR1  ("BaseMachine Sequencer")
-#define TITLE_STR2  ("20160908")
+#define TITLE_STR2  ("20160909")
 
 #define SEQUENCE_N  (16)
 #define SPI_RATE    (16000000)  // Actual frequency about 5MHz
@@ -109,16 +109,18 @@
 //------------------------------------------------------------------------
 // Callback functions
 //------------------------------------------------------------------------
-void updateFunction(int ticks)
+void updateTicks(int ticks)
 {
     if (ticks == 0) {
         envelopeGenerator.init(envelope);
+        // ToDo: 再生中のLCD表示を検討→SPI1とSPI2の信号のタイミングを調査
+        sequencerDisplay.update(SequencerDisplay::run, sequenceSender.getStep());
     }
 
     if (sequences[sequenceSender.getStep()].isNoteOn()) {
         uint16_t level = envelopeGenerator.getModLevel();
         if (!sequences[sequenceSender.getStep()].isAccent()) {
-            level = level * 3 / 4;
+            level = level * 1 / 2;
         }
         ampController.outDca(level);
     } else {
@@ -127,9 +129,6 @@
     envelopeGenerator.update();
     
     filterController.outDcf();
-    
-    // ToDo: 再生中のLCD表示を検討→SPI1とSPI2の信号のタイミングを調査
-    //sequencerDisplay.update(SequencerDisplay::run, sequenceSender.getStep());
 }
 
 //------------------------------------------------------------------------
@@ -453,7 +452,7 @@
     
     envelopeGenerator.init(envelope);
 
-    sequenceSender.attachUpdate(&updateFunction);
+    sequenceSender.attachUpdate(&updateTicks);
     sequenceSender.setWaveShape(waveShape);
     
     //--------------------------------------------------------------------
@@ -481,6 +480,7 @@
         } else {
             if (isDirty) {
                 //sequencerDisplay.update(SequencerDisplay::run, currentStep);
+                /*
                 static int cnt = 0;
                 char buffer[32];
                 sprintf(buffer, "%d", cnt);
@@ -488,7 +488,13 @@
                 gLCD.clear();
                 gLCD.drawstring(0, 0, buffer);
                 gLCD.display();
-                isDirty = false;
+                */
+                //gLCD.fillrect((currentStep-1) * 7, 1, 7, 1, 0);
+                //gLCD.clear();
+                //gLCD.fillrect(currentStep * 7, 1, 7, 3, 1);
+                //gLCD.display();
+                
+                //isDirty = false;
             }
         }
     }