Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed vcdLogger vcdSignal
button.cpp
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 20-JAN-2015 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, const PinName pin, Logger& logger) : DigitalIn(pin), Signal(name,1,logger) 00024 { 00025 } 00026 00027 void Button::PrintState() 00028 { 00029 string suffix(""); 00030 int32_t time_ref = 0; 00031 if (read()) 00032 { 00033 string msg("Key released"); 00034 PrintVector(0, suffix, msg, time_ref); 00035 } 00036 else 00037 { 00038 string msg("Key pressed"); 00039 PrintVector(1, suffix, msg, time_ref); 00040 } 00041 }
Generated on Tue Jul 12 2022 21:39:12 by
1.7.2