This library is derived library of DigitalOut. Cumulative counter that detected the Hi edge and I have the operation cumulative time function .
LogDigitalOut.cpp
- Committer:
- naseba_atsushi
- Date:
- 2015-01-29
- Revision:
- 1:23b306c0a0b2
- Parent:
- 0:b63c87da380a
- Child:
- 2:3251929c6549
File content as of revision 1:23b306c0a0b2:
#include "LogDigitalOut.h" #include "mbed.h" LogDigitalOut::LogDigitalOut(PinName pin) : _pin(pin) { _pin = 0; } void LogDigitalOut::CountUp() { if (buffer==0) { if (_pin) { count ++; } } buffer = _pin; } void LogDigitalOut::RatiosUp() { if (_pin) { ratios ++; } } void LogDigitalOut::ResetAccumulate() { count = 0; ratios = 0; } int LogDigitalOut::GetCount() { return count; } int LogDigitalOut::GetRatios() { return ratios; } int LogDigitalOut::Read() { return _pin; } void LogDigitalOut::Write(int volume) { _pin = volume; }