Wojciech Rynczuk / Mbed 2 deprecated vcdMaker_Demo_DISCO_L476

Dependencies:   BSP_DISCO_L476VG COMPASS_DISCO_L476VG mbed vcdLogger vcdSignal

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers button.cpp Source File

button.cpp

Go to the documentation of this file.
00001 /*!
00002   @file button.cpp
00003 
00004   The implementation of the button signal class.
00005 
00006   @par Full Description
00007   The implementation of the button signal class.
00008 
00009   @if REVISION_HISTORY_INCLUDED
00010   @par Edit History
00011   @li [0]    wojciech.rynczuk@wp.pl    04-MAR-2016    Initial file revision.
00012   @endif
00013 
00014   @ingroup Signal
00015 
00016   The MIT License (MIT)
00017   Copyright (c) 2016 Wojciech Rynczuk
00018 
00019 */
00020 
00021 #include "button.hpp "
00022   
00023 Button::Button(const string& name, Logger& logger) : Signal(name,1,logger), m_State(0)
00024 {
00025 }
00026 
00027 Button& Button::operator=(unsigned int value)
00028 {
00029     m_State = value;
00030     return *this;
00031 }
00032     
00033 void Button::PrintState()
00034 {
00035   string  suffix("");
00036   int32_t time_ref = 0;
00037   if (!m_State)
00038   {
00039     string msg("Key released");
00040     PrintVector(0, suffix, msg, time_ref);
00041   }
00042   else
00043   {
00044     string msg("Key pressed");
00045     PrintVector(1, suffix, msg, time_ref);
00046   }
00047 }