This is the vcdMaker demo project. See http://vcdmaker.org for details. vcdMaker is supposed to help engineers to debug their applications and systems. It transforms text log files into the VCD format which can be easily displayed as a waveform. Use the mbed serial logger at 115200 baud rate.

Dependencies:   BSP_DISCO_L476VG COMPASS_DISCO_L476VG mbed vcdLogger vcdSignal

Files at this revision

API Documentation at this revision

Comitter:
ketjow
Date:
Wed Dec 07 09:14:34 2016 +0000
Parent:
1:297d1bcaa432
Commit message:
Sync signal added

Changed in this revision

Signals/sync.cpp Show annotated file Show diff for this revision Revisions of this file
Signals/sync.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
vcdSignal.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Signals/sync.cpp	Wed Dec 07 09:14:34 2016 +0000
@@ -0,0 +1,26 @@
+#include "sync.hpp"
+  
+Sync::Sync(const string& name, Logger& logger) : Signal(name,1,logger), m_State(0)
+{
+}
+
+Sync& Sync::operator=(unsigned int value)
+{
+    m_State = value;
+    return *this;
+}
+    
+void Sync::PrintState()
+{
+  string  suffix("");
+  int32_t time_ref = 0;
+  if (!m_State)
+  {
+    /* Do nothing */
+  }
+  else
+  {
+    string msg("Sync triggered");
+    PrintEvent(msg, time_ref);
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Signals/sync.hpp	Wed Dec 07 09:14:34 2016 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+#include "signal.hpp"
+
+class Sync : public Signal
+{
+  public:
+  Sync(const string& name, Logger& logger);
+  Sync& operator=(unsigned int value);
+  
+  void PrintState();
+  
+  private:
+  unsigned int m_State;
+};
--- a/main.cpp	Sat May 28 19:25:26 2016 +0000
+++ b/main.cpp	Wed Dec 07 09:14:34 2016 +0000
@@ -24,6 +24,7 @@
 #include "magnetometer.hpp"
 #include "accelerometer.hpp"
 #include "button.hpp"
+#include "sync.hpp"
 #include "COMPASS_DISCO_L476VG.h"
 
 #define NO_OF_LINES      ((uint32_t)75)
@@ -48,13 +49,15 @@
 Accelerometer accelerometer("Disco.Sensors.Accelerometer.", compass, slogger);
 
 // Buttons
-Button        button_sync("Disco.Sync", slogger);
 Button        button_center("Disco.Buttons.Center", slogger);
 Button        button_left("Disco.Buttons.Left", slogger);
 Button        button_up("Disco.Buttons.Up", slogger);
 Button        button_right("Disco.Buttons.Right", slogger);
 Button        button_down("Disco.Buttons.Down", slogger);
 
+//Synchronization
+Sync          sync_signal("Disco.Sync", slogger);
+
 // Joystick button
 InterruptIn center(JOYSTICK_CENTER);
 InterruptIn left(JOYSTICK_LEFT);
@@ -127,13 +130,13 @@
 }
 
 void sync_released() {
-    button_sync = 0;
-    button_sync.PrintState(); 
+    sync_signal = 0;
+    sync_signal.PrintState(); 
 }
 
 void sync_pressed() {
-    button_sync = 1;
-    button_sync.PrintState();  
+    sync_signal = 1;
+    sync_signal.PrintState();  
 }
 
 void accelerometer_tick()
--- a/vcdSignal.lib	Sat May 28 19:25:26 2016 +0000
+++ b/vcdSignal.lib	Wed Dec 07 09:14:34 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/ketjow/code/vcdSignal/#abd95c8ed6c1
+http://mbed.org/users/ketjow/code/vcdSignal/#5be5e7e966cd