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

Signals/button.cpp

Committer:
ketjow
Date:
2016-12-07
Revision:
2:fcfb6ced9c00
Parent:
0:936379a8793e

File content as of revision 2:fcfb6ced9c00:

/*!
  @file button.cpp

  The implementation of the button signal class.

  @par Full Description
  The implementation of the button signal class.

  @if REVISION_HISTORY_INCLUDED
  @par Edit History
  @li [0]    wojciech.rynczuk@wp.pl    04-MAR-2016    Initial file revision.
  @endif

  @ingroup Signal

  The MIT License (MIT)
  Copyright (c) 2016 Wojciech Rynczuk

*/

#include "button.hpp"
  
Button::Button(const string& name, Logger& logger) : Signal(name,1,logger), m_State(0)
{
}

Button& Button::operator=(unsigned int value)
{
    m_State = value;
    return *this;
}
    
void Button::PrintState()
{
  string  suffix("");
  int32_t time_ref = 0;
  if (!m_State)
  {
    string msg("Key released");
    PrintVector(0, suffix, msg, time_ref);
  }
  else
  {
    string msg("Key pressed");
    PrintVector(1, suffix, msg, time_ref);
  }
}