Signal Generator

Dependencies:   IniManager RA8875 Watchdog mbed-rtos mbed

Fork of speaker_demo_Analog by jim hamblen

Revision:
4:10281ddb673d
Parent:
3:d22f3e52d06a
Child:
5:49dd0c647a40
--- a/SignalGenDisplay.cpp	Mon Jan 16 04:33:06 2017 +0000
+++ b/SignalGenDisplay.cpp	Mon Jan 16 21:05:13 2017 +0000
@@ -317,6 +317,7 @@
                         for (int i=0; i<radio_CyclesCount; i++) {
                             if (lcd->Intersect(radio_Cycles[i], point)) {
                                 pulseMode = i;
+                                signal->Stop();
                                 ShowCyclesControl();
                             }
                         }
@@ -346,6 +347,7 @@
         for (int i=0; i<ModeCount; i++) {
             if (strcmp(ModeNames[i], buf) == 0) {
                 mode = (SG_Mode)i;
+                printf("Read ini mode is %d\r\n", mode);
                 break;
             }
         }
@@ -490,6 +492,14 @@
     printf("      ?: This help          <cr>:  Save number\r\n");
     printf("      #: Dump RA8875       <esc>:  Exit number entry\r\n");
     //printf("  4:  Reverse sawtoothSignal\r\n");
+    
+    printf(" Settings:\r\n");
+    printf("    Mode: %d - %s\r\n", mode, ModeNames[mode]);
+    printf("    Freq: %f\r\n", frequency);
+    printf("    Duty: %f\r\n", dutycycle);
+    printf("    Volt: %f\r\n", voltage);
+    printf("    Offs: %f\r\n", offset);
+    printf("    Puls: %d - %s\r\n", pulseMode, radio_CyclesLabels[pulseMode]);
 }
 
 SignalGenDisplay::OM_Changes SignalGenDisplay::Poll(char c) {
@@ -754,6 +764,7 @@
 bool SignalGenDisplay::SetWaveformMode(SG_Mode _mode, bool force) {
     if (/* _mode >= SG_SINE && */ _mode <= SG_USER) {
         mode = _mode;
+        printf("mode is %d\r\n", mode);
         DrawModeButtons();
         return true;
     } else {
@@ -1210,7 +1221,7 @@
     if (textLen == 0) {
         lcd->fillrect(UI_START_STOP, UI_BackColor);
         if (showIt) {
-            DrawButton(UI_START_STOP, false, SG_START, true, pulseMode ? 2 : signal->isRunning());
+            DrawButton(UI_START_STOP, signal->isRunning(), SG_START, true, pulseMode ? 2 : signal->isRunning());
         }
     }
 }
@@ -1303,7 +1314,7 @@
     printf("-> resetDataEntry(next: %d) curr:%d, save:%d\r\n", nextMode, last, save);
     EntryMd = nextMode;
     if (last != OM_NONE)
-        signal->PrepareWaveform(SG_SAWTOOTH, frequency, dutycycle, voltage, offset);
+        signal->PrepareWaveform(mode, frequency, dutycycle, voltage, offset);
     switch (last) {
         case OM_NONE:
             updateDutyCycle();