MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/driver/DiscreteOutput_DoublePin.cpp

35 lines
780 B
C++
Raw Normal View History

/*
* DiscreteOutput_DoublePin.cpp
*
* Created on: 3 <EFBFBD><EFBFBD><EFBFBD>. 2018 <EFBFBD>.
* Author: titov
*/
#include "DiscreteOutput_DoublePin.hh"
driver::detail::DiscreteOutput_DoublePin::DiscreteOutput_DoublePin(
peripheral::IGpio & one, bool active_one,
peripheral::IGpio & two, bool active_two ) :
one(one), two(two), active_one(active_one), active_two(active_two) {}
void driver::detail::DiscreteOutput_DoublePin::on() {
one.write( active_one );
two.write( active_two );
}
void driver::detail::DiscreteOutput_DoublePin::off() {
two.write( not active_two );
one.write( not active_one );
}
bool driver::detail::DiscreteOutput_DoublePin::isCompleted() const {
return one.read() == active_one
and two.read() == active_two;
}