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/button.cpp@1:446154224f92, 2016-02-20 (annotated)
- Committer:
- ketjow
- Date:
- Sat Feb 20 20:48:44 2016 +0000
- Revision:
- 1:446154224f92
- Parent:
- 0:9a59cffaafad
- Child:
- 2:a13cde5c679c
vcdMaker Demo release 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ketjow | 1:446154224f92 | 1 | /*! |
ketjow | 1:446154224f92 | 2 | @file button.cpp |
ketjow | 1:446154224f92 | 3 | |
ketjow | 1:446154224f92 | 4 | The implementation of the button signal class. |
ketjow | 1:446154224f92 | 5 | |
ketjow | 1:446154224f92 | 6 | @par Full Description |
ketjow | 1:446154224f92 | 7 | The implementation of the button signal class. |
ketjow | 1:446154224f92 | 8 | |
ketjow | 1:446154224f92 | 9 | @if REVISION_HISTORY_INCLUDED |
ketjow | 1:446154224f92 | 10 | @par Edit History |
ketjow | 1:446154224f92 | 11 | @li [0] wojciech.rynczuk@wp.pl 20-JAN-2015 Initial file revision. |
ketjow | 1:446154224f92 | 12 | @endif |
ketjow | 1:446154224f92 | 13 | |
ketjow | 1:446154224f92 | 14 | @ingroup Signal |
ketjow | 1:446154224f92 | 15 | |
ketjow | 1:446154224f92 | 16 | @par Copyright (c) MMXV Wojciech Rynczuk |
ketjow | 1:446154224f92 | 17 | |
ketjow | 1:446154224f92 | 18 | Distributed under MIT License |
ketjow | 1:446154224f92 | 19 | |
ketjow | 1:446154224f92 | 20 | */ |
ketjow | 1:446154224f92 | 21 | |
ketjow | 1:446154224f92 | 22 | #include "button.hpp" |
ketjow | 0:9a59cffaafad | 23 | |
ketjow | 1:446154224f92 | 24 | Button::Button(const string& name, const PinName pin, Logger& logger) : DigitalIn(pin), Signal(name,1,logger) |
ketjow | 1:446154224f92 | 25 | { |
ketjow | 1:446154224f92 | 26 | } |
ketjow | 0:9a59cffaafad | 27 | |
ketjow | 1:446154224f92 | 28 | void Button::PrintState() |
ketjow | 1:446154224f92 | 29 | { |
ketjow | 1:446154224f92 | 30 | string suffix(""); |
ketjow | 1:446154224f92 | 31 | int32_t time_ref = 0; |
ketjow | 1:446154224f92 | 32 | if (read()) |
ketjow | 0:9a59cffaafad | 33 | { |
ketjow | 1:446154224f92 | 34 | string msg("Key released"); |
ketjow | 1:446154224f92 | 35 | PrintVector(0, suffix, msg, time_ref); |
ketjow | 1:446154224f92 | 36 | } |
ketjow | 1:446154224f92 | 37 | else |
ketjow | 1:446154224f92 | 38 | { |
ketjow | 1:446154224f92 | 39 | string msg("Key pressed"); |
ketjow | 1:446154224f92 | 40 | PrintVector(1, suffix, msg, time_ref); |
ketjow | 1:446154224f92 | 41 | } |
ketjow | 1:446154224f92 | 42 | } |