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
Signals/magnetometer.cpp
- Committer:
- ketjow
- Date:
- 2016-02-12
- Revision:
- 0:9a59cffaafad
- Child:
- 1:446154224f92
File content as of revision 0:9a59cffaafad:
#include "magnetometer.hpp" Magnetometer::Magnetometer(const string& name, Logger& logger) : Signal(name, 32, logger) { m_Magnetometer = new MAG3110(PTE25, PTE24); m_MagXPrev = 0; m_MagYPrev = 0; m_MagZPrev = 0; m_MagXCurr = 0;; m_MagYCurr = 0; m_MagZCurr = 0; } Magnetometer::~Magnetometer() { delete m_Magnetometer; } void Magnetometer::PrintState() { string suffix("MagX"); string msg(""); int32_t time_ref = 0; m_MagXCurr = m_Magnetometer->readVal(MAG_OUT_X_MSB); m_MagYCurr = m_Magnetometer->readVal(MAG_OUT_Y_MSB); m_MagZCurr = m_Magnetometer->readVal(MAG_OUT_Z_MSB); if ( (CheckFilter()) || \ (fabs((float)(m_MagXCurr - m_MagXPrev)) > 50) || \ (fabs((float)(m_MagYCurr - m_MagYPrev)) > 50) || \ (fabs((float)(m_MagZCurr - m_MagZPrev)) > 50)) { PrintVector(m_MagXCurr, suffix, msg, time_ref); suffix = "MagY"; time_ref = 0; PrintVector(m_MagYCurr, suffix, msg, time_ref); suffix = "MagZ"; time_ref = 0; PrintVector(m_MagZCurr, suffix, msg, time_ref); m_MagXPrev = m_MagXCurr; m_MagYPrev = m_MagYCurr; m_MagZPrev = m_MagZCurr; } }