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-02-04
Revision:
3:e03cb5ec8912
Parent:
2:3251929c6549

File content as of revision 3:e03cb5ec8912:

#include "LogDigitalOut.h"
#include "mbed.h"


LogDigitalOut::LogDigitalOut(PinName pin) : _pin(pin) {
    _pin = 0;
}
/*************************************************************
 * @fn void LogDigitalOut::CountUp()
 * @breaf 動作回数カウントアップ
 * @param None
 * @return None
 * @sa None
 * @detail off->onを検出し、カウントアップする
 ************************************************************/
void LogDigitalOut::CountUp() {
    if (buffer==0) {
        if (_pin) {
            count ++;
        }
    }
    buffer = _pin;
}
/** My HelloWorld class.
 *  Used for printing "Hello World" on USB serial.
 */
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;
}