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.

Dependencies:   mbed vcdLogger vcdSignal

Revision:
0:9a59cffaafad
Child:
1:446154224f92
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Signals/accelerometer.cpp	Fri Feb 12 21:38:04 2016 +0000
@@ -0,0 +1,45 @@
+#include "accelerometer.hpp"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+Accelerometer::Accelerometer(const string& name, Logger& logger) : Signal(name, 32, logger)
+{
+    m_Accelerometer = new MMA8451Q(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+    m_Filter = 1;
+    m_AccXPrev = 0;
+    m_AccYPrev = 0;
+    m_AccZPrev = 0;
+    m_AccXCurr = 0;
+    m_AccYCurr = 0;
+    m_AccZCurr = 0;
+}
+
+Accelerometer::~Accelerometer()
+{
+    delete m_Accelerometer;
+}
+  
+void Accelerometer::PrintState()
+{
+    string  suffix("AccX");
+    string  msg("f");
+    int32_t time_ref = 0;
+    
+    m_AccXCurr = m_Accelerometer->getAccX();
+    m_AccYCurr = m_Accelerometer->getAccY();
+    m_AccZCurr = m_Accelerometer->getAccZ();
+    if ( (CheckFilter()) || \
+         (fabs(m_AccXCurr - m_AccXPrev) > 0.1) || \
+         (fabs(m_AccYCurr - m_AccYPrev) > 0.1) || \
+         (fabs(m_AccZCurr - m_AccZPrev) > 0.1))
+    {
+        PrintReal(m_AccXCurr, suffix, msg, time_ref);
+        suffix = "AccY";
+        PrintReal(m_AccYCurr, suffix, msg, time_ref);
+        suffix = "AccZ";
+        PrintReal(m_AccZCurr, suffix, msg, time_ref);
+        m_AccXPrev = m_AccXCurr;
+        m_AccYPrev = m_AccYCurr;
+        m_AccZPrev = m_AccZCurr;
+    }
+}