MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/schematic/AlarmTimerLogic.cpp

54 lines
735 B
C++

/*
* AlarmTimer.cpp
*
* Created on: 26 ìàÿ 2021 ã.
* Author: sozonov
*/
#include "AlarmTimerLogic.hh"
void AlarmTimerLogic::stop() {
current_state = false;
otf_pause = true;
}
void AlarmTimerLogic::start() {
if( not otf_pause )
time_start = clock();
current_state = true;
}
void AlarmTimerLogic::reset() {
time_start = clock();
current_time = 0;
current_state= false;
otf_alarm = false;
otf_pause = false;
}
void AlarmTimerLogic::process() {
if( current_state && not otf_alarm ) {
current_time = clock() - time_start;
if( current_time >= time_out ) {
alarm();
otf_alarm = true;
stop();
}
}
}